From 9b8757cc9e5595c4c90afc59d6359d52dfdb0bed Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 3 Jun 2021 14:55:59 +0300 Subject: [PATCH] selectRegion & selectRegionRegistration --- .../actions/calculate/validate/elements.ts | 13 +---------- .../Effects/reactions/gibddReactions.ts | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts index e3174d9..ef6abb2 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts @@ -45,16 +45,6 @@ const CUSTOM_CONDITIONS: TElements< } return false; }, - selectObjectRegionRegistration: calculationStore => { - const objectRegistration = calculationStore.getValue('objectRegistration'); - if (objectRegistration === 100000001) { - const objectRegionRegistration = calculationStore.getValue( - 'objectRegionRegistration', - ); - return CONDITIONS.IS_NULL(objectRegionRegistration); - } - return false; - }, }; const elementsValidations: TElements = { @@ -88,8 +78,7 @@ const elementsValidations: TElements = { selectQuote: CUSTOM_CONDITIONS.selectQuote, tbxVehicleTaxInYear: CUSTOM_CONDITIONS.tbxVehicleTaxInYear, radioTypePTS: CUSTOM_CONDITIONS.radioTypePTS, - selectObjectRegionRegistration: - CUSTOM_CONDITIONS.selectObjectRegionRegistration, + selectObjectRegionRegistration: CONDITIONS.IS_NULL, }; export default function (this: ICalculationStore) { diff --git a/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts index b1330e6..d6724ad 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts @@ -14,10 +14,10 @@ import { get } from 'lodash'; const v: TElements = { tbxVehicleTaxInYear: { value: 0, validator: value => value === 0 }, radioTypePTS: { value: null, validator: value => value === null }, - selectObjectRegionRegistration: { - value: null, - validator: value => value === null, - }, + // selectObjectRegionRegistration: { + // value: null, + // validator: value => value === null, + // }, }; const gibddReactions: IReactionEffect[] = [ @@ -355,19 +355,22 @@ const gibddReactions: IReactionEffect[] = [ typePTS, }) => { calculationStore.setFilter('selectRegistration', options => - options.filter( - x => + options.filter(x => { + return ( x.evo_whom_register === objectRegistration && - x.evo_pts_type && - x.evo_pts_type.includes(typePTS) && + (typePTS + ? x.evo_pts_type && + x.evo_pts_type.filter(x => x > 0).includes(typePTS) + : true) && x.evo_gibdd_region === (objectRegionRegistration.evo_regionid === regionRegistration) && (x.accountid ? objectRegionRegistration.accounts .map(x => x.accountid) .includes(x.evo_accountid) - : true), - ), + : true) + ); + }), ); }, }),