Если Плавающая ставка = Да и Лизинг без КАСКО содержит данные,
то выводить сообщение "При плавающей ставке нельзя оформлять Лизинг без КАСКО"
This commit is contained in:
parent
65db1c0536
commit
8bdbbaab51
@ -1,3 +1,4 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
import type { ValidationContext } from '../types';
|
||||
import elementsProps from '@/Components/Calculation/config/elements-props';
|
||||
import { getElementName } from '@/Components/Calculation/config/map/values';
|
||||
@ -24,6 +25,7 @@ const Schema = ValuesSchema.pick({
|
||||
finDepartmentRewardSumm: true,
|
||||
firstPaymentPerc: true,
|
||||
firstPaymentRub: true,
|
||||
floatingRate: true,
|
||||
importProgramSum: true,
|
||||
importerRewardPerc: true,
|
||||
importerRewardRub: true,
|
||||
@ -38,6 +40,7 @@ const Schema = ValuesSchema.pick({
|
||||
leaseObjectPriceWthtVAT: true,
|
||||
leaseObjectYear: true,
|
||||
leasingPeriod: true,
|
||||
leasingWithoutKasko: true,
|
||||
maxMass: true,
|
||||
maxPriceChange: true,
|
||||
maxSpeed: true,
|
||||
@ -93,6 +96,19 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Если Плавающая ставка = Да и Лизинг без КАСКО содержит данные,
|
||||
* то выводить сообщение "При плавающей ставке нельзя оформлять Лизинг без КАСКО"
|
||||
*/
|
||||
const { floatingRate, leasingWithoutKasko } = values;
|
||||
if (floatingRate && leasingWithoutKasko) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'При плавающей ставке нельзя оформлять Лизинг без КАСКО',
|
||||
path: ['selectLeasingWithoutKasko'],
|
||||
});
|
||||
}
|
||||
|
||||
(Object.keys(values) as Values[]).forEach((valueName) => {
|
||||
const elementName = getElementName(valueName);
|
||||
if (elementName) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user