validaton: починили проверку ОСАГО и КАСКО
This commit is contained in:
parent
d16936cac3
commit
d858e0eaad
@ -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,25 +30,52 @@ function validateInsuranceTable(this: ICalculationStore) {
|
||||
const invalid =
|
||||
osagoInsuranceCompanyOption?.evo_osago_with_kasko &&
|
||||
osagoRow.insuranceCompany !== kaskoRow.insuranceCompany;
|
||||
if (invalid)
|
||||
if (invalid) {
|
||||
openNotification({
|
||||
type: 'error',
|
||||
message: 'Ошибка',
|
||||
description:
|
||||
'Невозможно страхование ОСАГО отдельно от КАСКО - страховая компания должна быть одна!',
|
||||
});
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'osago'),
|
||||
)({
|
||||
insuranceCompany: {
|
||||
validation: !invalid,
|
||||
},
|
||||
});
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'kasko'),
|
||||
)({
|
||||
insuranceCompany: {
|
||||
validation: !invalid,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка на заполнение ОСАГО и КАСКО
|
||||
*/
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'osago'),
|
||||
)({
|
||||
insuranceCompany: {
|
||||
validation: !invalid,
|
||||
validation: !isNil(osagoRow.insuranceCompany),
|
||||
},
|
||||
insured: {
|
||||
validation: !isNil(osagoRow.insured),
|
||||
},
|
||||
});
|
||||
|
||||
this.setTableRow('tableInsurance', rows =>
|
||||
rows.findIndex(x => x?.key === 'kasko'),
|
||||
)({
|
||||
insuranceCompany: {
|
||||
validation: !invalid,
|
||||
validation: !isNil(kaskoRow.insuranceCompany),
|
||||
},
|
||||
insured: {
|
||||
validation: !isNil(kaskoRow.insured),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user