diff --git a/index.html b/index.html index 535b73c..fc6153b 100644 --- a/index.html +++ b/index.html @@ -143,7 +143,7 @@ } catch(e) { return dateStr; } } - function renderPortal(client, company, allServices) { + function renderPortal(client, company, allServices) { document.getElementById('companyName').innerText = company.name || "Empresa"; if (company.logo) { document.getElementById('companyLogo').src = company.logo; @@ -186,6 +186,9 @@ hasWorker = true; } + // 🚨 DETECTAMOS SI ES URGENCIA 🚨 + let isUrgent = srv.is_urgent === true || (raw['Urgente'] && (raw['Urgente'].toLowerCase() === 'sí' || raw['Urgente'].toLowerCase() === 'si' || raw['Urgente'].toLowerCase() === 'true')); + let statusHtml = ''; if (isFinalized || stNameLower.includes('finalizado') || stNameLower.includes('anulado')) { @@ -293,6 +296,24 @@ `; } } + // 🚨 NUEVO BLOQUE: SI ES URGENCIA, MOSTRAMOS ESTO EN VEZ DE "ELEGIR CITA" + else if (isUrgent) { + statusHtml = `
+
+
+ +
+
+

Prioridad Máxima

+

Aviso Urgente

+

+ ${hasWorker ? 'Técnico de urgencia asignado. Acudirá a tu domicilio lo antes posible.' : 'Estamos localizando al técnico de urgencia más cercano para que acuda de inmediato.'} +

+
+
+
`; + } + // Si NO es urgente, entonces sí mostramos el botón de Elegir cita else if (stNameLower.includes('esperando') || stNameLower.includes('asignado') || (hasWorker && !hasDate)) { statusHtml = `