From 56959e491baadd4cc86f42c4cdbb9e9ebf0a9ea7 Mon Sep 17 00:00:00 2001 From: Chika Date: Thu, 21 Apr 2022 17:04:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B5=D1=81=D0=BB=D0=B8=20=D0=B2=20=D0=A1?= =?UTF-8?q?=D0=9A=20=D0=9E=D0=A1=D0=90=D0=93=D0=9E=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=20evo=5Fosago=5Fwith=5Fkasko=3DTrue=20=D0=98=20=D0=A1?= =?UTF-8?q?=D0=9A=20=D0=9E=D0=A1=D0=90=D0=93=D0=9E=20!=3D=20=D0=A1=D0=9A?= =?UTF-8?q?=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E,=20=D1=82=D0=BE=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B2=D0=B5=D1=81=D1=82=D0=B8=20=D0=B8=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BA=D1=83:=20"=D0=9D=D0=B5=D0=B2=D0=BE=D0=B7?= =?UTF-8?q?=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=20=D1=81=D1=82=D1=80=D0=B0=D1=85?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=9E=D0=A1=D0=90=D0=93?= =?UTF-8?q?=D0=9E=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BE=D1=82=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E=20-=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D1=85=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BE=D0=BB=D0=B6?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B1=D1=8B=D1=82=D1=8C=20=D0=BE=D0=B4=D0=BD?= =?UTF-8?q?=D0=B0!",=20=D0=B8=D0=BD=D0=B0=D1=87=D0=B5=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=20=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/calculate/validate/tables.ts | 35 +++++++++++++++++++ .../query/options/insurance_options.graphql | 1 + .../services/CrmService/types/entities.ts | 1 + 3 files changed, 37 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts index 3255687..182458b 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/tables.ts @@ -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) { diff --git a/src/core/services/CrmService/graphql/query/options/insurance_options.graphql b/src/core/services/CrmService/graphql/query/options/insurance_options.graphql index a671cff..7058f20 100644 --- a/src/core/services/CrmService/graphql/query/options/insurance_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/insurance_options.graphql @@ -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 } } diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index cf8ebcc..0088a43 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -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 {