From 86fe6ffd2c3bf5e818b8dcd125715fe8ae9e55ac Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 8 Feb 2022 13:34:56 +0300 Subject: [PATCH] last fixes for db21b16 --- .../actions/calculate/validate/elements.ts | 20 ------------------- .../Effects/reactions/otherReactions.ts | 17 +++------------- .../reactions/recalcWoRevisionReactions.ts | 6 +++++- 3 files changed, 8 insertions(+), 35 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 546e875..4bfff21 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts @@ -1,4 +1,3 @@ -import { numberElementsProps } from 'client/Containers/Calculation/Elements/props/common'; import { getValueName } from 'client/Containers/Calculation/Elements/tools'; import { ElementsNames } from 'client/Containers/Calculation/types/elements'; import { pipe } from 'core/tools/func'; @@ -193,30 +192,11 @@ const entityElementsConditions = ( {}, ); -/** Проверяем по настройкам полей min max */ -const numberElementsConditions = Object.keys(numberElementsProps).reduce( - (acc, elem) => { - acc[elem] = (calculationStore, elementName) => { - const valueName = getValueName(elementName); - const value = calculationStore.getValue(valueName); - const { min, max } = numberElementsProps[elem]; - return { - isValid: - (min === undefined || value >= min) && - (max === undefined || value <= max), - }; - }; - return acc; - }, - {} as Partial>, -); - const conditions = Object.assign( {}, customConditions, elementsConditions, entityElementsConditions, - numberElementsConditions, ); export default function (this: ICalculationStore) { diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index 1261951..58709b9 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -487,9 +487,7 @@ const reactionEffects: IReactionEffect[] = [ calculationStore => ({ expression: () => { - const { lastPaymentRub, lastPaymentPerc, insNSIB } = - calculationStore.values; - return { lastPaymentRub, lastPaymentPerc, insNSIB }; + return calculationStore.getValues(['lastPaymentRub', 'insNSIB']); }, effect: ({ lastPaymentRub, insNSIB }) => { if (insNSIB && lastPaymentRub && lastPaymentRub < 3500) { @@ -500,18 +498,9 @@ const reactionEffects: IReactionEffect[] = [ description: 'Последний платеж меньше 3500 руб. не может быть при наличии НСИБ, укажите большее значение', })(); - return; - } else if (lastPaymentRub && lastPaymentRub < 1000) { - calculationStore.setValidation('tbxLastPaymentRub', false); - openNotification({ - type: 'error', - title: 'Ошибка', - description: - 'Последний платеж меньше 1000 руб. не может быть, укажите большее значение', - })(); - return; + } else { + calculationStore.setValidation('tbxLastPaymentRub', true); } - calculationStore.setValidation('tbxLastPaymentRub', true); }, }), diff --git a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts index 8a74da8..76f2b8d 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/recalcWoRevisionReactions.ts @@ -540,7 +540,11 @@ const reactionEffects: IReactionEffect[] = [ calculationStore => ({ expression: () => - calculationStore.getValues(['lastPaymentPerc', 'balanceHolder']), + calculationStore.getValues([ + 'lastPaymentPerc', + 'balanceHolder', + 'lastPaymentRule', + ]), effect: ({ lastPaymentPerc, balanceHolder }) => { if (balanceHolder && balanceHolder === 100000001) { if (!lastPaymentPerc || parseFloat(lastPaymentPerc) < 1) {