diff --git a/src/client/stores/CalculationStore/Effects/reactions/insuranceReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/insuranceReactions.ts index ce70f59..aa77463 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/insuranceReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/insuranceReactions.ts @@ -1,4 +1,6 @@ import { IReactionEffect } from 'core/types/Calculation/Store/effect'; +import { Process } from 'core/types/Calculation/Store/process'; +import { get } from 'lodash'; const mapObjectCategoryToUseFor = { 100000000: [100000000, 100000002], @@ -55,6 +57,30 @@ const insuranceReactions: IReactionEffect[] = [ } }, }), + + (calculationStore, calculationProcess) => ({ + expression: () => { + return calculationStore.getValue('INNForCalc'); + }, + effect: INNForCalc => { + if (calculationProcess.hasProcess(Process.LoadKp)) { + return; + } + + const mapINNForCalcToInfuranceOPF = { + 10: 100000000, + 12: 100000001, + }; + + const OPFValue = get( + mapINNForCalcToInfuranceOPF, + INNForCalc ? INNForCalc.toString().length : 0, + null, + ); + + calculationStore.setValue('infuranceOPF', OPFValue); + }, + }), ]; export default insuranceReactions; diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts index 9d0814f..e674efe 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts @@ -63,6 +63,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ INNForCalc, regionRegistration, creditRate, + infuranceOPF, } = calculationStore.values; calculationStore.setStatus('selectQuote', ElementStatus.Disabled); @@ -305,6 +306,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ INNForCalc, regionRegistration, creditRate, + infuranceOPF, }); message.success({