-
+
+
@@ -121,12 +128,17 @@
document.addEventListener('DOMContentLoaded', async () => {
if (!localStorage.getItem("token")) window.location.href = "index.html";
- await loadInbox();
- lucide.createIcons();
+ // Damos un pequeño tiempo para que layout.js termine de pintar
+ setTimeout(() => {
+ loadInbox();
+ lucide.createIcons();
+ }, 100);
});
async function loadInbox() {
const container = document.getElementById('inboxContainer');
+ container.innerHTML = '
';
+
try {
const [svcRes, mapRes] = await Promise.all([
fetch(`${API_URL}/providers/scraped`, { headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` } }),
@@ -138,11 +150,11 @@
allScraped = svcData.services || [];
if (allScraped.length === 0) {
- container.innerHTML = `
-
-
-
No hay servicios nuevos pendientes.
-
`;
+ container.innerHTML = `
+
+
¡Buzón Limpio!
+
No hay nuevos expedientes para procesar.
+
`;
lucide.createIcons();
return;
}
@@ -152,34 +164,46 @@
const raw = svc.raw_data || {};
const myMap = globalMappings.filter(m => m.provider === svc.provider);
- const name = raw[myMap.find(m => m.target_key === 'clientName')?.original_key] || "No detectado";
+ const name = raw[myMap.find(m => m.target_key === 'clientName')?.original_key] || "Nombre no identificado";
const addr = raw[myMap.find(m => m.target_key === 'address')?.original_key] || "Sin dirección";
const phone = raw[myMap.find(m => m.target_key === 'phone')?.original_key] || raw['Teléfono'] || "S/T";
const card = document.createElement('div');
- card.className = "service-card bg-white p-4 rounded-xl border border-gray-200 shadow-sm flex items-center gap-4 fade-in";
+ card.className = "service-card bg-white p-5 rounded-2xl border border-slate-200 flex items-center gap-6 fade-in shadow-sm";
+ card.style.borderLeftColor = svc.provider === 'homeserve' ? '#ef4444' : '#3b82f6';
+
card.innerHTML = `
-
-
${svc.provider}
-
-
#${svc.service_ref.slice(-4)}
+
+ ${svc.provider}
+
+ #${svc.service_ref.slice(-4)}
-
${name}
-
${addr}
-
-
${phone}
+
+
${name}
+ ${svc.raw_data.Urgente === 'Sí' ? 'URGENTE' : ''}
+
+
+ ${addr}
+
+
+
+ ${phone}
+
+
+ Detectado: ${new Date(svc.created_at).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}
+
-