feature/filtro-pedimentos-tipo-invoices
This commit is contained in:
@@ -31,6 +31,11 @@
|
||||
const selectedPedimento = pedimentos.find((p) => p.id === parseInt(pedimentoId));
|
||||
if (!selectedPedimento) return;
|
||||
|
||||
// Si el tipo de operación está vacío, llenarlo con el del pedimento
|
||||
if (selectedPedimento.operation_type && !formData.operation_type) {
|
||||
formData.operation_type = selectedPedimento.operation_type;
|
||||
}
|
||||
|
||||
// Actualizar los campos del pedimento en formData
|
||||
formData.fecha_pedimento_del = selectedPedimento.pedimento_dates?.start_date || '';
|
||||
formData.fecha_pedimento_al = selectedPedimento.pedimento_dates?.end_date || '';
|
||||
@@ -121,6 +126,24 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Limpiar pedimento seleccionado si ya no está en la lista filtrada (p. ej. al cambiar tipo de factura)
|
||||
$effect(() => {
|
||||
const pid = formData?.pedimento_id;
|
||||
const list = pedimentos || [];
|
||||
if (pid == null || pid === '') return;
|
||||
const id = typeof pid === 'string' ? parseInt(pid, 10) : pid;
|
||||
if (Number.isNaN(id)) return;
|
||||
const found = list.some((p) => p.id === id);
|
||||
if (!found) {
|
||||
formData.pedimento_id = null;
|
||||
formData.pedimento = '';
|
||||
formData.fecha_pedimento_del = '';
|
||||
formData.fecha_pedimento_al = '';
|
||||
formData.clave_pedimento = '';
|
||||
formData.regimen_pedimento = '';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Datos Principales en una fila compacta (reusable across tabs) -->
|
||||
|
||||
Reference in New Issue
Block a user