diff --git a/index2.html b/index2.html index c610d19..2f690b3 100644 --- a/index2.html +++ b/index2.html @@ -301,6 +301,27 @@ let currentQuotes = []; let globalCompanyData = null; // 🛑 NUEVO: Guarda los datos para el PDF + // 🛑 NUEVO: Diccionario de logos de compañías + const companyLogos = { + 'REPSOL': 'https://cdn.sanity.io/images/rn4tswnp/production/1bc5be0207b732bd18dd0fc38e063d5701267068-1000x832.png?rect=6,0,994,832&h=320&auto=format&dpr=2', + 'MUTUA': 'https://www.google.com/s2/favicons?domain=mutua.es&sz=128', + 'ALLIANZ': 'https://www.google.com/s2/favicons?domain=allianz.es&sz=128', + 'CASER': 'https://www.google.com/s2/favicons?domain=caser.es&sz=128', + 'SEGURCAIXA': 'https://unijepol.eu/wp-content/uploads/2021/01/Segur-Caixa-Adeslas.jpg', + 'LA CAIXA': 'https://www.google.com/s2/favicons?domain=segurcaixaadeslas.es&sz=128', + 'AXA': 'https://www.google.com/s2/favicons?domain=axa.es&sz=128', + 'LDA': 'https://www.google.com/s2/favicons?domain=lineadirecta.com&sz=128', + 'LINEA DIRECTA': 'https://www.google.com/s2/favicons?domain=lineadirecta.com&sz=128', + 'HOMESERVE': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTeO7TsnpOYqLGgJm0puUyUMLi657od4mGWKQ&s', + 'RGA': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRemEVB4iYmTGoZL0nrBQJkZ1vNlDNtKfGEug&s', + 'RURAL': 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRemEVB4iYmTGoZL0nrBQJkZ1vNlDNtKfGEug&s', + 'SANTANDER': 'https://www.google.com/s2/favicons?domain=santander.com&sz=128', + 'BANSABADELL': 'https://www.google.com/s2/favicons?domain=bancsabadell.com&sz=128', + 'GENERALI': 'https://cdn.worldvectorlogo.com/logos/generali-logo.svg', + 'MAPFRE': 'https://www.google.com/s2/favicons?domain=mapfre.es&sz=128', + 'DEFAULT': 'https://cdn-icons-png.flaticon.com/512/2875/2875438.png' + }; + document.addEventListener("DOMContentLoaded", async () => { lucide.createIcons(); const urlParams = new URLSearchParams(window.location.search); @@ -984,10 +1005,44 @@ if (stNameLower.includes('esperando') || stNameLower.includes('asignado') || (hasWorker && !hasDate)) countPend++; } + // 🛑 NUEVO: Extraer la compañía y el logotipo + let compName = (raw["Compañía"] || raw["COMPAÑIA"] || raw["Aseguradora"] || raw["Cliente"] || "").toUpperCase(); + let compLogo = companyLogos['DEFAULT']; + let isPrivate = false; + + // Si no hay compañía o es particular + if (!compName || compName === "PARTICULAR" || compName === "PRIVADO") { + isPrivate = true; + compName = "PARTICULAR"; + } else { + // Buscar coincidencia en el diccionario + for (const [key, url] of Object.entries(companyLogos)) { + if (compName.includes(key)) { + compLogo = url; + break; + } + } + } + + // Si es particular, hereda el logo de tu empresa (si existe) + if (isPrivate && globalCompanyData?.logo) { + compLogo = globalCompanyData.logo; + } + // Generación de la tarjeta Blanca let cardHtml = `
+
+
+
+ +
+ ${compName} +
+ REF #${srv.service_ref} +
+