если в СК ОСАГО поле evo_osago_with_kasko=True И СК ОСАГО != СК КАСКО, то вывести и ошибку: "Невозможно страхование ОСАГО отдельно от КАСКО -

страховая компания должна быть одна!", иначе все ок
This commit is contained in:
Chika 2022-04-21 17:04:31 +03:00
parent 6f804f15cc
commit 56959e491b
3 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import { openNotification } from 'client/Elements/Notification';
import valuesConstants from 'core/constants/values';
import { shiftRight } from 'core/tools/array';
import { ICalculationStore } from 'core/types/Calculation/Store';
@ -36,6 +37,40 @@ function validateInsuranceTable(this: ICalculationStore) {
validation: !isNil(kaskoRow.insured),
},
});
/**
* если в СК ОСАГО поле evo_osago_with_kasko=True И СК ОСАГО != СК КАСКО,
* то вывести и ошибку: "Невозможно страхование ОСАГО отдельно от КАСКО -
* страховая компания должна быть одна!", иначе все ок
*/
const osagoInsuranceCompanyOption =
this.tables?.tableInsurance?.options?.insuranceCompany?.find(
x => x.accountid === osagoRow.insuranceCompany,
);
const invalid =
osagoInsuranceCompanyOption?.evo_osago_with_kasko &&
osagoRow.insuranceCompany !== kaskoRow.insuranceCompany;
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,
},
});
}
function validatePaymentsTable(this: ICalculationStore) {

View File

@ -11,5 +11,6 @@ query GetInsuranceOptions($evo_account_type: [Int!], $statecode: Int) {
evo_id_elt_osago
evo_legal_region_calc
evo_inn
evo_osago_with_kasko
}
}

View File

@ -60,6 +60,7 @@ export interface IAccount extends BaseEntity {
evo_id_elt?: string;
evo_id_elt_osago?: string;
evo_legal_region_calc?: boolean;
evo_osago_with_kasko?: boolean;
}
export interface ISalonProvider extends IAccount {