From 39e393934cb5a61fd5dbe87f47e8fd1f620e08b3 Mon Sep 17 00:00:00 2001 From: marsalva Date: Mon, 16 Feb 2026 20:26:57 +0000 Subject: [PATCH] Actualizar servicios.html --- servicios.html | 91 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/servicios.html b/servicios.html index ad1f64c..c94ac46 100644 --- a/servicios.html +++ b/servicios.html @@ -24,29 +24,39 @@

PANEL OPERATIVO

-

Gestión de expedientes aceptados y control de citas.

+

Tablero Kanban de gestión de expedientes.

-
-
-
-
-

Asignados a Operario (Pendiente Cita)

+
+ +
+
+
+

Sin Asignar / En Pausa

+
+
+
+ +
+
+
+

Asignados (Falta Fecha)

-
-
-
-

Servicios Citados / En Curso

+
+
+
+

Citados / En Curso

+
@@ -106,7 +116,7 @@

Compañía Aseguradora

- +
@@ -134,8 +144,7 @@

Descripción de la Avería

-
-
+
@@ -207,16 +216,30 @@ } function renderLists() { - const pending = localData.filter(s => s.estado_operativo === 'asignado_operario'); - const assigned = localData.filter(s => s.estado_operativo === 'citado'); + // Lógica de separación en 3 columnas + const unassigned = localData.filter(s => !s.assigned_name); + const pending = localData.filter(s => s.assigned_name && (!s.raw_data.scheduled_date || s.raw_data.scheduled_date === "")); + const assigned = localData.filter(s => s.raw_data.scheduled_date && s.raw_data.scheduled_date !== ""); + + document.getElementById('unassigned-list').innerHTML = unassigned.length > 0 + ? unassigned.map(s => cardTemplate(s, 'rose', 'Sin Asignar')).join('') + : '

Vacío

'; document.getElementById('pending-list').innerHTML = pending.length > 0 - ? pending.map(s => cardTemplate(s, 'blue', 'Asignado')).join('') - : '

Sin pendientes

'; + ? pending.map(s => cardTemplate(s, 'blue', 'Falta Fecha')).join('') + : '

Vacío

'; document.getElementById('assigned-list').innerHTML = assigned.length > 0 - ? assigned.map(s => cardTemplate(s, 'emerald', 'En Curso')).join('') - : '

Sin servicios citados

'; + ? assigned.map(s => { + let color = 'emerald'; + let label = 'Citado'; + if(s.raw_data.status_operativo === 'trabajando') { color = 'amber'; label = 'Trabajando'; } + if(s.raw_data.status_operativo === 'incidencia') { color = 'red'; label = 'Incidencia'; } + if(s.raw_data.status_operativo === 'terminado') { color = 'purple'; label = 'Terminado'; } + return cardTemplate(s, color, label); + }).join('') + : '

Vacío

'; + lucide.createIcons(); } @@ -226,25 +249,26 @@ const addr = raw["Dirección"] || raw["DOMICILIO"] || "---"; const cita = raw.scheduled_date ? `${raw.scheduled_date} | ${raw.scheduled_time}` : 'Pendiente Cita'; - const estadoActual = raw.status_operativo || 'citado'; let iconEstado = 'calendar'; - if(estadoActual === 'de_camino') iconEstado = 'car'; - if(estadoActual === 'trabajando') iconEstado = 'wrench'; - if(estadoActual === 'incidencia') iconEstado = 'alert-triangle'; - if(estadoActual === 'terminado') iconEstado = 'check-circle'; + if(raw.status_operativo === 'de_camino') iconEstado = 'car'; + if(raw.status_operativo === 'trabajando') iconEstado = 'wrench'; + if(raw.status_operativo === 'incidencia') iconEstado = 'alert-triangle'; + if(raw.status_operativo === 'terminado') iconEstado = 'check-circle'; return ` -
+
- ${label} -

${name}

+
+ ${label} + #${s.service_ref} +
+

${name}

${addr}

-
+
${s.assigned_name || 'Sin asignar'}
${raw.scheduled_date ? `
${cita}
` : ''}
-
`; } @@ -255,7 +279,7 @@ document.getElementById('detId').value = s.id; document.getElementById('detRef').innerText = s.service_ref; - // --- NUEVO: ASIGNAR COMPAÑÍA --- + // COMPAÑÍA ASEGURADORA const companyName = raw['Compañía'] || raw['COMPAÑIA'] || raw['Procedencia'] || "Particular"; document.getElementById('detCompany').innerText = companyName; @@ -267,7 +291,7 @@ document.getElementById('detPhoneLink').href = cleanPhone ? `tel:${cleanPhone}` : "#"; document.getElementById('detAddrText').innerText = `${raw["Dirección"] || "Dirección no especificada"} ${raw["Población"] || ""}`; - document.getElementById('detWorker').innerText = s.assigned_name || "Pendiente"; + document.getElementById('detWorker').innerText = s.assigned_name || "Pendiente Asignar"; document.getElementById('detDesc').innerHTML = (raw["Descripción"] || raw["DESCRIPCION"] || "No hay notas adicionales del siniestro.") .replace(/\n/g, '
'); @@ -306,8 +330,9 @@ if(res.ok) { closeDetailModal(); - document.getElementById('toastAppt').classList.remove('hidden'); - setTimeout(() => { document.getElementById('toastAppt').classList.add('hidden'); }, 3000); + const toast = document.getElementById('toastAppt'); + toast.classList.remove('hidden'); + setTimeout(() => { toast.classList.add('hidden'); }, 3000); refreshPanel(); } else { alert("Error en el servidor al guardar.");