diff --git a/Components/Calculation/Form/Insurance/config.ts b/Components/Calculation/Form/Insurance/config.ts
index 655f0c2..933aaa9 100644
--- a/Components/Calculation/Form/Insurance/config.ts
+++ b/Components/Calculation/Form/Insurance/config.ts
@@ -1,15 +1,12 @@
-import type { FormComponentConfig } from '../../lib/renderFormComponent';
+import type { FormTabRows } from '../../lib/render-rows';
-const config: FormComponentConfig = {
- id: 'insurance',
- title: 'Страхование',
- rows: [
- [['tbxLeaseObjectYear', 'selectLeaseObjectUseFor', 'selectLegalClientRegion']],
- [['selectEngineType', 'tbxInsFranchise', 'selectLegalClientTown']],
- [['selectLeaseObjectCategory', 'tbxMileage', 'tbxINNForCalc']],
- [['tbxLeaseObjectMotorPower', 'cbxWithTrailer', 'selectGPSBrand']],
- [['tbxEngineVolume', 'cbxInsDecentral', 'selectGPSModel']],
- ],
-};
+export const id = 'insurance';
+export const title = 'Страхование';
-export default config;
+export const rows: FormTabRows = [
+ [['tbxLeaseObjectYear', 'selectLeaseObjectUseFor', 'selectLegalClientRegion']],
+ [['selectEngineType', 'tbxInsFranchise', 'selectLegalClientTown']],
+ [['selectLeaseObjectCategory', 'tbxMileage', 'tbxINNForCalc']],
+ [['tbxLeaseObjectMotorPower', 'cbxWithTrailer', 'selectGPSBrand']],
+ [['tbxEngineVolume', 'cbxInsDecentral', 'selectGPSModel']],
+];
diff --git a/Components/Calculation/Form/Insurance/index.jsx b/Components/Calculation/Form/Insurance/index.jsx
index 960d635..57009de 100644
--- a/Components/Calculation/Form/Insurance/index.jsx
+++ b/Components/Calculation/Form/Insurance/index.jsx
@@ -1,13 +1,13 @@
-import renderFormComponent from 'Components/Calculation/lib/renderFormComponent';
+import renderFormRows from 'Components/Calculation/lib/render-rows';
import { Flex } from 'UIKit/grid';
-import config from './config';
+import { id, rows, title } from './config';
function Insurance() {
- const rows = renderFormComponent(config);
+ const renderedRows = renderFormRows(rows);
return (
- {rows}
+ {renderedRows}
{/* TODO: add Insurance Table */}
{/* TODO: add FinGAP Table */}
@@ -15,7 +15,7 @@ function Insurance() {
}
export default {
- id: config.id,
- title: config.title,
+ id,
+ title,
Component: Insurance,
};
diff --git a/Components/Calculation/Form/Leasing/config.ts b/Components/Calculation/Form/Leasing/config.ts
index 3fe6526..c47402d 100644
--- a/Components/Calculation/Form/Leasing/config.ts
+++ b/Components/Calculation/Form/Leasing/config.ts
@@ -1,18 +1,15 @@
/* eslint-disable object-curly-newline */
-import type { FormComponentConfig } from '../../lib/renderFormComponent';
+import type { FormTabRows } from '../../lib/render-rows';
-const config: FormComponentConfig = {
- id: 'leasing',
- title: 'Лизинг',
- rows: [
- [['selectProduct'], { gridTemplateColumns: '1fr' }],
- [['tbxLeaseObjectPrice', 'tbxVATInLeaseObjectPrice', 'tbxLeaseObjectPriceWthtVAT']],
- [['selectSupplierCurrency', 'tbxSupplierDiscountRub', 'tbxSupplierDiscountPerc']],
- [['tbxFirstPaymentPerc', 'tbxFirstPaymentRub']],
- [['tbxLeasingPeriod', 'tbxSaleBonus', 'tbxRedemptionPaymentSum']],
- [['selectSubsidy', 'labelSubsidySum']],
- [['tbxLastPaymentPerc', 'tbxLastPaymentRub', 'radioLastPaymentRule']],
- ],
-};
+export const id = 'leasing';
+export const title = 'Лизинг';
-export default config;
+export const rows: FormTabRows = [
+ [['selectProduct'], { gridTemplateColumns: '1fr' }],
+ [['tbxLeaseObjectPrice', 'tbxVATInLeaseObjectPrice', 'tbxLeaseObjectPriceWthtVAT']],
+ [['selectSupplierCurrency', 'tbxSupplierDiscountRub', 'tbxSupplierDiscountPerc']],
+ [['tbxFirstPaymentPerc', 'tbxFirstPaymentRub']],
+ [['tbxLeasingPeriod', 'tbxSaleBonus', 'tbxRedemptionPaymentSum']],
+ [['selectSubsidy', 'labelSubsidySum']],
+ [['tbxLastPaymentPerc', 'tbxLastPaymentRub', 'radioLastPaymentRule']],
+];
diff --git a/Components/Calculation/Form/Leasing/index.jsx b/Components/Calculation/Form/Leasing/index.jsx
index e09823e..edd5281 100644
--- a/Components/Calculation/Form/Leasing/index.jsx
+++ b/Components/Calculation/Form/Leasing/index.jsx
@@ -1,12 +1,12 @@
-import renderFormComponent from 'Components/Calculation/lib/renderFormComponent';
-import config from './config';
+import renderFormRows from 'Components/Calculation/lib/render-rows';
+import { id, rows, title } from './config';
function Leasing() {
- return renderFormComponent(config);
+ return renderFormRows(rows);
}
export default {
- id: config.id,
- title: config.title,
+ id,
+ title,
Component: Leasing,
};
diff --git a/Components/Calculation/Form/LeasingObject/config.ts b/Components/Calculation/Form/LeasingObject/config.ts
index 6d84442..9865dd5 100644
--- a/Components/Calculation/Form/LeasingObject/config.ts
+++ b/Components/Calculation/Form/LeasingObject/config.ts
@@ -1,26 +1,23 @@
/* eslint-disable object-curly-newline */
-import type { FormComponentConfig } from '../../lib/renderFormComponent';
+import type { FormTabRows } from '../../lib/render-rows';
-const config: FormComponentConfig = {
- id: 'leasing-object',
- title: 'ПЛ',
- rows: [
- [
- ['selectLeaseObjectType', 'labelDepreciationGroup'],
- { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] },
- ],
- [['selectBrand', 'cbxLeaseObjectUsed'], { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] }],
- [['selectModel', 'cbxWithTrailer'], { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] }],
- [
- ['selectConfiguration', 'radioDeliveryTime'],
- { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] },
- ],
- [['selectLeaseObjectUseFor'], { gridTemplateColumns: '1fr' }],
- [['tbxLeaseObjectCount', 'selectEngineType', 'tbxMaxSpeed']],
- [['tbxLeaseObjectYear', 'tbxLeaseObjectMotorPower', 'tbxCountSeats']],
- [['selectLeaseObjectCategory', 'tbxEngineVolume', 'tbxMileage']],
- [['tbxMaxMass', 'tbxEngineHours']],
+export const id = 'leasing-object';
+export const title = 'ПЛ';
+
+export const rows: FormTabRows = [
+ [
+ ['selectLeaseObjectType', 'labelDepreciationGroup'],
+ { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] },
],
-};
-
-export default config;
+ [['selectBrand', 'cbxLeaseObjectUsed'], { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] }],
+ [['selectModel', 'cbxWithTrailer'], { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] }],
+ [
+ ['selectConfiguration', 'radioDeliveryTime'],
+ { gridTemplateColumns: ['1fr', '1fr', '2fr 1fr'] },
+ ],
+ [['selectLeaseObjectUseFor'], { gridTemplateColumns: '1fr' }],
+ [['tbxLeaseObjectCount', 'selectEngineType', 'tbxMaxSpeed']],
+ [['tbxLeaseObjectYear', 'tbxLeaseObjectMotorPower', 'tbxCountSeats']],
+ [['selectLeaseObjectCategory', 'tbxEngineVolume', 'tbxMileage']],
+ [['tbxMaxMass', 'tbxEngineHours']],
+];
diff --git a/Components/Calculation/Form/LeasingObject/index.jsx b/Components/Calculation/Form/LeasingObject/index.jsx
index a146f1e..7a42130 100644
--- a/Components/Calculation/Form/LeasingObject/index.jsx
+++ b/Components/Calculation/Form/LeasingObject/index.jsx
@@ -1,12 +1,12 @@
-import renderFormComponent from '../../lib/renderFormComponent';
-import config from './config';
+import renderFormRows from '../../lib/render-rows';
+import { id, rows, title } from './config';
function LeasingObject() {
- return renderFormComponent(config);
+ return renderFormRows(rows);
}
export default {
- id: config.id,
- title: config.title,
+ id,
+ title,
Component: LeasingObject,
};
diff --git a/Components/Calculation/Form/Payments/config.ts b/Components/Calculation/Form/Payments/config.ts
index f97137c..e95a193 100644
--- a/Components/Calculation/Form/Payments/config.ts
+++ b/Components/Calculation/Form/Payments/config.ts
@@ -1,5 +1,4 @@
-/* eslint-disable import/prefer-default-export */
-import type { ElementsRow } from '../../lib/renderFormComponent';
+import type { ElementsRow } from '../../lib/render-rows';
export const id = 'payments';
export const title = 'Платежи';
diff --git a/Components/Calculation/Form/SupplierAgent/config.ts b/Components/Calculation/Form/SupplierAgent/config.ts
index f46babc..3c7ce30 100644
--- a/Components/Calculation/Form/SupplierAgent/config.ts
+++ b/Components/Calculation/Form/SupplierAgent/config.ts
@@ -1,51 +1,45 @@
/* eslint-disable object-curly-newline */
-import type { FormComponentConfig } from '../../lib/renderFormComponent';
+import type { FormTabRows } from '../../lib/render-rows';
-const config: FormComponentConfig = {
- id: 'supplier-agent',
- title: 'Поставщик/агент',
- rows: [
- { title: 'Поставщик предмета лизинга' },
- [['selectDealer'], { gridTemplateColumns: '1fr' }],
- [
- ['selectDealerPerson', 'selectDealerBroker'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
- [
- ['selectDealerRewardCondition', 'selectDealerBrokerRewardCondition'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
- [
- ['tbxDealerRewardSumm', 'tbxDealerBrokerRewardSumm'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
+export const id = 'supplier-agent';
+export const title = 'Поставщик/агент';
- { title: 'Агент, передавший контакт' },
- [
- ['selectIndAgent', 'selectCalcDoubleAgent'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
- [
- ['selectIndAgentRewardCondition', 'selectCalcDoubleAgentRewardCondition'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
- [
- ['tbxIndAgentRewardSumm', 'tbxCalcDoubleAgentRewardSumm'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
- [
- ['selectCalcBroker', 'selectCalcFinDepartment'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
- [
- ['selectCalcBrokerRewardCondition', 'selectFinDepartmentRewardCondtion'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
- [
- ['tbxCalcBrokerRewardSum', 'tbxFinDepartmentRewardSumm'],
- { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
- ],
+export const rows: FormTabRows = [
+ { title: 'Поставщик предмета лизинга' },
+ [['selectDealer'], { gridTemplateColumns: '1fr' }],
+ [
+ ['selectDealerPerson', 'selectDealerBroker'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
+ ],
+ [
+ ['selectDealerRewardCondition', 'selectDealerBrokerRewardCondition'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
+ ],
+ [
+ ['tbxDealerRewardSumm', 'tbxDealerBrokerRewardSumm'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
],
-};
-export default config;
+ { title: 'Агент, передавший контакт' },
+ [['selectIndAgent', 'selectCalcDoubleAgent'], { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] }],
+ [
+ ['selectIndAgentRewardCondition', 'selectCalcDoubleAgentRewardCondition'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
+ ],
+ [
+ ['tbxIndAgentRewardSumm', 'tbxCalcDoubleAgentRewardSumm'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
+ ],
+ [
+ ['selectCalcBroker', 'selectCalcFinDepartment'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
+ ],
+ [
+ ['selectCalcBrokerRewardCondition', 'selectFinDepartmentRewardCondtion'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
+ ],
+ [
+ ['tbxCalcBrokerRewardSum', 'tbxFinDepartmentRewardSumm'],
+ { gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'] },
+ ],
+];
diff --git a/Components/Calculation/Form/SupplierAgent/index.jsx b/Components/Calculation/Form/SupplierAgent/index.jsx
index ba328a3..51a59fc 100644
--- a/Components/Calculation/Form/SupplierAgent/index.jsx
+++ b/Components/Calculation/Form/SupplierAgent/index.jsx
@@ -1,12 +1,12 @@
-import renderFormComponent from '../../lib/renderFormComponent';
-import config from './config';
+import renderFormRows from '../../lib/render-rows';
+import { id, rows, title } from './config';
function Leasing() {
- return renderFormComponent(config);
+ return renderFormRows(rows);
}
export default {
- id: config.id,
- title: config.title,
+ id,
+ title,
Component: Leasing,
};
diff --git a/Components/Calculation/lib/renderFormComponent.tsx b/Components/Calculation/lib/render-rows.tsx
similarity index 84%
rename from Components/Calculation/lib/renderFormComponent.tsx
rename to Components/Calculation/lib/render-rows.tsx
index b7fce07..560ecb4 100644
--- a/Components/Calculation/lib/renderFormComponent.tsx
+++ b/Components/Calculation/lib/render-rows.tsx
@@ -12,14 +12,10 @@ export type ElementsRow = [
];
type DividerRow = { title: string };
-export type FormComponentConfig = {
- id: string;
- title: string;
- rows: Array;
-};
+export type FormTabRows = Array;
-function renderFormComponent(config: FormComponentConfig) {
- const rows = config.rows.map((row, i) => {
+function renderFormRows(rowsConfig: FormTabRows) {
+ const rows = rowsConfig.map((row, i) => {
if (Array.isArray(row)) {
const [elements, style] = row;
const renderedElements = elements.map((elementName) => {
@@ -61,4 +57,4 @@ function renderFormComponent(config: FormComponentConfig) {
);
}
-export default renderFormComponent;
+export default renderFormRows;