unlimited: add tbxPi field
This commit is contained in:
parent
96e792b91d
commit
7d16bf2e53
@ -2,7 +2,7 @@ import type { FormTabRows } from '../lib/render-rows';
|
||||
|
||||
const defaultRowStyle = { gridTemplateColumns: '1fr' };
|
||||
|
||||
export const rows: FormTabRows = [
|
||||
export const mainRows: FormTabRows = [
|
||||
{ title: 'Выбор Интереса/ЛС' },
|
||||
[['selectLead'], defaultRowStyle],
|
||||
[['selectOpportunity'], defaultRowStyle],
|
||||
@ -14,10 +14,20 @@ export const rows: FormTabRows = [
|
||||
gridTemplateColumns: ['1fr 0.15fr'],
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
export const paramsRows: FormTabRows = [
|
||||
{ title: 'Параметры расчета' },
|
||||
[['labelIrrInfo'], defaultRowStyle],
|
||||
[['radioCalcType'], defaultRowStyle],
|
||||
[['tbxIRR_Perc'], defaultRowStyle],
|
||||
[['tbxTotalPayments'], defaultRowStyle],
|
||||
];
|
||||
|
||||
export const unlimitedParamsRows: FormTabRows = [
|
||||
{ title: 'Параметры расчета' },
|
||||
[['labelIrrInfo'], defaultRowStyle],
|
||||
[['radioCalcType'], defaultRowStyle],
|
||||
[['tbxIRR_Perc', 'tbxPi'], { gridTemplateColumns: '1fr 1fr' }],
|
||||
[['tbxTotalPayments'], defaultRowStyle],
|
||||
];
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import renderFormRows from '../lib/render-rows';
|
||||
import { rows } from './config';
|
||||
import * as config from './config';
|
||||
import Background from '@/Components/Layout/Background';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { min } from '@/styles/mq';
|
||||
import styled from 'styled-components';
|
||||
|
||||
@ -17,5 +18,17 @@ const Wrapper = styled(Background)`
|
||||
`;
|
||||
|
||||
export default function Settings() {
|
||||
return <Wrapper>{renderFormRows(rows)}</Wrapper>;
|
||||
const { $process } = useStore();
|
||||
|
||||
const mainRows = renderFormRows(config.mainRows);
|
||||
const paramsRows = $process.has('Unlimited')
|
||||
? renderFormRows(config.unlimitedParamsRows)
|
||||
: renderFormRows(config.paramsRows);
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
{mainRows}
|
||||
{paramsRows}
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
|
||||
@ -133,6 +133,7 @@ const components = wrapComponentsMap({
|
||||
tbxVIN: e.Input,
|
||||
selectUser: e.Select,
|
||||
cbxSupplierFinancing: e.Switch,
|
||||
tbxPi: e.InputNumber,
|
||||
|
||||
/** Readonly Elements */
|
||||
labelLeaseObjectRisk: e.Text,
|
||||
|
||||
@ -481,7 +481,19 @@ const props: Partial<ElementsProps> = {
|
||||
optionFilterProp: 'label',
|
||||
},
|
||||
tbxIRR_Perc: {
|
||||
min: 0,
|
||||
min: -500,
|
||||
max: 500,
|
||||
step: 0.0001,
|
||||
precision: 6,
|
||||
parser,
|
||||
formatter: createFormatter({ minimumFractionDigits: 6, maximumFractionDigits: 6 }),
|
||||
addonAfter: '%',
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
tbxPi: {
|
||||
min: -500,
|
||||
max: 500,
|
||||
step: 0.0001,
|
||||
precision: 6,
|
||||
|
||||
@ -127,6 +127,7 @@ const titles: Record<ActionElements | ValuesElements, string> = {
|
||||
tbxVIN: 'VIN',
|
||||
selectUser: 'Пользователь',
|
||||
cbxSupplierFinancing: 'Финансирование поставщика',
|
||||
tbxPi: 'PI',
|
||||
|
||||
/** Link Elements */
|
||||
linkDownloadKp: '',
|
||||
|
||||
@ -192,6 +192,7 @@ const types = wrapElementsTypes({
|
||||
tbxVIN: t.Value,
|
||||
selectUser: t.Options,
|
||||
cbxSupplierFinancing: t.Switch,
|
||||
tbxPi: t.Number,
|
||||
|
||||
labelLeaseObjectRisk: t.Readonly,
|
||||
tbxInsKaskoPriceLeasePeriod: t.Readonly,
|
||||
|
||||
@ -130,6 +130,7 @@ const elementsToValues = wrapElementsMap({
|
||||
tbxVIN: 'vin',
|
||||
selectUser: 'user',
|
||||
cbxSupplierFinancing: 'supplierFinancing',
|
||||
tbxPi: 'pi',
|
||||
|
||||
/** Readonly Elements */
|
||||
labelLeaseObjectRisk: 'leaseObjectRiskName',
|
||||
|
||||
@ -193,14 +193,14 @@ export const radioCalcType = [
|
||||
label: 'IRR',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'Суммы',
|
||||
value: 100_000_001,
|
||||
},
|
||||
{
|
||||
label: 'PI',
|
||||
value: 100_000_099,
|
||||
},
|
||||
{
|
||||
label: 'Суммы',
|
||||
value: 100_000_001,
|
||||
},
|
||||
];
|
||||
|
||||
export const selectRequirementTelematic = [
|
||||
@ -503,6 +503,7 @@ const defaultOptions: CalculationOptions = {
|
||||
tbxVIN: [],
|
||||
selectUser: [],
|
||||
cbxSupplierFinancing: [],
|
||||
tbxPi: [],
|
||||
};
|
||||
|
||||
export default defaultOptions;
|
||||
|
||||
@ -126,6 +126,7 @@ const defaultStatuses: CalculationStatuses = {
|
||||
tbxMileage: 'Default',
|
||||
tbxMinPriceChange: 'Default',
|
||||
tbxParmentsDecreasePercent: 'Default',
|
||||
tbxPi: 'Default',
|
||||
tbxQuoteName: 'Default',
|
||||
tbxRedemptionPaymentSum: 'Disabled',
|
||||
tbxSaleBonus: 'Default',
|
||||
|
||||
@ -101,6 +101,7 @@ const defaultValues: CalculationValues = {
|
||||
opportunity: null,
|
||||
opportunityUrl: null,
|
||||
parmentsDecreasePercent: 94,
|
||||
pi: 0,
|
||||
plPriceRub: 0,
|
||||
priceWithDiscount: false,
|
||||
product: null,
|
||||
@ -134,12 +135,12 @@ const defaultValues: CalculationValues = {
|
||||
townRegistration: null,
|
||||
tracker: null,
|
||||
typePTS: null,
|
||||
user: null,
|
||||
VATInLeaseObjectPrice: 0,
|
||||
vehicleTaxInLeasingPeriod: 0,
|
||||
vehicleTaxInYear: 0,
|
||||
withTrailer: false,
|
||||
vin: null,
|
||||
user: null,
|
||||
withTrailer: false,
|
||||
};
|
||||
|
||||
export default defaultValues;
|
||||
|
||||
@ -90,6 +90,7 @@ const ValuesSchema = z.object({
|
||||
objectTypeTax: z.number().nullable(),
|
||||
opportunity: z.string().nullable(),
|
||||
parmentsDecreasePercent: z.number(),
|
||||
pi: z.number(),
|
||||
priceWithDiscount: z.boolean(),
|
||||
product: z.string().nullable(),
|
||||
quote: z.string().nullable(),
|
||||
@ -119,12 +120,12 @@ const ValuesSchema = z.object({
|
||||
townRegistration: z.string().nullable(),
|
||||
tracker: z.string().nullable(),
|
||||
typePTS: z.number().nullable(),
|
||||
user: z.string().nullable(),
|
||||
VATInLeaseObjectPrice: z.number(),
|
||||
vehicleTaxInLeasingPeriod: z.number(),
|
||||
vehicleTaxInYear: z.number(),
|
||||
withTrailer: z.boolean(),
|
||||
vin: z.string().nullable(),
|
||||
user: z.string().nullable(),
|
||||
withTrailer: z.boolean(),
|
||||
|
||||
/**
|
||||
* Link Values
|
||||
|
||||
@ -858,7 +858,7 @@ export async function createRequestData({
|
||||
},
|
||||
|
||||
async npvniExpected() {
|
||||
return 0;
|
||||
return values.pi / 100;
|
||||
},
|
||||
|
||||
async nsBonus() {
|
||||
|
||||
@ -104,6 +104,7 @@ export function transformCalculateResults({
|
||||
IRR_Perc: columns?.cashflowMsfoColumn?.nominal * 100,
|
||||
downloadKp: null,
|
||||
lastPaymentRub: last(columns?.sumWithVatColumn?.values) || 0,
|
||||
pi: columns?.piColumn.values[0] * 100,
|
||||
totalPayments: columns?.sumWithVatColumn?.values[0] - inputValues.subsidySum,
|
||||
};
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ export const OutputDataSchema = z.object({
|
||||
IRR_Perc: true,
|
||||
downloadKp: true,
|
||||
lastPaymentRub: true,
|
||||
pi: true,
|
||||
totalPayments: true,
|
||||
}),
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user