Merge pull request 'Mejoramiento de los errores en vehiculos' (#396) from fix/vehiculos into development
Reviewed-on: ADUANASOFT/anexo76#396
This commit is contained in:
@@ -196,6 +196,10 @@
|
||||
throw new Error(tv('vehicle_key_required'));
|
||||
}
|
||||
|
||||
if (!isEdit && !formData.entity_code) {
|
||||
throw new Error('El Código de Entidad es obligatorio para nuevos vehículos');
|
||||
}
|
||||
|
||||
let response;
|
||||
if (isEdit && item) {
|
||||
response = await vehiclesApi.update(item.vehicle_key, formData, companyId);
|
||||
@@ -204,9 +208,9 @@
|
||||
}
|
||||
|
||||
if (response.error) {
|
||||
const ve = (response as { validationErrors?: { msg?: string }[] }).validationErrors;
|
||||
const ve = response.validationErrors;
|
||||
if (ve?.length) {
|
||||
throw new Error(ve.map((e) => e.msg).join(' · '));
|
||||
throw new Error(ve.map((e) => e.message).join(' · '));
|
||||
}
|
||||
throw new Error(response.error);
|
||||
}
|
||||
@@ -372,7 +376,7 @@
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="entity_code">{tv('label_entity_code')}</Label>
|
||||
<Label for="entity_code">{tv('label_entity_code')} <span class="text-destructive">*</span></Label>
|
||||
<Select.Root type="single" bind:value={formData.entity_code}>
|
||||
<Select.Trigger class="w-full" id="entity_code">
|
||||
{ENTITY_OPTS.find((o) => o.value === (formData.entity_code || ''))?.label ??
|
||||
|
||||
Reference in New Issue
Block a user