2023-04-19 22:34:50 +03:00

36 lines
991 B
TypeScript

import type { ProcessContext } from '../types';
import { reaction } from 'mobx';
export function common({ store }: ProcessContext) {
const { $calculation } = store;
reaction(
() => $calculation.element('radioBalanceHolder').getValue(),
(balanceHolder) => {
if (balanceHolder === 100_000_001) {
$calculation.element('cbxLastPaymentRedemption').setValue(true).block();
} else {
$calculation.element('cbxLastPaymentRedemption').unblock();
}
}
);
reaction(
() => $calculation.element('cbxPriceWithDiscount').getValue(),
(priceWithDiscount) => {
if (priceWithDiscount === true) {
$calculation.element('cbxFullPriceWithDiscount').setValue(false);
}
}
);
reaction(
() => $calculation.element('cbxFullPriceWithDiscount').getValue(),
(fullPriceWithDiscount) => {
if (fullPriceWithDiscount === true) {
$calculation.element('cbxPriceWithDiscount').setValue(false);
}
}
);
}