Actualizar servicios.html
This commit is contained in:
@@ -346,10 +346,18 @@
|
||||
}
|
||||
|
||||
function cardTemplate(s, color, label) {
|
||||
const raw = s.raw_data;
|
||||
const name = raw["Nombre Cliente"] || raw["CLIENTE"] || "Asegurado";
|
||||
const raw = s.raw_data || {};
|
||||
const name = raw["Nombre Cliente"] || raw["CLIENTE"] || "Asegurado Sin Nombre";
|
||||
const addr = raw["Dirección"] || raw["DOMICILIO"] || "---";
|
||||
const pop = raw["Población"] || raw["POBLACION-PROVINCIA"] || "";
|
||||
const fullAddr = `${addr} ${pop}`.trim();
|
||||
const phone = raw["Teléfono"] || raw["TELEFONO"] || raw["TELEFONOS"] || "";
|
||||
|
||||
// Extraer solo números para el enlace de llamada
|
||||
const cleanPhone = phone.toString().replace(/\D/g, '');
|
||||
|
||||
const cita = raw.scheduled_date ? `${raw.scheduled_date} | ${raw.scheduled_time}` : 'Pendiente Cita';
|
||||
const companyName = raw['Compañía'] || raw['COMPAÑIA'] || raw['Procedencia'] || (s.provider === 'MANUAL' ? 'PARTICULAR' : 'ASEGURADORA');
|
||||
|
||||
let iconEstado = 'calendar';
|
||||
if(raw.status_operativo === 'de_camino') iconEstado = 'car';
|
||||
@@ -371,22 +379,51 @@
|
||||
|
||||
// LÓGICA DE BLOQUEO (No se puede abrir si está buscando o en bolsa, a menos que ya tenga operario y sea pausa)
|
||||
const isBlocked = !s.assigned_name && (s.automation_status === 'in_progress' || s.automation_status === 'failed');
|
||||
const clickAction = isBlocked ? `shakeCard(this, '${s.automation_status}')` : `openDetail(${s.id})`;
|
||||
const clickAction = isBlocked ? `shakeCard(this, '${s.automation_status}'); event.stopPropagation();` : `openDetail(${s.id})`;
|
||||
const cursorStyle = isBlocked ? 'cursor-not-allowed' : 'cursor-pointer';
|
||||
|
||||
// Renderizado de la Tarjeta Mejorada
|
||||
return `
|
||||
<div class="bg-white p-5 rounded-3xl border border-slate-100 shadow-sm card-hover text-left flex items-start justify-between gap-4 ${cursorStyle}" onclick="${clickAction}">
|
||||
<div class="space-y-1 w-full min-w-0">
|
||||
<div class="flex items-center gap-2 mb-2">
|
||||
<span class="text-[8px] font-black ${badgeClass} px-2 py-0.5 rounded-md uppercase tracking-wider">${label}</span>
|
||||
<span class="text-[8px] text-slate-400 font-bold uppercase border border-slate-100 px-1.5 py-0.5 rounded-md">#${s.service_ref}</span>
|
||||
<div class="bg-white p-4 rounded-3xl border border-slate-200 shadow-sm card-hover text-left flex flex-col gap-3 relative ${cursorStyle}" onclick="${clickAction}">
|
||||
|
||||
<div class="flex items-center justify-between w-full">
|
||||
<span class="text-[9px] font-black ${badgeClass} px-2.5 py-1 rounded-lg uppercase tracking-wider shadow-sm flex items-center gap-1.5">
|
||||
${isBlocked ? '<span class="w-1.5 h-1.5 bg-current rounded-full pulse-slow opacity-70"></span>' : ''}
|
||||
${label}
|
||||
</span>
|
||||
<span class="text-[9px] text-slate-400 font-bold uppercase bg-slate-50 border border-slate-100 px-2 py-1 rounded-lg">#${s.service_ref}</span>
|
||||
</div>
|
||||
<h4 class="font-black text-slate-800 uppercase text-xs leading-tight truncate">${name}</h4>
|
||||
<p class="text-[10px] text-slate-400 font-bold uppercase truncate">${addr}</p>
|
||||
<div class="flex items-center gap-3 mt-3 pt-2 border-t border-slate-50">
|
||||
<div class="flex items-center gap-1.5"><i data-lucide="user" class="w-3 h-3 text-slate-400"></i><span class="text-[9px] font-black text-slate-600 uppercase">${s.assigned_name || 'Sin asignar'}</span></div>
|
||||
${raw.scheduled_date && !isBlocked ? `<div class="flex items-center gap-1.5 text-blue-600"><i data-lucide="${iconEstado}" class="w-3 h-3"></i><span class="text-[9px] font-black uppercase">${cita}</span></div>` : ''}
|
||||
|
||||
<div>
|
||||
<p class="text-[9px] font-black text-blue-500 uppercase tracking-widest mb-0.5">${companyName}</p>
|
||||
<h4 class="font-black text-slate-800 uppercase text-sm leading-tight line-clamp-1" title="${name}">${name}</h4>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5 bg-slate-50/50 p-2.5 rounded-xl border border-slate-100">
|
||||
<p class="text-[10px] text-slate-600 font-medium uppercase line-clamp-1 flex items-center gap-1.5" title="${fullAddr}">
|
||||
<i data-lucide="map-pin" class="w-3 h-3 text-slate-400 shrink-0"></i> ${fullAddr}
|
||||
</p>
|
||||
|
||||
${phone ? `
|
||||
<div class="flex items-center justify-between">
|
||||
<p class="text-[10px] font-black text-slate-700 flex items-center gap-1.5">
|
||||
<i data-lucide="phone" class="w-3 h-3 text-slate-400"></i> ${phone}
|
||||
</p>
|
||||
${cleanPhone ? `<a href="tel:${cleanPhone}" onclick="event.stopPropagation();" class="bg-emerald-50 text-emerald-600 p-1.5 rounded-lg hover:bg-emerald-500 hover:text-white transition-colors shadow-sm" title="Llamar al cliente"><i data-lucide="phone-call" class="w-3.5 h-3.5"></i></a>` : ''}
|
||||
</div>
|
||||
` : '<p class="text-[10px] italic text-slate-400">Sin teléfono</p>'}
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between mt-1 pt-3 border-t border-slate-100">
|
||||
<div class="flex items-center gap-1.5 min-w-0">
|
||||
<div class="bg-slate-100 p-1 rounded-md text-slate-500 shrink-0"><i data-lucide="hard-hat" class="w-3 h-3"></i></div>
|
||||
<span class="text-[9px] font-black text-slate-600 uppercase truncate" title="${s.assigned_name || 'Sin asignar'}">${s.assigned_name || 'Sin asignar'}</span>
|
||||
</div>
|
||||
${raw.scheduled_date && !isBlocked ? `
|
||||
<div class="flex items-center gap-1.5 text-blue-600 shrink-0 ml-2">
|
||||
<i data-lucide="${iconEstado}" class="w-3 h-3"></i>
|
||||
<span class="text-[9px] font-black uppercase">${cita}</span>
|
||||
</div>` : ''}
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user