Actualizar index2.html
This commit is contained in:
55
index2.html
55
index2.html
@@ -301,6 +301,27 @@
|
|||||||
let currentQuotes = [];
|
let currentQuotes = [];
|
||||||
let globalCompanyData = null; // 🛑 NUEVO: Guarda los datos para el PDF
|
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 () => {
|
document.addEventListener("DOMContentLoaded", async () => {
|
||||||
lucide.createIcons();
|
lucide.createIcons();
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
@@ -984,10 +1005,44 @@
|
|||||||
if (stNameLower.includes('esperando') || stNameLower.includes('asignado') || (hasWorker && !hasDate)) countPend++;
|
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
|
// Generación de la tarjeta Blanca
|
||||||
let cardHtml = `
|
let cardHtml = `
|
||||||
<div id="service-card-${srv.id}" class="bg-white rounded-[2rem] p-6 shadow-sm border border-slate-100 relative text-left transition-all duration-500">
|
<div id="service-card-${srv.id}" class="bg-white rounded-[2rem] p-6 shadow-sm border border-slate-100 relative text-left transition-all duration-500">
|
||||||
|
|
||||||
|
<div class="flex justify-between items-center mb-5 pb-4 border-b border-slate-100">
|
||||||
|
<div class="flex items-center gap-2.5">
|
||||||
|
<div class="w-8 h-8 rounded-lg bg-slate-50 border border-slate-100 flex items-center justify-center p-1 shrink-0 overflow-hidden">
|
||||||
|
<img src="${compLogo}" class="w-full h-full object-contain">
|
||||||
|
</div>
|
||||||
|
<span class="text-xs font-black text-slate-700 uppercase tracking-widest truncate max-w-[130px]" title="${compName}">${compName}</span>
|
||||||
|
</div>
|
||||||
|
<span class="text-[10px] font-bold text-slate-400 bg-slate-50 px-2.5 py-1.5 rounded-lg border border-slate-100 tracking-widest shrink-0">REF #${srv.service_ref}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex items-start gap-4 mb-5">
|
<div class="flex items-start gap-4 mb-5">
|
||||||
<div class="w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 ${headerColor}">
|
<div class="w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 ${headerColor}">
|
||||||
<i data-lucide="${icon}" class="w-6 h-6"></i>
|
<i data-lucide="${icon}" class="w-6 h-6"></i>
|
||||||
|
|||||||
Reference in New Issue
Block a user