payments min value = 3

This commit is contained in:
vchikalkin 2023-02-08 10:10:07 +03:00
parent f6879220cb
commit 6e5d05371f
4 changed files with 6 additions and 10 deletions

View File

@ -24,14 +24,7 @@ export const columns: ColumnsType<Payment> = [
render: (_value, payment) => {
const Component = buildValueComponent(payment.num, InputNumber);
return (
<Component
max={100}
min={payment.num === 0 ? 0 : 0.01}
precision={payment.num === 0 ? 4 : 2}
step={1}
/>
);
return <Component max={100} min={0} precision={payment.num === 0 ? 4 : 2} step={1} />;
},
},
];

View File

@ -5,3 +5,4 @@ export const MIN_INSURANCE = 3000;
export const RATE = 7.75;
export const MAX_LEASING_PERIOD = 60;
export const MIN_LASTPAYMENT_NSIB = 3500;
export const MIN_PAYMENT = 3;

View File

@ -2,6 +2,7 @@ import * as seasonsConstants from './lib/seasons-constants';
import * as seasonsTools from './lib/seasons-tools';
import validatePaymentsTable from './validation';
import { selectHighSeasonStart } from '@/config/default-options';
import { MIN_PAYMENT } from '@/constants/values';
import type { ReactionsContext } from '@/process/types';
import type { Row } from '@/stores/tables/payments/types';
import ValidationHelper from '@/stores/validation/helper';
@ -114,7 +115,8 @@ export default function paymentsReactions({ store }: ReactionsContext) {
length: leasingPeriod - 2,
},
(_, k) => {
const payment = 100 * (parmentsDecreasePercent / 100) ** k;
let payment = 100 * (parmentsDecreasePercent / 100) ** k;
if (payment < MIN_PAYMENT) payment = MIN_PAYMENT;
return {
status: 'Disabled',

View File

@ -1,4 +1,5 @@
import { SEASONS_PERIOD_NUMBER, SEASONS_PERIODS } from './lib/seasons-constants';
import { MIN_PAYMENT } from '@/constants/values';
import type RootStore from '@/stores/root';
import { counting, max, min, shift, sort } from 'radash';
import { areEqual, isSorted } from 'tools/array';
@ -10,7 +11,6 @@ export default function validatePaymentsTable({ $calculation, $tables }: RootSto
* для строк с 2 до "Срок лизинга-1" минимальное значение должно быть равно 3
*/
{
const MIN_PAYMENT = 3;
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const targetPayments = $tables.payments.values.slice(1, leasingPeriod - 1);