diff --git a/automatizaciones.html b/automatizaciones.html index bc59303..dc7137b 100644 --- a/automatizaciones.html +++ b/automatizaciones.html @@ -235,6 +235,11 @@ const pop = raw['Población'] || raw['POBLACION-PROVINCIA'] || ""; const fullAddr = `${addr} ${pop}`.trim(); const phone = (raw['Teléfono'] || raw['TELEFONOS'] || raw['TELEFONO'] || "").match(/[6789]\d{8}/)?.[0] || ""; + + // --- OBTENER NOMBRES DE GREMIO Y OPERARIO (SI EXISTEN EN EL BORRADOR) --- + const guildName = allGuilds.find(g => g.id == raw['guild_id'])?.name || null; + const opName = raw['assigned_to_name'] || null; + 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.onclick = (e) => { @@ -257,18 +262,20 @@ ${statusLabel}

${fullAddr}

-
+ +
#${svc.service_ref} + ${guildName ? `${guildName}` : ''} + ${opName ? `${opName}` : ''}
${!isArchived ? ` - ` : ''}
`; container.appendChild(card); }); @@ -325,6 +332,10 @@ const id = document.getElementById('impScrapedId').value; const btn = e.currentTarget; btn.disabled = true; + + // --- OBTENER NOMBRE DEL OPERARIO SELECCIONADO PARA MOSTRAR EN LA TARJETA --- + const opSelect = document.getElementById('impOperator'); + const opName = opSelect.options[opSelect.selectedIndex]?.text.includes('--') ? null : opSelect.options[opSelect.selectedIndex]?.text; const payload = { name: document.getElementById('impName').value, @@ -336,6 +347,7 @@ // --- CAMPOS CORREGIDOS PARA EL GUARDADO --- guild_id: document.getElementById('impGuild').value, assigned_to: document.getElementById('impOperator').value, + assigned_to_name: opName, internal_notes: document.getElementById('impNotesInt').value, client_notes: document.getElementById('impNotesExt').value };