From 3668714b6a83bb776e9f8b989c93d2e29e94a5fd Mon Sep 17 00:00:00 2001 From: Chika Date: Sat, 16 Jul 2022 11:28:12 +0300 Subject: [PATCH] process/agents: dealerPerson & dealerBroker relations --- config/default-statuses.ts | 4 ++-- process/agents/reactions/common.ts | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/config/default-statuses.ts b/config/default-statuses.ts index b7c081e..e9c9e13 100644 --- a/config/default-statuses.ts +++ b/config/default-statuses.ts @@ -66,10 +66,10 @@ const defaultStatuses: CalculationStatuses = { selectDealer: 'Default', selectDealerPerson: 'Default', selectDealerRewardCondition: 'Default', - tbxDealerRewardSumm: 'Default', + tbxDealerRewardSumm: 'Disabled', selectDealerBroker: 'Default', selectDealerBrokerRewardCondition: 'Default', - tbxDealerBrokerRewardSumm: 'Default', + tbxDealerBrokerRewardSumm: 'Disabled', selectIndAgentRewardCondition: 'Default', tbxIndAgentRewardSumm: 'Default', selectCalcDoubleAgentRewardCondition: 'Default', diff --git a/process/agents/reactions/common.ts b/process/agents/reactions/common.ts index aa47638..0131524 100644 --- a/process/agents/reactions/common.ts +++ b/process/agents/reactions/common.ts @@ -53,6 +53,7 @@ export default function commonReactions(store: RootStore, apolloClient: ApolloCl async (dealerId) => { if (!dealerId) { $calculation.resetElement('selectDealerPerson'); + $calculation.resetElement('selectDealerBroker'); return; } @@ -89,8 +90,6 @@ export default function commonReactions(store: RootStore, apolloClient: ApolloCl () => $calculation.getElementValue('selectDealerPerson'), async (dealerPersonId) => { if (!dealerPersonId) { - $calculation.resetElement('selectDealerBroker'); - return; } @@ -193,6 +192,7 @@ export default function commonReactions(store: RootStore, apolloClient: ApolloCl }); $calculation.setElementValue('tbxDealerRewardSumm', evo_reward_condition?.evo_reward_summ); + $calculation.unblockElement('tbxDealerRewardSumm'); } ); @@ -249,6 +249,26 @@ export default function commonReactions(store: RootStore, apolloClient: ApolloCl 'tbxDealerBrokerRewardSumm', evo_reward_condition?.evo_reward_summ ); + + $calculation.unblockElement('tbxDealerBrokerRewardSumm'); + } + ); + + reaction( + () => $calculation.getElementValue('selectDealerRewardCondition'), + (dealerRewardConditionId) => { + if (dealerRewardConditionId) { + $calculation.resetElementValue('selectDealerBroker'); + } + } + ); + + reaction( + () => $calculation.getElementValue('selectDealerBrokerRewardCondition'), + (dealerBrokerRewardConditionId) => { + if (dealerBrokerRewardConditionId) { + $calculation.resetElementValue('selectDealerPerson'); + } } ); }