Actualizar asignados.html

This commit is contained in:
2026-02-24 21:19:12 +00:00
parent 755abec6c7
commit 1b471593bc

View File

@@ -346,25 +346,48 @@
const raw = req.raw_data || {};
const name = raw["Nombre Cliente"] || raw["CLIENTE"] || "Cliente";
const rDate = formatDate(raw.requested_date);
const rTime = addOneHour(raw.requested_time); // Calculamos el tramo para mostrarlo
const rTime = addOneHour(raw.requested_time);
// Extraer descripción limpia y teléfono
const desc = raw["Descripción"] || raw["DESCRIPCION"] || "Sin notas de avería.";
const rawPhone = raw["Teléfono"] || raw["TELEFONOS"] || raw["TELEFONO"] || "";
const matchPhone = rawPhone.toString().match(/[6789]\d{8}/);
const safePhone = matchPhone ? matchPhone[0] : "";
reqList.innerHTML += `
<div class="bg-blue-50 border border-blue-200 p-4 rounded-3xl flex justify-between items-center shadow-sm relative overflow-hidden">
<div class="absolute right-0 top-0 w-16 h-16 bg-blue-100 rounded-bl-full opacity-50 z-0"></div>
<div class="relative z-10 flex-1">
<div class="bg-blue-50 border border-blue-200 p-5 rounded-[2rem] flex flex-col shadow-sm relative overflow-hidden gap-3">
<div class="absolute right-0 top-0 w-24 h-24 bg-blue-100 rounded-bl-full opacity-50 z-0"></div>
<div class="relative z-10">
<p class="text-[9px] font-black text-blue-500 uppercase tracking-widest mb-0.5">Cita Solicitada</p>
<h3 class="font-black text-slate-800 text-sm leading-tight truncate">${name}</h3>
<p class="text-[10px] font-bold text-slate-600 mt-1">${rDate} | ${raw.requested_time} - ${rTime}</p>
<h3 class="font-black text-slate-800 text-base leading-tight truncate pr-8">${name}</h3>
<p class="text-[10px] font-bold text-slate-600 mt-1 flex items-center gap-1"><i data-lucide="calendar" class="w-3 h-3 text-blue-500"></i> ${rDate} | ${raw.requested_time} - ${rTime}</p>
</div>
<div class="relative z-10 bg-white/70 p-3 rounded-2xl border border-blue-100/50 mt-1">
<p class="text-[10px] font-medium text-slate-600 line-clamp-2 leading-relaxed">${desc}</p>
</div>
<div class="flex gap-2 relative z-10 mt-1">
<button onclick="quickCallInline('${safePhone}')" class="flex-1 bg-white border border-blue-200 text-blue-600 hover:bg-blue-100 font-black py-3 rounded-xl flex items-center justify-center gap-1.5 active:scale-95 transition-transform shadow-sm text-[10px] uppercase tracking-widest">
<i data-lucide="phone" class="w-4 h-4"></i> Llamar
</button>
<button onclick="openApproveModal(${req.id})" class="flex-1 bg-blue-600 text-white hover:bg-blue-700 font-black py-3 rounded-xl flex items-center justify-center gap-1.5 shadow-md active:scale-95 transition-transform text-[10px] uppercase tracking-widest">
Revisar <i data-lucide="chevron-right" class="w-4 h-4"></i>
</button>
</div>
<button onclick="openApproveModal(${req.id})" class="bg-blue-600 text-white w-10 h-10 rounded-full flex items-center justify-center shadow-lg active:scale-95 transition-transform shrink-0 ml-3 relative z-10">
<i data-lucide="chevron-right" class="w-5 h-5"></i>
</button>
</div>
`;
});
lucide.createIcons();
}
// Helper rápido para el botón de llamada
function quickCallInline(phone) {
if (phone) window.location.href = `tel:+34${phone}`;
else alert("No hay un teléfono válido guardado para este cliente.");
}
function openApproveModal(id) {
const req = pendingRequests.find(r => r.id === id);
if(!req) return;