если Тип предмета лизинга leaseObjectType= Легковой автомобиль (ID=1) И "Первый платеж" firstPaymentPerc < 25 И "PlPrice" больше 20 000 000 и "Плательщик КАСКО" insuredKASKO = ЛД 100 000 001, то ошибка "При дорогом авто и авансе меньше 25% нельзя включать КАСКО в график"
This commit is contained in:
parent
c3854c8194
commit
eba2589077
@ -11,10 +11,13 @@ import { z } from 'zod';
|
||||
export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
return ValuesSchema.pick({
|
||||
brand: true,
|
||||
firstPaymentPerc: true,
|
||||
insDecentral: true,
|
||||
leaseObjectType: true,
|
||||
leasingPeriod: true,
|
||||
leasingWithoutKasko: true,
|
||||
partialVAT: true,
|
||||
plPriceRub: true,
|
||||
product: true,
|
||||
quote: true,
|
||||
recalcWithRevision: true,
|
||||
@ -37,6 +40,9 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
fingap: fingapRisks,
|
||||
partialVAT,
|
||||
product: productId,
|
||||
leaseObjectType: leaseObjectTypeId,
|
||||
firstPaymentPerc,
|
||||
plPriceRub,
|
||||
},
|
||||
ctx
|
||||
) => {
|
||||
@ -234,6 +240,30 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
path: ['cbxPartialVAT'],
|
||||
});
|
||||
}
|
||||
|
||||
let evo_leasingobject_type: CRMTypes.GetLeaseObjectTypeQuery['evo_leasingobject_type'] =
|
||||
null;
|
||||
|
||||
if (leaseObjectTypeId) {
|
||||
const { data } = await apolloClient.query({
|
||||
query: CRMTypes.GetLeaseObjectTypeDocument,
|
||||
variables: { leaseObjectTypeId },
|
||||
});
|
||||
({ evo_leasingobject_type } = data);
|
||||
}
|
||||
|
||||
if (
|
||||
evo_leasingobject_type?.evo_id === '1' &&
|
||||
firstPaymentPerc < 25 &&
|
||||
plPriceRub > 20_000_000 &&
|
||||
insurance.values.kasko.insured === 100_000_001
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'При дорогом авто и авансе меньше 25% нельзя включать КАСКО в график',
|
||||
path: ['tbxLeaseObjectPrice'],
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user