diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts index e51fc88..d7d7323 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts @@ -30,18 +30,17 @@ const elementsValidations: TElements = { // selectRate: VALIDATIONS.IS_NULL, selectRegistration: VALIDATIONS.IS_NULL, selectLeaseObjectCategory: VALIDATIONS.IS_NULL, - tbxLeasingPeriod: valueName => CalculationStore.getValue(valueName) < 7, - selectSeasonType: valueName => - CalculationStore.getValue('graphType') === 100000003 && - VALIDATIONS.IS_NULL(valueName), - selectHighSeasonStart: valueName => - CalculationStore.getValue('graphType') === 100000003 && - VALIDATIONS.IS_NULL(valueName), + // selectSeasonType: valueName => + // CalculationStore.getValue('graphType') === 100000003 && + // VALIDATIONS.IS_NULL(valueName), + // selectHighSeasonStart: valueName => + // CalculationStore.getValue('graphType') === 100000003 && + // VALIDATIONS.IS_NULL(valueName), tbxLeaseObjectPrice: VALIDATIONS.LESS_OR_EQUALS_ZERO, - tbxLastPaymentPerc: VALIDATIONS.IS_NULL, - tbxLastPaymentRub: VALIDATIONS.IS_NULL, - tbxFirstPaymentPerc: VALIDATIONS.IS_NULL, - tbxFirstPaymentRub: VALIDATIONS.IS_NULL, + // tbxLastPaymentPerc: VALIDATIONS.IS_NULL, + // tbxLastPaymentRub: VALIDATIONS.IS_NULL, + // tbxFirstPaymentPerc: VALIDATIONS.IS_NULL, + // tbxFirstPaymentRub: VALIDATIONS.IS_NULL, tbxLeaseObjectCount: VALIDATIONS.LESS_OR_EQUALS_ZERO, selectQuote: valueName => CalculationStore.getValue('recalcWithRevision') === true && @@ -52,19 +51,11 @@ const validateElement = (elementName, condition) => { if (condition) { CalculationStore.setValidation(elementName, false); } else { - //TODO: antidote in reactions CalculationStore.setValidation(elementName, true); } }; const validateElements = () => { - if ( - Object.keys(CalculationStore.validations).some( - x => CalculationStore.validations[x] === false, - ) - ) { - return; - } Object.keys(elementsValidations).forEach(elementName => { validateElement( elementName, diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index 49b011e..b019d8b 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -1768,6 +1768,33 @@ const reactionEffects: IReactionEffect[] = [ fireImmediately: true, }, }), + + // TODO: revert to validator + calculationStore => ({ + expression: () => { + const { graphType, seasonType } = calculationStore.values; + return [graphType, seasonType]; + }, + effect: ([graphType, seasonType]) => { + calculationStore.setValidation( + 'selectSeasonType', + !(graphType === 100000003 && seasonType === null), + ); + }, + }), + + calculationStore => ({ + expression: () => { + const { graphType, highSeasonStart } = calculationStore.values; + return [graphType, highSeasonStart]; + }, + effect: ([graphType, highSeasonStart]) => { + calculationStore.setValidation( + 'selectHighSeasonStart', + !(graphType === 100000003 && highSeasonStart === null), + ); + }, + }), ]; export default reactionEffects;