diff --git a/proveedores.html b/proveedores.html
index be8dfb7..212e64f 100644
--- a/proveedores.html
+++ b/proveedores.html
@@ -118,7 +118,7 @@
-
+
Estado Operativo
-
@@ -653,7 +653,7 @@
lucide.createIcons();
}
- async function openEditor(id) {
+ async function openEditor(id, isArchived = false) {
const svc = scrapedData.find(s => s.id === id);
if(!svc) return;
const raw = svc.raw_data;
@@ -662,7 +662,12 @@
document.getElementById('modalCompanyLogo').innerHTML = `
})
`;
document.getElementById('displayRef').innerText = `REF: ${svc.service_ref}`;
document.getElementById('displayCompany').innerText = companyName;
- document.getElementById('modalStatusBadge').innerHTML = `
SERVICIO ACTIVO`;
+
+ if (isArchived) {
+ document.getElementById('modalStatusBadge').innerHTML = `
ARCHIVADO`;
+ } else {
+ document.getElementById('modalStatusBadge').innerHTML = `
SERVICIO ACTIVO`;
+ }
document.getElementById('impScrapedId').value = id;
document.getElementById('impName').value = raw['Nombre Cliente'] || raw['CLIENTE'] || "S/N";
@@ -681,7 +686,6 @@
document.getElementById('impNotesInt').value = raw['internal_notes'] || "";
document.getElementById('impNotesExt').value = raw['client_notes'] || "";
- // 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) : "";
@@ -692,6 +696,38 @@
document.getElementById('impOperator').innerHTML = '
';
}
+ // --- CARGAR ESTADOS EN EL SELECTOR ---
+ const statusSelect = document.getElementById('impStatus');
+ statusSelect.innerHTML = '
';
+ systemStatuses.forEach(st => {
+ statusSelect.innerHTML += `
`;
+ });
+ if (raw.status_operativo) statusSelect.value = raw.status_operativo;
+
+ // --- BLOQUEAR INPUTS SI ESTÁ ARCHIVADO ---
+ const inputsToLock = ['impName', 'impPhone', 'impAddress', 'impCP', 'impDesc', 'impUrgent', 'impGuild', 'impOperator', 'impNotesExt'];
+ inputsToLock.forEach(inputId => {
+ const el = document.getElementById(inputId);
+ if (!el) return;
+
+ if (isArchived) {
+ el.setAttribute('readonly', 'true');
+ el.classList.add('bg-slate-100', 'text-slate-400', 'cursor-not-allowed');
+ if (el.tagName === 'SELECT') el.style.pointerEvents = 'none';
+ } else {
+ el.removeAttribute('readonly');
+ el.classList.remove('bg-slate-100', 'text-slate-400', 'cursor-not-allowed');
+ if (el.tagName === 'SELECT') el.style.pointerEvents = 'auto';
+ }
+ });
+
+ // Bloqueamos el botón de Traspaso Manual y Enviar a Bolsa si está archivado
+ const btnsToHide = document.querySelectorAll('button[type="submit"], button[onclick="sendToQueue()"]');
+ btnsToHide.forEach(btn => {
+ if(isArchived) btn.classList.add('hidden');
+ else btn.classList.remove('hidden');
+ });
+
document.getElementById('importModal').classList.remove('hidden');
lucide.createIcons();
}
@@ -713,7 +749,8 @@
assigned_to: document.getElementById('impOperator').value,
assigned_to_name: opName,
internal_notes: document.getElementById('impNotesInt').value,
- client_notes: document.getElementById('impNotesExt').value
+ client_notes: document.getElementById('impNotesExt').value,
+ status_operativo: document.getElementById('impStatus').value || null // <-- CAMPO NUEVO
};
}
@@ -830,6 +867,6 @@
m.innerText = msg; t.classList.remove('hidden');
setTimeout(() => t.classList.add('hidden'), 4000);
}
-
+