effect for indAgent=>reward condition
This commit is contained in:
parent
c994757ae4
commit
5b82522f13
@ -200,6 +200,94 @@ const reactionEffects: IReactionEffect[] = [
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { agent } = calculationStore.values;
|
||||
return agent;
|
||||
},
|
||||
effect: agentid => {
|
||||
if (!agentid) {
|
||||
calculationStore.setStatus('selectDoubleAgent', Status.Disabled);
|
||||
} else {
|
||||
calculationStore.setStatus('selectDoubleAgent', Status.Default);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { newClient } = calculationStore.values;
|
||||
return newClient;
|
||||
},
|
||||
effect: newClient => {
|
||||
if (newClient && newClient.length > 0) {
|
||||
calculationStore.setValue('account', null);
|
||||
calculationStore.setValue('contactClient', null);
|
||||
calculationStore.setStatus('selectAccount', Status.Disabled);
|
||||
calculationStore.setStatus('selectContactClient', Status.Disabled);
|
||||
} else {
|
||||
calculationStore.setStatus('selectAccount', Status.Default);
|
||||
calculationStore.setStatus('selectContactClient', Status.Default);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { account } = calculationStore.values;
|
||||
return account;
|
||||
},
|
||||
effect: account => {
|
||||
if (account && account.length > 0) {
|
||||
calculationStore.setStatus('tbxNewClient', Status.Disabled);
|
||||
calculationStore.setValue('newClient', null);
|
||||
} else {
|
||||
calculationStore.setStatus('tbxNewClient', Status.Default);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { indAgent } = calculationStore.values;
|
||||
return indAgent;
|
||||
},
|
||||
effect: indAgentId => {
|
||||
if (!indAgentId) {
|
||||
calculationStore.setValue('indAgentRewardCondition', null);
|
||||
calculationStore.setStatus(
|
||||
'selectIndAgentRewardCondition',
|
||||
Status.Disabled,
|
||||
);
|
||||
} else {
|
||||
calculationStore.setValue('indAgentRewardCondition', null);
|
||||
calculationStore.setStatus(
|
||||
'selectIndAgentRewardCondition',
|
||||
Status.Default,
|
||||
);
|
||||
CalculationService.getEntityOptions({
|
||||
entityName: 'evo_reward_condition',
|
||||
where: {
|
||||
statecode: 0,
|
||||
// TODO < > текущей даты
|
||||
// evo_datefrom: new Date(),
|
||||
// evo_dateto: new Date(),
|
||||
evo_agent_accountid: indAgentId,
|
||||
},
|
||||
})
|
||||
.then(reward_conditions => {
|
||||
calculationStore.setOptions(
|
||||
'selectIndAgentRewardCondition',
|
||||
reward_conditions,
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { channel } = calculationStore.values;
|
||||
|
||||
@ -58,6 +58,9 @@ const TOWN_2_ID = faker.random.uuid();
|
||||
const TOWN_3_ID = faker.random.uuid();
|
||||
const TOWN_4_ID = faker.random.uuid();
|
||||
|
||||
const REWARD_CONDITION_1_ID = faker.random.uuid();
|
||||
const REWARD_CONDITION_2_ID = faker.random.uuid();
|
||||
|
||||
/**
|
||||
* Fake Consts
|
||||
*/
|
||||
@ -329,6 +332,22 @@ const entityFakeData: {
|
||||
statecode: 0,
|
||||
},
|
||||
],
|
||||
evo_reward_condition: [
|
||||
{
|
||||
statecode: 0,
|
||||
evo_agent_accountid: ACCOUNT_6_ID,
|
||||
evo_reward_conditionid: REWARD_CONDITION_1_ID,
|
||||
evo_name: 'Не более 1.5%',
|
||||
evo_reward_summ: 1.5,
|
||||
},
|
||||
{
|
||||
statecode: 0,
|
||||
evo_agent_accountid: ACCOUNT_6_ID,
|
||||
evo_reward_conditionid: REWARD_CONDITION_2_ID,
|
||||
evo_name: 'Не более 2%',
|
||||
evo_reward_summ: 2,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default entityFakeData;
|
||||
|
||||
@ -89,6 +89,7 @@ export interface IEvoRewardCondition extends IBaseOption {
|
||||
evo_dateto?: Date;
|
||||
evo_agent_accountid?: string;
|
||||
evo_double_agent_accountid?: string;
|
||||
evo_reward_summ?: number;
|
||||
statecode?: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user