diff --git a/src/client/stores/CalculationStore/Effects/reaction.ts b/src/client/stores/CalculationStore/Effects/reaction.ts index 9ef587e..0e481ee 100644 --- a/src/client/stores/CalculationStore/Effects/reaction.ts +++ b/src/client/stores/CalculationStore/Effects/reaction.ts @@ -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; diff --git a/src/core/fakeData/entityFakes.ts b/src/core/fakeData/entityFakes.ts index f05a41c..238c09d 100644 --- a/src/core/fakeData/entityFakes.ts +++ b/src/core/fakeData/entityFakes.ts @@ -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, + }, ], };