Actualizar proveedores.html
This commit is contained in:
@@ -303,7 +303,6 @@
|
||||
} catch (e) { console.error("Error en loadInbox:", e); }
|
||||
}
|
||||
|
||||
// ====== 🔥 DETECCIÓN DE URGENCIA Y GREMIO AÑADIDA AQUÍ ======
|
||||
function buildServiceCard(svc) {
|
||||
const raw = svc.raw_data || {};
|
||||
const isArchived = svc.status === 'archived';
|
||||
@@ -314,8 +313,14 @@
|
||||
const fullAddr = `${addr} ${pop}`.trim();
|
||||
const phone = (raw['Teléfono'] || raw['TELEFONOS'] || raw['TELEFONO'] || "").match(/[6789]\d{8}/)?.[0] || "";
|
||||
|
||||
// CORRECCIÓN: Ahora lee el guild_id del JSON interno asegurándose de que lo coja en cualquier caso.
|
||||
const guildName = allGuilds.find(g => g.id == (svc.guild_id || raw['guild_id'] || raw.guild_id))?.name || null;
|
||||
// CORRECCIÓN BLINDADA DEL GREMIO
|
||||
let guildName = null;
|
||||
const rawGuildId = svc.guild_id || raw['guild_id'] || raw.guild_id;
|
||||
|
||||
if (rawGuildId) {
|
||||
const foundGuild = allGuilds.find(g => String(g.id) === String(rawGuildId));
|
||||
if (foundGuild) guildName = foundGuild.name;
|
||||
}
|
||||
|
||||
const opName = raw['assigned_to_name'] || null;
|
||||
|
||||
@@ -328,7 +333,6 @@
|
||||
const sysStatus = (svc.status || '').toLowerCase();
|
||||
const linkedStatus = (raw['estado'] || raw['status'] || '').toLowerCase();
|
||||
|
||||
// DETECCIÓN DE URGENCIA (Ya sea por la BD o por el raw_data)
|
||||
const isUrgent = svc.is_urgent === true || (raw['Urgente'] && raw['Urgente'].toLowerCase() === 'sí') || (raw['URGENTE'] && raw['URGENTE'].toLowerCase() === 'si');
|
||||
const urgentBadge = isUrgent ? `<span class="bg-red-500 text-white px-2 py-0.5 rounded-md text-[9px] font-black uppercase shadow-sm animate-pulse ml-3">🔥 Urgente</span>` : '';
|
||||
|
||||
@@ -535,12 +539,12 @@
|
||||
document.getElementById('impNotesInt').value = raw['internal_notes'] || "";
|
||||
document.getElementById('impNotesExt').value = raw['client_notes'] || "";
|
||||
|
||||
// CORRECCIÓN: Ahora lee el guild_id del JSON interno asegurándose de que lo coja en cualquier caso para rellenar el desplegable.
|
||||
const savedGuild = svc.guild_id || raw['guild_id'] || raw.guild_id || "";
|
||||
document.getElementById('impGuild').value = savedGuild;
|
||||
// CORRECCIÓN BLINDADA DEL SELECTOR DE GREMIOS
|
||||
const rawGuildId = svc.guild_id || raw['guild_id'] || raw.guild_id;
|
||||
document.getElementById('impGuild').value = rawGuildId ? String(rawGuildId) : "";
|
||||
|
||||
if(savedGuild) {
|
||||
await loadOpsForGuild(savedGuild);
|
||||
if(rawGuildId) {
|
||||
await loadOpsForGuild(rawGuildId);
|
||||
document.getElementById('impOperator').value = raw['assigned_to'] || "";
|
||||
} else {
|
||||
document.getElementById('impOperator').innerHTML = '<option value="">-- Automática --</option>';
|
||||
|
||||
Reference in New Issue
Block a user