From 2905a0bcf26f985416cd1d0c84a9685fde47ed35 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 5 Apr 2021 17:34:44 +0300 Subject: [PATCH] reset insuranceCompany only after trailer --- .../Effects/reactions/tablesReactions.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts index 34101f4..8cec4ee 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts @@ -786,10 +786,11 @@ export default [ const { leaseObjectCategory } = calculationStore.values; return leaseObjectCategory; }, - effect: leaseObjectCategory => { - const isTrailer = leaseObjectCategory === 100000004; + effect: (nextLeaseObjectCategory, prevLeaseObjectCategory) => { + const nextIsTrailer = nextLeaseObjectCategory === 100000004; + const prevIsTrailer = prevLeaseObjectCategory === 100000004; - if (isTrailer) { + if (nextIsTrailer) { const otherInsuranceCompany = calculationStore.tables.tableInsurance.options?.insuranceCompany?.find( x => x.name?.includes('ПРОЧИЕ'), ); @@ -825,7 +826,7 @@ export default [ )({ insuranceCompany: { filter: insuranceOsagoDefaultFilter, - value: null, + value: prevIsTrailer ? null : undefined, status: ElementStatus.Default, }, insCost: {