diff --git a/proveedores.html b/proveedores.html index a372a5d..a8ffb73 100644 --- a/proveedores.html +++ b/proveedores.html @@ -303,7 +303,7 @@ } catch (e) { console.error("Error en loadInbox:", e); } } - // ====== 🔥 DETECCIÓN DE URGENCIA AÑADIDA AQUÍ ====== + // ====== 🔥 DETECCIÓN DE URGENCIA Y GREMIO AÑADIDA AQUÍ ====== function buildServiceCard(svc) { const raw = svc.raw_data || {}; const isArchived = svc.status === 'archived'; @@ -313,7 +313,10 @@ 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] || ""; - const guildName = allGuilds.find(g => g.id == (svc.guild_id || raw['guild_id'] || raw.guild_id))?.name || null; + + // 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; + const opName = raw['assigned_to_name'] || null; let badgeEstado = ''; @@ -532,7 +535,8 @@ document.getElementById('impNotesInt').value = raw['internal_notes'] || ""; document.getElementById('impNotesExt').value = raw['client_notes'] || ""; - const savedGuild = raw['guild_id'] || ""; + // 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; if(savedGuild) {