diff --git a/src/client/Components/Calculation/ELT/Content/Components/Controls/BottomControls.jsx b/src/client/Components/Calculation/ELT/Content/Components/Controls/BottomControls.jsx
new file mode 100644
index 0000000..e486652
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/Components/Controls/BottomControls.jsx
@@ -0,0 +1,33 @@
+import { message } from 'antd';
+import Button from 'client/Elements/Button';
+import { useStores } from 'client/hooks/useStores';
+import { Process } from 'core/types/Calculation/Store/process';
+import { ElementStatus } from 'core/types/statuses';
+
+const BottomControls = ({ insType, onSelectRow, selectedKey }) => {
+ const { calculationStore } = useStores();
+ const { ELTStore } = calculationStore.stores;
+ const handleSelectRow = () => {
+ const { calculationProcess } = calculationStore.stores;
+ calculationProcess.addProcess(Process.ELT);
+ ELTStore[insType].setKey(selectedKey);
+ onSelectRow.call(calculationStore, insType, selectedKey);
+ calculationProcess.deleteProcess(Process.ELT);
+
+ message.success({ content: 'Выбранный расчет ЭЛТ применен' });
+ };
+
+ return (
+
+ );
+};
+
+export default BottomControls;
diff --git a/src/client/Components/Calculation/ELT/Content/Components/Controls/TopControls.jsx b/src/client/Components/Calculation/ELT/Content/Components/Controls/TopControls.jsx
new file mode 100644
index 0000000..bd32e19
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/Components/Controls/TopControls.jsx
@@ -0,0 +1,62 @@
+import ReloadOutlined from '@ant-design/icons/lib/icons/ReloadOutlined';
+import { getTitle } from 'client/Containers/Calculation/lib/elements/tools';
+import Button from 'client/Elements/Button';
+import { openNotification } from 'client/Elements/Notification';
+import { PrimaryText } from 'client/Elements/Text';
+import { useStores } from 'client/hooks/useStores';
+import { Flex } from 'client/UIKit/grid';
+import { ElementStatus } from 'core/types/statuses';
+import { useState } from 'react';
+import { resetIns } from '../../lib/resetIns';
+import { validate } from '../../lib/validation';
+
+const TopControls = ({ title, insType, fetchData, requiredFields }) => {
+ const [isPending, setIsPending] = useState(false);
+ const { calculationStore } = useStores();
+
+ function getMissingFields() {
+ const missingFields = validate.call(calculationStore, requiredFields);
+ if (missingFields && missingFields.length > 0) {
+ const elementsNames = missingFields.map(fieldName => getTitle(fieldName));
+ return elementsNames;
+ }
+ }
+
+ const handleGetData = () => {
+ const missingFieldsTitles = getMissingFields();
+ if (missingFieldsTitles && missingFieldsTitles.length > 0) {
+ const message = String.prototype.concat(
+ 'Не заполнены поля: ',
+ missingFieldsTitles.join(', '),
+ );
+ openNotification({
+ type: 'error',
+ title: 'Ошибка во время расчета ЭЛТ',
+ description: message,
+ })();
+ return;
+ }
+
+ resetIns.call(calculationStore, insType);
+ setIsPending(true);
+ fetchData.call(calculationStore).finally(
+ setTimeout(() => {
+ setIsPending(false);
+ }, 1500),
+ );
+ };
+
+ return (
+
+ {title}
+ }
+ />
+
+ );
+};
+
+export default TopControls;
diff --git a/src/client/Components/Calculation/ELT/Content/Components/Controls/index.js b/src/client/Components/Calculation/ELT/Content/Components/Controls/index.js
new file mode 100644
index 0000000..2e18d6f
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/Components/Controls/index.js
@@ -0,0 +1,4 @@
+import BottomControls from './BottomControls';
+import TopControls from './TopControls';
+
+export { BottomControls, TopControls };
diff --git a/src/client/Components/Calculation/ELT/Content/Components/InsContent.jsx b/src/client/Components/Calculation/ELT/Content/Components/InsContent.jsx
deleted file mode 100644
index d18cb6a..0000000
--- a/src/client/Components/Calculation/ELT/Content/Components/InsContent.jsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import Alert from 'client/Elements/Alert';
-import { useStores } from 'client/hooks/useStores';
-import { useEffect, useState } from 'react';
-import { getFieldsNames, validate } from '../lib/validation';
-import InsTable from './InsTable';
-import Controls from './TableControls';
-
-export default ({
- title,
- insType,
- getData,
- onSelectRow,
- requiredFields,
- ...tableProps
-}) => props => {
- const { calculationStore } = useStores();
- const { ELTStore } = calculationStore.stores;
- const [selectedKey, selectKey] = useState('');
- const [alert, setAlert] = useState({
- message: undefined,
- type: undefined,
- });
- const [isPending, setIsPending] = useState(false);
-
- useEffect(() => {
- selectKey(ELTStore[insType].selectedKey);
- }, []);
-
- const handleGetData = () => {
- const missingFields = validate.call(calculationStore, requiredFields);
- if (missingFields && missingFields.length > 0) {
- const fieldsNames = getFieldsNames(missingFields);
- const msgText = String.prototype.concat(
- 'Не заполнены поля: ',
- fieldsNames.join(', '),
- );
- setAlert({ message: msgText, type: 'error' });
- return;
- } else {
- setAlert({ message: undefined, type: undefined });
- }
-
- setIsPending(true);
- const resetPending = () => setIsPending(false);
- getData.call(calculationStore, resetPending);
- };
-
- const handleSelectRow = () => {
- ELTStore[insType].setKey(selectedKey);
- onSelectRow.call(calculationStore, insType, selectedKey);
- setAlert({ message: 'Выбранные параметры сохранены', type: 'success' });
- setTimeout(() => {
- setAlert({ message: undefined, type: undefined });
- }, 2500);
- };
-
- return (
-
- {alert.message && }
-
-
- );
-};
diff --git a/src/client/Components/Calculation/ELT/Content/Components/InsTable.tsx b/src/client/Components/Calculation/ELT/Content/Components/InsTable.tsx
index 0621b60..c3269cf 100644
--- a/src/client/Components/Calculation/ELT/Content/Components/InsTable.tsx
+++ b/src/client/Components/Calculation/ELT/Content/Components/InsTable.tsx
@@ -1,39 +1,51 @@
+//@ts-nocheck
import { Table as AntTable, TableProps } from 'antd';
+import { useStores } from 'client/hooks/useStores';
import { Box } from 'client/UIKit/grid';
+import mq from 'client/UIKit/mq';
import { toJS } from 'mobx';
import { observer } from 'mobx-react-lite';
-import React from 'react';
+import React, { useEffect } from 'react';
import styled from 'styled-components';
const TableWrapper = styled(Box)`
- .ant-table-row-level-1 .ant-table-selection-column {
- visibility: hidden;
- }
+ height: 100%;
+ overflow-x: scroll;
+ ${mq.laptop`
+overflow-x: hidden;
+`}
+ margin-bottom: 5px;
`;
interface ITableProps {
+ insType: string;
selectKey: (key: string) => void;
selectedKey: string;
tableConfig: TableProps;
- dataSource: any[];
}
-export default observer(
- ({ selectKey, selectedKey, tableConfig, dataSource, ...props }) => {
- return (
-
- {
- selectKey(record.key);
- },
- })}
- dataSource={toJS(dataSource)}
- {...props}
- >
-
- );
- },
-) as React.FC;
+export default observer(({ insType, selectKey, selectedKey, tableConfig }) => {
+ const { calculationStore } = useStores();
+ const { ELTStore } = calculationStore.stores;
+
+ // update parent selectedKey from store (when reset)
+ const storeSelectedKey = ELTStore[insType].selectedKey;
+ useEffect(() => {
+ selectKey(storeSelectedKey);
+ }, [storeSelectedKey]);
+
+ return (
+
+ {
+ selectKey(record.key);
+ },
+ })}
+ dataSource={toJS(ELTStore[insType].list)}
+ >
+
+ );
+}) as React.FC;
diff --git a/src/client/Components/Calculation/ELT/Content/Components/TableControls.jsx b/src/client/Components/Calculation/ELT/Content/Components/TableControls.jsx
deleted file mode 100644
index 656583a..0000000
--- a/src/client/Components/Calculation/ELT/Content/Components/TableControls.jsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import ReloadOutlined from '@ant-design/icons/lib/icons/ReloadOutlined';
-import Button from 'client/Elements/Button';
-import { PrimaryText } from 'client/Elements/Text';
-import { Flex } from 'client/UIKit/grid';
-import { ElementStatus } from 'core/types/statuses';
-import styled from 'styled-components';
-
-const TopControls = ({ title, getData, isLoading }) => (
-
- {title}
- }
- />
-
-);
-
-const BottomControls = ({ selectRow }) => (
-
-);
-
-const ContentWrapper = styled(Flex)`
- width: 550px !important;
-`;
-
-export default ({ children, ...props }) => (
-
-
- {children}
-
-
-);
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/Kasko.stories.jsx b/src/client/Components/Calculation/ELT/Content/Kasko/Kasko.stories.jsx
index d6650b3..c4ebe16 100644
--- a/src/client/Components/Calculation/ELT/Content/Kasko/Kasko.stories.jsx
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/Kasko.stories.jsx
@@ -1,5 +1,5 @@
import InsTable from '../InsTable';
-import tableConfig from '../lib/config';
+import tableConfig from '../lib/config/table';
export default {
title: 'Components/Calculation/ELT/Kasko',
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/index.jsx b/src/client/Components/Calculation/ELT/Content/Kasko/index.jsx
index 5d26e12..7b9a425 100644
--- a/src/client/Components/Calculation/ELT/Content/Kasko/index.jsx
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/index.jsx
@@ -1,17 +1,17 @@
-import InsContent from '../Components/InsContent';
-import tableConfig from '../lib/config';
-import getData from '../lib/getData';
+import buildELTContent from '../build';
+import { fetchData } from '../lib/requests';
import composeRequest from './lib/composeRequest';
+import tableConfig from './lib/config';
import convertEltResult from './lib/convertEltResult';
import onSelectRow from './lib/onSelectRow';
import { requiredFields } from './lib/validation';
const insType = 'kasko';
-export default InsContent({
+export default buildELTContent({
title: 'КАСКО',
insType,
- getData: getData(insType, composeRequest, convertEltResult),
+ fetchData: fetchData(insType, composeRequest, convertEltResult),
onSelectRow,
tableConfig,
requiredFields,
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts
index 2ab8f07..d14ff8c 100644
--- a/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts
@@ -1,6 +1,6 @@
import { currentDate } from 'core/tools/date';
import { ICalculationStore } from 'core/types/Calculation/Store/index';
-import { isNull } from 'lodash';
+import { get, isNull } from 'lodash';
const mapEngineType = {
100000000: '0',
@@ -37,8 +37,9 @@ const mapCategory = {
const getSpecified = value => !isNull(value);
export default function (this: ICalculationStore) {
- const regionName = this.getOption('selectRegionRegistration')?.evo_name;
- const cityName = this.getOption('selectTownRegistration')?.evo_name;
+ const region = this.getOption('selectRegionRegistration');
+ const city = this.getOption('selectTownRegistration');
+ const kladr = get(city, 'evo_kladr_id') || get(region, 'evo_kladr_id');
const brandId = this.getOption('selectBrand')?.evo_id;
const modelId = this.getOption('selectModel')?.evo_id;
@@ -57,7 +58,7 @@ export default function (this: ICalculationStore) {
const cost =
this.getValue('leaseObjectPrice') - this.getValue('supplierDiscountRub');
- const franchise = this.getValue('insFranchise');
+ const franchise = parseInt(this.getValue('insFranchise') || 0);
const franchiseSpecified = getSpecified(franchise);
const puuMark = this.getOption('selectGPSBrand')?.evo_id;
const puuModel = this.getOption('selectGPSModel')?.evo_id;
@@ -108,19 +109,11 @@ export default function (this: ICalculationStore) {
? '11635'
: '0';
- const globalLimitSum = this.getTableRowValues('tableInsurance', 2, 'value')
- .insCost
- ? 1000000
- : 0;
- const globalLimitSumSpecified = getSpecified(globalLimitSum);
- const limitSumId = globalLimitSum + '';
-
- const INN = this.getValue('INNForCalc') || '' + '';
+ const INN = `${this.getValue('INNForCalc')}`;
return {
preparams: {
- regionName,
- cityName,
+ kladr,
brandId,
modelId,
},
@@ -170,8 +163,6 @@ export default function (this: ICalculationStore) {
classification,
},
drivers: [{ age, experience, sex, sexSpecified }],
- GO: { limitSumId, globalLimitSum, globalLimitSumSpecified },
- NS: { LimitSum: '1000000' },
Insurer: {
SubjectType: 1,
SubjectTypeSpecified: true,
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/config/columns.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/config/columns.ts
new file mode 100644
index 0000000..7485c9a
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/config/columns.ts
@@ -0,0 +1,23 @@
+import { formatMoney } from 'core/tools/format';
+
+const columns: { title: string; dataIndex: string; [key: string]: any }[] = [
+ {
+ title: 'Страховая компания',
+ dataIndex: 'name',
+ },
+ {
+ title: 'Сумма',
+ dataIndex: 'kaskoSum',
+ //@ts-ignore
+ sorter: (a, b) => a.kaskoSum || 0 - b.kaskoSum || 0,
+ sortDirections: ['descend', 'ascend'],
+ render: value => formatMoney(value, 'RUB'),
+ },
+ {
+ title: 'Франшиза',
+ dataIndex: 'totalFranchise',
+ render: value => formatMoney(value, 'RUB'),
+ },
+];
+
+export default columns;
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/config/index.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/config/index.ts
new file mode 100644
index 0000000..6cbcbbf
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/config/index.ts
@@ -0,0 +1,4 @@
+import tableConfig from '../../../lib/config/table';
+import columns from './columns';
+
+export default { columns, ...tableConfig };
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/convertEltResult.js b/src/client/Components/Calculation/ELT/Content/Kasko/lib/convertEltResult.js
index 8e73af2..e9d6734 100644
--- a/src/client/Components/Calculation/ELT/Content/Kasko/lib/convertEltResult.js
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/convertEltResult.js
@@ -1,21 +1,6 @@
import { get, pick } from 'lodash';
-const mapKaskoSums = [
- {
- sumTitle: 'КАСКО',
- sumPath: 'paymentPeriods[0].kaskoSum',
- },
- {
- sumTitle: 'ДГО',
- sumPath: 'paymentPeriods[0].goSum',
- },
- {
- sumTitle: 'НС',
- sumPath: 'paymentPeriods[0].nsSum',
- },
-];
-
-export default function (resultCompany, key) {
+export default function (resultCompany, key, { leasingPeriod }) {
if (!resultCompany || Object.keys(resultCompany).length === 0) {
return;
}
@@ -25,23 +10,17 @@ export default function (resultCompany, key) {
['message', 'requestId', 'skCalcId'],
'',
);
- const sumsFromResult = Object.fromEntries(
- ['kaskoSum', 'goSum', 'nsSum', 'premiumSum'].map(x => [
- x,
- get(resultCompany, 'paymentPeriods[0].' + x, 0),
- ]),
- );
+
+ const sumsFromResult = pick(resultCompany, ['totalFranchise'], 0);
+
+ const kaskoSumSource =
+ leasingPeriod < 16 ? 'kaskoSum' : 'paymentPeriods[0].kaskoSum';
+ const kaskoSum = get(resultCompany, kaskoSumSource, 0);
return {
key,
- sumType: 'premiumSum',
- sumTitle: 'Премия по договору',
...dataFromResult,
...sumsFromResult,
- children: mapKaskoSums.map(({ sumPath, ...x }) => ({
- key,
- ...x,
- premiumSum: get(resultCompany, sumPath, 0),
- })),
+ kaskoSum,
};
}
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts
index df7c96f..62428c9 100644
--- a/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts
@@ -8,7 +8,10 @@ export default function (
const selectedRow = this.stores.ELTStore[insType].list.find(
x => x.key === selectedKey,
);
- const { accountid, kaskoSum, goSum, nsSum } = selectedRow;
+ const { accountid, kaskoSum, totalFranchise } = selectedRow;
+
+ this.setValue('insFranchise', totalFranchise);
+
this.setTableRows(
'tableInsurance',
1,
@@ -19,17 +22,17 @@ export default function (
},
insCost: { value: kaskoSum },
},
- {
- insuranceCompany: {
- value: accountid,
- },
- insCost: { value: goSum },
- },
- {
- insuranceCompany: {
- value: accountid,
- },
- insCost: { value: nsSum },
- },
+ // {
+ // insuranceCompany: {
+ // value: accountid,
+ // },
+ // insCost: { value: goSum },
+ // },
+ // {
+ // insuranceCompany: {
+ // value: accountid,
+ // },
+ // insCost: { value: nsSum },
+ // },
]);
}
diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts
index 223ed45..b9561d6 100644
--- a/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts
+++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts
@@ -5,9 +5,15 @@ export const requiredFields: ElementsNames[] = [
'selectTownRegistration',
'selectBrand',
'selectModel',
+ 'cbxLeaseObjectUsed',
'tbxLeaseObjectYear',
'tbxLeaseObjectMotorPower',
+ 'selectEngineType',
'tbxLeasingPeriod',
'tbxLeaseObjectPrice',
+ 'tbxSupplierDiscountRub',
+ 'tbxInsFranchise',
'selectLeaseObjectCategory',
+ 'selectLeaseObjectUseFor',
+ 'tbxINNForCalc',
];
diff --git a/src/client/Components/Calculation/ELT/Content/Osago/index.jsx b/src/client/Components/Calculation/ELT/Content/Osago/index.jsx
index 8d384cd..aca7123 100644
--- a/src/client/Components/Calculation/ELT/Content/Osago/index.jsx
+++ b/src/client/Components/Calculation/ELT/Content/Osago/index.jsx
@@ -1,17 +1,17 @@
-import InsContent from '../Components/InsContent';
-import tableConfig from '../lib/config';
-import getData from '../lib/getData';
+import buildELTContent from '../build';
+import { fetchData } from '../lib/requests';
import composeRequest from './lib/composeRequest';
+import tableConfig from './lib/config';
import convertEltResult from './lib/convertEltResult';
import onSelectRow from './lib/onSelectRow';
import { requiredFields } from './lib/validation';
const insType = 'osago';
-export default InsContent({
+export default buildELTContent({
title: 'ОСАГО',
insType,
- getData: getData(insType, composeRequest, convertEltResult),
+ fetchData: fetchData(insType, composeRequest, convertEltResult),
onSelectRow,
tableConfig,
requiredFields,
diff --git a/src/client/Components/Calculation/ELT/Content/Osago/lib/composeRequest.ts b/src/client/Components/Calculation/ELT/Content/Osago/lib/composeRequest.ts
index 988b755..cde4973 100644
--- a/src/client/Components/Calculation/ELT/Content/Osago/lib/composeRequest.ts
+++ b/src/client/Components/Calculation/ELT/Content/Osago/lib/composeRequest.ts
@@ -1,6 +1,6 @@
import { currentDate } from 'core/tools/date';
import { ICalculationStore } from 'core/types/Calculation/Store';
-import { isNull } from 'lodash';
+import { get, isNull } from 'lodash';
const mapCategory = {
100000000: 'A',
@@ -11,7 +11,7 @@ const mapCategory = {
};
const mapSubCategoryBuilder = (leaseObjectUseFor, maxMass, countSeats) => ({
- 100000000: () => '0',
+ 100000000: '0',
100000001: () => {
if (leaseObjectUseFor === 100000001) {
return '11';
@@ -39,8 +39,9 @@ const mapSubCategoryBuilder = (leaseObjectUseFor, maxMass, countSeats) => ({
const getSpecified = value => !isNull(value);
export default function (this: ICalculationStore) {
- const regionName = this.getOption('selectRegionRegistration')?.evo_name;
- const cityName = this.getOption('selectTownRegistration')?.evo_name;
+ const region = this.getOption('selectRegionRegistration');
+ const city = this.getOption('selectTownRegistration');
+ const kladr = get(city, 'evo_kladr_id') || get(region, 'evo_kladr_id');
const brandId = this.getOption('selectBrand')?.evo_id;
const modelId = this.getOption('selectModel')?.evo_id;
@@ -54,19 +55,20 @@ export default function (this: ICalculationStore) {
: '0';
let category = '0';
- if (Object.keys(mapCategory).includes(leaseObjectCategory)) {
- category = mapCategory[leaseObjectCategory];
+ if (Object.keys(mapCategory).includes(`${leaseObjectCategory}`)) {
+ category = mapCategory[`${leaseObjectCategory}`];
}
const leaseObjectUseFor = this.getValue('leaseObjectUseFor');
const maxMass = this.getValue('maxMass');
const countSeats = this.getValue('countSeats');
+
const mapSubCategory = mapSubCategoryBuilder(
leaseObjectUseFor,
maxMass,
countSeats,
);
- const subCategory = mapSubCategory[leaseObjectCategory];
+ const subCategory = mapSubCategory[leaseObjectCategory]();
let seatingCapacity = 0;
if (leaseObjectCategory === 100000003) {
@@ -87,13 +89,11 @@ export default function (this: ICalculationStore) {
resident: 1,
country: 'Российская Федерация',
region: 'Москва',
- district: '0',
+ // district: '0',
city: 'Москва',
cityKladr: '7700000000000',
street: 'ул. Котляковская',
- streetKladr: '0',
house: '8',
- korpus: '0',
flat: '337',
};
@@ -106,19 +106,27 @@ export default function (this: ICalculationStore) {
factAddress: address,
phone: '8 (800) 333-75-75',
email: 'client@evoleasing.ru',
+ subjectType: 1,
+ subjectTypeSpecified: true,
+ opf: 1,
+ opfSpecified: true,
};
return {
preparams: {
- regionName,
- cityName,
+ kladr,
brandId,
modelId,
},
ELTParams: {
+ driversCount: 0,
tsToRegistrationPlace: 0,
contractBeginDate: currentDate,
duration: 12,
+ insurerType: 1,
+ ownerType: 1,
+ contractOptionId: 1,
+ contractStatusId: 13,
carInfo: {
mark,
model,
@@ -126,10 +134,6 @@ export default function (this: ICalculationStore) {
vehiclePower,
tsType: { category, subCategory },
vehicle: {
- regNumber: '0',
- bodyNumber: '0',
- chassisNumber: '0',
- VIN: '0',
seatingCapacity,
seatingCapacitySpecified,
maxAllowedMass,
diff --git a/src/client/Components/Calculation/ELT/Content/lib/config/columns.ts b/src/client/Components/Calculation/ELT/Content/Osago/lib/config/columns.ts
similarity index 50%
rename from src/client/Components/Calculation/ELT/Content/lib/config/columns.ts
rename to src/client/Components/Calculation/ELT/Content/Osago/lib/config/columns.ts
index 2450641..d4c2901 100644
--- a/src/client/Components/Calculation/ELT/Content/lib/config/columns.ts
+++ b/src/client/Components/Calculation/ELT/Content/Osago/lib/config/columns.ts
@@ -1,20 +1,17 @@
-export type KaskoDataNames = 'name' | 'sumTitle' | 'premiumSum';
+import { formatMoney } from 'core/tools/format';
-const columns: { title: string; dataIndex: KaskoDataNames }[] = [
+const columns: { title: string; dataIndex: string; [key: string]: any }[] = [
{
title: 'Страховая компания',
dataIndex: 'name',
},
- {
- title: '',
- dataIndex: 'sumTitle',
- },
{
title: 'Сумма',
dataIndex: 'premiumSum',
//@ts-ignore
- sorter: (a, b) => a.premiumSum - b.premiumSum,
+ sorter: (a, b) => a.premiumSum || 0 - b.premiumSum || 0,
sortDirections: ['descend', 'ascend'],
+ render: value => formatMoney(value),
},
];
diff --git a/src/client/Components/Calculation/ELT/Content/Osago/lib/config/index.ts b/src/client/Components/Calculation/ELT/Content/Osago/lib/config/index.ts
new file mode 100644
index 0000000..6cbcbbf
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/Osago/lib/config/index.ts
@@ -0,0 +1,4 @@
+import tableConfig from '../../../lib/config/table';
+import columns from './columns';
+
+export default { columns, ...tableConfig };
diff --git a/src/client/Components/Calculation/ELT/Content/Osago/lib/validation.ts b/src/client/Components/Calculation/ELT/Content/Osago/lib/validation.ts
index 223ed45..fc43ff6 100644
--- a/src/client/Components/Calculation/ELT/Content/Osago/lib/validation.ts
+++ b/src/client/Components/Calculation/ELT/Content/Osago/lib/validation.ts
@@ -9,5 +9,10 @@ export const requiredFields: ElementsNames[] = [
'tbxLeaseObjectMotorPower',
'tbxLeasingPeriod',
'tbxLeaseObjectPrice',
+ 'selectLeaseObjectUseFor',
+ 'tbxMaxMass',
+ 'tbxCountSeats',
+ 'cbxWithTrailer',
'selectLeaseObjectCategory',
+ 'tbxINNForCalc',
];
diff --git a/src/client/Components/Calculation/ELT/Content/build.jsx b/src/client/Components/Calculation/ELT/Content/build.jsx
new file mode 100644
index 0000000..0bf5a7e
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/build.jsx
@@ -0,0 +1,28 @@
+import { Flex } from 'client/UIKit/grid';
+import { useState } from 'react';
+import styled from 'styled-components';
+import { BottomControls, TopControls } from './Components/Controls';
+import InsTable from './Components/InsTable';
+
+const ContentWrapper = styled(Flex)`
+ flex-direction: column;
+ width: 100%; !important
+`;
+
+const buildELTContent = ({ tableConfig, ...params }) => props => {
+ const [selectedKey, selectKey] = useState();
+ return (
+
+
+
+
+
+ );
+};
+
+export default buildELTContent;
diff --git a/src/client/Components/Calculation/ELT/Content/index.jsx b/src/client/Components/Calculation/ELT/Content/index.jsx
index 38e1cea..3c5b34f 100644
--- a/src/client/Components/Calculation/ELT/Content/index.jsx
+++ b/src/client/Components/Calculation/ELT/Content/index.jsx
@@ -1,18 +1,14 @@
import { Flex } from 'client/UIKit/grid';
-import mq from 'client/UIKit/mq';
import styled from 'styled-components';
import Kasko from './Kasko';
import Osago from './Osago';
const ContentDivider = styled.div`
margin: 16px 0;
- ${mq.laptopHD`
- margin: 0 16px;
- `}
`;
export default () => (
-
+
diff --git a/src/client/Components/Calculation/ELT/Content/lib/config/index.ts b/src/client/Components/Calculation/ELT/Content/lib/config/table.ts
similarity index 62%
rename from src/client/Components/Calculation/ELT/Content/lib/config/index.ts
rename to src/client/Components/Calculation/ELT/Content/lib/config/table.ts
index f6add11..b399cec 100644
--- a/src/client/Components/Calculation/ELT/Content/lib/config/index.ts
+++ b/src/client/Components/Calculation/ELT/Content/lib/config/table.ts
@@ -1,15 +1,13 @@
import { TableProps } from 'antd';
-import columns from './columns';
export default {
- columns,
rowSelection: {
hideSelectAll: true,
type: 'radio',
},
expandable: {
- // rowExpandable: record => record.message || record.children,
- // expandedRowRender: record => record.message,
+ rowExpandable: record => record.message || record.children,
+ expandedRowRender: record => record.message,
// expandRowByClick: true,
// expandIconColumnIndex: -1,
},
diff --git a/src/client/Components/Calculation/ELT/Content/lib/getData.ts b/src/client/Components/Calculation/ELT/Content/lib/requests.ts
similarity index 59%
rename from src/client/Components/Calculation/ELT/Content/lib/getData.ts
rename to src/client/Components/Calculation/ELT/Content/lib/requests.ts
index 45deb9a..c5e3fd9 100644
--- a/src/client/Components/Calculation/ELT/Content/lib/getData.ts
+++ b/src/client/Components/Calculation/ELT/Content/lib/requests.ts
@@ -1,9 +1,20 @@
+import axios from 'axios';
import ELTService from 'core/services/ELTService';
import { ICalculationStore } from 'core/types/Calculation/Store';
import { IAccount } from 'core/types/Entities/crmEntities';
+import { toJS } from 'mobx';
+
+const CancelToken = axios.CancelToken;
+export let sources = {};
+
+export function cancelRequests(insType: string) {
+ if (sources[insType]) sources[insType].cancel();
+}
+
+export const fetchData = (insType: string, composeRequest, convertEltResult) =>
+ function (this: ICalculationStore) {
+ sources[insType] = CancelToken.source();
-export default (insType: string, composeRequest, convertEltResult) =>
- function (this: ICalculationStore, callback: () => any) {
const { ELTStore } = this.stores;
const request = composeRequest.call(this);
@@ -11,10 +22,13 @@ export default (insType: string, composeRequest, convertEltResult) =>
(company: IAccount, i: number) =>
new Promise((resolve, reject) => {
ELTService[insType]
- .getCalculation({
- companyIds: [company.evo_id_elt],
- ...request,
- })
+ .getCalculation(
+ {
+ companyIds: [company.evo_id_elt],
+ ...request,
+ },
+ sources[insType].token,
+ )
.then(res => {
if (!company.evo_id_elt || !res[company.evo_id_elt]) {
return;
@@ -22,6 +36,7 @@ export default (insType: string, composeRequest, convertEltResult) =>
const converted = convertEltResult(
res[company.evo_id_elt],
company.accountid,
+ toJS(this.getValues(['leasingPeriod'])),
);
ELTStore.setCompanyRes(
insType,
@@ -36,5 +51,5 @@ export default (insType: string, composeRequest, convertEltResult) =>
}),
);
- Promise.allSettled(requests).then(() => callback());
+ return Promise.race(requests);
};
diff --git a/src/client/Components/Calculation/ELT/Content/lib/resetIns.ts b/src/client/Components/Calculation/ELT/Content/lib/resetIns.ts
new file mode 100644
index 0000000..62d2cd1
--- /dev/null
+++ b/src/client/Components/Calculation/ELT/Content/lib/resetIns.ts
@@ -0,0 +1,48 @@
+import { ICalculationStore } from 'core/types/Calculation/Store';
+import { TCRMEntity } from 'core/types/Entities/crmEntities';
+import { pick } from 'lodash';
+import { sources } from './requests';
+
+const mapInsType = {
+ kasko: 100000000,
+ osago: 100000001,
+};
+
+export const initFields = ['evo_id_elt', 'name', 'accountid'];
+
+export function initIns(this: ICalculationStore, insType) {
+ const insuranceCompanies = this.getTableOptions(
+ 'tableInsurance',
+ 'insuranceCompany',
+ );
+ if (insuranceCompanies === undefined) {
+ return;
+ }
+ const { ELTStore } = this.stores;
+ const list: TCRMEntity[] = [];
+ insuranceCompanies.forEach(company => {
+ if (
+ company &&
+ company.evo_id_elt &&
+ company.evo_type_ins_policy &&
+ company.evo_type_ins_policy.includes(mapInsType[insType])
+ ) {
+ const companyData = pick(company, initFields, '');
+ list.push(companyData);
+ }
+ });
+ ELTStore[insType].list.replace(list);
+}
+
+export function resetIns(this: ICalculationStore, insType) {
+ sources[insType] && sources[insType].cancel();
+
+ const { ELTStore } = this.stores;
+
+ const list: TCRMEntity[] = [];
+ ELTStore[insType].list.forEach(x => {
+ const picked = pick(x, initFields, '');
+ list.push(picked);
+ });
+ ELTStore[insType].reset(list);
+}
diff --git a/src/client/Components/Calculation/ELT/Content/lib/validation.ts b/src/client/Components/Calculation/ELT/Content/lib/validation.ts
index 0f93f7e..d89b766 100644
--- a/src/client/Components/Calculation/ELT/Content/lib/validation.ts
+++ b/src/client/Components/Calculation/ELT/Content/lib/validation.ts
@@ -1,19 +1,16 @@
-import { elementsTitles } from 'client/Containers/Calculation/lib/elements/titles';
-import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
+import { getValueName } from 'client/Containers/Calculation/lib/elements/tools';
import { ICalculationStore } from 'core/types/Calculation/Store';
import { ElementsNames } from 'core/types/Calculation/Store/elements';
+import { isNil } from 'lodash';
-export function validate(this: ICalculationStore, requiredValues) {
- const missingValues = requiredValues.filter(x => {
- const valueName = elementsValues[x] || '';
-
- return (
- this.values[valueName] === undefined || this.values[valueName] === null
- );
+export function validate(
+ this: ICalculationStore,
+ requiredFields: ElementsNames[],
+) {
+ const missingValues = requiredFields.filter(fieldName => {
+ const valueName = getValueName(fieldName);
+ const value = this.getValue(valueName);
+ return isNil(value);
});
return missingValues;
}
-
-export function getFieldsNames(elementsNames: ElementsNames[]): string[] {
- return elementsNames.map(x => elementsTitles[x] || '');
-}
diff --git a/src/client/Components/Calculation/ELT/index.jsx b/src/client/Components/Calculation/ELT/index.jsx
index 28e6c2f..dd03955 100644
--- a/src/client/Components/Calculation/ELT/index.jsx
+++ b/src/client/Components/Calculation/ELT/index.jsx
@@ -1,51 +1,7 @@
-import { Modal } from 'antd';
-import { Outlined as SpinnerOutlined } from 'client/Components/Spinner';
-import Button from 'client/Elements/Button';
-import { CenterContent } from 'client/Elements/Wrapper';
-import { Box } from 'client/UIKit/grid';
-import { lazy, Suspense, useState } from 'react';
+import { lazy } from 'react';
const Content = lazy(() => import('./Content'));
-const ELT = ({ title }) => {
- const [isOpenModal, setIsOpenModal] = useState(false);
- function closeModal() {
- setIsOpenModal(false);
- }
- return (
- <>
-
-
- {isOpenModal && (
-
-
-
-
- }
- >
-
-
-
- )}
- >
- );
-};
+const ELT = () => ;
export default ELT;
diff --git a/src/client/Components/Calculation/InsuranceTag.jsx b/src/client/Components/Calculation/InsuranceTag.jsx
new file mode 100644
index 0000000..187c339
--- /dev/null
+++ b/src/client/Components/Calculation/InsuranceTag.jsx
@@ -0,0 +1,25 @@
+import Tag from 'client/Elements/Tag';
+import { useStores } from 'client/hooks/useStores';
+import { observer } from 'mobx-react-lite';
+import { Flex } from 'rebass';
+
+const InsuranceTag = observer(() => {
+ const {
+ calculationStore: {
+ stores: { ELTStore },
+ },
+ } = useStores();
+
+ return (
+
+ {ELTStore.osago.selectedKey && (
+ Применен расчет ЭЛТ для ОСАГО
+ )}
+ {ELTStore.kasko.selectedKey && (
+ Применен расчет ЭЛТ для КАСКО
+ )}
+
+ );
+});
+
+export default InsuranceTag;
diff --git a/src/client/Containers/Calculation/Sections/sectionsList.ts b/src/client/Containers/Calculation/Sections/sectionsList.ts
index e9481fa..b32274a 100644
--- a/src/client/Containers/Calculation/Sections/sectionsList.ts
+++ b/src/client/Containers/Calculation/Sections/sectionsList.ts
@@ -276,7 +276,6 @@ const sections: ISection[] = [
'radioInsKaskoType',
'tbxInsFranchise',
'tbxMileage',
- // 'btnInsCalculation',
// 'selectInsPeriod',
// 'btnFranschise',
],
@@ -287,7 +286,7 @@ const sections: ISection[] = [
'tbxInsAgeDrivers',
'tbxInsExpDrivers',
'cbxWithTrailer',
- // 'tbxINNForCalc',
+ 'tbxINNForCalc',
// 'btnDriversApplication',
],
},
@@ -307,7 +306,21 @@ const sections: ISection[] = [
style: { columnsNumber: 1 },
blocks: [
{
- elements: ['componentElt', 'tableInsurance'],
+ elements: ['tableInsurance'],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ title: 'ЭЛТ',
+ groups: [
+ {
+ title: 'Расчет страховки ЭЛТ',
+ style: { columnsNumber: 1 },
+ blocks: [
+ {
+ elements: ['componentElt'],
},
],
},
diff --git a/src/client/Containers/Calculation/lib/buildElement.js b/src/client/Containers/Calculation/lib/buildElement.js
index 23fa937..e8b6652 100644
--- a/src/client/Containers/Calculation/lib/buildElement.js
+++ b/src/client/Containers/Calculation/lib/buildElement.js
@@ -11,9 +11,9 @@ import elementsActions from './elements/actions';
import elementsComponents from './elements/components';
import elementsComputedValues from './elements/computedValues';
import tables from './elements/tables';
+import { getValueName } from './elements/tools';
import elementsTypes from './elements/types';
import elementsUrls from './elements/urls';
-import elementsValues from './elements/values';
export function buildElement(elementName, elementProps = {}) {
const elementType = elementsTypes[elementName];
@@ -53,7 +53,7 @@ export function buildElement(elementName, elementProps = {}) {
default: {
return withValue(Component)({
name: elementName,
- valueName: elementsValues[elementName],
+ valueName: getValueName(elementName),
...elementProps,
});
}
diff --git a/src/client/Containers/Calculation/lib/elements/components.ts b/src/client/Containers/Calculation/lib/elements/components.ts
index c342466..cdc2c62 100644
--- a/src/client/Containers/Calculation/lib/elements/components.ts
+++ b/src/client/Containers/Calculation/lib/elements/components.ts
@@ -94,7 +94,6 @@ const elementsComponents: TElements = {
cbxInsDecentral: Switch,
radioInsKaskoType: Radio,
tbxInsFranchise: InputNumber,
- btnInsCalculation: Button,
selectInsPeriod: Select,
btnFranschise: Button,
cbxInsUnlimitDrivers: Switch,
diff --git a/src/client/Containers/Calculation/lib/elements/elementsProps.ts b/src/client/Containers/Calculation/lib/elements/elementsProps.ts
index 4959992..86fb4ec 100644
--- a/src/client/Containers/Calculation/lib/elements/elementsProps.ts
+++ b/src/client/Containers/Calculation/lib/elements/elementsProps.ts
@@ -1,5 +1,9 @@
import DownloadOutlined from '@ant-design/icons/lib/icons/DownloadOutlined';
+import InsuranceTag from 'client/Components/Calculation/InsuranceTag';
import { currentYear } from 'core/tools/date';
+import { formatMoney, formatNumber } from 'core/tools/format';
+import { compose } from 'core/tools/func';
+import { round } from 'core/tools/num';
import {
validateEmail,
validateInn,
@@ -8,7 +12,6 @@ import {
} from 'core/tools/validate';
import { ElementProps } from 'core/types/Calculation/components';
import { TElements } from 'core/types/Calculation/Store/elements';
-import { round } from 'lodash';
const elementsProps: TElements = {
selectChannel: {
@@ -71,23 +74,24 @@ const elementsProps: TElements = {
text: 'Создать интерес',
},
tbxLeaseObjectPrice: {
- min: '1000',
- max: '1000000000',
+ min: '1000.00',
+ max: '1000000000.00',
step: '10000.00',
precision: 2,
+ formatter: formatNumber,
},
tbxSupplierDiscountRub: {
- // TODO formatter + rub, parser
min: '0',
max: '1000000000',
step: '10000.00',
precision: 2,
+ formatter: formatNumber,
},
tbxSupplierDiscountPerc: {
- // TODO formatter + %, parser
min: '0',
max: '100',
precision: 2,
+ formatter: formatNumber,
},
radioBalanceHolder: {
style: 'button',
@@ -97,17 +101,20 @@ const elementsProps: TElements = {
// max: '1.30',
step: '0.1',
precision: 2,
+ formatter: formatNumber,
},
tbxFirstPaymentPerc: {
min: '0',
max: '50',
precision: 2,
+ formatter: formatNumber,
},
tbxFirstPaymentRub: {
min: '0',
max: '1000000000',
step: '10000.00',
precision: 2,
+ formatter: formatNumber,
},
radioLastPaymentRule: {
style: 'button',
@@ -116,18 +123,21 @@ const elementsProps: TElements = {
min: '0',
max: '15',
step: '1.000000',
+ precision: 6,
+ formatter: formatNumber,
},
tbxLastPaymentRub: {
min: '0',
max: '1000000000',
step: '10000.00',
+ precision: 2,
+ formatter: formatNumber,
},
tbxLeasingPeriod: {
min: '7',
max: '60',
},
tbxParmentsDecreasePercent: {
- // TODO: formatter, parser: %
min: '50',
max: '99',
},
@@ -178,16 +188,21 @@ const elementsProps: TElements = {
min: '0.00',
max: '20000.00',
step: '10.00',
+ precision: 2,
+ formatter: formatNumber,
},
tbxEngineVolume: {
min: '0.00',
max: '99.99',
step: '0.50',
+ precision: 2,
+ formatter: formatNumber,
},
tbxMaxMass: {
min: '0',
max: '999999',
step: '100',
+ formatter: formatNumber,
},
tbxCountSeats: {
min: '0',
@@ -204,31 +219,43 @@ const elementsProps: TElements = {
min: '0.0',
max: '20.0',
step: '0.1',
+ precision: 1,
+ formatter: formatNumber,
},
tbxDealerBrokerRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
+ precision: 1,
+ formatter: formatNumber,
},
tbxIndAgentRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
+ precision: 1,
+ formatter: formatNumber,
},
tbxCalcDoubleAgentRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
+ precision: 1,
+ formatter: formatNumber,
},
tbxCalcBrokerRewardSum: {
min: '0.0',
max: '20.0',
step: '0.1',
+ precision: 1,
+ formatter: formatNumber,
},
tbxFinDepartmentRewardSumm: {
min: '0.0',
max: '20.0',
step: '0.1',
+ precision: 1,
+ formatter: formatNumber,
},
radioInsKaskoType: {
style: 'button',
@@ -237,10 +264,8 @@ const elementsProps: TElements = {
min: '0',
max: '75000',
step: '10000.00',
- },
- btnInsCalculation: {
- type: 'primary',
- text: 'Запрос расчета страховки',
+ precision: 2,
+ formatter: formatNumber,
},
btnFranschise: {
type: 'ghost',
@@ -319,8 +344,9 @@ const elementsProps: TElements = {
},
tbxMileage: {
min: 0,
- step: 100,
+ step: 100.0,
precision: 2,
+ formatter: formatNumber,
},
cbxRecalcWithRevision: {
text: 'Пересчет без пересмотра',
@@ -364,31 +390,57 @@ const elementsProps: TElements = {
selectObjectRegionRegistration: {
showSearch: true,
},
+ tbxINNForCalc: {
+ validation: {
+ errorMessage: 'Некорректный ИНН',
+ validator: validateInn,
+ },
+ },
+ tableInsurance: {
+ tag: {
+ Component: InsuranceTag,
+ },
+ },
+ tbxInsKaskoPriceLeasePeriod: {
+ min: 0,
+ precision: 2,
+ formatter: formatNumber,
+ },
};
-const resultElementsProps: TElements = [
- '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) },
- }),
+const resultElementsProps: TElements = Object.assign(
{},
+ [
+ 'labelResultTotalGraphwithNDS',
+ 'labelResultPlPrice',
+ 'labelResultInsKasko',
+ 'labelResultInsOsago',
+ 'labelResultDopProdSum',
+ 'labelResultFirstPayment',
+ 'labelResultLastPayment',
+ 'labelResultAB_FL',
+ 'labelResultAB_UL',
+ 'labelResultBonusMPL',
+ 'labelResultDopMPLLeasing',
+ 'labelResultBonusDopProd',
+ ].reduce(
+ (ac, a) => ({
+ ...ac,
+ [a]: { middleware: value => compose(round, formatMoney)(value || 0) },
+ }),
+ {},
+ ),
+ [
+ 'labelResultPriceUpPr',
+ 'labelResultIRRGraphPerc',
+ 'labelResultIRRNominalPerc',
+ 'labelResultTerm',
+ ].reduce(
+ (ac, a) => ({
+ ...ac,
+ [a]: { middleware: value => round(value || 0) },
+ }),
+ {},
+ ),
);
-
export default Object.assign(elementsProps, resultElementsProps);
diff --git a/src/client/Containers/Calculation/lib/elements/tables/insurance.ts b/src/client/Containers/Calculation/lib/elements/tables/insurance.ts
index 37a73ee..45e7d72 100644
--- a/src/client/Containers/Calculation/lib/elements/tables/insurance.ts
+++ b/src/client/Containers/Calculation/lib/elements/tables/insurance.ts
@@ -6,6 +6,7 @@ import {
insuranceKaskoDefaultFilter,
insuranceOsagoDefaultFilter,
} from 'core/constants/stores/Calculation/filters';
+import { formatNumber } from 'core/tools/format';
import {
ITable,
TableColumn,
@@ -48,6 +49,8 @@ const columns: TableColumn[] = [
min: '0.00',
max: '1500000.00',
step: '1000.00',
+ precision: 2,
+ formatter: formatNumber,
},
},
{
diff --git a/src/client/Containers/Calculation/lib/elements/tables/results.ts b/src/client/Containers/Calculation/lib/elements/tables/results.ts
index 4d7b459..001a35f 100644
--- a/src/client/Containers/Calculation/lib/elements/tables/results.ts
+++ b/src/client/Containers/Calculation/lib/elements/tables/results.ts
@@ -1,10 +1,12 @@
import Label from 'client/Elements/Label';
+import { formatMoney } from 'core/tools/format';
+import { compose } from 'core/tools/func';
+import { round } from 'core/tools/num';
import {
ITable,
TableColumn,
TableColumnFeatures,
} from 'core/types/Calculation/Store/tables';
-import { round } from 'lodash';
const columns: TableColumn[] = [
{
@@ -12,7 +14,7 @@ const columns: TableColumn[] = [
title: 'Сумма платежа',
Component: Label,
props: {
- middleware: value => value && round(value, 2).toFixed(2),
+ middleware: value => compose(round, formatMoney)(value || 0),
},
},
{
@@ -20,7 +22,7 @@ const columns: TableColumn[] = [
title: 'НДС к возмещению',
Component: Label,
props: {
- middleware: value => value && round(value, 2).toFixed(2),
+ middleware: value => compose(round, formatMoney)(value || 0),
},
},
{
@@ -28,7 +30,7 @@ const columns: TableColumn[] = [
title: 'Сумма досрочного выкупа',
Component: Label,
props: {
- middleware: value => value && round(value, 2).toFixed(2),
+ middleware: value => compose(round, formatMoney)(value || 0),
},
},
];
diff --git a/src/client/Containers/Calculation/lib/elements/titles.ts b/src/client/Containers/Calculation/lib/elements/titles.ts
index da1c2f8..01bdcac 100644
--- a/src/client/Containers/Calculation/lib/elements/titles.ts
+++ b/src/client/Containers/Calculation/lib/elements/titles.ts
@@ -133,22 +133,23 @@ export const elementsTitles: TElements = {
selectObjectTypeTax: 'Тип ТС для ТН',
radioTypePTS: 'Тип ПТС',
labelRegistrationDescription: 'Описание регистрации',
+ tbxINNForCalc: 'ИНН контрагента',
};
const resultsTitles: TElements = {
labelResultTotalGraphwithNDS: 'Итого по графику, с НДС',
- labelResultPlPrice: 'Стоимость ПЛ, руб. с НДС',
+ labelResultPlPrice: 'Стоимость ПЛ с НДС',
labelResultPriceUpPr: 'Удорожание, год',
labelResultIRRGraphPerc: 'IRR по графику клиента, %',
labelResultIRRNominalPerc: 'IRR (номинал), %',
labelResultInsKasko: 'КАСКО, НС, ДГО в графике',
labelResultInsOsago: 'ОСАГО в графике',
labelResultDopProdSum: 'Общая сумма доп.продуктов',
- labelResultFirstPayment: 'Первый платеж, руб.',
- labelResultLastPayment: 'Последний платеж, руб.',
+ labelResultFirstPayment: 'Первый платеж.',
+ labelResultLastPayment: 'Последний платеж.',
labelResultTerm: 'Срок, мес.',
- labelResultAB_FL: 'АВ ФЛ, без НДФЛ, руб.',
- labelResultAB_UL: 'АВ ЮЛ, с НДС, руб.',
+ labelResultAB_FL: 'АВ ФЛ, без НДФЛ.',
+ labelResultAB_UL: 'АВ ЮЛ, с НДС.',
labelResultBonusMPL: 'Бонус МПЛ за лизинг, без НДФЛ',
labelResultDopMPLLeasing: 'Доп.бонус МПЛ за лизинг, без НДФЛ',
labelResultBonusDopProd: 'Бонус МПЛ за доп.продукты, без НДФЛ',
diff --git a/src/client/Containers/Calculation/lib/elements/tools.ts b/src/client/Containers/Calculation/lib/elements/tools.ts
new file mode 100644
index 0000000..da5862a
--- /dev/null
+++ b/src/client/Containers/Calculation/lib/elements/tools.ts
@@ -0,0 +1,19 @@
+//@ts-nocheck
+import { ElementsNames } from 'core/types/Calculation/Store/elements';
+import { ValuesNames } from 'core/types/Calculation/Store/values';
+import { elementsTitles } from './titles';
+import { elementsValues } from './values';
+
+export function getValueName(fieldName: ElementsNames): ValuesNames {
+ return elementsValues[fieldName];
+}
+
+export function getFieldName(valueName: ValuesNames): ElementsNames {
+ return Object.keys(elementsValues).find(
+ key => elementsValues[key] === valueName,
+ );
+}
+
+export function getTitle(fieldName: ElementsNames): string {
+ return elementsTitles[fieldName];
+}
diff --git a/src/client/Containers/Calculation/lib/elements/types.ts b/src/client/Containers/Calculation/lib/elements/types.ts
index 2df55a2..6682813 100644
--- a/src/client/Containers/Calculation/lib/elements/types.ts
+++ b/src/client/Containers/Calculation/lib/elements/types.ts
@@ -3,7 +3,6 @@ import { StoreTables } from 'core/types/Calculation/Store/tables';
const elementsTypes: TElements = {
labelLeaseObjectRisk: ElementType.Computed,
- btnInsCalculation: ElementType.Action,
btnFranschise: ElementType.Action,
btnDriversApplication: ElementType.Action,
tbxInsKaskoPriceLeasePeriod: ElementType.Computed,
diff --git a/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts
index d1a90e2..ac6ec17 100644
--- a/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts
+++ b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts
@@ -58,6 +58,7 @@ const query = gql`
evo_fias_id
evo_businessunit_evolution
evo_oktmo
+ evo_kladr_id
}
selectAccount: accounts(
evo_account_type: $account_account_type
diff --git a/src/client/Containers/Calculation/lib/fetchData/queries/ownerQuery.ts b/src/client/Containers/Calculation/lib/fetchData/queries/ownerQuery.ts
index 3233e50..0f94ffc 100644
--- a/src/client/Containers/Calculation/lib/fetchData/queries/ownerQuery.ts
+++ b/src/client/Containers/Calculation/lib/fetchData/queries/ownerQuery.ts
@@ -1,5 +1,5 @@
-import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
import { gql } from '@apollo/client';
+import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
const query = gql`
query($statecode: Int, $domainname: String) {
@@ -18,6 +18,7 @@ const query = gql`
evo_city_fias_id
}
}
+ evo_inn
}
selectOpportunity: opportunities(
statecode: $statecode
diff --git a/src/client/Containers/Calculation/lib/renderSections.js b/src/client/Containers/Calculation/lib/renderSections.js
index 0c15137..80efe0b 100644
--- a/src/client/Containers/Calculation/lib/renderSections.js
+++ b/src/client/Containers/Calculation/lib/renderSections.js
@@ -25,13 +25,25 @@ const ElementTitle = styled.h5`
const renderElements = ({ elements }) => {
return elements.map((elementName, ie) => {
const elementTitle = elementsTitles[elementName];
- const { tooltip, ...elementProps } = elementsProps[elementName] || {};
+ const { tooltip, tag, ...elementProps } = elementsProps[elementName] || {};
+
+ let TagComponent = () => null;
+ if (tag && tag.Component) {
+ TagComponent = tag.Component;
+ }
const Component = buildElement(elementName, elementProps);
return (
- {elementTitle}
+
+ {elementTitle}
+
+
diff --git a/src/client/Elements/InputNumber.jsx b/src/client/Elements/InputNumber.jsx
index 6629a8b..6758263 100644
--- a/src/client/Elements/InputNumber.jsx
+++ b/src/client/Elements/InputNumber.jsx
@@ -24,6 +24,7 @@ const InputNumber = ({
status,
validateStatus,
message,
+ formatter,
...props
}) => {
return (
@@ -34,10 +35,14 @@ const InputNumber = ({
>
{
- value = value.replace(/[^0-9.,]+/, '');
- if (value === '') {
- return '0';
+ // parser={value => value.replace(/\$\s?|(,*)/g, '')}
+ decimalSeparator=","
+ formatter={value => {
+ if (formatter) {
+ return formatter(value, {
+ minimumFractionDigits: props.precision,
+ maximumFractionDigits: props.precision,
+ });
}
return value;
}}
@@ -45,6 +50,7 @@ const InputNumber = ({
style={styles}
onChange={value => setCurrentValue(value)}
value={value}
+ stringMode
/>
{status === ElementStatus.Loading && }
diff --git a/src/client/Elements/Tag.jsx b/src/client/Elements/Tag.jsx
new file mode 100644
index 0000000..52e9ff2
--- /dev/null
+++ b/src/client/Elements/Tag.jsx
@@ -0,0 +1,3 @@
+import { Tag as AntTag } from 'antd';
+
+export default AntTag;
diff --git a/src/client/hooks/Calculation/useValue.js b/src/client/hooks/Calculation/useValue.js
index f1aa51f..82fe3b1 100644
--- a/src/client/hooks/Calculation/useValue.js
+++ b/src/client/hooks/Calculation/useValue.js
@@ -1,5 +1,4 @@
import { DEFAULT_DEBOUNCE_DELAY } from 'core/constants/debounce';
-import { Process } from 'core/types/Calculation/Store/process';
import { useEffect, useState } from 'react';
import { useDebouncedCallback } from 'use-debounce';
import { useStores } from '../useStores';
@@ -92,7 +91,7 @@ export const useTableValue = ({
);
useEffect(() => {
- if (columnCallback && calculationProcess.process === Process.Default)
+ if (columnCallback && calculationProcess.noProcesses())
debouncedCellCallback(
columnCallback,
calculationStore,
diff --git a/src/client/stores/CalculationStore/Data/values.js b/src/client/stores/CalculationStore/Data/values.js
index 4a6375b..7a8903d 100644
--- a/src/client/stores/CalculationStore/Data/values.js
+++ b/src/client/stores/CalculationStore/Data/values.js
@@ -1,4 +1,4 @@
-import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
+import { getValueName } from 'client/Containers/Calculation/lib/elements/tools';
import initialFilters from 'client/stores/CalculationStore/config/initialFilters';
import initialOptions from 'client/stores/CalculationStore/config/initialOptions';
import initialStatuses from 'client/stores/CalculationStore/config/initialStatuses';
@@ -72,7 +72,7 @@ const valuesActions = {
});
},
getCurrentOption(elementName) {
- const valueName = elementsValues[elementName];
+ const valueName = getValueName(elementName);
const currentValue = this.values[valueName];
if (!currentValue) {
return;
@@ -98,7 +98,7 @@ const valuesActions = {
return this.filters[elementName];
},
setFilter(elementName, filter) {
- const valueName = elementsValues[elementName];
+ const valueName = getValueName(elementName);
const value = this.getValue(valueName);
if (
filter &&
diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts
index 6942316..e3174d9 100644
--- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts
+++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts
@@ -1,6 +1,9 @@
-import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
+import { getValueName } from 'client/Containers/Calculation/lib/elements/tools';
import { ICalculationStore } from 'core/types/Calculation/Store';
-import { TElements } from 'core/types/Calculation/Store/elements';
+import {
+ ElementsNames,
+ TElements,
+} from 'core/types/Calculation/Store/elements';
const CONDITIONS = {
IS_NULL: value => value === undefined || value === null,
@@ -90,8 +93,8 @@ const elementsValidations: TElements = {
};
export default function (this: ICalculationStore) {
- Object.keys(elementsValidations).forEach(elementName => {
- const valueName = elementsValues[elementName];
+ (Object.keys(elementsValidations) as ElementsNames[]).forEach(elementName => {
+ const valueName = getValueName(elementName);
const value = this.getValue(valueName);
const condition = elementsValidations[elementName];
let conditionRes;
diff --git a/src/client/stores/CalculationStore/Effects/reactions/eltReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/eltReactions.ts
new file mode 100644
index 0000000..4d05d98
--- /dev/null
+++ b/src/client/stores/CalculationStore/Effects/reactions/eltReactions.ts
@@ -0,0 +1,99 @@
+import { message } from 'antd';
+import { requiredFields as kaskoRequiredFields } from 'client/Components/Calculation/ELT/Content/Kasko/lib/validation';
+import { cancelRequests } from 'client/Components/Calculation/ELT/Content/lib/requests';
+import { resetIns } from 'client/Components/Calculation/ELT/Content/lib/resetIns';
+import { requiredFields as osagoRequiredFields } from 'client/Components/Calculation/ELT/Content/Osago/lib/validation';
+import { getValueName } from 'client/Containers/Calculation/lib/elements/tools';
+import { TCalculationProcess } from 'client/stores/CalculationStore/subStores/calculationProcess';
+import { IReactionEffect } from 'core/types/Calculation/Store/effect';
+import { ElementsNames } from 'core/types/Calculation/Store/elements';
+import { ICalculationStore } from 'core/types/Calculation/Store/index';
+import { Process } from 'core/types/Calculation/Store/process';
+
+const resetConf = [
+ {
+ insType: 'osago',
+ requiredFields: osagoRequiredFields,
+ tableRowNumber: 0,
+ },
+ {
+ insType: 'kasko',
+ requiredFields: [
+ ...kaskoRequiredFields,
+ 'tbxInsAgeDrivers',
+ 'tbxInsExpDrivers',
+ ],
+ tableRowNumber: 1,
+ },
+];
+
+const RESET_MESSAGES = {
+ kasko: 'Расчеты ЭЛТ по КАСКО сброшены',
+ osago: 'Расчеты ЭЛТ по ОСАГО сброшены',
+};
+
+const eltReactions: IReactionEffect[] = [
+ ...resetConf.map(
+ ({ insType, requiredFields }) => (
+ calculationStore: ICalculationStore,
+ calculationProcess: TCalculationProcess,
+ ) => ({
+ expression: () => {
+ return calculationStore.getValues(
+ //@ts-ignore
+ (requiredFields as ElementsNames[]).map(getValueName),
+ );
+ },
+ effect: () => {
+ cancelRequests(insType);
+ if (
+ calculationProcess.hasProcess(Process.ELT) ||
+ calculationProcess.hasProcess(Process.LoadKp)
+ ) {
+ return;
+ }
+ const { ELTStore } = calculationStore.stores;
+ if (ELTStore[insType].isReseted() === true) {
+ return;
+ }
+ message.warn({ content: RESET_MESSAGES[insType] });
+ resetIns.call(calculationStore, insType);
+ },
+ }),
+ ),
+
+ ...resetConf.map(
+ ({ insType, tableRowNumber }) => (
+ calculationStore: ICalculationStore,
+ calculationProcess: TCalculationProcess,
+ ) => ({
+ expression: () => {
+ return [
+ ...['insuranceCompany', 'insCost'].map(
+ fieldName =>
+ calculationStore.tables.tableInsurance.rows[tableRowNumber][
+ fieldName
+ ].value,
+ ),
+ ];
+ },
+ effect: () => {
+ cancelRequests(insType);
+ if (
+ calculationProcess.hasProcess(Process.ELT) ||
+ calculationProcess.hasProcess(Process.LoadKp)
+ ) {
+ return;
+ }
+ const { ELTStore } = calculationStore.stores;
+ if (ELTStore[insType].isReseted() === true) {
+ return;
+ }
+ message.warn({ content: RESET_MESSAGES[insType] });
+ resetIns.call(calculationStore, insType);
+ },
+ }),
+ ),
+];
+
+export default eltReactions;
diff --git a/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts
index acf6643..70eabe3 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/gibddReactions.ts
@@ -1,21 +1,24 @@
-import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
+import { getValueName } from 'client/Containers/Calculation/lib/elements/tools';
import { openNotification } from 'client/Elements/Notification';
import _1CService from 'core/services/1CService';
import { currentDate } from 'core/tools/date';
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
-import { TElements } from 'core/types/Calculation/Store/elements';
+import {
+ ElementsNames,
+ TElements,
+} from 'core/types/Calculation/Store/elements';
import { Process } from 'core/types/Calculation/Store/process';
import { ElementStatus } from 'core/types/statuses';
import { get } from 'lodash';
-const v = {
+const v: TElements = {
tbxVehicleTaxInYear: { value: 0, validator: value => value === 0 },
radioTypePTS: { value: null, validator: value => value === null },
selectObjectRegionRegistration: {
value: null,
validator: value => value === null,
},
-} as TElements;
+};
const gibddReactions: IReactionEffect[] = [
calculationStore => ({
@@ -41,8 +44,8 @@ const gibddReactions: IReactionEffect[] = [
},
}),
- ...Object.keys(v).map(elementName => {
- const valueName = elementsValues[elementName];
+ ...(Object.keys(v) as ElementsNames[]).map(elementName => {
+ const valueName = getValueName(elementName);
const value = v[elementName].value;
const validator = v[elementName].validator;
@@ -97,7 +100,7 @@ const gibddReactions: IReactionEffect[] = [
]);
},
effect: ({ objectRegistration, objectCategoryTax }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (objectRegistration === 100000001) {
@@ -287,7 +290,7 @@ const gibddReactions: IReactionEffect[] = [
leaseObjectYear,
leaseObjectMotorPower,
}) => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (
diff --git a/src/client/stores/CalculationStore/Effects/reactions/index.ts b/src/client/stores/CalculationStore/Effects/reactions/index.ts
index 10d208b..4dda424 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/index.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/index.ts
@@ -1,3 +1,4 @@
+import eltReactions from './eltReactions';
import gibddReactions from './gibddReactions';
import loadKpReaction from './loadKpReaction';
import otherReactions from './otherReactions';
@@ -15,5 +16,6 @@ export default [
...statusReactions,
...recalcWoRevisionReactions,
...gibddReactions,
+ ...eltReactions,
loadKpReaction,
];
diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts
index 3b98b7f..ee199c3 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts
@@ -9,10 +9,11 @@ import { IGetCRMEntitiesResponse } from 'core/types/Calculation/Responses';
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
import { TElements } from 'core/types/Calculation/Store/elements';
import { Process } from 'core/types/Calculation/Store/process';
+import { ValuesNames } from 'core/types/Calculation/Store/values';
import { IEvoGraph } from 'core/types/Entities/crmEntities';
import { ElementStatus } from 'core/types/statuses';
import NIL from 'uuid/dist/nil';
-import mapKPtoValues from './mapKpToValues';
+import { getKpPropName } from './mapKpToValues';
import optionsQuery from './optionsQuery';
import quoteQuery from './quoteQuery';
@@ -57,6 +58,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
leaseObjectCount,
calcType,
indAgent,
+ INNForCalc,
} = calculationStore.values;
calculationStore.setStatus('selectQuote', ElementStatus.Disabled);
@@ -75,14 +77,16 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
if (!quote) {
throw new Error('No quote!');
}
- calculationProcess.setProcess(Process.LoadKp);
+ calculationProcess.addProcess(Process.LoadKp);
if (!Array.isArray(quote)) {
const newValues = Object.assign(
{},
- ...Object.values(elementsValues).map(valueName => ({
- //@ts-ignore
- [valueName]: quote[mapKPtoValues[valueName]],
- })),
+ ...(Object.values(elementsValues) as ValuesNames[]).map(
+ valueName => ({
+ //@ts-ignore
+ [valueName]: quote[getKpPropName(valueName)],
+ }),
+ ),
);
let regionRegistration = quote.evo_regionid,
@@ -297,6 +301,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
indAgent,
requirementTelematic,
vehicleTaxInYear,
+ INNForCalc,
});
message.success({
@@ -316,7 +321,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
calculationStore.setStatus('selectQuote', ElementStatus.Default);
calculationStore.setStatus('btnCalculate', ElementStatus.Default);
calculationStore.setStatus('btnCreateKP', ElementStatus.Default);
- calculationProcess.setProcess(Process.Default);
+ calculationProcess.deleteProcess(Process.LoadKp);
});
},
});
diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts
index bc46fc8..63261a5 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts
@@ -1,4 +1,4 @@
-import { TValues } from 'core/types/Calculation/Store/values';
+import { TValues, ValuesNames } from 'core/types/Calculation/Store/values';
// import { TCRMEntity } from 'core/types/Entities/crmEntities';
const mapKPtoValues: TValues = {
@@ -94,4 +94,8 @@ const mapKPtoValues: TValues = {
typePTS: 'evo_pts_type',
};
+export function getKpPropName(valueName: ValuesNames) {
+ return mapKPtoValues[valueName];
+}
+
export default mapKPtoValues;
diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts
index dd10afd..48cf0b2 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts
@@ -2,7 +2,7 @@ import { openNotification } from 'client/Elements/Notification';
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
import { Process } from 'core/types/Calculation/Store/process';
import { ElementStatus } from 'core/types/statuses';
-import { intersection, round } from 'lodash';
+import { get, intersection, round } from 'lodash';
const reactionEffects: IReactionEffect[] = [
// calculationStore => ({
@@ -189,7 +189,7 @@ const reactionEffects: IReactionEffect[] = [
},
);
if (indAgentRewardCondition) {
- if (calculationProcess.process !== Process.LoadKp) {
+ if (!calculationProcess.hasProcess(Process.LoadKp)) {
calculationStore.setValue(
'indAgentRewardSumm',
indAgentRewardCondition.evo_reward_summ || 0,
@@ -258,7 +258,7 @@ const reactionEffects: IReactionEffect[] = [
calcDoubleAgentRewardCondition &&
calcDoubleAgentRewardCondition.evo_reward_summ
) {
- if (calculationProcess.process !== Process.LoadKp) {
+ if (!calculationProcess.hasProcess(Process.LoadKp)) {
calculationStore.setValue(
'calcDoubleAgentRewardSumm',
calcDoubleAgentRewardCondition.evo_reward_summ,
@@ -300,7 +300,7 @@ const reactionEffects: IReactionEffect[] = [
calcBrokerRewardCondition &&
calcBrokerRewardCondition.evo_reward_summ
) {
- if (calculationProcess.process !== Process.LoadKp) {
+ if (!calculationProcess.hasProcess(Process.LoadKp)) {
calculationStore.setValue(
'calcBrokerRewardSum',
calcBrokerRewardCondition.evo_reward_summ,
@@ -339,7 +339,7 @@ const reactionEffects: IReactionEffect[] = [
finDepartmentRewardCondtion &&
finDepartmentRewardCondtion.evo_reward_summ
) {
- if (calculationProcess.process !== Process.LoadKp) {
+ if (!calculationProcess.hasProcess(Process.LoadKp)) {
calculationStore.setValue(
'finDepartmentRewardSumm',
finDepartmentRewardCondtion.evo_reward_summ,
@@ -729,7 +729,7 @@ const reactionEffects: IReactionEffect[] = [
},
effect: graphType => {
if (graphType) {
- if (calculationProcess.process === Process.Default) {
+ if (!calculationProcess.hasProcess(Process.LoadKp)) {
calculationStore.setValue('seasonType', null);
calculationStore.setValue('highSeasonStart', null);
calculationStore.setValue('parmentsDecreasePercent', 96);
@@ -946,7 +946,7 @@ const reactionEffects: IReactionEffect[] = [
);
if (dealerRewardContition) {
if (dealerRewardContition.evo_reward_summ) {
- if (calculationProcess.process !== Process.LoadKp) {
+ if (!calculationProcess.hasProcess(Process.LoadKp)) {
calculationStore.setValue(
'dealerRewardSumm',
dealerRewardContition.evo_reward_summ,
@@ -1004,7 +1004,7 @@ const reactionEffects: IReactionEffect[] = [
dealerBrokerRewardContition &&
dealerBrokerRewardContition.evo_reward_summ
) {
- if (calculationProcess.process !== Process.LoadKp) {
+ if (!calculationProcess.hasProcess(Process.LoadKp)) {
calculationStore.setValue(
'dealerBrokerRewardSumm',
dealerBrokerRewardContition.evo_reward_summ,
@@ -1394,7 +1394,7 @@ const reactionEffects: IReactionEffect[] = [
return tarif;
},
effect: tarif_evo_id => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
@@ -1439,7 +1439,7 @@ const reactionEffects: IReactionEffect[] = [
return { leaseObjectType };
},
effect: () => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setValue('technicalCard', null);
@@ -1452,7 +1452,7 @@ const reactionEffects: IReactionEffect[] = [
return leasingPeriod;
},
effect: () => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
@@ -1718,6 +1718,19 @@ const reactionEffects: IReactionEffect[] = [
);
},
}),
+
+ calculationStore => ({
+ expression: () => {
+ return {
+ lead: calculationStore.getOption('selectLead'),
+ opportnity: calculationStore.getOption('selectOpportunity'),
+ };
+ },
+ effect: ({ lead, opportunity }) => {
+ const inn = get(lead, 'evo_inn', '');
+ calculationStore.setValue('INNForCalc', inn);
+ },
+ }),
];
export default reactionEffects;
diff --git a/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts b/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts
index 571ec96..6841291 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/priceReactions/index.ts
@@ -11,7 +11,7 @@ export default [
return [leaseObjectPrice, supplierDiscountRub];
},
effect: ([leaseObjectPrice, supplierDiscountRub = 0]) => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setValue(
@@ -33,7 +33,7 @@ export default [
return [leaseObjectPrice, supplierDiscountPerc];
},
effect: ([leaseObjectPrice = 0, supplierDiscountPerc = 0]) => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setValue(
@@ -52,7 +52,7 @@ export default [
return firstPaymentRub;
},
effect: (firstPaymentRub = 0) => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const { supplierCurrency, leaseObjectPrice } = calculationStore.values;
@@ -110,7 +110,7 @@ export default [
return [supplierCurrency, leaseObjectPrice, comissionPerc];
},
effect: ([supplierCurrencyId, leaseObjectPrice = 0, comissionPerc = 0]) => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const rub = calculateRub(calculationStore)(
@@ -131,7 +131,7 @@ export default [
return comissionRub;
},
effect: comissionRub => {
- if (calculationProcess.process !== Process.Default) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const { supplierCurrency, leaseObjectPrice } = calculationStore.values;
@@ -174,7 +174,7 @@ export default [
]) => {
if (
lastPaymentRule !== 100000001 ||
- calculationProcess.process !== Process.Default
+ calculationProcess.hasProcess(Process.LoadKp)
) {
return;
}
@@ -213,7 +213,7 @@ export default [
]) => {
if (
lastPaymentRule !== 100000000 ||
- calculationProcess.process !== Process.Default
+ calculationProcess.hasProcess(Process.LoadKp)
) {
return;
}
diff --git a/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts
index 07d1c33..819c99d 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts
@@ -13,7 +13,7 @@ export default [
return values.lead;
},
effect: async leadid => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (!leadid) {
@@ -220,7 +220,7 @@ export default [
return { leadid: lead, opportunityid: opportunity };
},
effect: ({ leadid, opportunityid }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (opportunityid) {
@@ -295,7 +295,7 @@ export default [
return account;
},
effect: account => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (account && account.length > 0) {
@@ -326,7 +326,7 @@ export default [
ElementStatus.Default,
);
- if (indAgentId && calculationProcess.process === Process.Default)
+ if (indAgentId && !calculationProcess.hasProcess(Process.LoadKp))
CrmService.crmgqlquery({
query: gql`
query(
@@ -387,7 +387,7 @@ export default [
ElementStatus.Default,
);
- if (doubleAgentId && calculationProcess.process === Process.Default)
+ if (doubleAgentId && !calculationProcess.hasProcess(Process.LoadKp))
CrmService.crmgqlquery({
query: gql`
query(
@@ -434,7 +434,7 @@ export default [
return calcFinDepartment;
},
effect: calcFinDepartmentId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (!calcFinDepartmentId) {
@@ -509,7 +509,7 @@ export default [
ElementStatus.Default,
);
- if (calcBrokerId && calculationProcess.process === Process.Default)
+ if (calcBrokerId && !calculationProcess.hasProcess(Process.LoadKp))
CrmService.crmgqlquery({
query: gql`
query(
@@ -556,7 +556,7 @@ export default [
return dealer;
},
effect: dealerId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (dealerId) {
@@ -622,7 +622,7 @@ export default [
return dealerPerson;
},
effect: dealerPersonId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setOptions('selectDealerBroker', []);
@@ -685,7 +685,7 @@ export default [
ElementStatus.Default,
);
- if (calculationProcess.process === Process.Default)
+ if (!calculationProcess.hasProcess(Process.LoadKp))
CrmService.crmgqlquery({
query: gql`
query(
@@ -744,7 +744,7 @@ export default [
'selectDealerRewardCondition',
ElementStatus.Default,
);
- if (calculationProcess.process === Process.Default)
+ if (!calculationProcess.hasProcess(Process.LoadKp))
CrmService.crmgqlquery({
query: gql`
query(
@@ -797,7 +797,7 @@ export default [
return brand;
},
effect: brandId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
@@ -850,7 +850,7 @@ export default [
return model;
},
effect: modelId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setStatus('selectConfiguration', ElementStatus.Disabled);
@@ -912,7 +912,7 @@ export default [
return supplier;
},
effect: supplierId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setOptions('selectFinDepartment', []);
@@ -952,7 +952,7 @@ export default [
},
//TODO: add $ownerid: Uuid
effect: ({ supplierId, channelId }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setOptions('selectAgent', []);
@@ -1021,7 +1021,7 @@ export default [
return GPSBrand;
},
effect: GPSBrandId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setStatus('selectGPSModel', ElementStatus.Disabled);
@@ -1080,7 +1080,7 @@ export default [
return regionRegistration;
},
effect: regionRegistrationId => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
calculationStore.setStatus(
@@ -1108,6 +1108,7 @@ export default [
evo_name
evo_townid
evo_fias_id
+ evo_kladr_id
}
}
`,
diff --git a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts
index a343080..65b1157 100644
--- a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts
+++ b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts
@@ -32,7 +32,7 @@ export default [
};
},
effect: ({ insuranceCompany, insTerm, insured }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
if (insTerm) {
@@ -87,7 +87,7 @@ export default [
};
},
effect: ({ insTerm, leasingPeriod }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const { rows: tableRows } = calculationStore.tables.tableInsurance;
@@ -245,7 +245,7 @@ export default [
};
},
effect: ({ kaskoRow, dgoRow, nsRow }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const { rows: tableRows } = calculationStore.tables.tableInsurance;
@@ -301,7 +301,7 @@ export default [
};
},
effect: ({ kaskoRow }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const { rows: tableRows } = calculationStore.tables.tableInsurance;
@@ -356,7 +356,7 @@ export default [
};
},
effect: ({ osagoRow }) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const { rows: tableRows } = calculationStore.tables.tableInsurance;
@@ -434,7 +434,7 @@ export default [
};
},
effect: async (nextParams, prevParams) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
@@ -754,7 +754,7 @@ export default [
return leaseObjectCategory;
},
effect: (nextLeaseObjectCategory, prevLeaseObjectCategory) => {
- if (calculationProcess.process === Process.LoadKp) {
+ if (calculationProcess.hasProcess(Process.LoadKp)) {
return;
}
const nextIsTrailer = nextLeaseObjectCategory === 100000004;
diff --git a/src/client/stores/CalculationStore/Effects/when.ts b/src/client/stores/CalculationStore/Effects/when.ts
index 6c9dc5a..d6aa06a 100644
--- a/src/client/stores/CalculationStore/Effects/when.ts
+++ b/src/client/stores/CalculationStore/Effects/when.ts
@@ -1,10 +1,5 @@
-import { IWhenEffect } from 'core/types/Calculation/Store/effect'; // @ts-nocheck
-import { pick } from 'lodash';
-
-const mapInsType = {
- kasko: 100000000,
- osago: 100000001,
-};
+import { initIns } from 'client/Components/Calculation/ELT/Content/lib/resetIns';
+import { IWhenEffect } from 'core/types/Calculation/Store/effect';
const whenEffects: IWhenEffect[] = [
calculationStore => ({
@@ -16,31 +11,8 @@ const whenEffects: IWhenEffect[] = [
return insuranceCompanies !== undefined && insuranceCompanies.length > 0;
},
effect: () => {
- const insuranceCompanies = calculationStore.getTableOptions(
- 'tableInsurance',
- 'insuranceCompany',
- );
- if (insuranceCompanies === undefined) {
- return;
- }
- const { ELTStore } = calculationStore.stores;
- insuranceCompanies.forEach(company => {
- if (company.evo_id_elt) {
- const companyData = pick(
- company,
- ['evo_id_elt', 'name', 'accountid'],
- '',
- );
- Object.keys(mapInsType).forEach(insType => {
- if (
- company &&
- company.evo_type_ins_policy &&
- company.evo_type_ins_policy.includes(mapInsType[insType])
- ) {
- ELTStore[insType].list.push(companyData);
- }
- });
- }
+ ['osago', 'kasko'].forEach(insType => {
+ initIns.call(calculationStore, insType);
});
},
}),
diff --git a/src/client/stores/CalculationStore/config/initialStatuses.ts b/src/client/stores/CalculationStore/config/initialStatuses.ts
index ea62083..14f0031 100644
--- a/src/client/stores/CalculationStore/config/initialStatuses.ts
+++ b/src/client/stores/CalculationStore/config/initialStatuses.ts
@@ -39,6 +39,7 @@ const initialStatuses: TElements = {
tbxVehicleTaxInLeasingPeriod: ElementStatus.Disabled,
selectObjectTypeTax: ElementStatus.Disabled,
selectLeaseObjectCategory: ElementStatus.Disabled,
+ tbxINNForCalc: ElementStatus.Disabled,
};
export default initialStatuses;
diff --git a/src/client/stores/CalculationStore/config/initialValues.ts b/src/client/stores/CalculationStore/config/initialValues.ts
index c5e1684..342479d 100644
--- a/src/client/stores/CalculationStore/config/initialValues.ts
+++ b/src/client/stores/CalculationStore/config/initialValues.ts
@@ -43,7 +43,6 @@ const initialValues: TValues = {
leaseObjectCategory: 100000001,
leaseObjectMotorPower: 0,
engineVolume: 0,
- leaseObjectUseFor: 100000000,
dealerRewardSumm: 0,
dealerBrokerRewardSumm: 0,
indAgent: null,
diff --git a/src/client/stores/CalculationStore/subStores/calculationProcess.ts b/src/client/stores/CalculationStore/subStores/calculationProcess.ts
index 66330ff..ada0634 100644
--- a/src/client/stores/CalculationStore/subStores/calculationProcess.ts
+++ b/src/client/stores/CalculationStore/subStores/calculationProcess.ts
@@ -1,14 +1,22 @@
import { ElementParam } from 'core/types/Calculation/Store';
import { ElementsNames } from 'core/types/Calculation/Store/elements';
-import { Process } from 'core/types/Calculation/Store/process';
import { TableNames } from 'core/types/Calculation/Store/tables';
import { ElementStatus } from 'core/types/statuses';
import { makeAutoObservable } from 'mobx';
const calculationProcess = makeAutoObservable({
- process: Process.Default,
- setProcess(process) {
- this.process = process;
+ processes: new Set(),
+ addProcess(process) {
+ this.processes.add(process);
+ },
+ deleteProcess(process) {
+ this.processes.delete(process);
+ },
+ hasProcess(process) {
+ return this.processes.has(process);
+ },
+ noProcesses() {
+ return this.processes.size === 0;
},
bypass: {
diff --git a/src/client/stores/CalculationStore/subStores/eltStore.ts b/src/client/stores/CalculationStore/subStores/eltStore.ts
index c8e7bf7..5ff43e5 100644
--- a/src/client/stores/CalculationStore/subStores/eltStore.ts
+++ b/src/client/stores/CalculationStore/subStores/eltStore.ts
@@ -1,4 +1,5 @@
// @ts-nocheck
+import { initFields } from 'client/Components/Calculation/ELT/Content/lib/resetIns';
import { makeAutoObservable } from 'mobx';
const ELTStore = makeAutoObservable(
@@ -6,8 +7,17 @@ const ELTStore = makeAutoObservable(
{},
...['osago', 'kasko'].map(x => ({
[x]: {
+ isReseted() {
+ return this.list.every(
+ x => Object.keys(x).length === initFields.length,
+ );
+ },
+ reset(list) {
+ this.selectedKey = undefined;
+ this.list.replace(list);
+ },
list: [],
- selectedKey: '',
+ selectedKey: undefined,
setKey(key) {
this.selectedKey = key;
},
diff --git a/src/core/services/1CService/leasingTrial.ts b/src/core/services/1CService/leasingTrial.ts
index af823bc..b07f06a 100644
--- a/src/core/services/1CService/leasingTrial.ts
+++ b/src/core/services/1CService/leasingTrial.ts
@@ -1,5 +1,6 @@
import axios from 'axios';
import { _1C_PROXY_URL } from 'core/constants/urls';
+import { wrapRequest } from 'core/tools/request';
import { IGetTransTaxRequest } from 'core/types/Calculation/Requests';
import { IGetTransTaxResponse } from 'core/types/Calculation/Responses';
@@ -7,17 +8,10 @@ export default class {
static getTransTax = (
payload: IGetTransTaxRequest,
): Promise =>
- new Promise((resolve, reject) => {
- axios
- .post(
- String.prototype.concat(_1C_PROXY_URL, '/leasingTrial', '/transTax'),
- payload,
- )
- .then(res => {
- resolve(res.data);
- })
- .catch(err => {
- reject(err);
- });
- });
+ wrapRequest(
+ axios.post(
+ String.prototype.concat(_1C_PROXY_URL, '/leasingTrial', '/transTax'),
+ payload,
+ ),
+ );
}
diff --git a/src/core/services/ELTService/Kasko.js b/src/core/services/ELTService/Kasko.js
index 2a3fea7..02c0b35 100644
--- a/src/core/services/ELTService/Kasko.js
+++ b/src/core/services/ELTService/Kasko.js
@@ -1,23 +1,16 @@
import axios from 'axios';
import { ELT_PROXY_URL } from 'core/constants/urls';
+import { wrapRequest } from 'core/tools/request';
-export default class {
- static getCalculation = payload =>
- new Promise((resolve, reject) => {
- axios
- .post(
- String.prototype.concat(
- ELT_PROXY_URL,
- '/insurance',
- '/calculateKasko',
- ),
- payload,
- )
- .then(res => {
- resolve(res.data);
- })
- .catch(err => {
- reject(err);
- });
- });
-}
+export default {
+ getCalculation: (payload, cancelToken) =>
+ wrapRequest(
+ axios.post(
+ String.prototype.concat(ELT_PROXY_URL, '/insurance', '/calculateKasko'),
+ payload,
+ {
+ cancelToken,
+ },
+ ),
+ ),
+};
diff --git a/src/core/services/ELTService/Osago.js b/src/core/services/ELTService/Osago.js
index 7998801..8d61fe6 100644
--- a/src/core/services/ELTService/Osago.js
+++ b/src/core/services/ELTService/Osago.js
@@ -1,24 +1,14 @@
import axios from 'axios';
import { ELT_PROXY_URL } from 'core/constants/urls';
+import { wrapRequest } from 'core/tools/request';
-export default class {
- static getCalculation = payload =>
- new Promise((resolve, reject) => {
- axios
- .post(
- String.prototype.concat(
- ELT_PROXY_URL,
- '/insurance',
- '/calculateOsago',
- ),
- payload,
- )
- .then(res => {
- resolve(res.data);
- })
- .catch(err => {
- reject(err);
- throw err.response.data;
- });
- });
-}
+export default {
+ getCalculation: (payload, cancelToken) =>
+ wrapRequest(
+ axios.post(
+ String.prototype.concat(ELT_PROXY_URL, '/insurance', '/calculateOsago'),
+ payload,
+ { cancelToken },
+ ),
+ ),
+};
diff --git a/src/core/services/UserService/index.js b/src/core/services/UserService/index.js
index 0b24af0..c71b6fd 100644
--- a/src/core/services/UserService/index.js
+++ b/src/core/services/UserService/index.js
@@ -1,16 +1,8 @@
import axios from 'axios';
import { AUTH_PROXY_URL } from 'core/constants/urls';
+import { wrapRequest } from 'core/tools/request';
export default class {
static fetchUser = () =>
- new Promise((resolve, reject) => {
- axios
- .get(String.prototype.concat(AUTH_PROXY_URL, '/user'))
- .then(res => {
- resolve(res.data);
- })
- .catch(err => {
- reject(err);
- });
- });
+ wrapRequest(axios.get(String.prototype.concat(AUTH_PROXY_URL, '/user')));
}
diff --git a/src/core/tools/format.ts b/src/core/tools/format.ts
new file mode 100644
index 0000000..16b9683
--- /dev/null
+++ b/src/core/tools/format.ts
@@ -0,0 +1,9 @@
+export const formatMoney = (n = 0, currency = 'RUB') =>
+ Intl.NumberFormat('ru', {
+ style: 'currency',
+ currency,
+ }).format(n);
+
+export const formatNumber = (n = 0.0, options: Intl.NumberFormatOptions) => {
+ return Intl.NumberFormat('ru', options).format(n);
+};
diff --git a/src/core/tools/func.js b/src/core/tools/func.js
new file mode 100644
index 0000000..0530eb2
--- /dev/null
+++ b/src/core/tools/func.js
@@ -0,0 +1,2 @@
+export const compose = (...functions) => args =>
+ functions.reduce((arg, fn) => fn(arg), args);
diff --git a/src/core/tools/num.js b/src/core/tools/num.js
new file mode 100644
index 0000000..94f8552
--- /dev/null
+++ b/src/core/tools/num.js
@@ -0,0 +1,3 @@
+import { round as _round } from 'lodash';
+
+export const round = (value, n) => _round(value, n || 2).toFixed(n || 2);
diff --git a/src/core/tools/request.js b/src/core/tools/request.js
new file mode 100644
index 0000000..951c044
--- /dev/null
+++ b/src/core/tools/request.js
@@ -0,0 +1,10 @@
+export const wrapRequest = request =>
+ new Promise((resolve, reject) => {
+ request
+ .then(res => {
+ resolve(res.data);
+ })
+ .catch(err => {
+ reject(err);
+ });
+ });
diff --git a/src/core/types/Calculation/Store/elements.ts b/src/core/types/Calculation/Store/elements.ts
index 4422715..9424d06 100644
--- a/src/core/types/Calculation/Store/elements.ts
+++ b/src/core/types/Calculation/Store/elements.ts
@@ -1,3 +1,5 @@
+import { TableNames } from 'core/types/Calculation/Store/tables';
+
export type ElementsNames =
| 'selectLead'
| 'selectOpportunity'
@@ -89,7 +91,6 @@ export type ElementsNames =
| 'radioInsKaskoType'
| 'tbxInsKaskoPriceLeasePeriod'
| 'cbxInsDecentral'
- | 'btnInsCalculation'
| 'selectInsPeriod'
| 'tbxInsFranchise'
| 'cbxInsUnlimitDrivers'
@@ -171,7 +172,8 @@ export type AllElements =
| ElementsNames
| ResultElementsNames
| LinkElementsNames
- | CustomComponents;
+ | CustomComponents
+ | TableNames;
export enum ElementType {
Default,
diff --git a/src/core/types/Calculation/Store/process.ts b/src/core/types/Calculation/Store/process.ts
index 022bca1..25f33eb 100644
--- a/src/core/types/Calculation/Store/process.ts
+++ b/src/core/types/Calculation/Store/process.ts
@@ -1,5 +1,5 @@
export enum Process {
- Default,
LoadKp,
RecalcWithoutRevision,
+ ELT,
}
diff --git a/src/core/types/Entities/crmEntities.ts b/src/core/types/Entities/crmEntities.ts
index b659e15..fc3aaf7 100644
--- a/src/core/types/Entities/crmEntities.ts
+++ b/src/core/types/Entities/crmEntities.ts
@@ -37,6 +37,7 @@ export interface ILead {
evo_agent_accountid?: string;
accountidData?: IAccount;
owner_domainname?: string;
+ evo_inn?: string;
}
export interface IOpportunity {
@@ -208,12 +209,14 @@ export interface IEvoRegion {
evo_businessunit_evolution?: boolean;
evo_oktmo?: string;
accounts?: IAccount[];
+ evo_kladr_id?: string;
}
export interface IEvoTown {
evo_name?: string;
evo_townid?: string;
statecode?: number;
evo_fias_id?: string;
+ evo_kladr_id?: string;
}
export interface IEvoContact {
parentcustomerid?: string;