From a341d3fd4762441fb8af591b10a5eff03ed4af47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A7=D0=B8=D0=BA=D0=B0=D0=BB=D0=BA=D0=B8=D0=BD?= Date: Thu, 24 Sep 2020 18:30:09 +0300 Subject: [PATCH] effect: calcDoubleAgentRewardCondition --- .../CalculationStore/Effects/reaction.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/client/stores/CalculationStore/Effects/reaction.ts b/src/client/stores/CalculationStore/Effects/reaction.ts index 5f390c8..ff09f96 100644 --- a/src/client/stores/CalculationStore/Effects/reaction.ts +++ b/src/client/stores/CalculationStore/Effects/reaction.ts @@ -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;