From 7a3315df838a62b38f2a1f0da3d2fd744037e4b0 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 31 Oct 2022 14:25:51 +0300 Subject: [PATCH] =?UTF-8?q?loadKP:=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D0=B8=20selectRegionRegistration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Effects/reactions/loadKpReaction/index.ts | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts index cb7fb30..37448af 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts @@ -4,7 +4,7 @@ import { resetIns } from 'client/Containers/Calculation/Components/ELT/lib/reset import { numberElementsProps } from 'client/Containers/Calculation/Elements/props/common'; import { getTitle, - getValueName + getValueName, } from 'client/Containers/Calculation/Elements/tools'; import { ElementsNames } from 'client/Containers/Calculation/types/elements'; import { openNotification } from 'client/Elements/Notification'; @@ -14,7 +14,7 @@ import { mainOptionsForQuoteQuery, quoteQuery, secondaryOptionsForQuoteQuery, - singleOptionsForQuoteQuery + singleOptionsForQuoteQuery, } from 'core/services/CrmService/graphql/query/quote'; import { TOptionizedEntity } from 'core/services/CrmService/types/common'; import { @@ -23,7 +23,7 @@ import { IEvoGraph, IEvoRewardCondition, IEvoTown, - IQuote + IQuote, } from 'core/services/CrmService/types/entities'; import { currentISODate } from 'core/tools/date'; import { NIL } from 'core/tools/uuid'; @@ -601,9 +601,24 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ // regionRegistration if (objectRegistration === 100000001) { regionRegistration = quote.evo_regionid; - calculationStore.setFilter('selectRegionRegistration', regions => - regions.filter(x => x.evo_businessunit_evolution === true), - ); + + const filter = regions => + regions.filter(x => x.evo_businessunit_evolution === true); + + calculationStore.setFilter('selectRegionRegistration', filter); + + /** + * TODO: Для нового калькулятора: + * костыль: скидываем значение поля selectRegionRegistration + * после фильтрации чтобы не ставилось значение из КП которого нет в отфильтрованном списке + */ + if ( + !calculationStore + .getOptions('selectRegionRegistration', undefined, true) + ?.find(x => x.value === regionRegistration) + ) { + regionRegistration = null; + } calculationStore.setStatus( 'selectRegionRegistration', ElementStatus.Default,