diff --git a/proveedores.html b/proveedores.html index a82bf80..12966bf 100644 --- a/proveedores.html +++ b/proveedores.html @@ -303,7 +303,7 @@ } catch (e) { console.error("Error en loadInbox:", e); } } - // NUEVA FUNCIÓN PARA CONSTRUIR LA TARJETA HTML (Evita repetir código) + // ====== 🔥 DETECCIÓN DE URGENCIA AÑADIDA AQUÍ ====== function buildServiceCard(svc) { const raw = svc.raw_data || {}; const isArchived = svc.status === 'archived'; @@ -325,6 +325,10 @@ const sysStatus = (svc.status || '').toLowerCase(); const linkedStatus = (raw['estado'] || raw['status'] || '').toLowerCase(); + // DETECCIÓN DE URGENCIA (Ya sea por la BD o por el raw_data) + const isUrgent = svc.is_urgent === true || (raw['Urgente'] && raw['Urgente'].toLowerCase() === 'sí') || (raw['URGENTE'] && raw['URGENTE'].toLowerCase() === 'si'); + const urgentBadge = isUrgent ? `🔥 Urgente` : ''; + if (!isArchived) { if (autoStatus.includes('bolsa') || autoStatus === 'in_progress' || sysStatus.includes('bolsa') || linkedStatus.includes('bolsa')) { bgClass = 'bg-orange-50/40 border-orange-200 hover:border-orange-400'; @@ -370,7 +374,7 @@ Nadie aceptó `; } else { - bgClass = 'bg-white border-slate-200'; + bgClass = isUrgent ? 'bg-red-50/20 border-red-300 hover:border-red-500 shadow-[0_0_15px_rgba(239,68,68,0.15)]' : 'bg-white border-slate-200'; badgeEstado = `
@@ -416,7 +420,10 @@
-

${name}

+
+

${name}

+ ${urgentBadge} +

${fullAddr}

#${svc.service_ref} @@ -520,7 +527,7 @@ document.getElementById('impCP').value = raw['Código Postal'] || raw['C.P.'] || ""; document.getElementById('impDesc').value = raw['Descripción'] || ""; - const isUrgent = raw['Urgente'] === 'Sí' || raw['Urgente'] === 'true' || raw['URGENTE'] === 'SI'; + const isUrgent = svc.is_urgent === true || raw['Urgente'] === 'Sí' || raw['Urgente'] === 'true' || raw['URGENTE'] === 'SI'; document.getElementById('impUrgent').value = isUrgent.toString(); document.getElementById('impNotesInt').value = raw['internal_notes'] || ""; document.getElementById('impNotesExt').value = raw['client_notes'] || "";