merge release/dyn-604_insurance-one-year-policies

This commit is contained in:
Chika 2021-12-09 13:03:09 +03:00
parent c00d31fa21
commit 0c347a57fc
3 changed files with 54 additions and 0 deletions

View File

@ -128,6 +128,58 @@ const customConditions: TElements<ValidationCondition> = {
'Первый платеж с учетом субсидии получается отрицательный, увеличьте первый платеж',
};
},
// TODO: temp (move to tableInsurance validation)
tbxLeasingPeriod: calculationStore => {
const { recalcWithRevision, leasingPeriod } = calculationStore.values;
const quote = calculationStore.getOption('selectQuote');
const kaskoRowIndex = calculationStore.tables.tableInsurance.rows.findIndex(
x => x.policyType?.value === 'КАСКО',
);
const kaskoValues = calculationStore.getTableRowValues(
'tableInsurance',
kaskoRowIndex,
'value',
);
const kaskoInsTerm = kaskoValues.insTerm;
if (
recalcWithRevision &&
quote?.evo_one_year_insurance &&
leasingPeriod > 16 &&
kaskoInsTerm !== 100000000
) {
calculationStore.setTableRow(
'tableInsurance',
kaskoRowIndex,
false,
)({
insTerm: {
validation: false,
},
});
return {
isValid: false,
message:
'Невозможно включить страховку на весь срок для однолетнего полиса',
};
} else {
calculationStore.setTableRow(
'tableInsurance',
kaskoRowIndex,
false,
)({
insTerm: {
validation: true,
},
});
return {
isValid: true,
};
}
},
};
const elementsValidations: TElements<any> = {

View File

@ -20,4 +20,5 @@ evo_legal_townid
link
evo_req_telematic
evo_req_telematic_accept
evo_one_year_insurance
`;

View File

@ -101,6 +101,7 @@ export interface IQuote {
evo_accept_control_addproduct_typeid?: string;
evo_req_telematic?: number;
evo_req_telematic_accept?: number;
evo_one_year_insurance?: boolean;
}
export interface IEvoGraph {