[2] fix: recalc disabled agents fields

This commit is contained in:
vchikalkin 2023-06-05 11:55:35 +03:00
parent aaa8cadc02
commit e6289b7174

View File

@ -113,6 +113,9 @@ export function common({ store, apolloClient }: ProcessContext) {
'tbxMileage',
'tbxParmentsDecreasePercent',
'tbxVIN',
// 'radioLastPaymentRule',
// 'tbxLastPaymentPerc',
// 'tbxLastPaymentRub',
];
reaction(
() => $calculation.element('cbxRecalcWithRevision').getValue(),
@ -130,17 +133,12 @@ export function common({ store, apolloClient }: ProcessContext) {
);
const agents: Elements[] = [
'selectCalcBroker',
'selectCalcBrokerRewardCondition',
'selectCalcDoubleAgent',
'selectCalcDoubleAgentRewardCondition',
'selectCalcFinDepartment',
'selectDealerBroker',
'selectDealerBrokerRewardCondition',
'selectDealerPerson',
'selectDealerRewardCondition',
'selectFinDepartmentRewardCondtion',
'selectIndAgent',
'selectIndAgentRewardCondition',
'tbxCalcBrokerRewardSum',
'tbxCalcDoubleAgentRewardSumm',
@ -153,7 +151,7 @@ export function common({ store, apolloClient }: ProcessContext) {
reaction(
() => $calculation.$values.getValues(['firstPaymentPerc', 'recalcWithRevision']),
({ firstPaymentPerc, recalcWithRevision }) => {
if (firstPaymentPerc === 0 || recalcWithRevision === true) {
if (firstPaymentPerc === 0 && recalcWithRevision === true) {
agents.forEach((elementName) =>
$calculation.$status.overrideStatus(elementName, 'Disabled')
);