process/agents: dealerPerson & dealerBroker relations

This commit is contained in:
Chika 2022-07-16 11:28:12 +03:00
parent b01008a7c4
commit 3668714b6a
2 changed files with 24 additions and 4 deletions

View File

@ -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',

View File

@ -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');
}
}
);
}