Actualizar automatizaciones.html

This commit is contained in:
2026-02-15 14:43:00 +00:00
parent 379512c867
commit 99f95491b4

View File

@@ -13,7 +13,7 @@
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; } .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.service-card { cursor: pointer; transition: all 0.2s ease; position: relative; } .service-card { cursor: pointer; transition: all 0.2s ease; position: relative; }
.service-card:hover:not(.archived) { transform: translateY(-2px); border-color: #3b82f6; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); } .service-card:hover:not(.archived) { transform: translateY(-2px); border-color: #3b82f6; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
.archived { opacity: 0.7; grayscale: 100%; cursor: not-allowed; } .archived { opacity: 0.7; grayscale: 100%; }
</style> </style>
</head> </head>
<body class="bg-gray-50 text-gray-800 font-sans antialiased overflow-hidden text-left"> <body class="bg-gray-50 text-gray-800 font-sans antialiased overflow-hidden text-left">
@@ -26,13 +26,13 @@
<main class="flex-1 overflow-x-hidden overflow-y-auto bg-gray-50 p-6 relative"> <main class="flex-1 overflow-x-hidden overflow-y-auto bg-gray-50 p-6 relative">
<div id="automationView" class="fade-in max-w-6xl mx-auto"> <div id="automationView" class="fade-in max-w-6xl mx-auto">
<div class="flex justify-between items-center mb-6"> <div class="flex justify-between items-center mb-8">
<div> <div>
<h2 class="text-2xl font-black text-slate-800 flex items-center gap-3"> <h2 class="text-2xl font-black text-slate-800 flex items-center gap-3">
<span class="bg-blue-600 p-2.5 rounded-xl text-white shadow-lg"><i data-lucide="bot"></i></span> <span class="bg-blue-600 p-2.5 rounded-xl text-white shadow-lg"><i data-lucide="bot"></i></span>
Buzón de Automatizaciones Buzón de Automatizaciones
</h2> </h2>
<p class="text-sm text-slate-500 mt-1 font-medium">Gestiona y filtra tus expedientes capturados.</p> <p class="text-sm text-slate-500 mt-1 font-medium">Filtra por proveedor, compañía o cualquier dato del asegurado.</p>
</div> </div>
<button onclick="loadInbox()" class="bg-white border-2 border-slate-200 hover:border-blue-600 hover:text-blue-600 text-slate-600 px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 transition-all active:scale-95 shadow-sm"> <button onclick="loadInbox()" class="bg-white border-2 border-slate-200 hover:border-blue-600 hover:text-blue-600 text-slate-600 px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 transition-all active:scale-95 shadow-sm">
<i data-lucide="refresh-cw" class="w-4 h-4"></i> Actualizar <i data-lucide="refresh-cw" class="w-4 h-4"></i> Actualizar
@@ -40,19 +40,19 @@
</div> </div>
<div class="bg-white p-4 rounded-2xl border border-slate-200 shadow-sm mb-6 flex flex-wrap gap-4 items-center"> <div class="bg-white p-4 rounded-2xl border border-slate-200 shadow-sm mb-6 flex flex-wrap gap-4 items-center">
<div class="flex-1 min-w-[200px] relative"> <div class="flex-1 min-w-[280px] relative">
<i data-lucide="search" class="w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"></i> <i data-lucide="search" class="w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"></i>
<input type="text" id="searchBox" oninput="renderFilteredInbox()" placeholder="Buscar por nombre, ref, dirección..." class="w-full pl-10 pr-4 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-blue-500 outline-none transition-all"> <input type="text" id="searchBox" oninput="renderFilteredInbox()" placeholder="Buscar por Nombre, REF, Dirección, Teléfono..." class="w-full pl-11 pr-4 py-2.5 bg-slate-50 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-blue-500 outline-none transition-all">
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<select id="filterProvider" onchange="renderFilteredInbox()" class="bg-slate-50 border border-slate-200 text-xs font-bold px-4 py-2.5 rounded-xl outline-none focus:ring-2 focus:ring-blue-500"> <select id="filterProvider" onchange="renderFilteredInbox()" class="bg-slate-50 border border-slate-200 text-[10px] font-black px-4 py-2.5 rounded-xl outline-none focus:ring-2 focus:ring-blue-500 uppercase tracking-widest">
<option value="ALL">TODOS LOS PROVEEDORES</option> <option value="ALL">PROVEEDORES</option>
<option value="homeserve">HOME (HOMESERVE)</option> <option value="homeserve">HOME (HOMESERVE)</option>
<option value="multiasistencia">MULTI (MULTIASISTENCIA)</option> <option value="multiasistencia">MULTI (MULTIASISTENCIA)</option>
</select> </select>
<select id="filterCompany" onchange="renderFilteredInbox()" class="bg-slate-50 border border-slate-200 text-xs font-bold px-4 py-2.5 rounded-xl outline-none focus:ring-2 focus:ring-blue-500"> <select id="filterCompany" onchange="renderFilteredInbox()" class="bg-slate-50 border border-slate-200 text-[10px] font-black px-4 py-2.5 rounded-xl outline-none focus:ring-2 focus:ring-blue-500 uppercase tracking-widest max-w-[200px]">
<option value="ALL">TODAS LAS COMPAÑÍAS</option> <option value="ALL">COMPAÑÍAS</option>
</select> </select>
</div> </div>
</div> </div>
@@ -64,7 +64,6 @@
<div id="importModal" class="fixed inset-0 bg-slate-900/75 hidden z-[100] flex items-center justify-center backdrop-blur-md p-2"> <div id="importModal" class="fixed inset-0 bg-slate-900/75 hidden z-[100] flex items-center justify-center backdrop-blur-md p-2">
<div class="bg-white rounded-[2.5rem] shadow-2xl w-full max-w-4xl flex flex-col max-h-[95vh] overflow-hidden border border-slate-200 fade-in text-left"> <div class="bg-white rounded-[2.5rem] shadow-2xl w-full max-w-4xl flex flex-col max-h-[95vh] overflow-hidden border border-slate-200 fade-in text-left">
<div class="px-8 pt-6 pb-4 flex justify-between items-center border-b border-slate-50"> <div class="px-8 pt-6 pb-4 flex justify-between items-center border-b border-slate-50">
<div class="flex items-center gap-4 text-left"> <div class="flex items-center gap-4 text-left">
<div id="modalCompanyLogo" class="w-12 h-12 rounded-xl bg-slate-50 border border-slate-100 p-2 flex items-center justify-center shadow-sm overflow-hidden"></div> <div id="modalCompanyLogo" class="w-12 h-12 rounded-xl bg-slate-50 border border-slate-100 p-2 flex items-center justify-center shadow-sm overflow-hidden"></div>
@@ -79,7 +78,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="flex items-center gap-4 text-left"> <div class="flex items-center gap-4 text-left">
<div class="flex flex-col items-end mr-4 text-left"> <div class="flex flex-col items-end mr-4 text-left">
<span class="text-[9px] font-black text-slate-400 uppercase mb-1">Prioridad</span> <span class="text-[9px] font-black text-slate-400 uppercase mb-1">Prioridad</span>
@@ -93,32 +91,27 @@
</button> </button>
</div> </div>
</div> </div>
<form id="importForm" onsubmit="handleFinalImport(event)" class="px-8 py-6 space-y-5 overflow-y-auto no-scrollbar text-left"> <form id="importForm" onsubmit="handleFinalImport(event)" class="px-8 py-6 space-y-5 overflow-y-auto no-scrollbar text-left">
<input type="hidden" id="impScrapedId"> <input type="hidden" id="impScrapedId">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-slate-50/50 p-3 rounded-2xl border border-slate-100 flex items-center gap-3"> <div class="bg-slate-50/50 p-3 rounded-2xl border border-slate-100 flex items-center gap-3">
<div class="bg-white p-2 rounded-xl shadow-sm text-slate-400"><i data-lucide="user" class="w-4 h-4"></i></div> <div class="bg-white p-2 rounded-xl shadow-sm text-slate-400"><i data-lucide="user"></i></div>
<div class="flex flex-col min-w-0 w-full text-left"> <div class="flex flex-col min-w-0 w-full text-left">
<span class="text-[9px] font-black text-slate-400 uppercase mb-0.5">Asegurado</span> <span class="text-[9px] font-black text-slate-400 uppercase mb-0.5">Asegurado</span>
<input type="text" id="impName" readonly class="bg-transparent border-none p-0 text-sm font-bold text-slate-700 outline-none w-full"> <input type="text" id="impName" readonly class="bg-transparent border-none p-0 text-sm font-bold text-slate-700 outline-none w-full">
</div> </div>
</div> </div>
<div class="bg-slate-50/50 p-3 rounded-2xl border border-slate-100 flex items-center gap-3 text-left"> <div class="bg-slate-50/50 p-3 rounded-2xl border border-slate-100 flex items-center gap-3 text-left">
<div class="bg-white p-2 rounded-xl shadow-sm text-emerald-500"><i data-lucide="phone" class="w-4 h-4"></i></div> <div class="bg-white p-2 rounded-xl shadow-sm text-emerald-500"><i data-lucide="phone"></i></div>
<div class="flex flex-col min-w-0 w-full text-left"> <div class="flex flex-col min-w-0 w-full text-left">
<span class="text-[9px] font-black text-slate-400 uppercase mb-0.5">Teléfono</span> <span class="text-[9px] font-black text-slate-400 uppercase mb-0.5">Teléfono</span>
<input type="text" id="impPhone" readonly class="bg-transparent border-none p-0 text-sm font-black text-emerald-600 outline-none w-full"> <input type="text" id="impPhone" readonly class="bg-transparent border-none p-0 text-sm font-black text-emerald-600 outline-none w-full">
</div> </div>
</div> </div>
</div> </div>
<div class="grid grid-cols-1 md:grid-cols-5 gap-3 text-left"> <div class="grid grid-cols-1 md:grid-cols-5 gap-3 text-left">
<div class="md:col-span-4 space-y-1 text-left"> <div class="md:col-span-4 space-y-1 text-left">
<label class="text-[9px] font-black text-blue-600 uppercase tracking-widest ml-2 flex items-center gap-1"> <label class="text-[9px] font-black text-blue-600 uppercase tracking-widest ml-2 flex items-center gap-1"><i data-lucide="map-pin"></i> Dirección</label>
<i data-lucide="map-pin" class="w-3 h-3"></i> Dirección
</label>
<input type="text" id="impAddress" required class="w-full border-2 border-slate-100 bg-white px-4 py-2.5 rounded-2xl text-sm font-medium outline-none focus:border-blue-500 shadow-sm"> <input type="text" id="impAddress" required class="w-full border-2 border-slate-100 bg-white px-4 py-2.5 rounded-2xl text-sm font-medium outline-none focus:border-blue-500 shadow-sm">
</div> </div>
<div class="space-y-1 text-center"> <div class="space-y-1 text-center">
@@ -126,7 +119,6 @@
<input type="text" id="impCP" required class="w-full border-2 border-slate-100 bg-white py-2.5 rounded-2xl text-sm font-black text-center outline-none focus:border-blue-500 shadow-sm"> <input type="text" id="impCP" required class="w-full border-2 border-slate-100 bg-white py-2.5 rounded-2xl text-sm font-black text-center outline-none focus:border-blue-500 shadow-sm">
</div> </div>
</div> </div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 p-5 rounded-[1.8rem] border-2 border-blue-50 bg-blue-50/30 text-left"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 p-5 rounded-[1.8rem] border-2 border-blue-50 bg-blue-50/30 text-left">
<div class="space-y-1 text-left"> <div class="space-y-1 text-left">
<label class="text-[9px] font-black text-blue-600 uppercase tracking-widest ml-2">Gremio Especialista *</label> <label class="text-[9px] font-black text-blue-600 uppercase tracking-widest ml-2">Gremio Especialista *</label>
@@ -141,7 +133,6 @@
</select> </select>
</div> </div>
</div> </div>
<div class="space-y-3 text-left"> <div class="space-y-3 text-left">
<div class="space-y-1 text-left"> <div class="space-y-1 text-left">
<label class="text-[9px] font-black text-slate-400 uppercase tracking-widest ml-2">Avería Detectada</label> <label class="text-[9px] font-black text-slate-400 uppercase tracking-widest ml-2">Avería Detectada</label>
@@ -158,13 +149,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="flex items-center gap-3 pt-4 border-t text-left"> <div class="flex items-center gap-3 pt-4 border-t text-left">
<button type="button" onclick="saveDraftChanges(event)" class="bg-slate-100 hover:bg-slate-200 text-slate-600 font-black px-6 py-5 rounded-[1.8rem] transition-all flex items-center justify-center gap-2 active:scale-95 text-xs uppercase tracking-widest"> <button type="button" onclick="saveDraftChanges(event)" class="bg-slate-100 hover:bg-slate-200 text-slate-600 font-black px-6 py-5 rounded-[1.8rem] transition-all flex items-center justify-center gap-2 active:scale-95 text-xs uppercase tracking-widest">
<i data-lucide="save" class="w-4 h-4"></i> <span>Guardar Borrador</span> <i data-lucide="save"></i> <span>Guardar Borrador</span>
</button> </button>
<button type="submit" class="flex-1 bg-slate-900 hover:bg-emerald-600 text-white font-black py-5 rounded-[1.8rem] shadow-xl transition-all flex items-center justify-center gap-3 active:scale-95 text-sm uppercase tracking-[0.2em]"> <button type="submit" class="flex-1 bg-slate-900 hover:bg-emerald-600 text-white font-black py-5 rounded-[1.8rem] shadow-xl transition-all flex items-center justify-center gap-3 active:scale-95 text-sm uppercase tracking-[0.2em]">
<span>TRASPASAR A CRM</span> <i data-lucide="send" class="w-5 h-5"></i> <span>TRASPASAR A CRM</span> <i data-lucide="send"></i>
</button> </button>
</div> </div>
</form> </form>
@@ -234,27 +224,26 @@
async function loadInbox() { async function loadInbox() {
const container = document.getElementById('inboxContainer'); const container = document.getElementById('inboxContainer');
try { try {
// MODIFICACIÓN: Ya no filtramos solo pending en la llamada, traemos todo para el buscador
const resSvc = await fetch(`${API_URL}/providers/scraped`, { headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` } }); const resSvc = await fetch(`${API_URL}/providers/scraped`, { headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` } });
const dataSvc = await resSvc.json(); const dataSvc = await resSvc.json();
scrapedData = dataSvc.services || []; scrapedData = dataSvc.services || [];
// Actualizar Filtro de Compañías // Actualizamos lista de compañías para el filtro
const companyFilter = document.getElementById('filterCompany'); const compSelect = document.getElementById('filterCompany');
const companies = [...new Set(scrapedData.map(s => { const uniqueCompanies = [...new Set(scrapedData.map(s => {
const raw = s.raw_data || {}; const raw = s.raw_data || {};
return (raw['Compañía'] || raw['COMPAÑIA'] || raw['Procedencia'] || "DESCONOCIDA").toString().toUpperCase().trim(); return (raw['Compañía'] || raw['COMPAÑIA'] || raw['Procedencia'] || "S/C").toString().toUpperCase().trim();
}))].sort(); }))].sort();
companyFilter.innerHTML = '<option value="ALL">TODAS LAS COMPAÑÍAS</option>'; compSelect.innerHTML = '<option value="ALL">COMPAÑÍAS</option>';
companies.forEach(c => { uniqueCompanies.forEach(c => compSelect.innerHTML += `<option value="${c}">${c}</option>`);
companyFilter.innerHTML += `<option value="${c}">${c}</option>`;
});
renderFilteredInbox(); // Render inicial con filtros aplicados renderFilteredInbox(); //
} catch (e) { showToast("Error de conexión", true); } } catch (e) { showToast("Error de conexión", true); }
} }
// FUNCIÓN PARA RENDERIZAR SEGÚN FILTROS // FUNCIÓN DE FILTRADO REACTIVO (NUEVA)
function renderFilteredInbox() { function renderFilteredInbox() {
const container = document.getElementById('inboxContainer'); const container = document.getElementById('inboxContainer');
const search = document.getElementById('searchBox').value.toUpperCase(); const search = document.getElementById('searchBox').value.toUpperCase();
@@ -266,26 +255,28 @@
const name = (raw['Nombre Cliente'] || raw['CLIENTE'] || "").toUpperCase(); const name = (raw['Nombre Cliente'] || raw['CLIENTE'] || "").toUpperCase();
const ref = (svc.service_ref || "").toUpperCase(); const ref = (svc.service_ref || "").toUpperCase();
const addr = (raw['Dirección'] || raw['DOMICILIO'] || "").toUpperCase(); const addr = (raw['Dirección'] || raw['DOMICILIO'] || "").toUpperCase();
const compName = (raw['Compañía'] || raw['COMPAÑIA'] || raw['Procedencia'] || "").toString().toUpperCase().trim(); const phone = (raw['Teléfono'] || raw['TELEFONO'] || "").toUpperCase();
const comp = (raw['Compañía'] || raw['COMPAÑIA'] || raw['Procedencia'] || "").toUpperCase();
const matchesSearch = name.includes(search) || ref.includes(search) || addr.includes(search); const matchesSearch = name.includes(search) || ref.includes(search) || addr.includes(search) || phone.includes(search);
const matchesProvider = provider === "ALL" || svc.provider === provider; const matchesProvider = provider === 'ALL' || svc.provider === provider;
const matchesCompany = company === "ALL" || compName === company; const matchesCompany = company === 'ALL' || comp === company;
return matchesSearch && matchesProvider && matchesCompany; return matchesSearch && matchesProvider && matchesCompany;
}); });
container.innerHTML = ""; container.innerHTML = "";
if(filtered.length === 0) { if(filtered.length === 0) {
container.innerHTML = '<div class="p-12 text-center text-slate-400 bg-white rounded-3xl border-2 border-dashed">No se encontraron expedientes con los filtros actuales.</div>'; container.innerHTML = '<div class="p-12 text-center text-slate-400 bg-white rounded-3xl border-2 border-dashed">No se encontraron expedientes.</div>';
return; return;
} }
filtered.forEach(svc => { filtered.forEach(svc => {
const raw = svc.raw_data || {}; const raw = svc.raw_data || {};
const isArchived = svc.status === 'archived'; const isArchived = svc.status === 'archived'; //
const statusLabel = isArchived ? 'ARCHIVADO' : 'SERVICIO ACTIVO'; const statusLabel = isArchived ? 'ARCHIVADO' : 'SERVICIO ACTIVO';
const statusClass = isArchived ? 'bg-gray-100 text-gray-500 border-gray-200' : 'bg-emerald-50 text-emerald-600 border-emerald-100'; const statusClass = isArchived ? 'bg-gray-100 text-gray-500 border-gray-200' : 'bg-emerald-50 text-emerald-600 border-emerald-100';
const name = raw['Nombre Cliente'] || raw['CLIENTE'] || "S/N"; const name = raw['Nombre Cliente'] || raw['CLIENTE'] || "S/N";
const addr = raw['Dirección'] || raw['DOMICILIO'] || ""; const addr = raw['Dirección'] || raw['DOMICILIO'] || "";
const pop = raw['Población'] || raw['POBLACION-PROVINCIA'] || ""; const pop = raw['Población'] || raw['POBLACION-PROVINCIA'] || "";
@@ -297,11 +288,13 @@
const card = document.createElement('div'); const card = document.createElement('div');
card.className = `service-card bg-white p-5 rounded-2xl border ${isArchived ? 'archived' : 'shadow-sm'} flex items-center justify-between transition-all group fade-in text-left`; card.className = `service-card bg-white p-5 rounded-2xl border ${isArchived ? 'archived' : 'shadow-sm'} flex items-center justify-between transition-all group fade-in text-left`;
card.onclick = (e) => { card.onclick = (e) => {
if (e.target.closest('a') || e.target.closest('button')) return; if (e.target.closest('a') || e.target.closest('button')) return;
if (isArchived) showToast("⚠️ Este servicio está ARCHIVADO y no se puede editar.", true); if (isArchived) showToast("⚠️ Este servicio está ARCHIVADO (ya no aparece en la web de compañía).", true);
else openEditor(svc.id); else openEditor(svc.id);
}; };
card.innerHTML = ` card.innerHTML = `
<div class="flex items-center gap-4 min-w-0 text-left"> <div class="flex items-center gap-4 min-w-0 text-left">
<div class="w-16 h-16 rounded-2xl flex flex-col items-center justify-center shrink-0 shadow-sm border border-slate-100 ${isArchived ? 'bg-gray-200 text-gray-400' : (svc.provider === 'homeserve' ? 'bg-red-50 text-red-600' : 'bg-blue-50 text-blue-600')}"> <div class="w-16 h-16 rounded-2xl flex flex-col items-center justify-center shrink-0 shadow-sm border border-slate-100 ${isArchived ? 'bg-gray-200 text-gray-400' : (svc.provider === 'homeserve' ? 'bg-red-50 text-red-600' : 'bg-blue-50 text-blue-600')}">
@@ -317,7 +310,6 @@
<span class="text-[8px] font-black px-2 py-0.5 rounded-full border ${statusClass}">${statusLabel}</span> <span class="text-[8px] font-black px-2 py-0.5 rounded-full border ${statusClass}">${statusLabel}</span>
</div> </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>
${guildName ? `<span class="text-[10px] bg-blue-50 text-blue-600 px-2 py-0.5 rounded-lg font-bold border border-blue-100"><i data-lucide="hammer" class="w-2.5 h-2.5 inline mr-1"></i>${guildName}</span>` : ''} ${guildName ? `<span class="text-[10px] bg-blue-50 text-blue-600 px-2 py-0.5 rounded-lg font-bold border border-blue-100"><i data-lucide="hammer" class="w-2.5 h-2.5 inline mr-1"></i>${guildName}</span>` : ''}
@@ -327,9 +319,9 @@
</div> </div>
<div class="flex items-center gap-2 text-left"> <div class="flex items-center gap-2 text-left">
${!isArchived ? ` ${!isArchived ? `
<div class="hidden group-hover:flex items-center gap-2 pr-4 transition-all"> <div class="hidden group-hover:flex items-center gap-1 pr-4 border-r mr-2 transition-all">
<a href="https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(fullAddr)}" target="_blank" class="action-btn p-2.5 rounded-xl bg-slate-50 text-slate-400 hover:text-blue-600 shadow-sm"><i data-lucide="map" class="w-5 h-5"></i></a> <a href="https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(fullAddr)}" target="_blank" class="action-btn p-2.5 rounded-xl bg-slate-50 text-slate-400 hover:text-blue-600 shadow-sm"><i data-lucide="map"></i></a>
${phone ? `<a href="https://wa.me/34${phone}" target="_blank" class="action-btn p-2.5 rounded-xl bg-slate-50 text-slate-400 hover:text-emerald-600 shadow-sm"><i data-lucide="message-square" class="w-5 h-5"></i></a>` : ''} ${phone ? `<a href="https://wa.me/34${phone}" target="_blank" class="action-btn p-2.5 rounded-xl bg-slate-50 text-slate-400 hover:text-emerald-600 shadow-sm"><i data-lucide="message-square"></i></a>` : ''}
</div> </div>
<div class="bg-blue-600 text-white p-4 rounded-2xl shadow-lg group-hover:scale-105 transition-all"><i data-lucide="chevron-right" class="w-6 h-6"></i></div>` : ''} <div class="bg-blue-600 text-white p-4 rounded-2xl shadow-lg group-hover:scale-105 transition-all"><i data-lucide="chevron-right" class="w-6 h-6"></i></div>` : ''}
</div>`; </div>`;
@@ -409,17 +401,10 @@
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${localStorage.getItem("token")}` }, headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${localStorage.getItem("token")}` },
body: JSON.stringify(payload) body: JSON.stringify(payload)
}); });
if(res.ok) { if(res.ok) { showToast("✅ Borrador guardado correctamente"); loadInbox(); }
showToast("✅ Borrador guardado correctamente"); else { showToast("❌ Error al guardar", true); }
loadInbox(); } catch (e) { showToast("❌ Error de red", true); }
} else { finally { btn.disabled = false; }
showToast("❌ Error al guardar", true);
}
} catch (e) {
showToast("❌ Error de red", true);
} finally {
btn.disabled = false;
}
} }
async function handleFinalImport(event) { async function handleFinalImport(event) {