effect: double agent => reward condition

This commit is contained in:
Владислав Чикалкин 2020-09-24 16:57:43 +03:00
parent 5b82522f13
commit 03b7c7b059
2 changed files with 58 additions and 0 deletions

View File

@ -288,6 +288,48 @@ const reactionEffects: IReactionEffect[] = [
},
}),
calculationStore => ({
expression: () => {
const { calcDoubleAgent } = calculationStore.values;
return calcDoubleAgent;
},
effect: doubleAgentId => {
if (!doubleAgentId) {
calculationStore.setValue('calcDoubleAgentRewardCondition', null);
calculationStore.setStatus(
'selectCalcDoubleAgentRewardCondition',
Status.Disabled,
);
} else {
calculationStore.setValue('calcDoubleAgentRewardCondition', null);
calculationStore.setStatus(
'selectCalcDoubleAgentRewardCondition',
Status.Default,
);
CalculationService.getEntityOptions({
entityName: 'evo_reward_condition',
where: {
statecode: 0,
// TODO < > текущей даты
// evo_datefrom: new Date(),
// evo_dateto: new Date(),
evo_agent_accountid: doubleAgentId,
},
})
.then(reward_conditions => {
console.log('reward_conditions', reward_conditions);
calculationStore.setOptions(
'selectCalcDoubleAgentRewardCondition',
reward_conditions,
);
})
.catch(err => {
throw err;
});
}
},
}),
calculationStore => ({
expression: () => {
const { channel } = calculationStore.values;

View File

@ -60,6 +60,8 @@ const TOWN_4_ID = faker.random.uuid();
const REWARD_CONDITION_1_ID = faker.random.uuid();
const REWARD_CONDITION_2_ID = faker.random.uuid();
const REWARD_CONDITION_3_ID = faker.random.uuid();
const REWARD_CONDITION_4_ID = faker.random.uuid();
/**
* Fake Consts
@ -347,6 +349,20 @@ const entityFakeData: {
evo_name: 'Не более 2%',
evo_reward_summ: 2,
},
{
statecode: 0,
evo_agent_accountid: ACCOUNT_7_ID,
evo_reward_conditionid: REWARD_CONDITION_3_ID,
evo_name: 'Не более 5%',
evo_reward_summ: 5,
},
{
statecode: 0,
evo_agent_accountid: ACCOUNT_7_ID,
evo_reward_conditionid: REWARD_CONDITION_4_ID,
evo_name: 'Не более 10%',
evo_reward_summ: 10,
},
],
};