infuranceOPF value reaction

This commit is contained in:
Chika 2021-06-18 14:26:11 +03:00
parent 248809e8e9
commit dccbce9adb
2 changed files with 28 additions and 0 deletions

View File

@ -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;

View File

@ -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({