diff --git a/proveedores.html b/proveedores.html
index 212e64f..4956754 100644
--- a/proveedores.html
+++ b/proveedores.html
@@ -704,22 +704,72 @@
});
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;
+ // --- 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
+ const descNotesSection = document.getElementById('impDesc').closest('.space-y-3'); // El bloque de avería y notas
+ const phoneSection = document.getElementById('impPhone').closest('.bg-slate-50\\/50'); // El campo de teléfono
+
+ // Bloquear los inputs que se quedan visibles para que no se editen por error
+ const inputsToLock = ['impName', 'impAddress', 'impCP', 'impUrgent'];
+
+ if (isArchived) {
+ // Ocultar lo innecesario
+ if(guildOperatorSection) guildOperatorSection.classList.add('hidden');
+ if(descNotesSection) descNotesSection.classList.add('hidden');
+ if(phoneSection) phoneSection.classList.add('hidden');
- 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';
+ // Hacer que el campo de nombre ocupe toda la línea (ya que quitamos el teléfono)
+ const nameContainer = document.getElementById('impName').closest('.grid');
+ if(nameContainer) {
+ nameContainer.classList.remove('md:grid-cols-2');
+ nameContainer.classList.add('grid-cols-1');
}
- });
+
+ // Bloquear los campos visibles (excepto el estado)
+ inputsToLock.forEach(inputId => {
+ const el = document.getElementById(inputId);
+ if (el) {
+ el.setAttribute('readonly', 'true');
+ el.classList.add('bg-transparent', 'text-slate-500', 'cursor-not-allowed');
+ if (el.tagName === 'SELECT') el.style.pointerEvents = 'none';
+ }
+ });
+
+ // Ajustar visualmente el modal para que no parezca un formulario
+ document.getElementById('impAddress').classList.remove('border-2', 'bg-white', 'shadow-sm');
+ document.getElementById('impAddress').classList.add('border-0', 'bg-slate-50/50', 'text-slate-500');
+ document.getElementById('impCP').classList.remove('border-2', 'bg-white', 'shadow-sm');
+ document.getElementById('impCP').classList.add('border-0', 'bg-slate-50/50', 'text-slate-500');
+
+ } else {
+ // Restaurar todo a la vista normal
+ if(guildOperatorSection) guildOperatorSection.classList.remove('hidden');
+ if(descNotesSection) descNotesSection.classList.remove('hidden');
+ if(phoneSection) phoneSection.classList.remove('hidden');
+
+ const nameContainer = document.getElementById('impName').closest('.grid');
+ if(nameContainer) {
+ nameContainer.classList.add('md:grid-cols-2');
+ nameContainer.classList.remove('grid-cols-1');
+ }
+
+ // Desbloquear campos
+ inputsToLock.forEach(inputId => {
+ const el = document.getElementById(inputId);
+ if (el) {
+ el.removeAttribute('readonly');
+ el.classList.remove('bg-transparent', 'text-slate-500', 'cursor-not-allowed');
+ if (el.tagName === 'SELECT') el.style.pointerEvents = 'auto';
+ }
+ });
+
+ // Restaurar estilos del formulario
+ document.getElementById('impAddress').classList.add('border-2', 'bg-white', 'shadow-sm');
+ document.getElementById('impAddress').classList.remove('border-0', 'bg-slate-50/50', 'text-slate-500');
+ document.getElementById('impCP').classList.add('border-2', 'bg-white', 'shadow-sm');
+ document.getElementById('impCP').classList.remove('border-0', 'bg-slate-50/50', 'text-slate-500');
+ }
// Bloqueamos el botón de Traspaso Manual y Enviar a Bolsa si está archivado
const btnsToHide = document.querySelectorAll('button[type="submit"], button[onclick="sendToQueue()"]');
@@ -728,6 +778,12 @@
else btn.classList.remove('hidden');
});
+ // Cambiar el texto del botón de Guardar si es archivado para que sea más intuitivo
+ const saveBtn = document.querySelector('button[onclick="saveDraftChanges(event)"] span');
+ if (saveBtn) {
+ saveBtn.innerText = isArchived ? "Actualizar Estado" : "Guardar";
+ }
+
document.getElementById('importModal').classList.remove('hidden');
lucide.createIcons();
}