fix: validation leaseObjectMotorPower evo_id !== '8'

This commit is contained in:
vchikalkin 2023-05-25 13:42:12 +03:00
parent 862e1293d3
commit 9454d9e2b2

View File

@ -88,14 +88,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
});
}
if (!leaseObjectMotorPower) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле ' + titles.tbxLeaseObjectMotorPower,
path: ['eltKasko', 'eltOsago'],
});
}
if (!leaseObjectUseFor) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
@ -114,6 +106,14 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
},
});
if (evo_leasingobject_type?.evo_id !== '8' && !leaseObjectMotorPower) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле ' + titles.tbxLeaseObjectMotorPower,
path: ['eltKasko', 'eltOsago'],
});
}
// Проверяем на мотоцикл
if (evo_leasingobject_type?.evo_id && ['11'].includes(evo_leasingobject_type?.evo_id)) {
ctx.addIssue({