effect: calcDoubleAgentRewardCondition

This commit is contained in:
Владислав Чикалкин 2020-09-24 18:30:09 +03:00
parent 7e5b126de8
commit a341d3fd47

View File

@ -474,6 +474,38 @@ const reactionEffects: IReactionEffect[] = [
},
}),
calculationStore => ({
expression: () => {
const { calcDoubleAgentRewardCondition } = calculationStore.values;
return calcDoubleAgentRewardCondition;
},
effect: calcDoubleAgentRewardConditionId => {
if (!calcDoubleAgentRewardConditionId) {
calculationStore.setValue('calcDoubleAgentRewardSumm', null);
calculationStore.setStatus(
'tbxCalcDoubleAgentRewardSumm',
Status.Disabled,
);
} else {
const calcDoubleAgentRewardCondition = calculationStore.options.selectCalcDoubleAgentRewardCondition?.find(
x => x.evo_reward_conditionid === calcDoubleAgentRewardConditionId,
);
if (calcDoubleAgentRewardCondition) {
if (calcDoubleAgentRewardCondition.evo_reward_summ) {
calculationStore.setValue(
'calcDoubleAgentRewardSumm',
calcDoubleAgentRewardCondition.evo_reward_summ,
);
calculationStore.setStatus(
'tbxCalcDoubleAgentRewardSumm',
Status.Default,
);
}
}
}
},
}),
calculationStore => ({
expression: () => {
const { channel } = calculationStore.values;