Actualizar automatizaciones.html
This commit is contained in:
@@ -217,13 +217,24 @@
|
|||||||
|
|
||||||
// SINCRONIZACIÓN DE TODOS LOS IDS DEL FORMULARIO
|
// SINCRONIZACIÓN DE TODOS LOS IDS DEL FORMULARIO
|
||||||
document.getElementById('impScrapedId').value = id;
|
document.getElementById('impScrapedId').value = id;
|
||||||
document.getElementById('impName').value = raw['Nombre Cliente'] || "";
|
document.getElementById('impName').value = raw['Nombre Cliente'] || raw['CLIENTE'] || "";
|
||||||
document.getElementById('impPhone').value = (raw['Teléfono'] || "").match(/[6789]\d{8}/)?.[0] || "";
|
|
||||||
document.getElementById('impAddress').value = `${raw['Dirección'] || ""} ${raw['Población'] || ""}`.trim();
|
// CORRECCIÓN: Busca el teléfono en todas las variantes posibles (singular, plural, inglés)
|
||||||
|
const rawPhone = raw['Teléfono'] || raw['TELEFONOS'] || raw['TELEFONO'] || raw['phone'] || "";
|
||||||
|
document.getElementById('impPhone').value = rawPhone.match(/[6789]\d{8}/)?.[0] || "";
|
||||||
|
|
||||||
|
// Dirección y Población unificadas
|
||||||
|
const addr = raw['Dirección'] || raw['DOMICILIO'] || "";
|
||||||
|
const pop = raw['Población'] || raw['POBLACION-PROVINCIA'] || "";
|
||||||
|
document.getElementById('impAddress').value = `${addr} ${pop}`.trim();
|
||||||
|
|
||||||
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;
|
||||||
document.getElementById('impCompany').value = raw['Compañía'] || svc.provider.toUpperCase();
|
|
||||||
|
// Identificar compañía correctamente
|
||||||
|
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
|
// Campos adicionales vacíos por defecto
|
||||||
|
|||||||
Reference in New Issue
Block a user