This repository has been archived on 2025-05-09. You can view files and clone it, but cannot push or open issues or pull requests.

365 lines
6.7 KiB
TypeScript

import { ElementProps } from 'core/types/Calculation/components';
import {
TElements,
ResultElementsNames,
} from 'core/types/Calculation/Store/elements';
import { round } from 'lodash';
import {
validateEmail,
validateInn,
validateKpp,
validatePhone,
} from 'core/tools/validate';
import { DownloadOutlined } from '@ant-design/icons';
const elementsProps: TElements<ElementProps> = {
selectChannel: {
showSearch: true,
},
selectAccount: {
showSearch: true,
},
tbxINN: {
validation: {
errorMessage: 'Некорректный ИНН',
validator: validateInn,
},
},
tbxKPP: {
validation: {
errorMessage: 'Некорректный КПП',
validator: validateKpp,
},
},
selectContactClient: {
showSearch: true,
},
radioContactGender: {
style: 'button',
},
tbxPhoneNumber: {
type: 'tel',
validation: {
errorMessage: 'Некорректный номер телефона',
validator: validatePhone,
},
//TODO: mask + 7(999) 999 99 99
},
tbxEmailAddress: {
type: 'email',
//TODO email mask
validation: {
errorMessage: 'Некорректный E-mail',
validator: validateEmail,
},
},
selectSupplier: {
showSearch: true,
},
selectFinDepartment: {
showSearch: false,
},
selectBroker: {
showSearch: false,
},
selectAgent: {
showSearch: true,
},
selectDoubleAgent: {
showSearch: true,
},
btnCreateLead: {
type: 'primary',
text: 'Создать интерес',
},
tbxLeaseObjectPrice: {
min: '10000',
max: '1000000000',
step: '10000.00',
precision: 2,
},
tbxSupplierDiscountRub: {
// TODO formatter + rub, parser
min: '0',
max: '1000000000',
step: '10000.00',
precision: 2,
},
tbxSupplierDiscountPerc: {
// TODO formatter + %, parser
min: '0',
max: '100',
precision: 2,
},
radioBalanceHolder: {
style: 'button',
},
tbxSaleBonus: {
min: '0.00',
// max: '1.30',
step: '0.1',
precision: 2,
},
tbxFirstPaymentPerc: {
min: '0',
max: '50',
precision: 2,
},
tbxFirstPaymentRub: {
min: '0',
max: '1000000000',
step: '10000.00',
precision: 2,
},
radioLastPaymentRule: {
style: 'button',
},
tbxLastPaymentPerc: {
min: '0',
max: '15',
step: '1.000000',
},
tbxLastPaymentRub: {
min: '0',
max: '1000000000',
step: '10000.00',
},
tbxLeasingPeriod: {
min: '7',
max: '60',
},
tbxParmentsDecreasePercent: {
// TODO: formatter, parser: %
min: '50',
max: '99',
},
radioSeasonType: {
style: 'button',
},
tbxComissionPerc: {
min: '0',
max: '100',
},
tbxComissionRub: {
min: '0',
max: '1000000000',
step: '10000.00',
},
selectLeaseObjectType: {
showSearch: true,
},
selectBrand: {
showSearch: true,
},
selectModel: {
showSearch: true,
},
selectConfiguration: {
showSearch: true,
},
radioDeliveryTime: {
showSearch: false,
style: 'button',
},
tbxLeaseObjectCount: {
min: '1',
max: '1000',
},
selectLeaseObjectUseFor: {
showSearch: true,
},
tbxLeaseObjectYear: {
min: '1994',
max: new Date().getUTCFullYear() + 1,
},
selectLeaseObjectCategory: {
showSearch: false,
},
selectEngineType: {
showSearch: true,
},
tbxLeaseObjectMotorPower: {
min: '0.00',
max: '20000.00',
step: '10.00',
},
tbxEngineVolume: {
min: '0.00',
max: '20000.00',
step: '0.50',
},
tbxMaxMass: {
min: '0',
max: '999999',
step: '100',
},
tbxCountSeats: {
min: '0',
max: '2000',
},
tbxMaxSpeed: {
min: '0',
max: '2000',
},
selectDealer: {
showSearch: true,
},
tbxDealerRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
},
tbxDealerBrokerRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
},
tbxIndAgentRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
},
tbxCalcDoubleAgentRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
},
tbxCalcBrokerRewardSum: {
min: '0.0',
max: '20.0',
step: '0.1',
},
tbxFinDepartmentRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
},
radioInsKaskoType: {
style: 'button',
},
tbxInsFranchise: {
min: '0',
max: '75000',
step: '10000.00',
},
btnInsCalculation: {
type: 'primary',
text: 'Запрос расчета страховки',
},
btnFranschise: {
type: 'ghost',
text: 'Заявление на франшизу',
},
tbxInsAgeDrivers: {
min: '18',
max: '99',
},
tbxInsExpDrivers: {
min: '0',
max: '99',
},
btnDriversApplication: {
type: 'ghost',
text: 'Заявление на ограничения по водителям',
},
selectRegionRegistration: {
showSearch: true,
},
selectTownRegistration: {
showSearch: true,
},
radioRequirementTelematic: {
style: 'button',
},
radioQuoteContactGender: {
style: 'button',
},
btnCreateKP: {
type: 'primary',
text: 'Создать КП',
},
tbxCreditRate: {
min: '0.00',
max: '99.99',
step: '0.1',
},
tbxMaxPriceChange: {
min: '0',
max: '1000000000',
step: '10000.00',
},
tbxImporterRewardPerc: {
min: '0.00',
max: '99.99',
step: '0.1',
},
tbxImporterRewardRub: {
min: '0',
max: '1000000000',
step: '10000.00',
},
selectLead: {
showSearch: true,
},
selectOpportunity: {
showSearch: true,
},
selectQuote: {
showSearch: true,
},
btnCalculate: {
text: 'Рассчитать график',
type: 'primary',
},
tbxIRR_Perc: {
min: '0.0000',
max: '500.0000',
step: '0.0001',
},
linkDownloadKp: {
type: 'primary',
text: 'Скачать КП',
icon: DownloadOutlined,
},
tbxMileage: {
min: 0,
step: 100,
precision: 2,
},
cbxRecalcWithRevision: {
text: 'Пересчет без пересмотра',
containerStyle: {
marginBottom: '8px',
},
},
};
const resultElementsProps: TElements<ElementProps> = [
'labelResultTotalGraphwithNDS',
'labelResultPlPrice',
'labelResultPriceUpPr',
'labelResultIRRGraphPerc',
'labelResultIRRNominalPerc',
'labelResultInsKasko',
'labelResultInsOsago',
'labelResultDopProdSum',
'labelResultFirstPayment',
'labelResultLastPayment',
'labelResultTerm',
'labelResultAB_FL',
'labelResultAB_UL',
'labelResultBonusMPL',
'labelResultDopMPLLeasing',
'labelResultBonusDopProd',
].reduce(
(ac, a) => ({
...ac,
[a]: { middleware: value => value && round(value, 2).toFixed(2) },
}),
{},
);
export default Object.assign(elementsProps, resultElementsProps);