Compare commits
1 Commits
dev
...
fix/irr-bo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daff9c8fbb |
@ -12,3 +12,5 @@ export const VEHICLE_SEATS = 20;
|
|||||||
export const ESN = 1.3;
|
export const ESN = 1.3;
|
||||||
export const NSIB_MAX = 5_000_000;
|
export const NSIB_MAX = 5_000_000;
|
||||||
export const NDFL = 0.13;
|
export const NDFL = 0.13;
|
||||||
|
|
||||||
|
export const IRR_THRESHOLD = 0.001;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import helper from '../lib/helper';
|
import helper from '../lib/helper';
|
||||||
|
import { IRR_THRESHOLD } from '@/constants/values';
|
||||||
import type { ProcessContext } from '@/process/types';
|
import type { ProcessContext } from '@/process/types';
|
||||||
import { disposableReaction } from '@/utils/mobx';
|
import { disposableReaction } from '@/utils/mobx';
|
||||||
import { comparer, reaction } from 'mobx';
|
import { comparer, reaction } from 'mobx';
|
||||||
@ -31,7 +32,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
|||||||
|
|
||||||
const { getIrr } = helper({ apolloClient });
|
const { getIrr } = helper({ apolloClient });
|
||||||
|
|
||||||
reaction(
|
disposableReaction(
|
||||||
|
() => $process.has('LoadKP'),
|
||||||
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
|
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
|
||||||
async (values) => {
|
async (values) => {
|
||||||
const { min, max } = await getIrr(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(
|
disposableReaction(
|
||||||
() => $process.has('Calculate') || $process.has('CreateKP'),
|
() => $process.has('Calculate') || $process.has('CreateKP'),
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user