From 73d3e037bf422b61aa6ef981494917224974b125 Mon Sep 17 00:00:00 2001 From: marsalva Date: Sun, 15 Feb 2026 22:29:05 +0000 Subject: [PATCH] Actualizar servicios.html --- servicios.html | 77 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/servicios.html b/servicios.html index a34938d..8dc1c3b 100644 --- a/servicios.html +++ b/servicios.html @@ -130,38 +130,59 @@ } catch (e) { console.error(e); } } - function renderLists() { - const pending = localData.filter(s => !s.raw_data.scheduled_date); - const assigned = localData.filter(s => s.raw_data.scheduled_date); + function renderLists() { + // 1. Pendientes de Cita (Recién aceptados o asignados manual sin fecha) + const pending = localData.filter(s => s.estado_operativo === 'asignado_operario'); + + // 2. Servicios en Curso (Ya tienen fecha de cita grabada) + const assigned = localData.filter(s => s.estado_operativo === 'citado'); - document.getElementById('pending-list').innerHTML = pending.map(s => cardTemplate(s, 'amber')).join(''); - document.getElementById('assigned-list').innerHTML = assigned.map(s => cardTemplate(s, 'emerald')).join(''); - lucide.createIcons(); - } + // Renderizamos con colores y textos específicos + document.getElementById('pending-list').innerHTML = pending.length > 0 + ? pending.map(s => cardTemplate(s, 'blue', 'Asignado a Operario')).join('') + : '

No hay servicios pendientes de cita.

'; - function cardTemplate(s, color) { - const raw = s.raw_data; - const name = raw["Nombre Cliente"] || raw["CLIENTE"] || "Asegurado"; - const addr = raw["Dirección"] || raw["DOMICILIO"] || "---"; - const worker = s.assigned_name || 'Sin operario'; + document.getElementById('assigned-list').innerHTML = assigned.length > 0 + ? assigned.map(s => cardTemplate(s, 'emerald', 'Citado')).join('') + : '

No hay servicios con cita programada.

'; + + lucide.createIcons(); +} + +function cardTemplate(s, color, label) { + const raw = s.raw_data; + const client = raw["Nombre Cliente"] || raw["CLIENTE"] || "Asegurado"; + const addr = raw["Dirección"] || raw["DOMICILIO"] || "---"; + const dateStr = raw.scheduled_date ? `${raw.scheduled_date} a las ${raw.scheduled_time}` : 'Sin fecha'; + + return ` +
+
+
+ ${label} + #${s.service_ref} +
+

${client}

+

${addr}

- return ` -
-
- #${s.service_ref} -

${name}

-

${addr}

-
-
- ${worker} -
+
+
+
+ ${s.assigned_name || 'Pendiente'}
-
- - -
-
`; - } + ${raw.scheduled_date ? ` +
+
+ ${dateStr} +
` : ''} +
+
+
+ + +
+
`; +} async function saveNewService(e) { e.preventDefault();