реакция radioBalanceHolder - cbxLastPaymentRedemption
This commit is contained in:
parent
d4444aff5c
commit
1db69ce4e2
@ -1,4 +1,3 @@
|
||||
import { MIN_LASTPAYMENT_NSIB } from '@/constants/values';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
@ -31,20 +30,15 @@ export default function commonReactions({ store }: ReactionsContext) {
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue();
|
||||
const insNSIB = $calculation.element('selectInsNSIB').getValue();
|
||||
|
||||
return {
|
||||
insNSIB,
|
||||
lastPaymentRub,
|
||||
};
|
||||
},
|
||||
({ lastPaymentRub, insNSIB }) => {
|
||||
$calculation.element('tbxLastPaymentRub').validate({
|
||||
invalid: Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB,
|
||||
message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`,
|
||||
});
|
||||
() => $calculation.element('radioBalanceHolder').getValue(),
|
||||
(balanceHolder) => {
|
||||
if (balanceHolder) {
|
||||
if (balanceHolder === 100000001) {
|
||||
$calculation.element('cbxLastPaymentRedemption').setValue(true).block();
|
||||
} else {
|
||||
$calculation.element('cbxLastPaymentRedemption').unblock();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
25
apps/web/process/price/reactions/validation.ts
Normal file
25
apps/web/process/price/reactions/validation.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { MIN_LASTPAYMENT_NSIB } from '@/constants/values';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export default function commonReactions({ store }: ReactionsContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue();
|
||||
const insNSIB = $calculation.element('selectInsNSIB').getValue();
|
||||
|
||||
return {
|
||||
insNSIB,
|
||||
lastPaymentRub,
|
||||
};
|
||||
},
|
||||
({ lastPaymentRub, insNSIB }) => {
|
||||
$calculation.element('tbxLastPaymentRub').validate({
|
||||
invalid: Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB,
|
||||
message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user