reaction: agents complete
This commit is contained in:
parent
9830f5dece
commit
99cce9a97d
@ -556,7 +556,7 @@ const reactionEffects: IReactionEffect[] = [
|
||||
},
|
||||
effect: calcDoubleAgentRewardConditionId => {
|
||||
if (!calcDoubleAgentRewardConditionId) {
|
||||
calculationStore.setValue('calcDoubleAgentRewardSumm', null);
|
||||
calculationStore.setValue('calcDoubleAgentRewardSumm', 0);
|
||||
calculationStore.setStatus(
|
||||
'tbxCalcDoubleAgentRewardSumm',
|
||||
Status.Disabled,
|
||||
@ -588,7 +588,7 @@ const reactionEffects: IReactionEffect[] = [
|
||||
},
|
||||
effect: calcBrokerRewardConditionId => {
|
||||
if (!calcBrokerRewardConditionId) {
|
||||
calculationStore.setValue('calcBrokerRewardSum', null);
|
||||
calculationStore.setValue('calcBrokerRewardSum', 0);
|
||||
calculationStore.setStatus('tbxCalcBrokerRewardSum', Status.Disabled);
|
||||
} else {
|
||||
const calcBrokerRewardCondition = calculationStore.options.selectCalcBrokerRewardCondition?.find(
|
||||
@ -617,7 +617,7 @@ const reactionEffects: IReactionEffect[] = [
|
||||
},
|
||||
effect: finDepartmentRewardCondtionId => {
|
||||
if (!finDepartmentRewardCondtionId) {
|
||||
calculationStore.setValue('finDepartmentRewardSumm', null);
|
||||
calculationStore.setValue('finDepartmentRewardSumm', 0);
|
||||
calculationStore.setStatus(
|
||||
'tbxFinDepartmentRewardSumm',
|
||||
Status.Disabled,
|
||||
@ -1166,6 +1166,140 @@ const reactionEffects: IReactionEffect[] = [
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { dealerRewardСondition } = calculationStore.values;
|
||||
return dealerRewardСondition;
|
||||
},
|
||||
effect: dealerRewardСonditionId => {
|
||||
if (!dealerRewardСonditionId) {
|
||||
calculationStore.setValue('dealerRewardSumm', 0);
|
||||
calculationStore.setStatus('tbxDealerRewardSumm', Status.Disabled);
|
||||
} else {
|
||||
const dealerRewardContition = calculationStore.options.selectDealerRewardСondition?.find(
|
||||
x => x.evo_reward_conditionid === dealerRewardСonditionId,
|
||||
);
|
||||
if (dealerRewardContition) {
|
||||
if (dealerRewardContition.evo_reward_summ) {
|
||||
calculationStore.setValue(
|
||||
'dealerRewardSumm',
|
||||
dealerRewardContition.evo_reward_summ,
|
||||
);
|
||||
calculationStore.setStatus('tbxDealerRewardSumm', Status.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { dealerBrokerRewardСondition } = calculationStore.values;
|
||||
return dealerBrokerRewardСondition;
|
||||
},
|
||||
effect: dealerBrokerRewardСonditionId => {
|
||||
if (!dealerBrokerRewardСonditionId) {
|
||||
calculationStore.setValue('dealerBrokerRewardSumm', 0);
|
||||
calculationStore.setStatus(
|
||||
'tbxDealerBrokerRewardSumm',
|
||||
Status.Disabled,
|
||||
);
|
||||
} else {
|
||||
const dealerBrokerRewardContition = calculationStore.options.selectDealerBrokerRewardСondition?.find(
|
||||
x => x.evo_reward_conditionid === dealerBrokerRewardСonditionId,
|
||||
);
|
||||
if (dealerBrokerRewardContition) {
|
||||
if (dealerBrokerRewardContition.evo_reward_summ) {
|
||||
calculationStore.setValue(
|
||||
'dealerBrokerRewardSumm',
|
||||
dealerBrokerRewardContition.evo_reward_summ,
|
||||
);
|
||||
calculationStore.setStatus(
|
||||
'tbxDealerBrokerRewardSumm',
|
||||
Status.Default,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { dealerRewardSumm } = calculationStore.values;
|
||||
return dealerRewardSumm;
|
||||
},
|
||||
effect: dealerRewardSumm => {
|
||||
const dealerRewardСonditionId =
|
||||
calculationStore.values.dealerRewardСondition;
|
||||
if (dealerRewardСonditionId) {
|
||||
const dealerRewardCondition = calculationStore.options.selectDealerRewardСondition?.find(
|
||||
x => x.evo_reward_conditionid === dealerRewardСonditionId,
|
||||
);
|
||||
if (dealerRewardCondition) {
|
||||
if (
|
||||
!dealerRewardCondition.evo_reduce_reward &&
|
||||
dealerRewardCondition.evo_reward_summ
|
||||
) {
|
||||
if (dealerRewardSumm < dealerRewardCondition.evo_reward_summ) {
|
||||
calculationStore.showModal(
|
||||
'Вознаграждение ЮЛ поставщика указано меньше условия по агентскому договору! \nЗначение установлено по условию договора.',
|
||||
);
|
||||
}
|
||||
}
|
||||
if (dealerRewardCondition.evo_reward_summ) {
|
||||
if (dealerRewardSumm > dealerRewardCondition.evo_reward_summ) {
|
||||
calculationStore.showModal(
|
||||
'Вознаграждение ЮЛ поставщика указано больше условия по агентскому договору! \nЗначение установлено по условию договора.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { dealerBrokerRewardSumm } = calculationStore.values;
|
||||
return dealerBrokerRewardSumm;
|
||||
},
|
||||
effect: dealerBrokerRewardSumm => {
|
||||
const dealerBrokerRewardСonditionId =
|
||||
calculationStore.values.dealerBrokerRewardСondition;
|
||||
if (dealerBrokerRewardСonditionId) {
|
||||
const dealerBrokerRewardСondition = calculationStore.options.selectDealerBrokerRewardСondition?.find(
|
||||
x => x.evo_reward_conditionid === dealerBrokerRewardСonditionId,
|
||||
);
|
||||
if (dealerBrokerRewardСondition) {
|
||||
if (
|
||||
!dealerBrokerRewardСondition.evo_reduce_reward &&
|
||||
dealerBrokerRewardСondition.evo_reward_summ
|
||||
) {
|
||||
if (
|
||||
dealerBrokerRewardSumm <
|
||||
dealerBrokerRewardСondition.evo_reward_summ
|
||||
) {
|
||||
calculationStore.showModal(
|
||||
'Вознаграждение брокера поставщика указано меньше условия по агентскому договору! \nЗначение установлено по условию договора.',
|
||||
);
|
||||
}
|
||||
}
|
||||
if (dealerBrokerRewardСondition.evo_reward_summ) {
|
||||
if (
|
||||
dealerBrokerRewardSumm >
|
||||
dealerBrokerRewardСondition.evo_reward_summ
|
||||
) {
|
||||
calculationStore.showModal(
|
||||
'Вознаграждение брокера поставщика указано больше условия по агентскому договору! \nЗначение установлено по условию договора.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export default reactionEffects;
|
||||
|
||||
Reference in New Issue
Block a user