From a800ad4b99bd3a2eb933288009b72d2b58fb79aa Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 23 Sep 2022 16:01:06 +0300 Subject: [PATCH] =?UTF-8?q?insuranceTables:=20=D0=BF=D1=83=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BF=D0=BE=D0=BA=D0=B0=20=D1=82=D0=B0=D0=BA=20=D0=B1?= =?UTF-8?q?=D1=83=D0=B4=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/tablesReactions.ts | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts index e07a5bd..24821f5 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts @@ -158,12 +158,60 @@ export default [ calculationStore.tables.tableInsurance.options?.insuranceCompany?.find( x => x.name?.includes('ПРОЧИЕ'), ); + const insuranceOtherFilter = singleValueFilter( + otherInsuranceCompany?.value, + ); calculationStore.setTableRow('tableInsurance', rows => rows.findIndex(x => x?.key === 'kasko'), )({ insuranceCompany: { value: otherInsuranceCompany?.value, status: ElementStatus.Disabled, + filter: insuranceOtherFilter, + }, + insCost: { + value: 0, + status: ElementStatus.Disabled, + }, + insTerm: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + insured: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'dgo'), + )({ + insuranceCompany: { + value: otherInsuranceCompany?.value, + status: ElementStatus.Disabled, + filter: insuranceOtherFilter, + }, + insCost: { + value: 0, + status: ElementStatus.Disabled, + }, + insTerm: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + insured: { + value: 100_000_000, + status: ElementStatus.Disabled, + }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'ns'), + )({ + insuranceCompany: { + value: otherInsuranceCompany?.value, + status: ElementStatus.Disabled, + filter: insuranceOtherFilter, }, insCost: { value: 0, @@ -179,6 +227,24 @@ export default [ }, }); } else if (leasingPeriod) { + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'kasko'), + )({ + insuranceCompany: { filter: insuranceKaskoDefaultFilter }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'dgo'), + )({ + insuranceCompany: { filter: insuranceKaskoDefaultFilter }, + }); + + calculationStore.setTableRow('tableInsurance', rows => + rows.findIndex(x => x?.key === 'ns'), + )({ + insuranceCompany: { filter: insuranceKaskoDefaultFilter }, + }); + if (leasingPeriod < 12) { calculationStore.setTableRow('tableInsurance', rows => rows.findIndex(x => x?.key === 'osago'),