merge branch 'fix/irr-bonus-reaction'
This commit is contained in:
parent
81eca1c6e0
commit
66b1e2cdcb
@ -12,3 +12,5 @@ export const VEHICLE_SEATS = 20;
|
||||
export const ESN = 1.3;
|
||||
export const NSIB_MAX = 5_000_000;
|
||||
export const NDFL = 0.13;
|
||||
|
||||
export const IRR_THRESHOLD = 0.001;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import helper from '../lib/helper';
|
||||
import { IRR_THRESHOLD } from '@/constants/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { comparer, reaction } from 'mobx';
|
||||
@ -31,7 +32,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
|
||||
const { getIrr } = helper({ apolloClient });
|
||||
|
||||
reaction(
|
||||
disposableReaction(
|
||||
() => $process.has('LoadKP'),
|
||||
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
|
||||
async (values) => {
|
||||
const { min, max } = await getIrr(values);
|
||||
@ -40,6 +42,19 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
}
|
||||
);
|
||||
|
||||
// костыль
|
||||
disposableReaction(
|
||||
() =>
|
||||
$process.has('LoadKP') ||
|
||||
$calculation.element('radioLastPaymentRule').getValue() === 100_000_002,
|
||||
() => $calculation.element('labelIrrInfo').getValue(),
|
||||
({ min }) => {
|
||||
if ($calculation.element('radioLastPaymentRule').getValue() === 100_000_002) return;
|
||||
|
||||
$calculation.element('tbxIRR_Perc').setValue(min + IRR_THRESHOLD);
|
||||
}
|
||||
);
|
||||
|
||||
disposableReaction(
|
||||
() => $process.has('Calculate') || $process.has('CreateKP'),
|
||||
() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user