Actualizar proveedores.html
This commit is contained in:
@@ -303,7 +303,7 @@
|
|||||||
} catch (e) { console.error("Error en loadInbox:", e); }
|
} 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) {
|
function buildServiceCard(svc) {
|
||||||
const raw = svc.raw_data || {};
|
const raw = svc.raw_data || {};
|
||||||
const isArchived = svc.status === 'archived';
|
const isArchived = svc.status === 'archived';
|
||||||
@@ -325,6 +325,10 @@
|
|||||||
const sysStatus = (svc.status || '').toLowerCase();
|
const sysStatus = (svc.status || '').toLowerCase();
|
||||||
const linkedStatus = (raw['estado'] || raw['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 ? `<span class="bg-red-500 text-white px-2 py-0.5 rounded-md text-[9px] font-black uppercase shadow-sm animate-pulse ml-3">🔥 Urgente</span>` : '';
|
||||||
|
|
||||||
if (!isArchived) {
|
if (!isArchived) {
|
||||||
if (autoStatus.includes('bolsa') || autoStatus === 'in_progress' || sysStatus.includes('bolsa') || linkedStatus.includes('bolsa')) {
|
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';
|
bgClass = 'bg-orange-50/40 border-orange-200 hover:border-orange-400';
|
||||||
@@ -370,7 +374,7 @@
|
|||||||
<span class="text-[8px] font-bold text-red-400">Nadie aceptó</span>
|
<span class="text-[8px] font-bold text-red-400">Nadie aceptó</span>
|
||||||
</div>`;
|
</div>`;
|
||||||
} else {
|
} 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 = `
|
badgeEstado = `
|
||||||
<div class="flex flex-col items-end gap-1">
|
<div class="flex flex-col items-end gap-1">
|
||||||
<span class="bg-slate-100 text-slate-500 px-3 py-1 rounded-full text-[10px] font-black uppercase flex items-center gap-1.5 border border-slate-200">
|
<span class="bg-slate-100 text-slate-500 px-3 py-1 rounded-full text-[10px] font-black uppercase flex items-center gap-1.5 border border-slate-200">
|
||||||
@@ -416,7 +420,10 @@
|
|||||||
<img src="${getLogoUrl(raw['Compañía'] || raw['COMPAÑIA'])}" onerror="this.src='${companyLogos['DEFAULT']}'" class="max-w-full max-h-full object-contain">
|
<img src="${getLogoUrl(raw['Compañía'] || raw['COMPAÑIA'])}" onerror="this.src='${companyLogos['DEFAULT']}'" class="max-w-full max-h-full object-contain">
|
||||||
</div>
|
</div>
|
||||||
<div class="min-w-0 flex-1">
|
<div class="min-w-0 flex-1">
|
||||||
<h3 class="font-black text-slate-800 truncate uppercase text-lg leading-tight">${name}</h3>
|
<div class="flex items-center">
|
||||||
|
<h3 class="font-black text-slate-800 truncate uppercase text-lg leading-tight">${name}</h3>
|
||||||
|
${urgentBadge}
|
||||||
|
</div>
|
||||||
<p class="text-xs text-slate-400 truncate italic mt-0.5">${fullAddr}</p>
|
<p class="text-xs text-slate-400 truncate italic mt-0.5">${fullAddr}</p>
|
||||||
<div class="flex flex-wrap gap-2 mt-2">
|
<div class="flex flex-wrap gap-2 mt-2">
|
||||||
<span class="text-[10px] bg-slate-100 text-slate-500 px-2 py-0.5 rounded-lg font-bold border">#${svc.service_ref}</span>
|
<span class="text-[10px] bg-slate-100 text-slate-500 px-2 py-0.5 rounded-lg font-bold border">#${svc.service_ref}</span>
|
||||||
@@ -520,7 +527,7 @@
|
|||||||
document.getElementById('impCP').value = raw['Código Postal'] || raw['C.P.'] || "";
|
document.getElementById('impCP').value = raw['Código Postal'] || raw['C.P.'] || "";
|
||||||
document.getElementById('impDesc').value = raw['Descripción'] || "";
|
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('impUrgent').value = isUrgent.toString();
|
||||||
document.getElementById('impNotesInt').value = raw['internal_notes'] || "";
|
document.getElementById('impNotesInt').value = raw['internal_notes'] || "";
|
||||||
document.getElementById('impNotesExt').value = raw['client_notes'] || "";
|
document.getElementById('impNotesExt').value = raw['client_notes'] || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user