Actualizar index.html
This commit is contained in:
37
index.html
37
index.html
@@ -146,13 +146,19 @@
|
||||
document.getElementById('clientName').innerText = client.name.split(' ')[0].toUpperCase();
|
||||
|
||||
const activeContainer = document.getElementById('activeServicesContainer');
|
||||
const historyContainerWrapper = document.getElementById('historyContainerWrapper');
|
||||
const historyContainer = document.getElementById('historyServicesContainer');
|
||||
|
||||
// Limpiar contenedores por si acaso (útil si hay recargas)
|
||||
activeContainer.innerHTML = '';
|
||||
historyContainer.innerHTML = '';
|
||||
|
||||
let hasActive = false;
|
||||
let hasHistory = false;
|
||||
|
||||
allServices.forEach(srv => {
|
||||
const isFinalized = srv.status_name === 'Terminado';
|
||||
const raw = srv.raw_data || {};
|
||||
// Usamos la nueva variable booleana que nos manda el servidor
|
||||
const isFinalized = srv.is_final;
|
||||
const descLimpia = summarizeDescription(srv.description);
|
||||
let statusHtml = '';
|
||||
|
||||
@@ -163,7 +169,7 @@
|
||||
</div>`;
|
||||
}
|
||||
else if (srv.status_name === 'Técnico de Camino') {
|
||||
const fullAddr = `${raw["Dirección"] || ""}, ${raw["Código Postal"] || ""} ${raw["Población"] || ""}`;
|
||||
const fullAddr = `${srv.raw_data?.["Dirección"] || ""}, ${srv.raw_data?.["Código Postal"] || ""} ${srv.raw_data?.["Población"] || ""}`;
|
||||
etasToInit.push({ id: srv.id, address: fullAddr });
|
||||
|
||||
statusHtml = `
|
||||
@@ -193,7 +199,6 @@
|
||||
</div>`;
|
||||
}
|
||||
else if (srv.status_name === 'En Incidencia' || (srv.status_name || '').toLowerCase().includes('incidencia')) {
|
||||
// AQUÍ ESTÁ EL BLOQUE DE INCIDENCIA AÑADIDO
|
||||
statusHtml = `
|
||||
<div class="bg-rose-50 border border-rose-200 p-6 rounded-3xl flex items-center gap-5 shadow-inner">
|
||||
<div class="w-14 h-14 bg-rose-500 text-white rounded-2xl flex items-center justify-center shadow-md shrink-0 animate-pulse">
|
||||
@@ -228,7 +233,7 @@
|
||||
let cardHtml = `
|
||||
<div class="bg-white/80 backdrop-blur-xl border border-white shadow-xl shadow-slate-200/40 rounded-[2.5rem] p-6 mb-6 relative overflow-hidden">
|
||||
<div class="flex justify-between items-start mb-5">
|
||||
<span class="text-[10px] font-black text-slate-400 uppercase tracking-widest">Expediente #${srv.title.replace('Expediente #', '').replace('🚨 URGENTE: ', '')}</span>
|
||||
<span class="text-[10px] font-black text-slate-400 uppercase tracking-widest">${srv.title}</span>
|
||||
${srv.assigned_worker && srv.assigned_worker !== 'Pendiente' ?
|
||||
`<div class="bg-slate-50 border border-slate-100 px-3 py-1.5 rounded-lg text-center shrink-0">
|
||||
<p class="text-[8px] uppercase font-black text-slate-400 mb-0.5">Técnico</p>
|
||||
@@ -244,11 +249,27 @@
|
||||
</div>
|
||||
`;
|
||||
|
||||
if (isFinalized) historyContainer.innerHTML += cardHtml;
|
||||
else { activeContainer.innerHTML += cardHtml; hasActive = true; }
|
||||
if (isFinalized) {
|
||||
historyContainer.innerHTML += cardHtml;
|
||||
hasHistory = true;
|
||||
} else {
|
||||
activeContainer.innerHTML += cardHtml;
|
||||
hasActive = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!hasActive) document.getElementById('noActiveServices').classList.remove('hidden');
|
||||
// Lógica para mostrar/ocultar secciones
|
||||
if (!hasActive) {
|
||||
document.getElementById('noActiveServices').classList.remove('hidden');
|
||||
} else {
|
||||
document.getElementById('noActiveServices').classList.add('hidden');
|
||||
}
|
||||
|
||||
if (hasHistory) {
|
||||
historyContainerWrapper.classList.remove('hidden');
|
||||
} else {
|
||||
historyContainerWrapper.classList.add('hidden');
|
||||
}
|
||||
|
||||
lucide.createIcons();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user