From 9d33a3cbd0989e20b47ac49a0784dbf2caeb7bf6 Mon Sep 17 00:00:00 2001 From: marsalva Date: Tue, 17 Feb 2026 21:32:39 +0000 Subject: [PATCH] Actualizar servicios.html --- servicios.html | 63 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/servicios.html b/servicios.html index 4c6ca04..71fa114 100644 --- a/servicios.html +++ b/servicios.html @@ -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 ` -
-
-
- ${label} - #${s.service_ref} +
+ +
+ + ${isBlocked ? '' : ''} + ${label} + + #${s.service_ref} +
+ +
+

${companyName}

+

${name}

+
+ +
+

+ ${fullAddr} +

+ + ${phone ? ` +
+

+ ${phone} +

+ ${cleanPhone ? `` : ''}
-

${name}

-

${addr}

-
-
${s.assigned_name || 'Sin asignar'}
- ${raw.scheduled_date && !isBlocked ? `
${cita}
` : ''} + ` : '

Sin teléfono

'} +
+ +
+
+
+ ${s.assigned_name || 'Sin asignar'}
+ ${raw.scheduled_date && !isBlocked ? ` +
+ + ${cita} +
` : ''}
`; }