Actualizar servicios.html

This commit is contained in:
2026-02-17 21:39:32 +00:00
parent 9d33a3cbd0
commit 8f411004b3

View File

@@ -351,10 +351,6 @@
const addr = raw["Dirección"] || raw["DOMICILIO"] || "---"; const addr = raw["Dirección"] || raw["DOMICILIO"] || "---";
const pop = raw["Población"] || raw["POBLACION-PROVINCIA"] || ""; const pop = raw["Población"] || raw["POBLACION-PROVINCIA"] || "";
const fullAddr = `${addr} ${pop}`.trim(); 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 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'); const companyName = raw['Compañía'] || raw['COMPAÑIA'] || raw['Procedencia'] || (s.provider === 'MANUAL' ? 'PARTICULAR' : 'ASEGURADORA');
@@ -365,7 +361,6 @@
if(raw.status_operativo === 'incidencia') iconEstado = 'alert-triangle'; if(raw.status_operativo === 'incidencia') iconEstado = 'alert-triangle';
if(raw.status_operativo === 'terminado') iconEstado = 'check-circle'; if(raw.status_operativo === 'terminado') iconEstado = 'check-circle';
// DICCIONARIO DE COLORES BLINDADO PARA TAILWIND JIT
const colorClasses = { const colorClasses = {
'rose': 'bg-rose-100 text-rose-600', 'rose': 'bg-rose-100 text-rose-600',
'blue': 'bg-blue-100 text-blue-600', 'blue': 'bg-blue-100 text-blue-600',
@@ -377,15 +372,12 @@
}; };
const badgeClass = colorClasses[color] || 'bg-slate-100 text-slate-600'; const badgeClass = colorClasses[color] || 'bg-slate-100 text-slate-600';
// 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 isBlocked = !s.assigned_name && (s.automation_status === 'in_progress' || s.automation_status === 'failed');
const clickAction = isBlocked ? `shakeCard(this, '${s.automation_status}'); event.stopPropagation();` : `openDetail(${s.id})`; const clickAction = isBlocked ? `shakeCard(this, '${s.automation_status}'); event.stopPropagation();` : `openDetail(${s.id})`;
const cursorStyle = isBlocked ? 'cursor-not-allowed' : 'cursor-pointer'; const cursorStyle = isBlocked ? 'cursor-not-allowed' : 'cursor-pointer';
// Renderizado de la Tarjeta Mejorada
return ` return `
<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="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"> <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"> <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>' : ''} ${isBlocked ? '<span class="w-1.5 h-1.5 bg-current rounded-full pulse-slow opacity-70"></span>' : ''}
@@ -393,27 +385,15 @@
</span> </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> <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> </div>
<div> <div>
<p class="text-[9px] font-black text-blue-500 uppercase tracking-widest mb-0.5">${companyName}</p> <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> <h4 class="font-black text-slate-800 uppercase text-sm leading-tight line-clamp-1" title="${name}">${name}</h4>
</div> </div>
<div class="bg-slate-50/50 p-2.5 rounded-xl border border-slate-100">
<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}"> <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} <i data-lucide="map-pin" class="w-3 h-3 text-slate-400 shrink-0"></i> ${fullAddr}
</p> </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> </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 justify-between mt-1 pt-3 border-t border-slate-100">
<div class="flex items-center gap-1.5 min-w-0"> <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> <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>