Validaciones para tipos de cambio

This commit is contained in:
2026-03-04 08:09:11 -06:00
parent 973298ccd9
commit 00004affe9
3 changed files with 47 additions and 1 deletions

View File

@@ -119,7 +119,14 @@
const companyId = companyStore.activeCompany?.id;
if (!companyId) throw new Error('No hay una compañía seleccionada');
if (!formData.date) throw new Error('La fecha es requerida');
if (formData.value === null) throw new Error('El valor es requerido');
if (
formData.value === null ||
formData.value === undefined ||
String(formData.value).trim() === ''
)
throw new Error('El tipo de cambio es requerido');
if (Number(formData.value) <= 0)
throw new Error('El tipo de cambio debe ser un valor mayor a 0');
showConfirmation = true;
} catch (e) {

View File

@@ -181,6 +181,20 @@
return;
}
// Validar tipo de cambio
if (
formData.exchange_rate === null ||
formData.exchange_rate === undefined ||
String(formData.exchange_rate).trim() === ''
) {
error = 'El tipo de cambio es requerido (pestaña Financieros)';
return;
}
if (Number(formData.exchange_rate) <= 0) {
error = 'El tipo de cambio debe ser mayor a 0 (pestaña Financieros)';
return;
}
loading = true;
error = null;