effect: calcBroker => reward condition
This commit is contained in:
parent
03b7c7b059
commit
10062ef490
@ -330,6 +330,90 @@ const reactionEffects: IReactionEffect[] = [
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { calcFinDepartment } = calculationStore.values;
|
||||
return calcFinDepartment;
|
||||
},
|
||||
effect: calcFinDepartmentId => {
|
||||
if (!calcFinDepartmentId) {
|
||||
calculationStore.setValue('finDepartmentRewardCondtion', null);
|
||||
calculationStore.setStatus(
|
||||
'selectFinDepartmentRewardCondtion',
|
||||
Status.Disabled,
|
||||
);
|
||||
} else {
|
||||
calculationStore.setValue('finDepartmentRewardCondtion', null);
|
||||
calculationStore.setStatus(
|
||||
'selectFinDepartmentRewardCondtion',
|
||||
Status.Default,
|
||||
);
|
||||
CalculationService.getEntityOptions({
|
||||
entityName: 'evo_reward_condition',
|
||||
where: {
|
||||
statecode: 0,
|
||||
// TODO < > текущей даты
|
||||
// evo_datefrom: new Date(),
|
||||
// evo_dateto: new Date(),
|
||||
evo_agent_accountid: calcFinDepartmentId,
|
||||
},
|
||||
})
|
||||
.then(reward_conditions => {
|
||||
console.log('reward_conditions', reward_conditions);
|
||||
calculationStore.setOptions(
|
||||
'selectFinDepartmentRewardCondtion',
|
||||
reward_conditions,
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { calcBroker } = calculationStore.values;
|
||||
return calcBroker;
|
||||
},
|
||||
effect: calcBrokerId => {
|
||||
if (!calcBrokerId) {
|
||||
calculationStore.setValue('calcBrokerRewardCondition', null);
|
||||
calculationStore.setStatus(
|
||||
'selectCalcBrokerRewardCondition',
|
||||
Status.Disabled,
|
||||
);
|
||||
} else {
|
||||
calculationStore.setValue('calcBrokerRewardCondition', null);
|
||||
calculationStore.setStatus(
|
||||
'selectCalcBrokerRewardCondition',
|
||||
Status.Default,
|
||||
);
|
||||
CalculationService.getEntityOptions({
|
||||
entityName: 'evo_reward_condition',
|
||||
where: {
|
||||
statecode: 0,
|
||||
// TODO < > текущей даты
|
||||
// evo_datefrom: new Date(),
|
||||
// evo_dateto: new Date(),
|
||||
evo_agent_accountid: calcBrokerId,
|
||||
},
|
||||
})
|
||||
.then(reward_conditions => {
|
||||
console.log('reward_conditions', reward_conditions);
|
||||
calculationStore.setOptions(
|
||||
'selectCalcBrokerRewardCondition',
|
||||
reward_conditions,
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { channel } = calculationStore.values;
|
||||
|
||||
@ -62,6 +62,10 @@ 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();
|
||||
const REWARD_CONDITION_5_ID = faker.random.uuid();
|
||||
const REWARD_CONDITION_6_ID = faker.random.uuid();
|
||||
const REWARD_CONDITION_7_ID = faker.random.uuid();
|
||||
const REWARD_CONDITION_8_ID = faker.random.uuid();
|
||||
|
||||
/**
|
||||
* Fake Consts
|
||||
@ -96,7 +100,7 @@ const entityFakeData: {
|
||||
},
|
||||
{
|
||||
accountid: ACCOUNT_4_ID,
|
||||
name: 'Финотдел1',
|
||||
name: 'Брокер',
|
||||
evo_account_type: 100000005,
|
||||
evo_supplier_type: 100000000,
|
||||
statecode: 0,
|
||||
@ -363,6 +367,34 @@ const entityFakeData: {
|
||||
evo_name: 'Не более 10%',
|
||||
evo_reward_summ: 10,
|
||||
},
|
||||
{
|
||||
statecode: 0,
|
||||
evo_agent_accountid: ACCOUNT_5_ID,
|
||||
evo_reward_conditionid: REWARD_CONDITION_5_ID,
|
||||
evo_name: 'Не более 15%',
|
||||
evo_reward_summ: 15,
|
||||
},
|
||||
{
|
||||
statecode: 0,
|
||||
evo_agent_accountid: ACCOUNT_5_ID,
|
||||
evo_reward_conditionid: REWARD_CONDITION_6_ID,
|
||||
evo_name: 'Не более 20%',
|
||||
evo_reward_summ: 20,
|
||||
},
|
||||
{
|
||||
statecode: 0,
|
||||
evo_agent_accountid: ACCOUNT_4_ID,
|
||||
evo_reward_conditionid: REWARD_CONDITION_7_ID,
|
||||
evo_name: 'Не более 15%',
|
||||
evo_reward_summ: 15,
|
||||
},
|
||||
{
|
||||
statecode: 0,
|
||||
evo_agent_accountid: ACCOUNT_4_ID,
|
||||
evo_reward_conditionid: REWARD_CONDITION_8_ID,
|
||||
evo_name: 'Не более 20%',
|
||||
evo_reward_summ: 20,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user