Actualizar automatizaciones.html
This commit is contained in:
@@ -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 @@
|
||||
<span class="text-[8px] font-black px-2 py-0.5 rounded-full border ${statusClass}">${statusLabel}</span>
|
||||
</div>
|
||||
<p class="text-xs text-slate-400 truncate italic mt-0.5">${fullAddr}</p>
|
||||
<div class="flex gap-2 mt-2">
|
||||
|
||||
<div class="flex flex-wrap gap-2 mt-2">
|
||||
<span class="text-[10px] bg-slate-100 text-slate-500 px-2 py-0.5 rounded-lg font-bold border">#${svc.service_ref}</span>
|
||||
${guildName ? `<span class="text-[10px] bg-blue-50 text-blue-600 px-2 py-0.5 rounded-lg font-bold border border-blue-100"><i data-lucide="hammer" class="w-2.5 h-2.5 inline mr-1"></i>${guildName}</span>` : ''}
|
||||
${opName ? `<span class="text-[10px] bg-purple-50 text-purple-600 px-2 py-0.5 rounded-lg font-bold border border-purple-100"><i data-lucide="user" class="w-2.5 h-2.5 inline mr-1"></i>${opName}</span>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 text-left">
|
||||
${!isArchived ? `
|
||||
<div class="hidden group-hover:flex items-center gap-1 pr-4 border-r mr-2 transition-all">
|
||||
<div class="hidden group-hover:flex items-center gap-2 pr-4 transition-all">
|
||||
<a href="https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(fullAddr)}" target="_blank" class="action-btn p-2.5 rounded-xl bg-slate-50 text-slate-400 hover:text-blue-600 shadow-sm"><i data-lucide="map"></i></a>
|
||||
${phone ? `<a href="https://wa.me/34${phone}" target="_blank" class="action-btn p-2.5 rounded-xl bg-slate-50 text-slate-400 hover:text-emerald-600 shadow-sm"><i data-lucide="message-square"></i></a>` : ''}
|
||||
</div>
|
||||
<div class="bg-blue-600 text-white p-4 rounded-2xl shadow-lg group-hover:scale-105 transition-all"><i data-lucide="chevron-right" class="w-6 h-6"></i></div>` : ''}
|
||||
</div>` : ''}
|
||||
</div>`;
|
||||
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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user