This commit is contained in:
vchikalkin 2022-04-25 15:22:27 +03:00
commit 5429791bbf
2 changed files with 31 additions and 24 deletions

View File

@ -76,7 +76,7 @@ const elementsProps: Partial<Record<AllElementsNames, ElementProps>> = {
},
tbxLastPaymentPerc: {
min: '0',
max: '15',
max: '70',
step: '1.000000',
precision: 6,
formatter: formatNumber,

View File

@ -11,32 +11,12 @@ function validateInsuranceTable(this: ICalculationStore) {
rows => rows.findIndex(x => x?.key === 'osago'),
'value',
);
this.setTableRow('tableInsurance', rows =>
rows.findIndex(x => x?.key === 'osago'),
)({
insuranceCompany: {
validation: !isNil(osagoRow.insuranceCompany),
},
insured: {
validation: !isNil(osagoRow.insured),
},
});
const kaskoRow = this.getTableRowValues(
'tableInsurance',
rows => rows.findIndex(x => x?.key === 'kasko'),
'value',
);
this.setTableRow('tableInsurance', rows =>
rows.findIndex(x => x?.key === 'kasko'),
)({
insuranceCompany: {
validation: !isNil(kaskoRow.insuranceCompany),
},
insured: {
validation: !isNil(kaskoRow.insured),
},
});
/**
* если в СК ОСАГО поле evo_osago_with_kasko=True И СК ОСАГО != СК КАСКО,
@ -50,7 +30,7 @@ function validateInsuranceTable(this: ICalculationStore) {
const invalid =
osagoInsuranceCompanyOption?.evo_osago_with_kasko &&
osagoRow.insuranceCompany !== kaskoRow.insuranceCompany;
if (invalid)
if (invalid) {
openNotification({
type: 'error',
message: 'Ошибка',
@ -71,6 +51,33 @@ function validateInsuranceTable(this: ICalculationStore) {
validation: !invalid,
},
});
return;
}
/**
* Проверка на заполнение ОСАГО и КАСКО
*/
this.setTableRow('tableInsurance', rows =>
rows.findIndex(x => x?.key === 'osago'),
)({
insuranceCompany: {
validation: !isNil(osagoRow.insuranceCompany),
},
insured: {
validation: !isNil(osagoRow.insured),
},
});
this.setTableRow('tableInsurance', rows =>
rows.findIndex(x => x?.key === 'kasko'),
)({
insuranceCompany: {
validation: !isNil(kaskoRow.insuranceCompany),
},
insured: {
validation: !isNil(kaskoRow.insured),
},
});
}
function validatePaymentsTable(this: ICalculationStore) {