Actualizar proveedores.html
This commit is contained in:
@@ -132,7 +132,7 @@
|
||||
<option value="true">🚨 MUY URGENTE</option>
|
||||
</select>
|
||||
</div>
|
||||
<button onclick="closeModal()" class="bg-slate-50 p-2 rounded-full hover:bg-red-50 hover:text-red-500 transition-all text-left">
|
||||
<button type="button" onclick="closeModal()" class="bg-slate-50 p-2 rounded-full hover:bg-red-50 hover:text-red-500 transition-all text-left">
|
||||
<i data-lucide="x" class="w-5 h-5"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -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 = `<img src="${getLogoUrl(companyName)}" class="max-w-full max-h-full object-contain">`;
|
||||
document.getElementById('displayRef').innerText = `REF: ${svc.service_ref}`;
|
||||
document.getElementById('displayCompany').innerText = companyName;
|
||||
|
||||
if (isArchived) {
|
||||
document.getElementById('modalStatusBadge').innerHTML = `<span class="text-[9px] bg-slate-100 text-slate-500 px-3 py-1 rounded-full font-black border border-slate-200"><i data-lucide="archive" class="w-2.5 h-2.5 inline mr-1"></i> ARCHIVADO</span>`;
|
||||
} else {
|
||||
document.getElementById('modalStatusBadge').innerHTML = `<span class="text-[9px] bg-emerald-50 text-emerald-600 px-3 py-1 rounded-full font-black border border-emerald-100">SERVICIO ACTIVO</span>`;
|
||||
}
|
||||
|
||||
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 = '<option value="">-- Automática --</option>';
|
||||
}
|
||||
|
||||
// --- CARGAR ESTADOS EN EL SELECTOR ---
|
||||
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;
|
||||
|
||||
// --- 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);
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user