process/calculate/common: radioCalcType tbxIRR_Perc tbxTotalPayments
This commit is contained in:
parent
1db69ce4e2
commit
8b3676bd00
@ -132,7 +132,7 @@ const defaultStatuses: CalculationStatuses = {
|
||||
tbxSubsidySum: 'Default',
|
||||
tbxSupplierDiscountPerc: 'Default',
|
||||
tbxSupplierDiscountRub: 'Default',
|
||||
tbxTotalPayments: 'Default',
|
||||
tbxTotalPayments: 'Disabled',
|
||||
tbxVATInLeaseObjectPrice: 'Default',
|
||||
tbxVehicleTaxInLeasingPeriod: 'Disabled',
|
||||
tbxVehicleTaxInYear: 'Default',
|
||||
|
||||
28
apps/web/process/calculate/reactions/common.ts
Normal file
28
apps/web/process/calculate/reactions/common.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export default function commonReactions({ store }: ReactionsContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('radioCalcType').getValue(),
|
||||
(calcType) => {
|
||||
switch (calcType) {
|
||||
case 100000001: {
|
||||
$calculation.element('tbxIRR_Perc').block();
|
||||
$calculation.element('tbxTotalPayments').unblock();
|
||||
break;
|
||||
}
|
||||
case 100000000:
|
||||
default: {
|
||||
$calculation.element('tbxIRR_Perc').unblock();
|
||||
$calculation.element('tbxTotalPayments').block();
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -1 +1,2 @@
|
||||
export { default as common } from './common';
|
||||
export { default as validation } from './validation';
|
||||
|
||||
@ -18,6 +18,7 @@ export default function injectDefaultReactions(context) {
|
||||
leadOpportunityReactions.urls(context);
|
||||
paymentsReactions(context);
|
||||
calculateReactions.validation(context);
|
||||
calculateReactions.common(context);
|
||||
supplierReactions.commonReactions(context);
|
||||
supplierReactions.validationReactions(context);
|
||||
agentsReactions.fillReactions(context);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user