import type { ProcessContext } from '../types'; import { disposableReaction } from '@/utils/mobx'; import { reaction } from 'mobx'; export function common({ store }: ProcessContext) { const { $calculation, $process } = 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); } } ); reaction( () => $calculation.element('cbxPartialVAT').getValue(), (partialVAT) => { if (partialVAT === true) { $calculation.element('cbxQuotePriceWithFullVAT').unblock(); } else { $calculation.element('cbxQuotePriceWithFullVAT').block(); } } ); disposableReaction( () => $process.has('LoadKP'), () => $calculation.element('cbxPartialVAT').getValue(), (partialVAT) => { if (partialVAT === true) { $calculation.element('cbxQuotePriceWithFullVAT').setValue(true); } else { $calculation.element('cbxQuotePriceWithFullVAT').setValue(false); } } ); }