merge branch dev/eslint-config
This commit is contained in:
parent
96c4a095b1
commit
b15de1ffe2
@ -7,4 +7,7 @@ package-lock.json
|
||||
coverage
|
||||
.eslintrc.js
|
||||
**/*.config.js
|
||||
**/scripts
|
||||
**/scripts
|
||||
packages/eslint-config-custom/*
|
||||
**/package.json
|
||||
turbo.json
|
||||
@ -1,10 +1,13 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
// This tells ESLint to load the config from the package `eslint-config-custom`
|
||||
extends: ['custom'],
|
||||
extends: ['custom', 'custom/rules'],
|
||||
settings: {
|
||||
next: {
|
||||
rootDir: ['apps/*/', 'packages/*/'],
|
||||
rootDir: ['packages/web/'],
|
||||
},
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
16
.vscode/settings.json
vendored
16
.vscode/settings.json
vendored
@ -13,10 +13,18 @@
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": true,
|
||||
"source.fixAll.eslint": true,
|
||||
"source.fixAll.format": true
|
||||
"source.fixAll": true,
|
||||
"source.fixAll.eslint": true
|
||||
},
|
||||
"workbench.editor.labelFormat": "short",
|
||||
"eslint.workingDirectories": [{ "directory": "apps/web", "changeProcessCWD": true }]
|
||||
"eslint.workingDirectories": [{ "directory": "apps/web", "changeProcessCWD": true }],
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"json",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"yaml"
|
||||
],
|
||||
"eslint.lintTask.enable": true
|
||||
}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
.next
|
||||
public
|
||||
*.config.js
|
||||
apollo.config.js
|
||||
mocks
|
||||
graphql
|
||||
graphql/crm.schema.graphql
|
||||
graphql/crm.types.ts
|
||||
package.json
|
||||
next-env.d.ts
|
||||
@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom'],
|
||||
extends: ['custom', 'custom/rules'],
|
||||
parserOptions: {
|
||||
project: './tsconfig.json',
|
||||
tsconfigRootDir: __dirname,
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type { FormTabRows } from '../../lib/render-rows';
|
||||
|
||||
export const id = 'add-product';
|
||||
|
||||
@ -6,7 +6,7 @@ function Insurance() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: Insurance,
|
||||
id,
|
||||
title,
|
||||
Component: Insurance,
|
||||
};
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type { FormTabRows } from '../../lib/render-rows';
|
||||
|
||||
export const id = 'create-kp';
|
||||
|
||||
@ -6,7 +6,7 @@ function CreateKP() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: CreateKP,
|
||||
id,
|
||||
title,
|
||||
Component: CreateKP,
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type { Risk } from './types';
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
|
||||
export const columns: ColumnsType<Risk> = [
|
||||
{
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { columns } from './config';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { toJS } from 'mobx';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import styled from 'styled-components';
|
||||
import { Flex } from 'ui';
|
||||
import Alert from 'ui/elements/Alert';
|
||||
import Table from 'ui/elements/Table';
|
||||
import { columns } from './config';
|
||||
|
||||
const Grid = styled(Flex)`
|
||||
flex-direction: column;
|
||||
@ -23,7 +23,7 @@ const Validation = observer(() => {
|
||||
return null;
|
||||
});
|
||||
|
||||
const FinGAPTable = observer(() => {
|
||||
const FinGAP = observer(() => {
|
||||
const { $tables } = useStore();
|
||||
const { fingap } = $tables;
|
||||
|
||||
@ -35,7 +35,6 @@ const FinGAPTable = observer(() => {
|
||||
columns={columns}
|
||||
dataSource={dataSource}
|
||||
rowSelection={{
|
||||
type: 'checkbox',
|
||||
onChange: (_, selectedRows) => {
|
||||
const selectedKeys = selectedRows.reduce((acc, row) => {
|
||||
acc.push(row.key);
|
||||
@ -47,6 +46,7 @@ const FinGAPTable = observer(() => {
|
||||
fingap.setSelectedKeys(selectedKeys);
|
||||
},
|
||||
selectedRowKeys,
|
||||
type: 'checkbox',
|
||||
}}
|
||||
pagination={false}
|
||||
size="small"
|
||||
@ -57,11 +57,11 @@ const FinGAPTable = observer(() => {
|
||||
);
|
||||
});
|
||||
|
||||
export default function () {
|
||||
export default function FinGAPTable() {
|
||||
return (
|
||||
<Grid>
|
||||
<Validation />
|
||||
<FinGAPTable />
|
||||
<FinGAP />
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { RiskSchema } from 'config/schema/fingap';
|
||||
import type { RiskSchema } from '@/config/schema/fingap';
|
||||
import type { z } from 'zod';
|
||||
|
||||
export type Risk = z.infer<typeof RiskSchema>;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
import { useRow } from 'stores/tables/insurance/hooks';
|
||||
import { useInsuranceValue } from './hooks';
|
||||
import type { Values } from './types';
|
||||
import { useRow } from '@/stores/tables/insurance/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
export function buildOptionComponent<T>(
|
||||
key: string,
|
||||
@ -16,7 +16,7 @@ export function buildOptionComponent<T>(
|
||||
const statuses = getStatus(valueName);
|
||||
|
||||
return (
|
||||
<Component value={value} options={options} setValue={setValue} status={statuses} {...props} />
|
||||
<Component options={options} setValue={setValue} status={statuses} value={value} {...props} />
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -31,6 +31,6 @@ export function buildValueComponent<T>(
|
||||
const { getStatus } = useRow(key);
|
||||
const statuses = getStatus(valueName);
|
||||
|
||||
return <Component value={value} setValue={setValue} status={statuses} {...props} />;
|
||||
return <Component setValue={setValue} status={statuses} value={value} {...props} />;
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { buildOptionComponent, buildValueComponent } from './builders';
|
||||
import type * as Insurance from './types';
|
||||
import { MAX_INSURANCE } from '@/constants/values';
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
import { MAX_INSURANCE } from 'constants/values';
|
||||
import { formatter, parser } from 'tools/number';
|
||||
import InputNumber from 'ui/elements/InputNumber';
|
||||
import Select from 'ui/elements/Select';
|
||||
import { buildOptionComponent, buildValueComponent } from './builders';
|
||||
import type * as Insurance from './types';
|
||||
|
||||
export const columns: ColumnsType<Insurance.RowValues> = [
|
||||
{
|
||||
@ -21,7 +21,7 @@ export const columns: ColumnsType<Insurance.RowValues> = [
|
||||
render: (_, record) => {
|
||||
const Component = buildOptionComponent(record.key, Select, 'insuranceCompany');
|
||||
|
||||
return <Component showSearch optionFilterProp="label" />;
|
||||
return <Component optionFilterProp="label" showSearch />;
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -43,13 +43,13 @@ export const columns: ColumnsType<Insurance.RowValues> = [
|
||||
|
||||
return (
|
||||
<Component
|
||||
min={0}
|
||||
max={MAX_INSURANCE}
|
||||
step={1000}
|
||||
precision={2}
|
||||
parser={parser}
|
||||
formatter={formatter}
|
||||
addonAfter="₽"
|
||||
formatter={formatter}
|
||||
max={MAX_INSURANCE}
|
||||
min={0}
|
||||
parser={parser}
|
||||
precision={2}
|
||||
step={1_000}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { useRow } from '@/stores/tables/insurance/hooks';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRow } from 'stores/tables/insurance/hooks';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
|
||||
export function useInsuranceValue(key, valueName) {
|
||||
@ -8,24 +7,19 @@ export function useInsuranceValue(key, valueName) {
|
||||
|
||||
const storeValue = row.getValue(valueName);
|
||||
|
||||
function setStoreValue(value) {
|
||||
return row.setValue(valueName, value);
|
||||
function setStoreValue(val) {
|
||||
return row.setValue(valueName, val);
|
||||
}
|
||||
|
||||
const [value, setValue] = useState(storeValue);
|
||||
|
||||
// eslint-disable-next-line object-curly-newline
|
||||
const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1000 });
|
||||
const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1_000 });
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
if (storeValue !== value) {
|
||||
debouncedSetStoreValue(value);
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[value]
|
||||
);
|
||||
useEffect(() => {
|
||||
if (storeValue !== value) {
|
||||
debouncedSetStoreValue(value);
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
useEffect(() => {
|
||||
setValue(storeValue);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { columns } from './config';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import styled from 'styled-components';
|
||||
import { Flex } from 'ui';
|
||||
import Alert from 'ui/elements/Alert';
|
||||
import Table from 'ui/elements/Table';
|
||||
import { columns } from './config';
|
||||
|
||||
const Grid = styled(Flex)`
|
||||
flex-direction: column;
|
||||
@ -28,7 +28,7 @@ const Validation = observer(() => {
|
||||
return null;
|
||||
});
|
||||
|
||||
const InsuranceTable = observer(() => {
|
||||
const Insurance = observer(() => {
|
||||
const store = useStore();
|
||||
|
||||
const { values } = store.$tables.insurance;
|
||||
@ -48,11 +48,11 @@ const InsuranceTable = observer(() => {
|
||||
);
|
||||
});
|
||||
|
||||
export default function () {
|
||||
export default function InsuranceTable() {
|
||||
return (
|
||||
<Grid>
|
||||
<Validation />
|
||||
<InsuranceTable />
|
||||
<Insurance />
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { KeysSchema, RowSchema } from 'config/schema/insurance';
|
||||
import type { KeysSchema, RowSchema } from '@/config/schema/insurance';
|
||||
import type { BaseOption, Status } from 'ui/elements/types';
|
||||
import type { z } from 'zod';
|
||||
|
||||
@ -9,7 +9,7 @@ export type RowValues = z.infer<typeof RowSchema>;
|
||||
export type Values = Exclude<keyof RowValues, 'key'>;
|
||||
|
||||
export type RowOptions = {
|
||||
[ValueName in Values]: BaseOption<RowValues[ValueName]>[];
|
||||
[ValueName in Values]: Array<BaseOption<RowValues[ValueName]>>;
|
||||
};
|
||||
|
||||
export type RowStatuses = Record<Values, Status>;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { Flex } from 'ui';
|
||||
import renderFormRows from '../../lib/render-rows';
|
||||
import { id, rows, title } from './config';
|
||||
import FinGAPTable from './FinGAPTable';
|
||||
import InsuranceTable from './InsuranceTable';
|
||||
import { Flex } from 'ui';
|
||||
|
||||
function Insurance() {
|
||||
const renderedRows = renderFormRows(rows);
|
||||
@ -17,7 +17,7 @@ function Insurance() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: Insurance,
|
||||
id,
|
||||
title,
|
||||
Component: Insurance,
|
||||
};
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type { FormTabRows } from '../../lib/render-rows';
|
||||
|
||||
export const id = 'leasing';
|
||||
|
||||
@ -6,7 +6,7 @@ function Leasing() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: Leasing,
|
||||
id,
|
||||
title,
|
||||
Component: Leasing,
|
||||
};
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type { FormTabRows } from '../../lib/render-rows';
|
||||
|
||||
export const id = 'leasing-object';
|
||||
|
||||
@ -6,7 +6,7 @@ function LeasingObject() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: LeasingObject,
|
||||
id,
|
||||
title,
|
||||
Component: LeasingObject,
|
||||
};
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import { Flex } from 'ui';
|
||||
import elementsRender from '../../config/elements-render';
|
||||
import { elements } from './config';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { Flex } from 'ui';
|
||||
|
||||
function PaymentsParams() {
|
||||
const renderedElements = elements.map((elementName) => {
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { usePaymentValue } from './hooks';
|
||||
import { useRowStatus } from '@/stores/tables/payments/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
import { useRowStatus } from 'stores/tables/payments/hooks';
|
||||
import { usePaymentValue } from './hooks';
|
||||
|
||||
export function buildValueComponent<T>(index: number, Component: ComponentType<T>) {
|
||||
return observer((props: T) => {
|
||||
const [value, setValue] = usePaymentValue(index);
|
||||
const status = useRowStatus(index);
|
||||
|
||||
return <Component value={value} setValue={setValue} status={status} {...props} />;
|
||||
return <Component setValue={setValue} status={status} value={value} {...props} />;
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { buildValueComponent } from './builders';
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
import InputNumber from 'ui/elements/InputNumber';
|
||||
|
||||
import { buildValueComponent } from './builders';
|
||||
|
||||
type Payment = {
|
||||
key: number;
|
||||
num: number;
|
||||
@ -27,10 +26,10 @@ export const columns: ColumnsType<Payment> = [
|
||||
|
||||
return (
|
||||
<Component
|
||||
min={payment.num === 0 ? 0 : 0.01}
|
||||
max={100}
|
||||
step={1}
|
||||
min={payment.num === 0 ? 0 : 0.01}
|
||||
precision={payment.num === 0 ? 4 : 2}
|
||||
step={1}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@ -1,24 +1,18 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { useRowValue } from '@/stores/tables/payments/hooks';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRowValue } from 'stores/tables/payments/hooks';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
|
||||
export function usePaymentValue(index) {
|
||||
const [storeValue, setStoreValue] = useRowValue(index);
|
||||
const [value, setValue] = useState(storeValue);
|
||||
|
||||
// eslint-disable-next-line object-curly-newline
|
||||
const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1000 });
|
||||
const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1_000 });
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
if (storeValue !== value) {
|
||||
debouncedSetStoreValue(value);
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[value]
|
||||
);
|
||||
useEffect(() => {
|
||||
if (storeValue !== value) {
|
||||
debouncedSetStoreValue(value);
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
useEffect(() => {
|
||||
setValue(storeValue);
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { columns } from './config';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { min } from '@/styles/mq';
|
||||
import { computed } from 'mobx';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import Alert from 'ui/elements/Alert';
|
||||
import Table from 'ui/elements/Table';
|
||||
import { Box, Flex } from 'ui/grid';
|
||||
import { columns } from './config';
|
||||
|
||||
const Grid = styled(Flex)`
|
||||
flex-direction: column;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { Box, Flex } from 'ui/grid';
|
||||
import elementsRender from '../../config/elements-render';
|
||||
import { id, title } from './config';
|
||||
import PaymentsParams from './PaymentsParams';
|
||||
import PaymentsTable from './PaymentsTable';
|
||||
import { Box, Flex } from 'ui/grid';
|
||||
|
||||
function Payments() {
|
||||
const radioGraphType = elementsRender.radioGraphType.render();
|
||||
@ -12,8 +12,8 @@ function Payments() {
|
||||
<Box
|
||||
sx={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'],
|
||||
gap: '10px',
|
||||
gridTemplateColumns: ['1fr', '1fr', '1fr 1fr'],
|
||||
}}
|
||||
>
|
||||
{radioGraphType}
|
||||
@ -25,7 +25,7 @@ function Payments() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: Payments,
|
||||
id,
|
||||
title,
|
||||
Component: Payments,
|
||||
};
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type { FormTabRows } from '../../lib/render-rows';
|
||||
|
||||
export const id = 'supplier-agent';
|
||||
|
||||
@ -6,7 +6,7 @@ function Leasing() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: Leasing,
|
||||
id,
|
||||
title,
|
||||
Component: Leasing,
|
||||
};
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
import Background from 'Components/Layout/Background';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import Tabs from 'ui/elements/layout/Tabs';
|
||||
import AddProduct from './AddProduct';
|
||||
import CreateKP from './CreateKP';
|
||||
import Insurance from './Insurance';
|
||||
@ -9,6 +5,10 @@ import Leasing from './Leasing';
|
||||
import LeasingObject from './LeasingObject';
|
||||
import Payments from './Payments';
|
||||
import SupplierAgent from './SupplierAgent';
|
||||
import Background from '@/Components/Layout/Background';
|
||||
import { min } from '@/styles/mq';
|
||||
import styled from 'styled-components';
|
||||
import Tabs from 'ui/elements/layout/Tabs';
|
||||
|
||||
const formTabs = [Leasing, Payments, LeasingObject, SupplierAgent, Insurance, AddProduct, CreateKP];
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type { FormTabRows } from '../lib/render-rows';
|
||||
|
||||
const defaultRowStyle = { gridTemplateColumns: '1fr' };
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import Background from 'Components/Layout/Background';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import renderFormRows from '../lib/render-rows';
|
||||
import { rows } from './config';
|
||||
import Background from '@/Components/Layout/Background';
|
||||
import { min } from '@/styles/mq';
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Wrapper = styled(Background)`
|
||||
padding: 4px 10px;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import * as CRMTypes from 'graphql/crm.types';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
|
||||
const CurrencyAddon = observer(() => {
|
||||
const { $calculation } = useStore();
|
||||
@ -9,10 +9,11 @@ const CurrencyAddon = observer(() => {
|
||||
const currencyid = $calculation.element('selectSupplierCurrency').getValue();
|
||||
|
||||
const { data } = useQuery(CRMTypes.GetTransactionCurrencyDocument, {
|
||||
skip: !currencyid,
|
||||
variables: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
currencyid: currencyid!,
|
||||
},
|
||||
skip: !currencyid,
|
||||
});
|
||||
|
||||
return <span>{data?.transactioncurrency?.currencysymbol}</span>;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
/* eslint-disable react/jsx-no-bind */
|
||||
import type { Elements } from '../config/map/actions';
|
||||
import { useStatus } from '@/stores/calculation/statuses/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
import { useStatus } from 'stores/calculation/statuses/hooks';
|
||||
import type { Elements } from '../config/map/actions';
|
||||
|
||||
type BuilderProps = {
|
||||
elementName: Elements;
|
||||
@ -18,8 +17,8 @@ export default function buildAction<T>(
|
||||
|
||||
return (
|
||||
<Component
|
||||
action={() => import(`process/${actionName}`).then((module) => module.default())}
|
||||
status={status}
|
||||
action={() => import(`process/${actionName}`).then((m) => m.default())}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
import { useOptions } from 'stores/calculation/options/hooks';
|
||||
import { useStatus } from 'stores/calculation/statuses/hooks';
|
||||
import { useValidation } from 'stores/calculation/validation/hooks';
|
||||
import type { Values } from 'stores/calculation/values/types';
|
||||
import type { Elements } from '../config/map/values';
|
||||
import { useStoreValue } from './hooks';
|
||||
import { useOptions } from '@/stores/calculation/options/hooks';
|
||||
import { useStatus } from '@/stores/calculation/statuses/hooks';
|
||||
import { useValidation } from '@/stores/calculation/validation/hooks';
|
||||
import type { Values } from '@/stores/calculation/values/types';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
type BuilderProps = {
|
||||
elementName: Elements;
|
||||
@ -24,12 +24,12 @@ export default function buildOptions<T>(
|
||||
|
||||
return (
|
||||
<Component
|
||||
value={value}
|
||||
setValue={setValue}
|
||||
options={options}
|
||||
status={status}
|
||||
isValid={isValid}
|
||||
help={help}
|
||||
isValid={isValid}
|
||||
options={options}
|
||||
setValue={setValue}
|
||||
status={status}
|
||||
value={value}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import type { Elements } from '../config/map/values';
|
||||
import { useStatus } from '@/stores/calculation/statuses/hooks';
|
||||
import { useValue } from '@/stores/calculation/values/hooks';
|
||||
import type { Values } from '@/stores/calculation/values/types';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
import { useStatus } from 'stores/calculation/statuses/hooks';
|
||||
import { useValue } from 'stores/calculation/values/hooks';
|
||||
import type { Values } from 'stores/calculation/values/types';
|
||||
import type { Elements } from '../config/map/values';
|
||||
|
||||
type BuilderProps = {
|
||||
elementName: Elements;
|
||||
@ -18,6 +18,6 @@ export default function buildReadonly<T>(
|
||||
const [value] = useValue(valueName);
|
||||
const status = useStatus(elementName);
|
||||
|
||||
return <Component value={value} status={status} readOnly {...props} />;
|
||||
return <Component readOnly status={status} value={value} {...props} />;
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
import { useStatus } from 'stores/calculation/statuses/hooks';
|
||||
import { useValidation } from 'stores/calculation/validation/hooks';
|
||||
import type { Values } from 'stores/calculation/values/types';
|
||||
import type { Elements } from '../config/map/values';
|
||||
import { useStoreValue } from './hooks';
|
||||
import { useStatus } from '@/stores/calculation/statuses/hooks';
|
||||
import { useValidation } from '@/stores/calculation/validation/hooks';
|
||||
import type { Values } from '@/stores/calculation/values/types';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
export type BuilderProps = {
|
||||
elementName: Elements;
|
||||
@ -22,11 +22,11 @@ export default function buildValue<T>(
|
||||
|
||||
return (
|
||||
<Component
|
||||
value={value}
|
||||
help={help}
|
||||
isValid={isValid}
|
||||
setValue={setValue}
|
||||
status={status}
|
||||
isValid={isValid}
|
||||
help={help}
|
||||
value={value}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -1,24 +1,18 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { useValue } from '@/stores/calculation/values/hooks';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useValue } from 'stores/calculation/values/hooks';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
|
||||
export function useStoreValue(valueName) {
|
||||
const [storeValue, setStoreValue] = useValue(valueName);
|
||||
const [value, setValue] = useState(storeValue);
|
||||
|
||||
// eslint-disable-next-line object-curly-newline
|
||||
const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1000 });
|
||||
const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1_000 });
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
if (storeValue !== value) {
|
||||
debouncedSetStoreValue(value);
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[value]
|
||||
);
|
||||
useEffect(() => {
|
||||
if (storeValue !== value) {
|
||||
debouncedSetStoreValue(value);
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
useEffect(() => {
|
||||
setValue(storeValue);
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import type { ComponentProps } from 'react';
|
||||
import * as e from 'ui/elements';
|
||||
/* eslint-disable jsdoc/multiline-blocks */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type { Elements as ActionElements } from './map/actions';
|
||||
import type { Elements as ValuesElements } from './map/values';
|
||||
import type { ComponentProps } from 'react';
|
||||
import * as e from 'ui/elements';
|
||||
|
||||
function wrapComponentsMap<C, T extends Record<ValuesElements | ActionElements, C>>(arg: T) {
|
||||
function wrapComponentsMap<C, T extends Record<ActionElements | ValuesElements, C>>(arg: T) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { MAX_FRANCHISE, MAX_LEASING_PERIOD } from 'constants/values';
|
||||
/* eslint-disable jsdoc/multiline-blocks */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import CurrencyAddon from '../addons/currency-addon';
|
||||
import type { ElementsProps } from './elements-components';
|
||||
import { MAX_FRANCHISE, MAX_LEASING_PERIOD } from '@/constants/values';
|
||||
import dayjs from 'dayjs';
|
||||
import { formatter, formatterExtra, parser } from 'tools/number';
|
||||
import { DownloadOutlined } from 'ui/elements/icons';
|
||||
import CurrencyAddon from '../addons/currency-addon';
|
||||
import type { ElementsProps } from './elements-components';
|
||||
|
||||
const props: Partial<ElementsProps> = {
|
||||
tbxLeaseObjectPrice: {
|
||||
@ -197,7 +199,7 @@ const props: Partial<ElementsProps> = {
|
||||
},
|
||||
tbxEngineVolume: {
|
||||
min: 0,
|
||||
max: 99.9999,
|
||||
max: 99.999_9,
|
||||
step: 0.5,
|
||||
precision: 4,
|
||||
parser,
|
||||
@ -354,7 +356,7 @@ const props: Partial<ElementsProps> = {
|
||||
tbxIRR_Perc: {
|
||||
min: 0,
|
||||
max: 500,
|
||||
step: 0.0001,
|
||||
step: 0.000_1,
|
||||
precision: 6,
|
||||
parser,
|
||||
formatter: formatterExtra,
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type map from '../map';
|
||||
import overrideRender from './override';
|
||||
import render from './render';
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import { Container, Head } from 'Components/Layout/Element';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentProps } from 'react';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import Link from 'ui/elements/Link';
|
||||
import Tooltip from 'ui/elements/Tooltip';
|
||||
import buildReadonly from '../../builders/build-readonly';
|
||||
import components from '../elements-components';
|
||||
import elementsProps from '../elements-props';
|
||||
@ -12,6 +5,12 @@ import titles from '../elements-titles';
|
||||
import types from '../elements-types';
|
||||
import map from '../map';
|
||||
import type { RenderProps } from './types';
|
||||
import { Container, Head } from '@/Components/Layout/Element';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentProps } from 'react';
|
||||
import Link from 'ui/elements/Link';
|
||||
import Tooltip from 'ui/elements/Tooltip';
|
||||
|
||||
const defaultLinkProps: ComponentProps<typeof Link> = {
|
||||
text: 'Открыть в CRM',
|
||||
@ -19,6 +18,31 @@ const defaultLinkProps: ComponentProps<typeof Link> = {
|
||||
};
|
||||
|
||||
const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
|
||||
selectHighSeasonStart: {
|
||||
render: () => {
|
||||
const elementName = 'selectHighSeasonStart';
|
||||
const title = titles.selectHighSeasonStart;
|
||||
const valueName = map.selectHighSeasonStart;
|
||||
const Component = components.selectHighSeasonStart;
|
||||
const props = elementsProps.selectHighSeasonStart;
|
||||
const { builder } = types.selectHighSeasonStart();
|
||||
|
||||
const Element = builder(Component, {
|
||||
elementName,
|
||||
valueName,
|
||||
});
|
||||
|
||||
return (
|
||||
<Tooltip placement="topLeft" title="С какого платежа начинается полный высокий сезон">
|
||||
<Container>
|
||||
<Head htmlFor={elementName} title={title} />
|
||||
<Element {...props} id={elementName} />
|
||||
</Container>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
selectLead: {
|
||||
render: () => {
|
||||
const elementName = 'selectLead';
|
||||
@ -41,9 +65,9 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
|
||||
return (
|
||||
<Container key={elementName}>
|
||||
<Head
|
||||
addon={<LinkComponent {...defaultLinkProps} />}
|
||||
htmlFor={elementName}
|
||||
title={title}
|
||||
addon={<LinkComponent {...defaultLinkProps} />}
|
||||
/>
|
||||
<Element {...props} id={elementName} />
|
||||
</Container>
|
||||
@ -73,9 +97,9 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
|
||||
return (
|
||||
<Container key={elementName}>
|
||||
<Head
|
||||
addon={<LinkComponent {...defaultLinkProps} />}
|
||||
htmlFor={elementName}
|
||||
title={title}
|
||||
addon={<LinkComponent {...defaultLinkProps} />}
|
||||
/>
|
||||
<Element {...props} id={elementName} />
|
||||
</Container>
|
||||
@ -105,9 +129,9 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
|
||||
return (
|
||||
<Container key={elementName}>
|
||||
<Head
|
||||
addon={<LinkComponent {...defaultLinkProps} />}
|
||||
htmlFor={elementName}
|
||||
title={title}
|
||||
addon={<LinkComponent {...defaultLinkProps} />}
|
||||
/>
|
||||
<Element {...props} id={elementName} />
|
||||
</Container>
|
||||
@ -115,56 +139,6 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
|
||||
},
|
||||
},
|
||||
|
||||
tbxVehicleTaxInYear: {
|
||||
render: () => {
|
||||
const elementName = 'tbxVehicleTaxInYear';
|
||||
const title = titles.tbxVehicleTaxInYear;
|
||||
const valueName = map.tbxVehicleTaxInYear;
|
||||
const Component = components.tbxVehicleTaxInYear;
|
||||
const props = elementsProps.tbxVehicleTaxInYear;
|
||||
const { builder } = types.tbxVehicleTaxInYear();
|
||||
|
||||
const Element = builder(Component, {
|
||||
elementName,
|
||||
valueName,
|
||||
});
|
||||
|
||||
return (
|
||||
<Tooltip title="Без учета налога на роскошь" placement="topLeft">
|
||||
<Container>
|
||||
<Head htmlFor={elementName} title={title} />
|
||||
<Element {...props} id={elementName} />
|
||||
</Container>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
selectHighSeasonStart: {
|
||||
render: () => {
|
||||
const elementName = 'selectHighSeasonStart';
|
||||
const title = titles.selectHighSeasonStart;
|
||||
const valueName = map.selectHighSeasonStart;
|
||||
const Component = components.selectHighSeasonStart;
|
||||
const props = elementsProps.selectHighSeasonStart;
|
||||
const { builder } = types.selectHighSeasonStart();
|
||||
|
||||
const Element = builder(Component, {
|
||||
elementName,
|
||||
valueName,
|
||||
});
|
||||
|
||||
return (
|
||||
<Tooltip title="С какого платежа начинается полный высокий сезон" placement="topLeft">
|
||||
<Container>
|
||||
<Head htmlFor={elementName} title={title} />
|
||||
<Element {...props} id={elementName} />
|
||||
</Container>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
selectSeasonType: {
|
||||
render: () => {
|
||||
const elementName = 'selectSeasonType';
|
||||
@ -203,6 +177,31 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
tbxVehicleTaxInYear: {
|
||||
render: () => {
|
||||
const elementName = 'tbxVehicleTaxInYear';
|
||||
const title = titles.tbxVehicleTaxInYear;
|
||||
const valueName = map.tbxVehicleTaxInYear;
|
||||
const Component = components.tbxVehicleTaxInYear;
|
||||
const props = elementsProps.tbxVehicleTaxInYear;
|
||||
const { builder } = types.tbxVehicleTaxInYear();
|
||||
|
||||
const Element = builder(Component, {
|
||||
elementName,
|
||||
valueName,
|
||||
});
|
||||
|
||||
return (
|
||||
<Tooltip placement="topLeft" title="Без учета налога на роскошь">
|
||||
<Container>
|
||||
<Head htmlFor={elementName} title={title} />
|
||||
<Element {...props} id={elementName} />
|
||||
</Container>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default overrideRender;
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import { Container, Head } from 'Components/Layout/Element';
|
||||
import components from '../elements-components';
|
||||
import elementsProps from '../elements-props';
|
||||
import titles from '../elements-titles';
|
||||
import types from '../elements-types';
|
||||
import map from '../map';
|
||||
import { Container, Head } from '@/Components/Layout/Element';
|
||||
|
||||
const render = Object.keys(map).reduce((acc, elementName) => {
|
||||
const title = titles[elementName];
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
/* eslint-disable jsdoc/multiline-blocks */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type { Elements as ActionElements } from './map/actions';
|
||||
import type { Elements as ValuesElements } from './map/values';
|
||||
|
||||
const titles: Record<ValuesElements | ActionElements, string> = {
|
||||
const titles: Record<ActionElements | ValuesElements, string> = {
|
||||
selectLead: 'Интерес',
|
||||
selectOpportunity: 'Лизинговая сделка',
|
||||
selectQuote: 'Предложение',
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
/* eslint-disable jsdoc/multiline-blocks */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { buildAction, buildOptions, buildReadonly, buildValue } from '../builders';
|
||||
import type { Elements as ActionElements } from './map/actions';
|
||||
import type { Elements as ValuesElements } from './map/values';
|
||||
|
||||
type ElementTypes = 'Value' | 'Readonly' | 'Options' | 'Action';
|
||||
type Builders = typeof buildValue | typeof buildReadonly | typeof buildOptions | typeof buildAction;
|
||||
type ElementTypes = 'Action' | 'Options' | 'Readonly' | 'Value';
|
||||
type Builders = typeof buildAction | typeof buildOptions | typeof buildReadonly | typeof buildValue;
|
||||
|
||||
type GetType = () => {
|
||||
typeName: ElementTypes;
|
||||
builder: Builders;
|
||||
typeName: ElementTypes;
|
||||
};
|
||||
|
||||
function wrapTypeGetters<G extends GetType, E extends Record<ElementTypes, G>>(arg: E) {
|
||||
@ -33,7 +35,7 @@ const t = wrapTypeGetters({
|
||||
}),
|
||||
});
|
||||
|
||||
function wrapElementsTypes<T, E extends Record<ValuesElements | ActionElements, T>>(arg: E) {
|
||||
function wrapElementsTypes<T, E extends Record<ActionElements | ValuesElements, T>>(arg: E) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import type { CalculationValues, Values } from 'stores/calculation/values/types';
|
||||
/* eslint-disable jsdoc/multiline-blocks */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type { CalculationValues, Values } from '@/stores/calculation/values/types';
|
||||
|
||||
function wrapElementsMap<T extends Record<string, Values>>(arg: T) {
|
||||
return arg;
|
||||
|
||||
@ -1,15 +1,19 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
import Divider from 'ui/elements/layout/Divider';
|
||||
import type { BoxProps } from 'ui/grid';
|
||||
import { Box } from 'ui/grid';
|
||||
|
||||
import elementsRender from '../config/elements-render';
|
||||
import type { Elements as ActionElements } from '../config/map/actions';
|
||||
import type { Elements as ValuesElements } from '../config/map/values';
|
||||
import Divider from 'ui/elements/layout/Divider';
|
||||
import type { BoxProps } from 'ui/grid';
|
||||
import { Box } from 'ui/grid';
|
||||
|
||||
export type ElementsRow = [elements: (ValuesElements | ActionElements)[], style?: BoxProps['sx']];
|
||||
export type ElementsRow = [
|
||||
elements: Array<ActionElements | ValuesElements>,
|
||||
style?: BoxProps['sx']
|
||||
];
|
||||
type DividerRow = { title: string };
|
||||
|
||||
export type FormTabRows = Array<ElementsRow | DividerRow>;
|
||||
export type FormTabRows = Array<DividerRow | ElementsRow>;
|
||||
|
||||
function renderFormRows(rowsConfig: FormTabRows) {
|
||||
const rows = rowsConfig.map((row, i) => {
|
||||
@ -18,7 +22,6 @@ function renderFormRows(rowsConfig: FormTabRows) {
|
||||
const renderedElements = elements.map((elementName) => {
|
||||
const render = elementsRender[elementName]?.render;
|
||||
|
||||
// eslint-disable-next-line object-curly-newline
|
||||
return render({});
|
||||
});
|
||||
|
||||
@ -27,8 +30,8 @@ function renderFormRows(rowsConfig: FormTabRows) {
|
||||
key={i.toString()}
|
||||
sx={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: ['1fr', '1fr', 'repeat(3, 1fr)'],
|
||||
gap: '10px',
|
||||
gridTemplateColumns: ['1fr', '1fr', 'repeat(3, 1fr)'],
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import Button from 'ui/elements/Button';
|
||||
import Result from 'ui/elements/Result';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { getUser } from '@/api/user/query';
|
||||
import { min } from '@/styles/mq';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getUser } from 'api/user/query';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import { Flex } from 'ui';
|
||||
|
||||
const UserText = styled.span`
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { min } from '@/styles/mq';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import { Box } from 'ui/grid';
|
||||
|
||||
const Background = styled(Box)`
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/* eslint-disable func-style */
|
||||
import { min } from '@/styles/mq';
|
||||
import type { ReactNode } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import { Flex } from 'ui';
|
||||
|
||||
const ElementTitle = styled.label`
|
||||
@ -23,12 +24,12 @@ export function Head({
|
||||
addon,
|
||||
htmlFor,
|
||||
}: {
|
||||
title: ReactNode;
|
||||
addon?: ReactNode;
|
||||
htmlFor: string;
|
||||
title: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<Flex flexDirection={['row']} justifyContent={['space-between']} alignItems={['center']}>
|
||||
<Flex alignItems={['center']} flexDirection={['row']} justifyContent={['space-between']}>
|
||||
<ElementTitle htmlFor={htmlFor}>{title}</ElementTitle>
|
||||
{addon}
|
||||
</Flex>
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
/* eslint-disable import/no-unresolved */
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import { Flex } from 'ui';
|
||||
import Auth from './Auth';
|
||||
import Logo from './Logo';
|
||||
import { min } from '@/styles/mq';
|
||||
import styled from 'styled-components';
|
||||
import { Flex } from 'ui';
|
||||
|
||||
const HeaderContent = styled(Flex)`
|
||||
flex-direction: row;
|
||||
@ -16,7 +15,6 @@ const HeaderContent = styled(Flex)`
|
||||
var(--color-tertiarty) 100%
|
||||
);
|
||||
|
||||
${'' /* height: 70px; */}
|
||||
padding: 10px 12px;
|
||||
${min('laptop')} {
|
||||
padding: 10px 12px;
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
/* eslint-disable react/forbid-component-props */
|
||||
import styles from './Logo.module.css';
|
||||
import { min } from '@/styles/mq';
|
||||
import Image from 'next/image';
|
||||
import logo from 'public/assets/images/logo-primary.svg';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import { Flex } from 'ui';
|
||||
import styles from './Logo.module.css';
|
||||
|
||||
const ImageWrapper = styled.div`
|
||||
width: 100px;
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
/* eslint-disable react/prop-types */
|
||||
/* eslint-disable import/no-unresolved */
|
||||
import { Flex } from 'ui';
|
||||
import Header from './Header';
|
||||
import { Flex } from 'ui';
|
||||
|
||||
export default function Layout({ children }) {
|
||||
return (
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type { Payment } from './types';
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
|
||||
export const columns: ColumnsType<Payment> = [
|
||||
{
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { MAX_LEASING_PERIOD } from 'constants/values';
|
||||
import { columns } from './config';
|
||||
import { MAX_LEASING_PERIOD } from '@/constants/values';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { toJS } from 'mobx';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import Table from 'ui/elements/Table';
|
||||
import { columns } from './config';
|
||||
|
||||
const PaymentsTable = observer(() => {
|
||||
const { $results } = useStore();
|
||||
@ -26,7 +26,7 @@ const PaymentsTable = observer(() => {
|
||||
});
|
||||
|
||||
export default {
|
||||
Component: PaymentsTable,
|
||||
id: 'payments-table',
|
||||
title: 'Таблица платежей',
|
||||
Component: PaymentsTable,
|
||||
};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
export type Payment = {
|
||||
key: string;
|
||||
ndsCompensation: string;
|
||||
num: number;
|
||||
paymentSum: string;
|
||||
ndsCompensation: string;
|
||||
redemptionAmount: string;
|
||||
};
|
||||
|
||||
@ -1,29 +1,27 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
|
||||
import type { Values } from 'stores/results/types';
|
||||
import type { Values } from '@/stores/results/types';
|
||||
|
||||
export const id = 'output';
|
||||
export const title = 'Результаты';
|
||||
|
||||
export const titles: Record<Values, string> = {
|
||||
resultTotalGraphwithNDS: 'Итого по графику, с НДС',
|
||||
resultPlPrice: 'Стоимость ПЛ с НДС',
|
||||
resultPriceUpPr: 'Удорожание, год',
|
||||
resultAB_FL: 'АВ ФЛ, без НДФЛ.',
|
||||
resultAB_UL: 'АВ ЮЛ, с НДС.',
|
||||
resultBonusDopProd: 'Бонус МПЛ за доп.продукты, без НДФЛ',
|
||||
resultBonusMPL: 'Бонус МПЛ за лизинг, без НДФЛ',
|
||||
resultBonusSafeFinance: 'Бонус за Safe Finance без НДФЛ',
|
||||
resultDopMPLLeasing: 'Доп.бонус МПЛ за лизинг, без НДФЛ',
|
||||
resultDopProdSum: 'Общая сумма доп.продуктов',
|
||||
resultFirstPayment: 'Первый платеж',
|
||||
resultFirstPaymentRiskPolicy: 'Первый платеж по риск политике, %',
|
||||
resultIRRGraphPerc: 'IRR по графику клиента, %',
|
||||
resultIRRNominalPerc: 'IRR (номинал), %',
|
||||
resultInsKasko: 'КАСКО, НС, ДГО в графике',
|
||||
resultInsOsago: 'ОСАГО в графике',
|
||||
resultDopProdSum: 'Общая сумма доп.продуктов',
|
||||
resultFirstPayment: 'Первый платеж',
|
||||
resultLastPayment: 'Последний платеж',
|
||||
resultPlPrice: 'Стоимость ПЛ с НДС',
|
||||
resultPriceUpPr: 'Удорожание, год',
|
||||
resultTerm: 'Срок, мес.',
|
||||
resultAB_FL: 'АВ ФЛ, без НДФЛ.',
|
||||
resultAB_UL: 'АВ ЮЛ, с НДС.',
|
||||
resultBonusMPL: 'Бонус МПЛ за лизинг, без НДФЛ',
|
||||
resultDopMPLLeasing: 'Доп.бонус МПЛ за лизинг, без НДФЛ',
|
||||
resultBonusDopProd: 'Бонус МПЛ за доп.продукты, без НДФЛ',
|
||||
resultBonusSafeFinance: 'Бонус за Safe Finance без НДФЛ',
|
||||
resultFirstPaymentRiskPolicy: 'Первый платеж по риск политике, %',
|
||||
resultTotalGraphwithNDS: 'Итого по графику, с НДС',
|
||||
};
|
||||
|
||||
const moneyFormatters = Object.fromEntries(
|
||||
@ -47,10 +45,9 @@ const moneyFormatters = Object.fromEntries(
|
||||
] as Values[]
|
||||
).map((a) => [
|
||||
a,
|
||||
// prettier-ignore
|
||||
Intl.NumberFormat('ru', {
|
||||
style: 'currency',
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}).format,
|
||||
])
|
||||
);
|
||||
@ -59,11 +56,10 @@ const percentFormatters = Object.fromEntries(
|
||||
(['resultIRRGraphPerc', 'resultIRRNominalPerc', 'resultFirstPaymentRiskPolicy'] as Values[]).map(
|
||||
(a) => [
|
||||
a,
|
||||
// prettier-ignore
|
||||
Intl.NumberFormat('ru', {
|
||||
style: 'percent',
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
minimumFractionDigits: 2,
|
||||
style: 'percent',
|
||||
}).format,
|
||||
]
|
||||
)
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { Container, Head } from 'Components/Layout/Element';
|
||||
import { formatters, id, title, titles } from './config';
|
||||
import { Container, Head } from '@/Components/Layout/Element';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { min } from '@/styles/mq';
|
||||
import { toJS } from 'mobx';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import Text from 'ui/elements/Text';
|
||||
import { Box } from 'ui/grid';
|
||||
import { formatters, id, title, titles } from './config';
|
||||
|
||||
const Grid = styled(Box)`
|
||||
display: grid;
|
||||
@ -40,7 +40,7 @@ const Results = observer(() => {
|
||||
});
|
||||
|
||||
export default {
|
||||
Component: Results,
|
||||
id,
|
||||
title,
|
||||
Component: Results,
|
||||
};
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* eslint-disable react/jsx-key */
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useStore } from 'stores/hooks';
|
||||
import styled from 'styled-components';
|
||||
import Alert from 'ui/elements/Alert';
|
||||
import { Box, Flex } from 'ui/grid';
|
||||
@ -23,18 +24,16 @@ const AlertWrapper = styled(Box)`
|
||||
`;
|
||||
|
||||
function getElementsErrors($calculation) {
|
||||
const errors = Object.values($calculation.$validation).map((validation) => {
|
||||
return Object.values($calculation.$validation).map((validation) => {
|
||||
const elementErrors = validation.getMessages();
|
||||
const elementTitle = validation.params.err_title;
|
||||
|
||||
return elementErrors.map((error) => (
|
||||
<AlertWrapper>
|
||||
<Alert key={error.name} type="error" showIcon message={Message(elementTitle, error)} />
|
||||
<Alert type="error" showIcon message={Message(elementTitle, error)} />
|
||||
</AlertWrapper>
|
||||
));
|
||||
});
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
function getPaymentsTableErrors($tables) {
|
||||
@ -50,9 +49,7 @@ function getInsuranceTableErrors($tables) {
|
||||
const messages = insurance.validation.getMessages();
|
||||
const title = insurance.validation.params.err_title;
|
||||
|
||||
return messages.map((message) => (
|
||||
<Alert type="error" showIcon message={Message(title, message)} />
|
||||
));
|
||||
return messages.map((text) => <Alert type="error" showIcon message={Message(title, text)} />);
|
||||
}
|
||||
|
||||
const Errors = observer(() => {
|
||||
@ -86,7 +83,7 @@ function Validation() {
|
||||
}
|
||||
|
||||
export default {
|
||||
Component: Validation,
|
||||
id: 'validation',
|
||||
title: 'Ошибки',
|
||||
Component: Validation,
|
||||
};
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import Background from 'Components/Layout/Background';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import Tabs from 'ui/elements/layout/Tabs';
|
||||
import PaymentsTable from './PaymentsTable';
|
||||
import Results from './Results';
|
||||
import Validation from './Validation';
|
||||
import Background from '@/Components/Layout/Background';
|
||||
import { min } from '@/styles/mq';
|
||||
import styled from 'styled-components';
|
||||
import Tabs from 'ui/elements/layout/Tabs';
|
||||
|
||||
const outputTabs = [PaymentsTable, Results, Validation];
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import type { RequestFinGAP, ResponseFinGAP } from './types';
|
||||
import getUrls from '@/config/urls';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import axios from 'axios';
|
||||
import getUrls from 'config/urls';
|
||||
import type { RequestFinGAP, ResponseFinGAP } from './types';
|
||||
|
||||
const { URL_CORE_FINGAP } = getUrls();
|
||||
|
||||
|
||||
@ -5,17 +5,17 @@ export type PaymentRow = {
|
||||
|
||||
export type RequestFinGAP = {
|
||||
calcType: number;
|
||||
payments: Array<PaymentRow>;
|
||||
payments: PaymentRow[];
|
||||
values: {
|
||||
plPrice: number;
|
||||
discount: number;
|
||||
firstPayment: number;
|
||||
leasingPeriod: number;
|
||||
plPrice: number;
|
||||
premiumPerc: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type ResponseFinGAP = {
|
||||
sum: number;
|
||||
premium: number;
|
||||
sum: number;
|
||||
};
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
import axios from 'axios';
|
||||
import getUrls from 'config/urls';
|
||||
import { love } from './tools';
|
||||
import type { User } from './types';
|
||||
import getUrls from '@/config/urls';
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
import axios from 'axios';
|
||||
|
||||
const { URL_GET_USER } = getUrls();
|
||||
|
||||
export async function getUser(config: AxiosRequestConfig) {
|
||||
const user = await axios.get<User>(URL_GET_USER, config).then((res) => love(res.data));
|
||||
|
||||
return user;
|
||||
return await axios.get<User>(URL_GET_USER, config).then((res) => love(res.data));
|
||||
}
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { publicRuntimeConfigSchema } from 'config/schema/runtime-config';
|
||||
import getConfig from 'next/config';
|
||||
import type { User } from './types';
|
||||
import { publicRuntimeConfigSchema } from '@/config/schema/runtime-config';
|
||||
import getConfig from 'next/config';
|
||||
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
const { USERS_SUPER } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||
|
||||
export function love(user: User) {
|
||||
const superUsers: string[] = JSON.parse(USERS_SUPER);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
if (superUsers?.includes(user.username)) user.displayName += '🧡';
|
||||
|
||||
return user;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
export type User = {
|
||||
displayName: string;
|
||||
username: string;
|
||||
department: string;
|
||||
position: string;
|
||||
mail: string;
|
||||
displayName: string;
|
||||
domain: string;
|
||||
domainName: string;
|
||||
mail: string;
|
||||
position: string;
|
||||
username: string;
|
||||
};
|
||||
|
||||
@ -5,12 +5,12 @@ module.exports = {
|
||||
name: 'crmgraphql',
|
||||
localSchemaFile: `${__dirname}/graphql/crm.schema.graphql`,
|
||||
},
|
||||
excludes: ['**/graphql/**/*.schema.graphql', '**/graphql/**/*.types.graphql'],
|
||||
includes: [
|
||||
'**/pages/**/*',
|
||||
'**/process/**/*',
|
||||
'**/Components/**/*',
|
||||
'**/graphql/**/*.query.graphql',
|
||||
],
|
||||
excludes: ['**/graphql/**/*.schema.graphql', '**/graphql/**/*.types.graphql'],
|
||||
},
|
||||
};
|
||||
|
||||
@ -1,19 +1,17 @@
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import getUrls from '@/config/urls';
|
||||
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
||||
import getUrls from 'config/urls';
|
||||
import { isServer } from 'tools/common';
|
||||
|
||||
/** @type {import('@apollo/client').ApolloClient<NormalizedCacheObject>} */
|
||||
/** @type {import('@apollo/client').ApolloClient<import('@apollo/client').NormalizedCacheObject>} */
|
||||
let apolloClient;
|
||||
|
||||
const { URL_CRM_GRAPHQL } = getUrls();
|
||||
|
||||
function createApolloClient() {
|
||||
return new ApolloClient({
|
||||
cache: new InMemoryCache(),
|
||||
ssrMode: isServer(),
|
||||
uri: URL_CRM_GRAPHQL,
|
||||
cache: new InMemoryCache(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type { CalculationOptions } from '@/stores/calculation/options/types';
|
||||
import { alphabetical } from 'radash';
|
||||
import type { CalculationOptions } from 'stores/calculation/options/types';
|
||||
|
||||
export const selectSeasonType = [
|
||||
{
|
||||
|
||||
@ -1,141 +1,141 @@
|
||||
import type { CalculationStatuses } from 'stores/calculation/statuses/types';
|
||||
import type { CalculationStatuses } from '@/stores/calculation/statuses/types';
|
||||
|
||||
const defaultStatuses: CalculationStatuses = {
|
||||
selectIndAgent: 'Default',
|
||||
selectCalcBroker: 'Default',
|
||||
selectCalcFinDepartment: 'Default',
|
||||
selectCalcDoubleAgent: 'Default',
|
||||
selectClientType: 'Disabled',
|
||||
tbxImporterRewardRub: 'Disabled',
|
||||
tbxImporterRewardPerc: 'Disabled',
|
||||
tbxMaxPriceChange: 'Disabled',
|
||||
tbxCreditRate: 'Disabled',
|
||||
selectRate: 'Disabled',
|
||||
selectTarif: 'Disabled',
|
||||
tbxVehicleTaxInLeasingPeriod: 'Disabled',
|
||||
selectObjectTypeTax: 'Disabled',
|
||||
selectLeaseObjectCategory: 'Disabled',
|
||||
tbxINNForCalc: 'Disabled',
|
||||
radioInfuranceOPF: 'Disabled',
|
||||
tbxRedemptionPaymentSum: 'Disabled',
|
||||
tbxLeaseObjectPriceWthtVAT: 'Disabled',
|
||||
selectLead: 'Default',
|
||||
selectOpportunity: 'Default',
|
||||
selectQuote: 'Default',
|
||||
cbxRecalcWithRevision: 'Default',
|
||||
selectProduct: 'Default',
|
||||
selectClientRisk: 'Default',
|
||||
tbxLeaseObjectPrice: 'Default',
|
||||
tbxVATInLeaseObjectPrice: 'Default',
|
||||
tbxEngineHours: 'Default',
|
||||
selectSupplierCurrency: 'Default',
|
||||
tbxSupplierDiscountRub: 'Default',
|
||||
tbxSupplierDiscountPerc: 'Default',
|
||||
tbxLeasingPeriod: 'Default',
|
||||
tbxFirstPaymentPerc: 'Default',
|
||||
tbxFirstPaymentRub: 'Default',
|
||||
tbxLastPaymentPerc: 'Default',
|
||||
tbxLastPaymentRub: 'Default',
|
||||
radioLastPaymentRule: 'Default',
|
||||
radioBalanceHolder: 'Default',
|
||||
radioGraphType: 'Default',
|
||||
tbxParmentsDecreasePercent: 'Default',
|
||||
selectSeasonType: 'Default',
|
||||
selectHighSeasonStart: 'Default',
|
||||
tbxComissionPerc: 'Default',
|
||||
tbxComissionRub: 'Default',
|
||||
tbxSaleBonus: 'Default',
|
||||
tbxIRR_Perc: 'Default',
|
||||
selectLeaseObjectType: 'Default',
|
||||
radioDeliveryTime: 'Default',
|
||||
labelDepreciationGroup: 'Default',
|
||||
tbxLeaseObjectCount: 'Default',
|
||||
cbxWithTrailer: 'Default',
|
||||
cbxLeaseObjectUsed: 'Default',
|
||||
tbxMaxMass: 'Default',
|
||||
tbxCountSeats: 'Default',
|
||||
tbxMaxSpeed: 'Default',
|
||||
selectBrand: 'Default',
|
||||
selectModel: 'Default',
|
||||
selectConfiguration: 'Default',
|
||||
tbxLeaseObjectYear: 'Default',
|
||||
selectEngineType: 'Default',
|
||||
tbxLeaseObjectMotorPower: 'Default',
|
||||
tbxEngineVolume: 'Default',
|
||||
selectLeaseObjectUseFor: 'Default',
|
||||
selectDealer: 'Default',
|
||||
selectDealerPerson: 'Default',
|
||||
selectDealerRewardCondition: 'Default',
|
||||
tbxDealerRewardSumm: 'Disabled',
|
||||
selectDealerBroker: 'Default',
|
||||
selectDealerBrokerRewardCondition: 'Default',
|
||||
tbxDealerBrokerRewardSumm: 'Disabled',
|
||||
selectIndAgentRewardCondition: 'Default',
|
||||
tbxIndAgentRewardSumm: 'Disabled',
|
||||
selectCalcDoubleAgentRewardCondition: 'Default',
|
||||
tbxCalcDoubleAgentRewardSumm: 'Disabled',
|
||||
selectCalcBrokerRewardCondition: 'Default',
|
||||
tbxCalcBrokerRewardSum: 'Disabled',
|
||||
selectFinDepartmentRewardCondtion: 'Default',
|
||||
tbxFinDepartmentRewardSumm: 'Disabled',
|
||||
selectGPSBrand: 'Default',
|
||||
selectGPSModel: 'Default',
|
||||
selectRegionRegistration: 'Default',
|
||||
selectTownRegistration: 'Default',
|
||||
radioInsKaskoType: 'Default',
|
||||
cbxInsDecentral: 'Default',
|
||||
tbxInsFranchise: 'Default',
|
||||
cbxInsUnlimitDrivers: 'Default',
|
||||
tbxInsAgeDrivers: 'Default',
|
||||
tbxInsExpDrivers: 'Default',
|
||||
cbxLastPaymentRedemption: 'Default',
|
||||
cbxPriceWithDiscount: 'Default',
|
||||
cbxFullPriceWithDiscount: 'Default',
|
||||
btnCalculate: 'Default',
|
||||
btnCreateKP: 'Default',
|
||||
cbxCostIncrease: 'Default',
|
||||
cbxInsurance: 'Default',
|
||||
cbxRegistrationQuote: 'Default',
|
||||
cbxTechnicalCardQuote: 'Default',
|
||||
cbxNSIB: 'Default',
|
||||
tbxQuoteName: 'Default',
|
||||
radioQuoteContactGender: 'Default',
|
||||
cbxQuoteRedemptionGraph: 'Default',
|
||||
cbxShowFinGAP: 'Default',
|
||||
cbxDisableChecks: 'Default',
|
||||
selectRegistration: 'Default',
|
||||
selectInsNSIB: 'Default',
|
||||
selectTechnicalCard: 'Default',
|
||||
selectRequirementTelematic: 'Default',
|
||||
selectTelematic: 'Default',
|
||||
selectTracker: 'Default',
|
||||
tbxMileage: 'Default',
|
||||
radioCalcType: 'Default',
|
||||
tbxTotalPayments: 'Default',
|
||||
radioObjectRegistration: 'Default',
|
||||
selectObjectRegionRegistration: 'Default',
|
||||
tbxVehicleTaxInYear: 'Default',
|
||||
selectObjectCategoryTax: 'Default',
|
||||
radioTypePTS: 'Default',
|
||||
selectLegalClientRegion: 'Default',
|
||||
selectLegalClientTown: 'Default',
|
||||
selectSubsidy: 'Default',
|
||||
tbxSubsidySum: 'Default',
|
||||
selectFuelCard: 'Default',
|
||||
tbxMinPriceChange: 'Default',
|
||||
linkDownloadKp: 'Default',
|
||||
selectImportProgram: 'Default',
|
||||
tbxImportProgramSum: 'Default',
|
||||
tbxAddEquipmentPrice: 'Default',
|
||||
labelLeaseObjectRisk: 'Default',
|
||||
tbxInsKaskoPriceLeasePeriod: 'Default',
|
||||
cbxFullPriceWithDiscount: 'Default',
|
||||
cbxInsDecentral: 'Default',
|
||||
cbxInsUnlimitDrivers: 'Default',
|
||||
cbxInsurance: 'Default',
|
||||
cbxLastPaymentRedemption: 'Default',
|
||||
cbxLeaseObjectUsed: 'Default',
|
||||
cbxNSIB: 'Default',
|
||||
cbxPriceWithDiscount: 'Default',
|
||||
cbxQuoteRedemptionGraph: 'Default',
|
||||
cbxRecalcWithRevision: 'Default',
|
||||
cbxRegistrationQuote: 'Default',
|
||||
cbxShowFinGAP: 'Default',
|
||||
cbxTechnicalCardQuote: 'Default',
|
||||
cbxWithTrailer: 'Default',
|
||||
labelDepreciationGroup: 'Default',
|
||||
labelIrrInfo: 'Default',
|
||||
labelLeaseObjectRisk: 'Default',
|
||||
labelRegistrationDescription: 'Default',
|
||||
linkDownloadKp: 'Default',
|
||||
linkLeadUrl: 'Default',
|
||||
linkOpportunityUrl: 'Default',
|
||||
linkQuoteUrl: 'Default',
|
||||
tbxBonusCoefficient: 'Default',
|
||||
btnCalculate: 'Default',
|
||||
btnCreateKP: 'Default',
|
||||
radioBalanceHolder: 'Default',
|
||||
radioCalcType: 'Default',
|
||||
radioDeliveryTime: 'Default',
|
||||
radioGraphType: 'Default',
|
||||
radioInfuranceOPF: 'Disabled',
|
||||
radioInsKaskoType: 'Default',
|
||||
radioLastPaymentRule: 'Default',
|
||||
radioObjectRegistration: 'Default',
|
||||
radioQuoteContactGender: 'Default',
|
||||
radioTypePTS: 'Default',
|
||||
selectBrand: 'Default',
|
||||
selectCalcBroker: 'Default',
|
||||
selectCalcBrokerRewardCondition: 'Default',
|
||||
selectCalcDoubleAgent: 'Default',
|
||||
selectCalcDoubleAgentRewardCondition: 'Default',
|
||||
selectCalcFinDepartment: 'Default',
|
||||
selectClientRisk: 'Default',
|
||||
selectClientType: 'Disabled',
|
||||
selectConfiguration: 'Default',
|
||||
selectDealer: 'Default',
|
||||
selectDealerBroker: 'Default',
|
||||
selectDealerBrokerRewardCondition: 'Default',
|
||||
selectDealerPerson: 'Default',
|
||||
selectDealerRewardCondition: 'Default',
|
||||
selectEngineType: 'Default',
|
||||
selectFinDepartmentRewardCondtion: 'Default',
|
||||
selectFuelCard: 'Default',
|
||||
selectGPSBrand: 'Default',
|
||||
selectGPSModel: 'Default',
|
||||
selectHighSeasonStart: 'Default',
|
||||
selectImportProgram: 'Default',
|
||||
selectIndAgent: 'Default',
|
||||
selectIndAgentRewardCondition: 'Default',
|
||||
selectInsNSIB: 'Default',
|
||||
selectLead: 'Default',
|
||||
selectLeaseObjectCategory: 'Disabled',
|
||||
selectLeaseObjectType: 'Default',
|
||||
selectLeaseObjectUseFor: 'Default',
|
||||
selectLeasingWithoutKasko: 'Default',
|
||||
selectLegalClientRegion: 'Default',
|
||||
selectLegalClientTown: 'Default',
|
||||
selectModel: 'Default',
|
||||
selectObjectCategoryTax: 'Default',
|
||||
selectObjectRegionRegistration: 'Default',
|
||||
selectObjectTypeTax: 'Disabled',
|
||||
selectOpportunity: 'Default',
|
||||
selectProduct: 'Default',
|
||||
selectQuote: 'Default',
|
||||
selectRate: 'Disabled',
|
||||
selectRegionRegistration: 'Default',
|
||||
selectRegistration: 'Default',
|
||||
selectRequirementTelematic: 'Default',
|
||||
selectSeasonType: 'Default',
|
||||
selectSubsidy: 'Default',
|
||||
selectSupplierCurrency: 'Default',
|
||||
selectTarif: 'Disabled',
|
||||
selectTechnicalCard: 'Default',
|
||||
selectTelematic: 'Default',
|
||||
selectTownRegistration: 'Default',
|
||||
selectTracker: 'Default',
|
||||
tbxAddEquipmentPrice: 'Default',
|
||||
tbxBonusCoefficient: 'Default',
|
||||
tbxCalcBrokerRewardSum: 'Disabled',
|
||||
tbxCalcDoubleAgentRewardSumm: 'Disabled',
|
||||
tbxComissionPerc: 'Default',
|
||||
tbxComissionRub: 'Default',
|
||||
tbxCountSeats: 'Default',
|
||||
tbxCreditRate: 'Disabled',
|
||||
tbxDealerBrokerRewardSumm: 'Disabled',
|
||||
tbxDealerRewardSumm: 'Disabled',
|
||||
tbxEngineHours: 'Default',
|
||||
tbxEngineVolume: 'Default',
|
||||
tbxFinDepartmentRewardSumm: 'Disabled',
|
||||
tbxFirstPaymentPerc: 'Default',
|
||||
tbxFirstPaymentRub: 'Default',
|
||||
tbxINNForCalc: 'Disabled',
|
||||
tbxIRR_Perc: 'Default',
|
||||
tbxImportProgramSum: 'Default',
|
||||
tbxImporterRewardPerc: 'Disabled',
|
||||
tbxImporterRewardRub: 'Disabled',
|
||||
tbxIndAgentRewardSumm: 'Disabled',
|
||||
tbxInsAgeDrivers: 'Default',
|
||||
tbxInsExpDrivers: 'Default',
|
||||
tbxInsFranchise: 'Default',
|
||||
tbxInsKaskoPriceLeasePeriod: 'Default',
|
||||
tbxLastPaymentPerc: 'Default',
|
||||
tbxLastPaymentRub: 'Default',
|
||||
tbxLeaseObjectCount: 'Default',
|
||||
tbxLeaseObjectMotorPower: 'Default',
|
||||
tbxLeaseObjectPrice: 'Default',
|
||||
tbxLeaseObjectPriceWthtVAT: 'Disabled',
|
||||
tbxLeaseObjectYear: 'Default',
|
||||
tbxLeasingPeriod: 'Default',
|
||||
tbxMaxMass: 'Default',
|
||||
tbxMaxPriceChange: 'Disabled',
|
||||
tbxMaxSpeed: 'Default',
|
||||
tbxMileage: 'Default',
|
||||
tbxMinPriceChange: 'Default',
|
||||
tbxParmentsDecreasePercent: 'Default',
|
||||
tbxQuoteName: 'Default',
|
||||
tbxRedemptionPaymentSum: 'Disabled',
|
||||
tbxSaleBonus: 'Default',
|
||||
tbxSubsidySum: 'Default',
|
||||
tbxSupplierDiscountPerc: 'Default',
|
||||
tbxSupplierDiscountRub: 'Default',
|
||||
tbxTotalPayments: 'Default',
|
||||
tbxVATInLeaseObjectPrice: 'Default',
|
||||
tbxVehicleTaxInLeasingPeriod: 'Disabled',
|
||||
tbxVehicleTaxInYear: 'Default',
|
||||
};
|
||||
|
||||
export default defaultStatuses;
|
||||
|
||||
@ -1,143 +1,144 @@
|
||||
import { RATE } from 'constants/values';
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { RATE } from '@/constants/values';
|
||||
import type { CalculationValues } from '@/stores/calculation/values/types';
|
||||
import dayjs from 'dayjs';
|
||||
import type { CalculationValues } from 'stores/calculation/values/types';
|
||||
|
||||
const defaultValues: CalculationValues = {
|
||||
lead: null,
|
||||
opportunity: null,
|
||||
quote: null,
|
||||
recalcWithRevision: false,
|
||||
leaseObjectPrice: 1_000_000,
|
||||
VATInLeaseObjectPrice: 0,
|
||||
leaseObjectPriceWthtVAT: 0,
|
||||
engineHours: 0,
|
||||
supplierCurrency: null,
|
||||
supplierDiscountRub: 0,
|
||||
supplierDiscountPerc: 0,
|
||||
leasingPeriod: 13,
|
||||
firstPaymentPerc: 25,
|
||||
firstPaymentRub: 0,
|
||||
lastPaymentPerc: 1,
|
||||
lastPaymentRule: 100_000_001,
|
||||
redemptionPaymentSum: 1000,
|
||||
addEquipmentPrice: 0,
|
||||
balanceHolder: 100_000_001,
|
||||
graphType: 100_000_000,
|
||||
parmentsDecreasePercent: 94,
|
||||
seasonType: null,
|
||||
highSeasonStart: null,
|
||||
comissionPerc: 0,
|
||||
comissionRub: 0,
|
||||
saleBonus: 1.3,
|
||||
IRR_Perc: 20,
|
||||
bonusCoefficient: 1,
|
||||
brand: null,
|
||||
model: null,
|
||||
configuration: null,
|
||||
deliveryTime: 100_000_000,
|
||||
leaseObjectCount: 1,
|
||||
withTrailer: false,
|
||||
leaseObjectUsed: false,
|
||||
maxMass: 0,
|
||||
countSeats: 0,
|
||||
maxSpeed: 0,
|
||||
leaseObjectYear: dayjs().year(),
|
||||
engineType: 100_000_000,
|
||||
leaseObjectCategory: null,
|
||||
leaseObjectMotorPower: 0,
|
||||
engineVolume: 0,
|
||||
dealerRewardSumm: 0,
|
||||
dealerBrokerRewardSumm: 0,
|
||||
indAgent: null,
|
||||
calcDoubleAgent: null,
|
||||
calcBroker: null,
|
||||
calcFinDepartment: null,
|
||||
dealerPerson: null,
|
||||
dealerBroker: null,
|
||||
dealer: null,
|
||||
indAgentRewardSumm: 0,
|
||||
calcDoubleAgentRewardSumm: 0,
|
||||
calcBrokerRewardCondition: null,
|
||||
calcBrokerRewardSum: 0,
|
||||
finDepartmentRewardSumm: 0,
|
||||
insKaskoType: 100_000_000,
|
||||
insDecentral: false,
|
||||
insUnlimitDrivers: true,
|
||||
insAgeDrivers: 0,
|
||||
insExpDrivers: 0,
|
||||
lastPaymentRedemption: true,
|
||||
priceWithDiscount: false,
|
||||
fullPriceWithDiscount: false,
|
||||
costIncrease: true,
|
||||
insurance: true,
|
||||
registrationQuote: true,
|
||||
technicalCardQuote: true,
|
||||
NSIB: true,
|
||||
quoteContactGender: 100_000_000,
|
||||
quoteRedemptionGraph: true,
|
||||
showFinGAP: true,
|
||||
creditRate: RATE,
|
||||
requirementTelematic: 100_000_000,
|
||||
maxPriceChange: 0,
|
||||
importerRewardPerc: 0,
|
||||
importerRewardRub: 0,
|
||||
disableChecks: false,
|
||||
insFranchise: 0,
|
||||
rate: null,
|
||||
calcDoubleAgent: null,
|
||||
calcDoubleAgentRewardCondition: null,
|
||||
calcDoubleAgentRewardSumm: 0,
|
||||
calcFinDepartment: null,
|
||||
calcType: 100_000_000,
|
||||
totalPayments: 0,
|
||||
vehicleTaxInYear: 0,
|
||||
vehicleTaxInLeasingPeriod: 0,
|
||||
objectRegistration: 100_000_000,
|
||||
typePTS: 100_000_001,
|
||||
insNSIB: null,
|
||||
regionRegistration: null,
|
||||
legalClientRegion: null,
|
||||
legalClientTown: null,
|
||||
infuranceOPF: null,
|
||||
product: null,
|
||||
clientRisk: null,
|
||||
clientType: null,
|
||||
lastPaymentRub: 0,
|
||||
leaseObjectType: null,
|
||||
leaseObjectUseFor: null,
|
||||
dealerRewardCondition: null,
|
||||
comissionPerc: 0,
|
||||
comissionRub: 0,
|
||||
configuration: null,
|
||||
costIncrease: true,
|
||||
countSeats: 0,
|
||||
creditRate: RATE,
|
||||
dealer: null,
|
||||
dealerBroker: null,
|
||||
dealerBrokerRewardCondition: null,
|
||||
indAgentRewardCondition: null,
|
||||
calcDoubleAgentRewardCondition: null,
|
||||
calcBrokerRewardCondition: null,
|
||||
dealerBrokerRewardSumm: 0,
|
||||
dealerPerson: null,
|
||||
dealerRewardCondition: null,
|
||||
dealerRewardSumm: 0,
|
||||
deliveryTime: 100_000_000,
|
||||
depreciationGroup: '-',
|
||||
disableChecks: false,
|
||||
discountRub: 0,
|
||||
engineHours: 0,
|
||||
engineType: 100_000_000,
|
||||
engineVolume: 0,
|
||||
finDepartmentRewardCondtion: null,
|
||||
finDepartmentRewardSumm: 0,
|
||||
firstPaymentPerc: 25,
|
||||
firstPaymentRub: 0,
|
||||
fuelCard: null,
|
||||
fullPriceWithDiscount: false,
|
||||
GPSBrand: null,
|
||||
GPSModel: null,
|
||||
townRegistration: null,
|
||||
INNForCalc: 0,
|
||||
quoteName: null,
|
||||
tarif: null,
|
||||
minPriceChange: 0,
|
||||
registration: null,
|
||||
technicalCard: null,
|
||||
telematic: null,
|
||||
tracker: null,
|
||||
mileage: 0,
|
||||
objectRegionRegistration: null,
|
||||
objectCategoryTax: null,
|
||||
objectTypeTax: null,
|
||||
subsidy: null,
|
||||
fuelCard: null,
|
||||
kpUrl: null,
|
||||
leadUrl: null,
|
||||
opportunityUrl: null,
|
||||
quoteUrl: null,
|
||||
subsidySum: 0,
|
||||
leaseObjectRiskName: '-',
|
||||
insKaskoPriceLeasePeriod: 0,
|
||||
irrInfo: '-',
|
||||
registrationDescription: '-',
|
||||
depreciationGroup: '-',
|
||||
graphType: 100_000_000,
|
||||
highSeasonStart: null,
|
||||
importerRewardPerc: 0,
|
||||
importerRewardRub: 0,
|
||||
importProgram: null,
|
||||
importProgramSum: 0,
|
||||
addEquipmentPrice: 0,
|
||||
bonusCoefficient: 1,
|
||||
plPriceRub: 0,
|
||||
discountRub: 0,
|
||||
indAgent: null,
|
||||
indAgentRewardCondition: null,
|
||||
indAgentRewardSumm: 0,
|
||||
infuranceOPF: null,
|
||||
INNForCalc: 0,
|
||||
insAgeDrivers: 0,
|
||||
insDecentral: false,
|
||||
insExpDrivers: 0,
|
||||
insFranchise: 0,
|
||||
insKaskoPriceLeasePeriod: 0,
|
||||
insKaskoType: 100_000_000,
|
||||
insNSIB: null,
|
||||
insUnlimitDrivers: true,
|
||||
insurance: true,
|
||||
IRR_Perc: 20,
|
||||
irrInfo: '-',
|
||||
kpUrl: null,
|
||||
lastPaymentPerc: 1,
|
||||
lastPaymentRedemption: true,
|
||||
lastPaymentRub: 0,
|
||||
lastPaymentRule: 100_000_001,
|
||||
lead: null,
|
||||
leadUrl: null,
|
||||
leaseObjectCategory: null,
|
||||
leaseObjectCount: 1,
|
||||
leaseObjectMotorPower: 0,
|
||||
leaseObjectPrice: 1_000_000,
|
||||
leaseObjectPriceWthtVAT: 0,
|
||||
leaseObjectRiskName: '-',
|
||||
leaseObjectType: null,
|
||||
leaseObjectUsed: false,
|
||||
leaseObjectUseFor: null,
|
||||
leaseObjectYear: dayjs().year(),
|
||||
leasingPeriod: 13,
|
||||
leasingWithoutKasko: null,
|
||||
legalClientRegion: null,
|
||||
legalClientTown: null,
|
||||
maxMass: 0,
|
||||
maxPriceChange: 0,
|
||||
maxSpeed: 0,
|
||||
mileage: 0,
|
||||
minPriceChange: 0,
|
||||
model: null,
|
||||
NSIB: true,
|
||||
objectCategoryTax: null,
|
||||
objectRegionRegistration: null,
|
||||
objectRegistration: 100_000_000,
|
||||
objectTypeTax: null,
|
||||
opportunity: null,
|
||||
opportunityUrl: null,
|
||||
parmentsDecreasePercent: 94,
|
||||
plPriceRub: 0,
|
||||
priceWithDiscount: false,
|
||||
product: null,
|
||||
quote: null,
|
||||
quoteContactGender: 100_000_000,
|
||||
quoteName: null,
|
||||
quoteRedemptionGraph: true,
|
||||
quoteUrl: null,
|
||||
rate: null,
|
||||
recalcWithRevision: false,
|
||||
redemptionPaymentSum: 1_000,
|
||||
regionRegistration: null,
|
||||
registration: null,
|
||||
registrationDescription: '-',
|
||||
registrationQuote: true,
|
||||
requirementTelematic: 100_000_000,
|
||||
saleBonus: 1.3,
|
||||
seasonType: null,
|
||||
showFinGAP: true,
|
||||
subsidy: null,
|
||||
subsidySum: 0,
|
||||
supplierCurrency: null,
|
||||
supplierDiscountPerc: 0,
|
||||
supplierDiscountRub: 0,
|
||||
tarif: null,
|
||||
technicalCard: null,
|
||||
technicalCardQuote: true,
|
||||
telematic: null,
|
||||
totalPayments: 0,
|
||||
townRegistration: null,
|
||||
tracker: null,
|
||||
typePTS: 100_000_001,
|
||||
VATInLeaseObjectPrice: 0,
|
||||
vehicleTaxInLeasingPeriod: 0,
|
||||
vehicleTaxInYear: 0,
|
||||
withTrailer: false,
|
||||
};
|
||||
|
||||
export default defaultValues;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import getUrls from 'config/urls';
|
||||
import getUrls from '@/config/urls';
|
||||
|
||||
const { BASE_PATH } = getUrls();
|
||||
|
||||
|
||||
@ -1,17 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { z } = require('zod');
|
||||
|
||||
const envSchema = z.object({
|
||||
USE_DEV_COLORS: z
|
||||
.unknown()
|
||||
.optional()
|
||||
.transform((val) => !!val),
|
||||
PORT: z.string().optional(),
|
||||
BASE_PATH: z.string().optional().default(''),
|
||||
USERS_SUPER: z.string().optional().default(''),
|
||||
PORT: z.string().optional(),
|
||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||
URL_CRM_GRAPHQL_DIRECT: z.string(),
|
||||
URL_GET_USER_DIRECT: z.string(),
|
||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||
USE_DEV_COLORS: z.unknown().optional().transform(Boolean),
|
||||
USERS_SUPER: z.string().optional().default(''),
|
||||
});
|
||||
|
||||
module.exports = envSchema;
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { z } from 'zod';
|
||||
|
||||
export const RiskSchema = z.object({
|
||||
key: z.string(),
|
||||
riskId: z.string(),
|
||||
riskName: z.string(),
|
||||
calcType: z.number(),
|
||||
premiumPerc: z.number(),
|
||||
sum: z.number(),
|
||||
premium: z.number(),
|
||||
keys: z.array(z.string()).optional(),
|
||||
});
|
||||
export const RiskSchema = z
|
||||
.object({
|
||||
calcType: z.number(),
|
||||
key: z.string(),
|
||||
keys: z.array(z.string()).optional(),
|
||||
premium: z.number(),
|
||||
premiumPerc: z.number(),
|
||||
riskId: z.string(),
|
||||
riskName: z.string(),
|
||||
sum: z.number(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const KeysSchema = z.union([z.literal('osago'), z.literal('kasko'), z.literal('fingap')]);
|
||||
export const KeysSchema = z.enum(['osago', 'kasko', 'fingap']);
|
||||
|
||||
export const RowSchema = z.object({
|
||||
key: KeysSchema,
|
||||
policyType: z.string(),
|
||||
insuranceCompany: z.string().nullable(),
|
||||
insured: z.number().nullable(),
|
||||
insCost: z.number(),
|
||||
insTerm: z.number().nullable(),
|
||||
});
|
||||
export const RowSchema = z
|
||||
.object({
|
||||
insCost: z.number(),
|
||||
insTerm: z.number().nullable(),
|
||||
insuranceCompany: z.string().nullable(),
|
||||
insured: z.number().nullable(),
|
||||
key: KeysSchema,
|
||||
policyType: z.string(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const PaymentsSchema = z.object({
|
||||
values: z.number().array(),
|
||||
});
|
||||
const PaymentsSchema = z
|
||||
.object({
|
||||
values: z.number().array(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export default PaymentsSchema;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const envSchema = require('./env');
|
||||
|
||||
const publicRuntimeConfigSchema = envSchema.pick({
|
||||
@ -8,11 +7,11 @@ const publicRuntimeConfigSchema = envSchema.pick({
|
||||
});
|
||||
|
||||
const serverRuntimeConfigSchema = envSchema.pick({
|
||||
PORT: true,
|
||||
BASE_PATH: true,
|
||||
PORT: true,
|
||||
URL_CORE_FINGAP_DIRECT: true,
|
||||
URL_CRM_GRAPHQL_DIRECT: true,
|
||||
URL_GET_USER_DIRECT: true,
|
||||
URL_CORE_FINGAP_DIRECT: true,
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -1,145 +1,152 @@
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { z } from 'zod';
|
||||
|
||||
const ValuesSchema = z.object({
|
||||
lead: z.string().nullable(),
|
||||
opportunity: z.string().nullable(),
|
||||
quote: z.string().nullable(),
|
||||
recalcWithRevision: z.boolean(),
|
||||
product: z.string().nullable(),
|
||||
clientRisk: z.string().nullable(),
|
||||
clientType: z.string().nullable(),
|
||||
leaseObjectPrice: z.number(),
|
||||
supplierCurrency: z.string().nullable(),
|
||||
supplierDiscountRub: z.number(),
|
||||
supplierDiscountPerc: z.number(),
|
||||
leasingPeriod: z.number(),
|
||||
firstPaymentPerc: z.number(),
|
||||
firstPaymentRub: z.number(),
|
||||
lastPaymentPerc: z.number(),
|
||||
lastPaymentRub: z.number(),
|
||||
lastPaymentRule: z.number().nullable(),
|
||||
importProgram: z.string().nullable(),
|
||||
importProgramSum: z.number(),
|
||||
addEquipmentPrice: z.number(),
|
||||
redemptionPaymentSum: z.number(),
|
||||
balanceHolder: z.number().nullable(),
|
||||
graphType: z.number().nullable(),
|
||||
parmentsDecreasePercent: z.number(),
|
||||
seasonType: z.number().nullable(),
|
||||
highSeasonStart: z.number().nullable(),
|
||||
comissionPerc: z.number(),
|
||||
comissionRub: z.number(),
|
||||
saleBonus: z.number(),
|
||||
IRR_Perc: z.number(),
|
||||
leaseObjectType: z.string().nullable(),
|
||||
deliveryTime: z.number().nullable(),
|
||||
leaseObjectCount: z.number(),
|
||||
withTrailer: z.boolean(),
|
||||
leaseObjectUsed: z.boolean(),
|
||||
maxMass: z.number(),
|
||||
countSeats: z.number(),
|
||||
maxSpeed: z.number(),
|
||||
brand: z.string().nullable(),
|
||||
model: z.string().nullable(),
|
||||
configuration: z.string().nullable(),
|
||||
leaseObjectYear: z.number(),
|
||||
engineType: z.number().nullable(),
|
||||
leaseObjectCategory: z.number().nullable(),
|
||||
leaseObjectMotorPower: z.number(),
|
||||
engineVolume: z.number(),
|
||||
leaseObjectUseFor: z.number().nullable(),
|
||||
dealer: z.string().nullable(),
|
||||
dealerPerson: z.string().nullable(),
|
||||
dealerRewardCondition: z.string().nullable(),
|
||||
dealerRewardSumm: z.number(),
|
||||
dealerBroker: z.string().nullable(),
|
||||
dealerBrokerRewardCondition: z.string().nullable(),
|
||||
dealerBrokerRewardSumm: z.number(),
|
||||
indAgent: z.string().nullable(),
|
||||
indAgentRewardCondition: z.string().nullable(),
|
||||
indAgentRewardSumm: z.number(),
|
||||
calcDoubleAgent: z.string().nullable(),
|
||||
calcDoubleAgentRewardCondition: z.string().nullable(),
|
||||
calcDoubleAgentRewardSumm: z.number(),
|
||||
calcBroker: z.string().nullable(),
|
||||
calcBrokerRewardCondition: z.string().nullable(),
|
||||
calcBrokerRewardSum: z.number(),
|
||||
calcFinDepartment: z.string().nullable(),
|
||||
finDepartmentRewardCondtion: z.string().nullable(),
|
||||
finDepartmentRewardSumm: z.number(),
|
||||
GPSBrand: z.string().nullable(),
|
||||
GPSModel: z.string().nullable(),
|
||||
regionRegistration: z.string().nullable(),
|
||||
townRegistration: z.string().nullable(),
|
||||
infuranceOPF: z.number().nullable(),
|
||||
insKaskoType: z.number().nullable(),
|
||||
insDecentral: z.boolean(),
|
||||
insFranchise: z.number(),
|
||||
insUnlimitDrivers: z.boolean(),
|
||||
insAgeDrivers: z.number(),
|
||||
insExpDrivers: z.number(),
|
||||
INNForCalc: z.number(),
|
||||
lastPaymentRedemption: z.boolean(),
|
||||
priceWithDiscount: z.boolean(),
|
||||
fullPriceWithDiscount: z.boolean(),
|
||||
costIncrease: z.boolean(),
|
||||
insurance: z.boolean(),
|
||||
registrationQuote: z.boolean(),
|
||||
technicalCardQuote: z.boolean(),
|
||||
NSIB: z.boolean(),
|
||||
quoteName: z.string().nullable(),
|
||||
quoteContactGender: z.number().nullable(),
|
||||
quoteRedemptionGraph: z.boolean(),
|
||||
showFinGAP: z.boolean(),
|
||||
tarif: z.string().nullable(),
|
||||
creditRate: z.number(),
|
||||
rate: z.string().nullable(),
|
||||
requirementTelematic: z.number().nullable(),
|
||||
minPriceChange: z.number(),
|
||||
maxPriceChange: z.number(),
|
||||
importerRewardPerc: z.number(),
|
||||
importerRewardRub: z.number(),
|
||||
disableChecks: z.boolean(),
|
||||
registration: z.string().nullable(),
|
||||
insNSIB: z.string().nullable(),
|
||||
technicalCard: z.string().nullable(),
|
||||
telematic: z.string().nullable(),
|
||||
tracker: z.string().nullable(),
|
||||
mileage: z.number(),
|
||||
calcType: z.number().nullable(),
|
||||
totalPayments: z.number(),
|
||||
objectRegistration: z.number().nullable(),
|
||||
objectRegionRegistration: z.string().nullable(),
|
||||
vehicleTaxInYear: z.number(),
|
||||
vehicleTaxInLeasingPeriod: z.number(),
|
||||
objectCategoryTax: z.number().nullable(),
|
||||
objectTypeTax: z.number().nullable(),
|
||||
typePTS: z.number().nullable(),
|
||||
legalClientRegion: z.string().nullable(),
|
||||
legalClientTown: z.string().nullable(),
|
||||
subsidy: z.string().nullable(),
|
||||
fuelCard: z.string().nullable(),
|
||||
leaseObjectPriceWthtVAT: z.number(),
|
||||
VATInLeaseObjectPrice: z.number(),
|
||||
engineHours: z.number(),
|
||||
bonusCoefficient: z.number(),
|
||||
leasingWithoutKasko: z.string().nullable(),
|
||||
const ValuesSchema = z
|
||||
.object({
|
||||
addEquipmentPrice: z.number(),
|
||||
balanceHolder: z.number().nullable(),
|
||||
bonusCoefficient: z.number(),
|
||||
brand: z.string().nullable(),
|
||||
calcBroker: z.string().nullable(),
|
||||
calcBrokerRewardCondition: z.string().nullable(),
|
||||
calcBrokerRewardSum: z.number(),
|
||||
calcDoubleAgent: z.string().nullable(),
|
||||
calcDoubleAgentRewardCondition: z.string().nullable(),
|
||||
calcDoubleAgentRewardSumm: z.number(),
|
||||
calcFinDepartment: z.string().nullable(),
|
||||
calcType: z.number().nullable(),
|
||||
clientRisk: z.string().nullable(),
|
||||
clientType: z.string().nullable(),
|
||||
comissionPerc: z.number(),
|
||||
comissionRub: z.number(),
|
||||
configuration: z.string().nullable(),
|
||||
costIncrease: z.boolean(),
|
||||
countSeats: z.number(),
|
||||
creditRate: z.number(),
|
||||
dealer: z.string().nullable(),
|
||||
dealerBroker: z.string().nullable(),
|
||||
dealerBrokerRewardCondition: z.string().nullable(),
|
||||
dealerBrokerRewardSumm: z.number(),
|
||||
dealerPerson: z.string().nullable(),
|
||||
dealerRewardCondition: z.string().nullable(),
|
||||
dealerRewardSumm: z.number(),
|
||||
deliveryTime: z.number().nullable(),
|
||||
disableChecks: z.boolean(),
|
||||
engineHours: z.number(),
|
||||
engineType: z.number().nullable(),
|
||||
engineVolume: z.number(),
|
||||
finDepartmentRewardCondtion: z.string().nullable(),
|
||||
finDepartmentRewardSumm: z.number(),
|
||||
firstPaymentPerc: z.number(),
|
||||
firstPaymentRub: z.number(),
|
||||
fuelCard: z.string().nullable(),
|
||||
fullPriceWithDiscount: z.boolean(),
|
||||
GPSBrand: z.string().nullable(),
|
||||
GPSModel: z.string().nullable(),
|
||||
graphType: z.number().nullable(),
|
||||
highSeasonStart: z.number().nullable(),
|
||||
importerRewardPerc: z.number(),
|
||||
importerRewardRub: z.number(),
|
||||
importProgram: z.string().nullable(),
|
||||
importProgramSum: z.number(),
|
||||
indAgent: z.string().nullable(),
|
||||
indAgentRewardCondition: z.string().nullable(),
|
||||
indAgentRewardSumm: z.number(),
|
||||
infuranceOPF: z.number().nullable(),
|
||||
INNForCalc: z.number(),
|
||||
insAgeDrivers: z.number(),
|
||||
insDecentral: z.boolean(),
|
||||
insExpDrivers: z.number(),
|
||||
insFranchise: z.number(),
|
||||
insKaskoType: z.number().nullable(),
|
||||
insNSIB: z.string().nullable(),
|
||||
insUnlimitDrivers: z.boolean(),
|
||||
insurance: z.boolean(),
|
||||
IRR_Perc: z.number(),
|
||||
lastPaymentPerc: z.number(),
|
||||
lastPaymentRedemption: z.boolean(),
|
||||
lastPaymentRub: z.number(),
|
||||
lastPaymentRule: z.number().nullable(),
|
||||
lead: z.string().nullable(),
|
||||
leaseObjectCategory: z.number().nullable(),
|
||||
leaseObjectCount: z.number(),
|
||||
leaseObjectMotorPower: z.number(),
|
||||
leaseObjectPrice: z.number(),
|
||||
leaseObjectPriceWthtVAT: z.number(),
|
||||
leaseObjectType: z.string().nullable(),
|
||||
leaseObjectUsed: z.boolean(),
|
||||
leaseObjectUseFor: z.number().nullable(),
|
||||
leaseObjectYear: z.number(),
|
||||
leasingPeriod: z.number(),
|
||||
leasingWithoutKasko: z.string().nullable(),
|
||||
legalClientRegion: z.string().nullable(),
|
||||
legalClientTown: z.string().nullable(),
|
||||
maxMass: z.number(),
|
||||
maxPriceChange: z.number(),
|
||||
maxSpeed: z.number(),
|
||||
mileage: z.number(),
|
||||
minPriceChange: z.number(),
|
||||
model: z.string().nullable(),
|
||||
NSIB: z.boolean(),
|
||||
objectCategoryTax: z.number().nullable(),
|
||||
objectRegionRegistration: z.string().nullable(),
|
||||
objectRegistration: z.number().nullable(),
|
||||
objectTypeTax: z.number().nullable(),
|
||||
opportunity: z.string().nullable(),
|
||||
parmentsDecreasePercent: z.number(),
|
||||
priceWithDiscount: z.boolean(),
|
||||
product: z.string().nullable(),
|
||||
quote: z.string().nullable(),
|
||||
quoteContactGender: z.number().nullable(),
|
||||
quoteName: z.string().nullable(),
|
||||
quoteRedemptionGraph: z.boolean(),
|
||||
rate: z.string().nullable(),
|
||||
recalcWithRevision: z.boolean(),
|
||||
redemptionPaymentSum: z.number(),
|
||||
regionRegistration: z.string().nullable(),
|
||||
registration: z.string().nullable(),
|
||||
registrationQuote: z.boolean(),
|
||||
requirementTelematic: z.number().nullable(),
|
||||
saleBonus: z.number(),
|
||||
seasonType: z.number().nullable(),
|
||||
showFinGAP: z.boolean(),
|
||||
subsidy: z.string().nullable(),
|
||||
supplierCurrency: z.string().nullable(),
|
||||
supplierDiscountPerc: z.number(),
|
||||
supplierDiscountRub: z.number(),
|
||||
tarif: z.string().nullable(),
|
||||
technicalCard: z.string().nullable(),
|
||||
technicalCardQuote: z.boolean(),
|
||||
telematic: z.string().nullable(),
|
||||
totalPayments: z.number(),
|
||||
townRegistration: z.string().nullable(),
|
||||
tracker: z.string().nullable(),
|
||||
typePTS: z.number().nullable(),
|
||||
VATInLeaseObjectPrice: z.number(),
|
||||
vehicleTaxInLeasingPeriod: z.number(),
|
||||
vehicleTaxInYear: z.number(),
|
||||
withTrailer: z.boolean(),
|
||||
|
||||
/** Link Values */
|
||||
kpUrl: z.string().nullable(),
|
||||
leadUrl: z.string().nullable(),
|
||||
opportunityUrl: z.string().nullable(),
|
||||
quoteUrl: z.string().nullable(),
|
||||
/**
|
||||
* Link Values
|
||||
*/
|
||||
kpUrl: z.string().nullable(),
|
||||
leadUrl: z.string().nullable(),
|
||||
opportunityUrl: z.string().nullable(),
|
||||
quoteUrl: z.string().nullable(),
|
||||
|
||||
/** Readonly Values */
|
||||
leaseObjectRiskName: z.string().nullable(),
|
||||
insKaskoPriceLeasePeriod: z.number(),
|
||||
irrInfo: z.string().nullable(),
|
||||
registrationDescription: z.string().nullable(),
|
||||
depreciationGroup: z.string().nullable(),
|
||||
subsidySum: z.number(),
|
||||
plPriceRub: z.number(),
|
||||
discountRub: z.number(),
|
||||
});
|
||||
/**
|
||||
* Readonly Values
|
||||
*/
|
||||
depreciationGroup: z.string().nullable(),
|
||||
discountRub: z.number(),
|
||||
insKaskoPriceLeasePeriod: z.number(),
|
||||
irrInfo: z.string().nullable(),
|
||||
leaseObjectRiskName: z.string().nullable(),
|
||||
plPriceRub: z.number(),
|
||||
registrationDescription: z.string().nullable(),
|
||||
subsidySum: z.number(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export default ValuesSchema;
|
||||
|
||||
@ -1,82 +1,36 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type * as Insurance from 'Components/Calculation/Form/Insurance/InsuranceTable/types';
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
|
||||
|
||||
const defaultRowOptions: Insurance.RowOptions = {
|
||||
insured: [
|
||||
{
|
||||
label: 'ЛП',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'ЛД',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insTerm: [
|
||||
{
|
||||
label: '12 месяцев',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'Срок ДЛ',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insCost: [],
|
||||
insuranceCompany: [],
|
||||
policyType: [],
|
||||
};
|
||||
|
||||
export const defaultOptions: Record<Insurance.Keys, Insurance.RowOptions> = {
|
||||
osago: {
|
||||
insured: [
|
||||
{
|
||||
label: 'ЛП',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'ЛД',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insTerm: [
|
||||
{
|
||||
label: '12 месяцев',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'Срок ДЛ',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insCost: [],
|
||||
insuranceCompany: [],
|
||||
policyType: [],
|
||||
},
|
||||
kasko: {
|
||||
insured: [
|
||||
{
|
||||
label: 'ЛП',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'ЛД',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insTerm: [
|
||||
{
|
||||
label: '12 месяцев',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'Срок ДЛ',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insCost: [],
|
||||
insuranceCompany: [],
|
||||
policyType: [],
|
||||
},
|
||||
fingap: {
|
||||
insured: [
|
||||
{
|
||||
label: 'ЛП',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'ЛД',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insTerm: [
|
||||
{
|
||||
label: '12 месяцев',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'Срок ДЛ',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
insCost: [],
|
||||
insuranceCompany: [],
|
||||
policyType: [],
|
||||
},
|
||||
osago: defaultRowOptions,
|
||||
kasko: defaultRowOptions,
|
||||
fingap: defaultRowOptions,
|
||||
};
|
||||
|
||||
export const defaultValues: Insurance.RowValues[] = [
|
||||
@ -108,24 +62,24 @@ export const defaultValues: Insurance.RowValues[] = [
|
||||
|
||||
export const defaultStatuses: Record<Insurance.Keys, Insurance.RowStatuses> = {
|
||||
osago: {
|
||||
insTerm: 'Disabled',
|
||||
insCost: 'Default',
|
||||
policyType: 'Default',
|
||||
insuranceCompany: 'Default',
|
||||
insured: 'Default',
|
||||
policyType: 'Default',
|
||||
insCost: 'Default',
|
||||
insTerm: 'Disabled',
|
||||
},
|
||||
kasko: {
|
||||
insTerm: 'Disabled',
|
||||
insCost: 'Default',
|
||||
policyType: 'Default',
|
||||
insuranceCompany: 'Default',
|
||||
insured: 'Default',
|
||||
policyType: 'Default',
|
||||
insCost: 'Default',
|
||||
insTerm: 'Disabled',
|
||||
},
|
||||
fingap: {
|
||||
insCost: 'Disabled',
|
||||
policyType: 'Default',
|
||||
insuranceCompany: 'Default',
|
||||
insured: 'Default',
|
||||
insCost: 'Disabled',
|
||||
insTerm: 'Default',
|
||||
policyType: 'Default',
|
||||
},
|
||||
};
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
const threshold = 0;
|
||||
|
||||
const screens = {
|
||||
|
||||
@ -1,35 +1,35 @@
|
||||
import urls from 'constants/urls';
|
||||
import { publicRuntimeConfigSchema, serverRuntimeConfigSchema } from './schema/runtime-config';
|
||||
import urls from '@/constants/urls';
|
||||
import getConfig from 'next/config';
|
||||
import { isServer } from 'tools/common';
|
||||
import { publicRuntimeConfigSchema, serverRuntimeConfigSchema } from './schema/runtime-config';
|
||||
|
||||
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig();
|
||||
|
||||
function getUrls() {
|
||||
const { BASE_PATH } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||
|
||||
if (isServer()) {
|
||||
const { URL_CRM_GRAPHQL_DIRECT, URL_GET_USER_DIRECT, URL_CORE_FINGAP_DIRECT, BASE_PATH, PORT } =
|
||||
const { URL_CRM_GRAPHQL_DIRECT, URL_GET_USER_DIRECT, URL_CORE_FINGAP_DIRECT, PORT } =
|
||||
serverRuntimeConfigSchema.parse(serverRuntimeConfig);
|
||||
|
||||
return {
|
||||
PORT,
|
||||
BASE_PATH,
|
||||
PORT,
|
||||
URL_CORE_FINGAP: URL_CORE_FINGAP_DIRECT,
|
||||
URL_CRM_GRAPHQL: URL_CRM_GRAPHQL_DIRECT,
|
||||
URL_GET_USER: URL_GET_USER_DIRECT,
|
||||
URL_CORE_FINGAP: URL_CORE_FINGAP_DIRECT,
|
||||
};
|
||||
}
|
||||
|
||||
const { BASE_PATH } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||
|
||||
function withBasePath(url: string) {
|
||||
return BASE_PATH + url;
|
||||
}
|
||||
|
||||
return {
|
||||
BASE_PATH,
|
||||
URL_CORE_FINGAP: withBasePath(urls.URL_CORE_FINGAP_PROXY),
|
||||
URL_CRM_GRAPHQL: withBasePath(urls.URL_CRM_GRAPHQL_PROXY),
|
||||
URL_GET_USER: withBasePath(urls.URL_GET_USER_PROXY),
|
||||
URL_CORE_FINGAP: withBasePath(urls.URL_CORE_FINGAP_PROXY),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,6 @@ const COLORS_DEV = {
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
COLORS_PROD,
|
||||
COLORS_DEV,
|
||||
COLORS_PROD,
|
||||
};
|
||||
|
||||
@ -1,2 +1 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export const STALE_TIME = Number.POSITIVE_INFINITY;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
URL_GET_USER_PROXY: '/api/auth/user',
|
||||
URL_CRM_GRAPHQL_PROXY: '/api/graphql/crm',
|
||||
URL_CORE_FINGAP_PROXY: '/api/core/fingap',
|
||||
URL_CRM_GRAPHQL_PROXY: '/api/graphql/crm',
|
||||
URL_GET_USER_PROXY: '/api/auth/user',
|
||||
};
|
||||
|
||||
@ -16,6 +16,7 @@ const customJestConfig = {
|
||||
moduleDirectories: ['node_modules', '<rootDir>/'],
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases (this will be automatically configured for you soon)
|
||||
'^@/(.*)$': '<rootDir>/$1',
|
||||
},
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
preset: 'ts-jest',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import getUrls from 'config/urls';
|
||||
import getUrls from '@/config/urls';
|
||||
import { rest } from 'msw';
|
||||
const _ = require('radash');
|
||||
|
||||
|
||||
@ -15,49 +15,49 @@ const favicons = fs.readdirSync('./public/favicon/prod');
|
||||
const faviconSubPath = env.USE_DEV_COLORS ? '/favicon/dev' : '/favicon/prod';
|
||||
function buildFaviconRewrite(source) {
|
||||
return {
|
||||
source,
|
||||
destination: String.prototype.concat(env.BASE_PATH, faviconSubPath, source),
|
||||
source,
|
||||
};
|
||||
}
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
basePath: env.BASE_PATH,
|
||||
transpilePackages: ['ui', 'tools'],
|
||||
output: 'standalone',
|
||||
swcMinify: true,
|
||||
reactStrictMode: true,
|
||||
compiler: {
|
||||
styledComponents: true,
|
||||
},
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
compiler: {
|
||||
styledComponents: true,
|
||||
experimental: {
|
||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||
},
|
||||
images: {
|
||||
deviceSizes: devices,
|
||||
},
|
||||
output: 'standalone',
|
||||
publicRuntimeConfig: publicRuntimeConfigSchema.parse(env),
|
||||
reactStrictMode: true,
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: urls.URL_CRM_GRAPHQL_PROXY,
|
||||
destination: env.URL_CRM_GRAPHQL_DIRECT,
|
||||
source: urls.URL_CRM_GRAPHQL_PROXY,
|
||||
},
|
||||
{
|
||||
source: urls.URL_GET_USER_PROXY,
|
||||
destination: env.URL_GET_USER_DIRECT,
|
||||
source: urls.URL_GET_USER_PROXY,
|
||||
},
|
||||
{
|
||||
source: urls.URL_CORE_FINGAP_PROXY,
|
||||
destination: env.URL_CORE_FINGAP_DIRECT,
|
||||
source: urls.URL_CORE_FINGAP_PROXY,
|
||||
},
|
||||
...favicons.map((fileName) => buildFaviconRewrite(`/${fileName}`)),
|
||||
];
|
||||
},
|
||||
publicRuntimeConfig: publicRuntimeConfigSchema.parse(env),
|
||||
serverRuntimeConfig: serverRuntimeConfigSchema.parse(env),
|
||||
experimental: {
|
||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||
},
|
||||
swcMinify: true,
|
||||
transpilePackages: ['ui', 'tools'],
|
||||
};
|
||||
|
||||
const plugins = [withLess];
|
||||
|
||||
@ -1,22 +1,20 @@
|
||||
/* eslint-disable global-require */
|
||||
import { ApolloProvider } from '@apollo/client';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import Layout from 'Components/Layout';
|
||||
import { theme } from 'config/ui';
|
||||
import Head from 'next/head';
|
||||
import 'normalize.css';
|
||||
import { useMemo } from 'react';
|
||||
import StoreProvider from 'stores/Provider';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
import { GlobalStyle } from 'styles/global-style';
|
||||
import { trpcClient } from 'trpc/client';
|
||||
import AntdConfig from 'ui/elements/Config';
|
||||
import 'ui/elements/styles/antd.less';
|
||||
import '../styles/fonts.css';
|
||||
import '../styles/globals.css';
|
||||
|
||||
import initializeQueryClient from 'api/client';
|
||||
import initializeApollo from 'apollo/client';
|
||||
import initializeQueryClient from '@/api/client';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import Layout from '@/Components/Layout';
|
||||
import { theme } from '@/config/ui';
|
||||
import StoreProvider from '@/stores/Provider';
|
||||
import { GlobalStyle } from '@/styles/global-style';
|
||||
import { trpcClient } from '@/trpc/client';
|
||||
import { ApolloProvider } from '@apollo/client';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import Head from 'next/head';
|
||||
import { useMemo } from 'react';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
import AntdConfig from 'ui/elements/Config';
|
||||
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { metaFavicon } from 'config/meta';
|
||||
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
|
||||
import { metaFavicon } from '@/config/meta';
|
||||
import Document, { Head, Html, Main, NextScript } from 'next/document';
|
||||
import { ServerStyleSheet } from 'styled-components';
|
||||
|
||||
@ -8,8 +9,8 @@ export default class MyDocument extends Document {
|
||||
const originalRenderPage = ctx.renderPage;
|
||||
|
||||
try {
|
||||
// prettier-ignore
|
||||
ctx.renderPage = () => originalRenderPage({
|
||||
ctx.renderPage = () =>
|
||||
originalRenderPage({
|
||||
enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),
|
||||
});
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/* eslint-disable canonical/filename-match-regex */
|
||||
import appRouter from '@/trpc/routers';
|
||||
import * as trpcNext from '@trpc/server/adapters/next';
|
||||
import appRouter from 'trpc/routers';
|
||||
|
||||
export default trpcNext.createNextApiHandler({
|
||||
router: appRouter,
|
||||
// eslint-disable-next-line object-curly-newline
|
||||
createContext: () => ({}),
|
||||
router: appRouter,
|
||||
});
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import { getUser } from '@/api/user/query';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import * as Calculation from '@/Components/Calculation';
|
||||
import { CRMError } from '@/Components/Common/Error';
|
||||
import Output from '@/Components/Output';
|
||||
import { getOwnerData, useInsuranceData, useMainData } from '@/process/init/get-data';
|
||||
import { useReactions } from '@/process/init/inject-reactions/hooks';
|
||||
import { min } from '@/styles/mq';
|
||||
import { dehydrate, QueryClient } from '@tanstack/react-query';
|
||||
import { getUser } from 'api/user/query';
|
||||
import initializeApollo from 'apollo/client';
|
||||
import * as Calculation from 'Components/Calculation';
|
||||
import { CRMError } from 'Components/Common/Error';
|
||||
import Output from 'Components/Output';
|
||||
import Head from 'next/head';
|
||||
import { getOwnerData, useInsuranceData, useMainData } from 'process/init/get-data';
|
||||
import { useReactions } from 'process/init/inject-reactions/hooks';
|
||||
import styled from 'styled-components';
|
||||
import { min } from 'styles/mq';
|
||||
import { Box } from 'ui/grid';
|
||||
|
||||
const Grid = styled(Box)`
|
||||
@ -56,8 +56,8 @@ function Home({ error }) {
|
||||
/** @type {import('next').GetServerSideProps} */
|
||||
export const getServerSideProps = async ({ req }) => {
|
||||
const { cookie = '' } = req.headers;
|
||||
// prettier-ignore
|
||||
const queryGetUser = () => getUser({
|
||||
const queryGetUser = () =>
|
||||
getUser({
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
|
||||
@ -1,2 +1 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export { default as validation } from './validation';
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import types from 'Components/Calculation/config/elements-types';
|
||||
import type * as Values from 'Components/Calculation/config/map/values';
|
||||
import type * as Insurance from 'Components/Calculation/Form/Insurance/InsuranceTable/types';
|
||||
import types from '@/Components/Calculation/config/elements-types';
|
||||
import type * as Values from '@/Components/Calculation/config/map/values';
|
||||
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import type { ReactionsContext } from 'process/types';
|
||||
import type { BaseOption } from 'ui/elements/types';
|
||||
|
||||
function hasInvalidValueOrOptions(value: unknown, options: BaseOption<unknown>[]) {
|
||||
function hasInvalidValueOrOptions(value: unknown, options: Array<BaseOption<unknown>>) {
|
||||
if (value === null) {
|
||||
return false;
|
||||
}
|
||||
@ -58,8 +58,8 @@ export default function validationReactions({ store }: ReactionsContext) {
|
||||
const value = element.getValue();
|
||||
|
||||
return {
|
||||
value,
|
||||
options,
|
||||
value,
|
||||
};
|
||||
},
|
||||
({ value, options }) => {
|
||||
@ -101,8 +101,8 @@ export default function validationReactions({ store }: ReactionsContext) {
|
||||
const value = row.getValue('insuranceCompany');
|
||||
|
||||
return {
|
||||
value,
|
||||
options,
|
||||
value,
|
||||
};
|
||||
},
|
||||
({ value, options }) => {
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { gql } from '@apollo/client';
|
||||
import initializeApollo from 'apollo/client';
|
||||
import type * as CRMTypes from 'graphql/crm.types';
|
||||
import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import type * as CRMTypes from '@/graphql/crm.types';
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
const QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE = gql`
|
||||
query GetConfiguratorDataFromQuote($quoteId: Uuid!) {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { radioGraphType, selectSeasonType } from 'config/default-options';
|
||||
import { radioGraphType, selectSeasonType } from '@/config/default-options';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { SEASON_TYPES } from '@/process/payments/lib/seasons-constants';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import * as CRMTypes from 'graphql/crm.types';
|
||||
import { reaction } from 'mobx';
|
||||
import { SEASON_TYPES } from 'process/payments/lib/seasons-constants';
|
||||
import type { ReactionsContext } from 'process/types';
|
||||
import { diff } from 'radash';
|
||||
import { normalizeOptions } from 'tools';
|
||||
|
||||
@ -19,35 +19,36 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
const { product, subsidy, importProgram, dealer } = $calculation.$values.values;
|
||||
|
||||
return {
|
||||
dealerId: dealer,
|
||||
importProgramId: importProgram,
|
||||
productId: product,
|
||||
subsidyId: subsidy,
|
||||
importProgramId: importProgram,
|
||||
dealerId: dealer,
|
||||
};
|
||||
},
|
||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||
async ({ productId, subsidyId, importProgramId, dealerId }) => {
|
||||
/**
|
||||
#1
|
||||
* DYN-190 При выборе значения в поле selectSubsidy необходимо добавить
|
||||
* фильтрацию в полях при условии что selectSubsidy не равно null:
|
||||
|
||||
Тип предмета лизинга selectLeaseObjectType
|
||||
если с записью Субсидия нет связанных Типов предмета лизинга,
|
||||
то указываются все записи согласно текущей фильтрации,
|
||||
иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectSubsidy
|
||||
|
||||
#2
|
||||
* На изменение поля Продукт selectProduct добавляем фильтрацию списков:
|
||||
в поле Тип предмета лизинга selectLeaseObjectType - указываются те, которые связаны с продуктом.
|
||||
Если с Продуктом нет связанных Типов предмета лизинга,
|
||||
то указывается весь список. Это надо добавить в текущие условия фильтрации данного поля
|
||||
|
||||
#3
|
||||
Тип предмета лизинга selectLeaseObjectType
|
||||
если с записью Субсидия нет связанных Типов предмета лизинга,
|
||||
то указываются все записи согласно текущей фильтрации,
|
||||
иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectImportProgram
|
||||
*/
|
||||
* #1
|
||||
* DYN-190 При выборе значения в поле selectSubsidy необходимо добавить
|
||||
* фильтрацию в полях при условии что selectSubsidy не равно null:
|
||||
*
|
||||
* Тип предмета лизинга selectLeaseObjectType
|
||||
* если с записью Субсидия нет связанных Типов предмета лизинга,
|
||||
* то указываются все записи согласно текущей фильтрации,
|
||||
* иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectSubsidy
|
||||
*
|
||||
* #2
|
||||
* На изменение поля Продукт selectProduct добавляем фильтрацию списков:
|
||||
* в поле Тип предмета лизинга selectLeaseObjectType - указываются те, которые связаны с продуктом.
|
||||
* Если с Продуктом нет связанных Типов предмета лизинга,
|
||||
* то указывается весь список. Это надо добавить в текущие условия фильтрации данного поля
|
||||
*
|
||||
* #3
|
||||
* Тип предмета лизинга selectLeaseObjectType
|
||||
* если с записью Субсидия нет связанных Типов предмета лизинга,
|
||||
* то указываются все записи согласно текущей фильтрации,
|
||||
* иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectImportProgram
|
||||
*/
|
||||
|
||||
let {
|
||||
data: { evo_leasingobject_types: leaseObjectTypes = [] },
|
||||
@ -192,9 +193,9 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
|
||||
/**
|
||||
* На изменение поля Тариф selectTarif добавляем фильрацию в полях:
|
||||
в поле Вид графика radioGraphType должны закрываться значения для выбора,
|
||||
которые указаны в массиве поля "Недопустимые виды графиков" evo_graphtype_exception.
|
||||
Если в массиве пусто, значит допустимы все значения
|
||||
* в поле Вид графика radioGraphType должны закрываться значения для выбора,
|
||||
* которые указаны в массиве поля "Недопустимые виды графиков" evo_graphtype_exception.
|
||||
* Если в массиве пусто, значит допустимы все значения
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.element('selectTarif').getValue(),
|
||||
@ -231,8 +232,8 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
*/
|
||||
reaction(
|
||||
() => ({
|
||||
tarif: $calculation.element('selectTarif').getValue(),
|
||||
graphType: $calculation.element('radioGraphType').getValue(),
|
||||
tarif: $calculation.element('selectTarif').getValue(),
|
||||
}),
|
||||
async ({ tarif, graphType }) => {
|
||||
let evo_tarif: CRMTypes.GetTarifQuery['evo_tarif'] = null;
|
||||
@ -249,7 +250,7 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
}
|
||||
|
||||
const seasonTypesExeption = evo_tarif?.evo_seasons_type_exception || [];
|
||||
let seasonTypes: Array<number> = [];
|
||||
let seasonTypes: number[] = [];
|
||||
|
||||
if (graphType === 100_000_001 || graphType === 100_000_003) {
|
||||
seasonTypes = SEASON_TYPES[graphType];
|
||||
@ -300,13 +301,12 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
}
|
||||
);
|
||||
|
||||
/* eslint-disable max-len */
|
||||
/**
|
||||
* Добавить фильтр для поля selectProduct (работает на загрузку КП)
|
||||
* если recalcWithRevision=True, то в списке поля selectProduct должны отображаться
|
||||
* записи quote.evo_baseproductid из поля Предложение selectQuote + дать возможность выбирать продукт,
|
||||
* связанный с оquote.evo_baseproductid из поля Предложение selectQuote по связи evo_evo_baseproduct_evo_baseproduct
|
||||
/* eslint-enable */
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.element('selectQuote').getValue(),
|
||||
async (quoteId) => {
|
||||
@ -315,11 +315,11 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
|
||||
const {
|
||||
data: { evo_baseproducts },
|
||||
} = await apolloClient.query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetProductsDocument,
|
||||
variables: {
|
||||
currentDate,
|
||||
},
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
|
||||
if (!$calculation.element('cbxRecalcWithRevision').getValue()) {
|
||||
|
||||
@ -1,26 +1,24 @@
|
||||
import * as CRMTypes from 'graphql/crm.types';
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import type { ReactionsContext } from 'process/types';
|
||||
|
||||
export default function validationReactions({ store, apolloClient }: ReactionsContext) {
|
||||
const { $calculation } = store;
|
||||
/* eslint-disable max-len */
|
||||
/**
|
||||
* На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку:
|
||||
* Если значение поля меньше значения в поле "Минимальный % убывания платежей" evo_min_decreasing_perc из записи,
|
||||
* указанной в поле ТарифselectTarif , то поле Процет убывания платежей tbxParmentsDecreasePercent должно обводиться красной рамкой
|
||||
* и выводиться сообщение "Процент убывания не может быть меньше минимального значения по данному тарифу
|
||||
- <указывается значение из поля "Минимальный % убывания платежей">, иначе красная рамка снимается.
|
||||
* При красной рамке в данном поле нельзя осуществить расчет графика.
|
||||
*/
|
||||
/* eslint-enable */
|
||||
* На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку:
|
||||
* Если значение поля меньше значения в поле "Минимальный % убывания платежей" evo_min_decreasing_perc из записи,
|
||||
* указанной в поле ТарифselectTarif , то поле Процет убывания платежей tbxParmentsDecreasePercent должно обводиться красной рамкой
|
||||
* и выводиться сообщение "Процент убывания не может быть меньше минимального значения по данному тарифу
|
||||
* - <указывается значение из поля "Минимальный % убывания платежей">, иначе красная рамка снимается.
|
||||
* При красной рамке в данном поле нельзя осуществить расчет графика.
|
||||
*/
|
||||
reaction(
|
||||
() => ({
|
||||
parmentsDecreasePercent: $calculation.element('tbxParmentsDecreasePercent').getValue(),
|
||||
tarifId: $calculation.element('selectTarif').getValue(),
|
||||
}),
|
||||
async ({ parmentsDecreasePercent, tarifId }) => {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
let evo_tarif: CRMTypes.GetTarifQuery['evo_tarif'] = null;
|
||||
|
||||
if (tarifId) {
|
||||
@ -35,9 +33,10 @@ export default function validationReactions({ store, apolloClient }: ReactionsCo
|
||||
}
|
||||
|
||||
$calculation.element('tbxParmentsDecreasePercent').validate({
|
||||
invalid:
|
||||
!!evo_tarif?.evo_min_decreasing_perc &&
|
||||
parmentsDecreasePercent < evo_tarif?.evo_min_decreasing_perc,
|
||||
invalid: Boolean(
|
||||
evo_tarif?.evo_min_decreasing_perc &&
|
||||
parmentsDecreasePercent < evo_tarif?.evo_min_decreasing_perc
|
||||
),
|
||||
message: `Процент убывания не может быть меньше минимального значения по данному тарифу - ${evo_tarif?.evo_min_decreasing_perc}`,
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { autorun, reaction } from 'mobx';
|
||||
|
||||
import * as CRMTypes from 'graphql/crm.types';
|
||||
import type { ReactionsContext } from 'process/types';
|
||||
import { makeDisposable, normalizeOptions } from 'tools';
|
||||
|
||||
dayjs.extend(utc);
|
||||
@ -28,11 +27,11 @@ export default function valuesReactions({ store, apolloClient }: ReactionsContex
|
||||
let {
|
||||
data: { evo_tarifs = [] },
|
||||
} = await apolloClient.query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetTarifsDocument,
|
||||
variables: {
|
||||
currentDate,
|
||||
},
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
|
||||
if (product && leasingPeriod && deliveryTime && evo_tarifs) {
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import { gql } from '@apollo/client';
|
||||
import initializeApollo from 'apollo/client';
|
||||
import { defaultValues } from 'config/tables/insurance-table';
|
||||
import type * as CRMTypes from 'graphql/crm.types';
|
||||
import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import { defaultValues } from '@/config/tables/insurance-table';
|
||||
import type * as CRMTypes from '@/graphql/crm.types';
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const DEFAULT_FINGAP_ROW = defaultValues.find((x) => x.key === 'fingap')!;
|
||||
|
||||
const QUERY_GET_FINGAP_DATA_FROM_QUOTE = gql`
|
||||
@ -20,10 +21,10 @@ const QUERY_GET_FINGAP_DATA_FROM_QUOTE = gql`
|
||||
`;
|
||||
|
||||
type QuoteFingapProcessData = {
|
||||
fingap: GetQuoteDataOutput['fingap'];
|
||||
insurance: {
|
||||
values: Pick<GetQuoteDataOutput['insurance']['values'], 'fingap'>;
|
||||
};
|
||||
fingap: GetQuoteDataOutput['fingap'];
|
||||
};
|
||||
|
||||
export default async function getFingapDataFromKP({
|
||||
@ -43,7 +44,7 @@ export default async function getFingapDataFromKP({
|
||||
},
|
||||
});
|
||||
|
||||
const keys: Array<string> = [];
|
||||
const keys: string[] = [];
|
||||
quote?.evo_product_risks?.forEach((x) => {
|
||||
if (x?.evo_addproduct_typeid) {
|
||||
keys.push(x.evo_addproduct_typeid);
|
||||
@ -58,9 +59,9 @@ export default async function getFingapDataFromKP({
|
||||
values: {
|
||||
fingap: {
|
||||
...DEFAULT_FINGAP_ROW,
|
||||
insTerm: quote?.evo_fingap_period || null,
|
||||
insuranceCompany: quote?.evo_fingap_accountid || null,
|
||||
insured: quote?.evo_fingap_payer || null,
|
||||
insTerm: quote?.evo_fingap_period || null,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
/* eslint-disable implicit-arrow-linebreak */
|
||||
/* eslint-disable unicorn/consistent-function-scoping */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { calculateFinGAP } from '@/api/core/query';
|
||||
import type { RequestFinGAP } from '@/api/core/types';
|
||||
import type { Risk } from '@/Components/Calculation/Form/Insurance/FinGAPTable/types';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import type * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import { calculateFinGAP } from 'api/core/query';
|
||||
import type { RequestFinGAP } from 'api/core/types';
|
||||
import type { Risk } from 'Components/Calculation/Form/Insurance/FinGAPTable/types';
|
||||
import { STALE_TIME } from 'constants/request';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import type * as CRMTypes from 'graphql/crm.types';
|
||||
import { comparer, reaction, toJS } from 'mobx';
|
||||
import type { ReactionsContext } from 'process/types';
|
||||
import { flatten } from 'tools/object';
|
||||
|
||||
dayjs.extend(utc);
|
||||
@ -27,21 +25,21 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
);
|
||||
|
||||
/**
|
||||
Реакция на изменение Страховой компании у ФинГАП и Срока лизинга:
|
||||
|
||||
Если Страхованя компания = Не выбрано, то
|
||||
|
||||
Плательщик insuredFinGAP = ЛП (100 000 000) и закрыто для редактирования,
|
||||
Стоимость за первый период inscostFinGAP = 0
|
||||
Срок страхования insTermFinGAP = 12 мес (100 000 000) и закрыто для редактирования
|
||||
|
||||
иначе
|
||||
|
||||
Плательщик insuredFinGAP = открыто для редактирования,
|
||||
Стоимость за первый период inscostFinGAP = 0
|
||||
Срок страхования insTermFinGAP = Если срок лизинга tbxLeasingPeriod < 13,
|
||||
то указываем Срок страхования insTermFinGAP = 12 мес
|
||||
и закрываем для редактирования, иначе открыто для редактирования
|
||||
* Реакция на изменение Страховой компании у ФинГАП и Срока лизинга:
|
||||
*
|
||||
* Если Страхованя компания = Не выбрано, то
|
||||
*
|
||||
* Плательщик insuredFinGAP = ЛП (100 000 000) и закрыто для редактирования,
|
||||
* Стоимость за первый период inscostFinGAP = 0
|
||||
* Срок страхования insTermFinGAP = 12 мес (100 000 000) и закрыто для редактирования
|
||||
*
|
||||
* иначе
|
||||
*
|
||||
* Плательщик insuredFinGAP = открыто для редактирования,
|
||||
* Стоимость за первый период inscostFinGAP = 0
|
||||
* Срок страхования insTermFinGAP = Если срок лизинга tbxLeasingPeriod < 13,
|
||||
* то указываем Срок страхования insTermFinGAP = 12 мес
|
||||
* и закрываем для редактирования, иначе открыто для редактирования
|
||||
*/
|
||||
reaction(
|
||||
() => {
|
||||
@ -62,19 +60,21 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
.setValue('insTerm', 100_000_000)
|
||||
.block('insured')
|
||||
.block('insTerm');
|
||||
} else {
|
||||
$tables.insurance
|
||||
.row('fingap')
|
||||
.setValue('insured', 100_000_000)
|
||||
.setValue('insCost', 0)
|
||||
.setValue('insTerm', leasingPeriod < 13 ? 100_000_000 : null)
|
||||
.unblock('insured');
|
||||
|
||||
if (leasingPeriod < 13) {
|
||||
$tables.insurance.row('fingap').block('insTerm');
|
||||
} else {
|
||||
$tables.insurance.row('fingap').unblock('insTerm');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$tables.insurance
|
||||
.row('fingap')
|
||||
.setValue('insured', 100_000_000)
|
||||
.setValue('insCost', 0)
|
||||
.setValue('insTerm', leasingPeriod < 13 ? 100_000_000 : null)
|
||||
.unblock('insured');
|
||||
|
||||
if (leasingPeriod < 13) {
|
||||
$tables.insurance.row('fingap').block('insTerm');
|
||||
} else {
|
||||
$tables.insurance.row('fingap').unblock('insTerm');
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -123,12 +123,12 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
|
||||
|
||||
return {
|
||||
finGAPInsuranceCompany,
|
||||
paymentsValues,
|
||||
plPriceRub,
|
||||
discountRub,
|
||||
finGAPInsuranceCompany,
|
||||
firstPaymentRub,
|
||||
leasingPeriod,
|
||||
paymentsValues,
|
||||
plPriceRub,
|
||||
};
|
||||
},
|
||||
async ({
|
||||
@ -154,16 +154,18 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
});
|
||||
|
||||
const risks = evo_addproduct_types?.map(
|
||||
// prettier-ignore
|
||||
(evo_addproduct_type) => ({
|
||||
(evo_addproduct_type) =>
|
||||
({
|
||||
calcType: evo_addproduct_type?.evo_type_calc_cerebellum,
|
||||
key: evo_addproduct_type?.evo_addproduct_typeid,
|
||||
keys: evo_addproduct_type?.evo_addproduct_types?.map(
|
||||
(addproduct_type) => addproduct_type?.evo_addproduct_typeid
|
||||
),
|
||||
premium: 0,
|
||||
premiumPerc: evo_addproduct_type?.evo_cost_service_provider_withoutnds,
|
||||
riskId: evo_addproduct_type?.evo_addproduct_typeid,
|
||||
riskName: evo_addproduct_type?.evo_name,
|
||||
calcType: evo_addproduct_type?.evo_type_calc_cerebellum,
|
||||
premiumPerc: evo_addproduct_type?.evo_cost_service_provider_withoutnds,
|
||||
sum: 0,
|
||||
premium: 0,
|
||||
keys: evo_addproduct_type?.evo_addproduct_types?.map((k) => k?.evo_addproduct_typeid),
|
||||
} as Risk)
|
||||
);
|
||||
|
||||
@ -178,15 +180,16 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
percentPayment: payment,
|
||||
})),
|
||||
values: {
|
||||
plPrice: plPriceRub,
|
||||
discount: discountRub,
|
||||
firstPayment: firstPaymentRub,
|
||||
leasingPeriod,
|
||||
plPrice: plPriceRub,
|
||||
premiumPerc: risk.premiumPerc || 0,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
function makeRequestGetFinGAP(request: RequestFinGAP) {
|
||||
const queryCalculateFinGAP = (context: QueryFunctionContext) =>
|
||||
calculateFinGAP(request, context);
|
||||
@ -207,8 +210,8 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
).then((results) => {
|
||||
const newRisks = risks.map((risk, i) => ({
|
||||
...risk,
|
||||
sum: results.at(i)?.sum || 0,
|
||||
premium: results.at(i)?.premium || 0,
|
||||
sum: results.at(i)?.sum || 0,
|
||||
}));
|
||||
|
||||
$tables.fingap.setRisks(newRisks);
|
||||
@ -216,8 +219,8 @@ export default function commonReactions({ store, apolloClient, queryClient }: Re
|
||||
},
|
||||
{
|
||||
// Important: delay prohibits multiple reaction invocation
|
||||
equals: comparer.structural,
|
||||
delay: 100,
|
||||
equals: comparer.structural,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user