Actualizar proveedores.html

This commit is contained in:
2026-03-14 16:44:17 +00:00
parent c7391dfc94
commit b20a537aed

View File

@@ -749,13 +749,19 @@
}
// --- CARGAR ESTADOS EN EL SELECTOR ---
filterStatusOptions(); // Ejecutamos el filtro inicial
const statusSelect = document.getElementById('impStatus');
statusSelect.innerHTML = '<option value="">(Sin Estado)</option>';
systemStatuses.forEach(st => {
statusSelect.innerHTML += `<option value="${st.id}">${st.name.toUpperCase()}</option>`;
});
if (raw.status_operativo) statusSelect.value = raw.status_operativo;
// Si el JSON traía un estado previo, intentamos fijarlo (solo si es válido en el filtro)
if (raw.status_operativo && Array.from(statusSelect.options).some(opt => opt.value === String(raw.status_operativo))) {
statusSelect.value = raw.status_operativo;
}
// Añadimos un "chivato" para que si eligen a un operario a mano, se desbloqueen los estados al instante
const opSelect = document.getElementById('impOperator');
opSelect.removeEventListener('change', filterStatusOptions); // Limpiar previo por si acaso
opSelect.addEventListener('change', filterStatusOptions);
// --- ADAPTACIÓN VISUAL PARA ARCHIVADOS (VISTA BREVE) ---
// Obtenemos los contenedores que queremos ocultar cuando esté archivado
const guildOperatorSection = document.getElementById('impGuild').closest('.grid'); // El bloque azul de gremio/operario