Actualizar automatizaciones.html

This commit is contained in:
2026-02-14 11:20:51 +00:00
parent ef0ea6d52c
commit 95301abc47

View File

@@ -237,15 +237,17 @@
if(!svc) return; if(!svc) return;
const raw = svc.raw_data; const raw = svc.raw_data;
// SINCRONIZACIÓN DE TODOS LOS IDS DEL FORMULARIO // Pintar IDs informativos del nuevo header
document.getElementById('displayRef').innerText = `REF: ${svc.service_ref}`;
document.getElementById('displayCompany').innerText = raw['Compañía'] || raw['COMPAÑIA'] || svc.provider.toUpperCase();
// Rellenar campos del formulario
document.getElementById('impScrapedId').value = id; document.getElementById('impScrapedId').value = id;
document.getElementById('impName').value = raw['Nombre Cliente'] || raw['CLIENTE'] || ""; document.getElementById('impName').value = raw['Nombre Cliente'] || raw['CLIENTE'] || "";
// CORRECCIÓN: Busca el teléfono en todas las variantes posibles (singular, plural, inglés) const rawPhone = raw['Teléfono'] || raw['TELEFONOS'] || raw['TELEFONO'] || "";
const rawPhone = raw['Teléfono'] || raw['TELEFONOS'] || raw['TELEFONO'] || raw['phone'] || "";
document.getElementById('impPhone').value = rawPhone.match(/[6789]\d{8}/)?.[0] || ""; document.getElementById('impPhone').value = rawPhone.match(/[6789]\d{8}/)?.[0] || "";
// Dirección y Población unificadas
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'] || "";
document.getElementById('impAddress').value = `${addr} ${pop}`.trim(); document.getElementById('impAddress').value = `${addr} ${pop}`.trim();
@@ -253,17 +255,13 @@
document.getElementById('impCP').value = raw['Código Postal'] || ""; document.getElementById('impCP').value = raw['Código Postal'] || "";
document.getElementById('impDesc').value = raw['Descripción'] || ""; document.getElementById('impDesc').value = raw['Descripción'] || "";
document.getElementById('impRef').value = svc.service_ref; document.getElementById('impRef').value = svc.service_ref;
// Identificar compañía correctamente
document.getElementById('impCompany').value = raw['Compañía'] || raw['COMPAÑIA'] || svc.provider.toUpperCase(); document.getElementById('impCompany').value = raw['Compañía'] || raw['COMPAÑIA'] || svc.provider.toUpperCase();
document.getElementById('impUrgent').value = (raw['Urgente'] === 'Sí' || raw['Urgente'] === 'true').toString(); document.getElementById('impUrgent').value = (raw['Urgente'] === 'Sí' || raw['Urgente'] === 'true').toString();
// Campos adicionales vacíos por defecto // Reset de campos adicionales
document.getElementById('impNotesInt').value = ""; document.getElementById('impNotesInt').value = "";
document.getElementById('impNotesExt').value = ""; document.getElementById('impNotesExt').value = "";
document.getElementById('impGuild').value = ""; document.getElementById('impGuild').value = "";
document.getElementById('impOperator').innerHTML = '<option value="">-- Automática --</option>';
document.getElementById('importModal').classList.remove('hidden'); document.getElementById('importModal').classList.remove('hidden');
lucide.createIcons(); lucide.createIcons();