This commit is contained in:
2025-06-09 08:50:28 -06:00
3 changed files with 88 additions and 72 deletions

View File

@@ -233,7 +233,7 @@
<!-- Activo -->
<div class="form-check mb-4">
<input id="status" name="status" type="checkbox" class="hide form-check-input" <?= $factura['status']==1?'checked':'' ?>>
<input id="status" value=1 name="status" type="checkbox" class="hide form-check-input" <?= $factura['status']==1?'checked':'' ?>>
<label for="status" class="hide form-check-label">Activo</label>
</div>
@@ -269,6 +269,7 @@
// ✅ 2. FUNCIÓN PARA CARGAR PROVEEDORES (CON PROMESA)
function cargarProveedores() {
const proveedorEl = document.getElementById('proveedor_id');
// Obtenemos la cadena con la ID del proveedor guardado
const proveedorActual = '<?= htmlspecialchars($proveedor_clave_actual ?? '') ?>';
return fetch('/IMPORTADORES/solicitud_importacion/ajax_proveedores')
@@ -287,8 +288,8 @@
opt.value = item.id;
opt.textContent = item.text;
// ✅ Pre-seleccionar si coincide con el proveedor actual
if (item.id === proveedorActual && proveedorActual !== '') {
// Comparar forzando a cadena para que coincida con proveedorActual
if (String(item.id) === proveedorActual && proveedorActual !== '') {
opt.selected = true;
}
@@ -395,4 +396,4 @@
</script>
</body>
</html>
</html>