merge refactor/january-2022 pt.1
This commit is contained in:
parent
f9ecf47390
commit
096cc8c1e6
3
.graphqlrc.yml
Normal file
3
.graphqlrc.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
schema:
|
||||||
|
- ./src/core/graphql/schemas/crm.graphql
|
||||||
|
documents: ./src/**/*.(graphql|gql)
|
||||||
33
.vscode/launch.json
vendored
33
.vscode/launch.json
vendored
@ -1,15 +1,22 @@
|
|||||||
{
|
{
|
||||||
// Use IntelliSense to learn about possible attributes.
|
// Use IntelliSense to learn about possible attributes.
|
||||||
// Hover to view descriptions of existing attributes.
|
// Hover to view descriptions of existing attributes.
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"type": "pwa-chrome",
|
"type": "pwa-chrome",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Launch Chrome against localhost",
|
"name": "Launch Chrome on 80",
|
||||||
"url": "http://localhost:80",
|
"url": "http://localhost:80",
|
||||||
"webRoot": "${workspaceFolder}"
|
"webRoot": "${workspaceFolder}"
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
"type": "pwa-chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch Chrome on 3000",
|
||||||
|
"url": "http://localhost:3000",
|
||||||
|
"webRoot": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
10
apollo.config.js
Normal file
10
apollo.config.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
client: {
|
||||||
|
service: {
|
||||||
|
name: 'crmgraphql',
|
||||||
|
url: 'http://localhost/crmgraphql/',
|
||||||
|
localSchemaFile: 'src/core/graphql/schemas/crm.graphql',
|
||||||
|
},
|
||||||
|
excludes: ['src/core/graphql/schemas/**/*.*'],
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -1,30 +1,19 @@
|
|||||||
const CracoAntDesignPlugin = require('craco-antd');
|
|
||||||
const colors = require('./src/client/UIKit/colors');
|
const colors = require('./src/client/UIKit/colors');
|
||||||
|
const CracoLessPlugin = require('craco-less');
|
||||||
const { ProvidePlugin } = require('webpack');
|
|
||||||
const CracoEsbuildPlugin = require('craco-esbuild');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
webpack: {
|
|
||||||
plugins: [
|
|
||||||
new ProvidePlugin({
|
|
||||||
React: 'react',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
{
|
{
|
||||||
plugin: CracoAntDesignPlugin,
|
plugin: CracoLessPlugin,
|
||||||
options: {
|
options: {
|
||||||
customizeTheme: {
|
lessLoaderOptions: {
|
||||||
'@primary-color': colors.primary,
|
lessOptions: {
|
||||||
},
|
modifyVars: { '@primary-color': colors.primary },
|
||||||
babelPluginImportOptions: {
|
javascriptEnabled: true,
|
||||||
libraryDirectory: 'es',
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ plugin: CracoEsbuildPlugin },
|
|
||||||
],
|
],
|
||||||
babel: {
|
babel: {
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -37,6 +26,15 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'import',
|
||||||
|
{
|
||||||
|
libraryName: 'antd',
|
||||||
|
libraryDirectory: 'lib',
|
||||||
|
style: true,
|
||||||
|
},
|
||||||
|
'antd',
|
||||||
|
],
|
||||||
['babel-plugin-styled-components'],
|
['babel-plugin-styled-components'],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
35
package.json
35
package.json
@ -3,35 +3,31 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/icons": "^4.6.2",
|
"@ant-design/icons": "^4.6.2",
|
||||||
"@apollo/client": "^3.3.13",
|
"@apollo/client": "^3.5.6",
|
||||||
"@craco/craco": "^6.1.1",
|
"@craco/craco": "^6.4.3",
|
||||||
"@testing-library/jest-dom": "^5.11.4",
|
|
||||||
"@testing-library/react": "^11.1.0",
|
|
||||||
"@testing-library/user-event": "^12.1.10",
|
|
||||||
"antd": "^4.15.5",
|
"antd": "^4.15.5",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
|
"babel-plugin-import": "^1.13.3",
|
||||||
"babel-plugin-styled-components": "^1.13.2",
|
"babel-plugin-styled-components": "^1.13.2",
|
||||||
"babel-plugin-transform-imports": "^2.0.0",
|
"babel-plugin-transform-imports": "^2.0.0",
|
||||||
"craco-antd": "^1.19.0",
|
"craco-less": "^2.0.0",
|
||||||
"craco-esbuild": "^0.3.4",
|
|
||||||
"dayjs": "^1.10.4",
|
"dayjs": "^1.10.4",
|
||||||
"graphql": "^15.5.0",
|
"graphql": "^16.2.0",
|
||||||
|
"graphql.macro": "^1.4.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mobx": "^6.1.8",
|
"mobx": "^6.1.8",
|
||||||
"mobx-react-lite": "^3.2.0",
|
"mobx-react-lite": "^3.2.0",
|
||||||
"pluralize": "^8.0.0",
|
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
|
"react-async-hook": "^4.0.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-router": "^5.2.0",
|
"react-router": "^5.2.0",
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": "^5.2.0",
|
||||||
"react-scripts": "^4.0.3",
|
"react-scripts": "^5.0.0",
|
||||||
"rebass": "^4.0.7",
|
"rebass": "^4.0.7",
|
||||||
"styled-components": "^5.2.3",
|
"styled-components": "^5.2.3",
|
||||||
"typescript": "^4.2.4",
|
"typescript": "^4.5.4",
|
||||||
"use-debounce": "^6.0.1",
|
"use-debounce": "^6.0.1",
|
||||||
"uuid": "^8.3.2",
|
"validator": "^13.5.2"
|
||||||
"validator": "^13.5.2",
|
|
||||||
"webpack": "4.44.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@storybook/addon-actions": "^6.2.9",
|
"@storybook/addon-actions": "^6.2.9",
|
||||||
@ -41,25 +37,31 @@
|
|||||||
"@storybook/preset-ant-design": "^0.0.2",
|
"@storybook/preset-ant-design": "^0.0.2",
|
||||||
"@storybook/preset-create-react-app": "^3.1.7",
|
"@storybook/preset-create-react-app": "^3.1.7",
|
||||||
"@storybook/react": "^6.2.9",
|
"@storybook/react": "^6.2.9",
|
||||||
|
"@testing-library/jest-dom": "^5.11.4",
|
||||||
|
"@testing-library/react": "^11.1.0",
|
||||||
|
"@testing-library/user-event": "^12.1.10",
|
||||||
"@types/jest": "^26.0.15",
|
"@types/jest": "^26.0.15",
|
||||||
"@types/lodash": "^4.14.168",
|
"@types/lodash": "^4.14.168",
|
||||||
"@types/node": "^12.0.0",
|
"@types/node": "^12.0.0",
|
||||||
"@types/pluralize": "^0.0.29",
|
|
||||||
"@types/react": "^17.0.0",
|
"@types/react": "^17.0.0",
|
||||||
"@types/react-dom": "^17.0.0",
|
"@types/react-dom": "^17.0.0",
|
||||||
"@types/react-router-dom": "^5.1.7",
|
"@types/react-router-dom": "^5.1.7",
|
||||||
"@types/rebass": "^4.0.8",
|
"@types/rebass": "^4.0.8",
|
||||||
"@types/styled-components": "^5.1.9",
|
"@types/styled-components": "^5.1.9",
|
||||||
"@types/uuid": "^8.3.0",
|
"@types/uuid": "^8.3.0",
|
||||||
|
"apollo": "^2.33.9",
|
||||||
"commitizen": "^4.2.3",
|
"commitizen": "^4.2.3",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
"dotenv-cli": "^4.1.1",
|
"dotenv-cli": "^4.1.1",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
"source-map-explorer": "^2.5.2"
|
"source-map-explorer": "^2.5.2"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"babel-loader": "8.1.0"
|
"babel-loader": "8.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"graphql:codegen": "apollo client:codegen --target typescript",
|
||||||
|
"graphql:update-schema": "apollo client:download-schema src/core/graphql/schemas/crm.graphql",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"start": "dotenv -e .env craco start",
|
"start": "dotenv -e .env craco start",
|
||||||
@ -69,7 +71,8 @@
|
|||||||
"commit": "git-cz",
|
"commit": "git-cz",
|
||||||
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
||||||
"storybook": "start-storybook -p 6006 -s public",
|
"storybook": "start-storybook -p 6006 -s public",
|
||||||
"build-storybook": "build-storybook -s public"
|
"build-storybook": "build-storybook -s public",
|
||||||
|
"babel:clear": "rimraf -rf ./node_modules/.cache/babel-loader/*"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { StoreProvider } from 'client/contexts/storeContext';
|
|||||||
import theme from 'client/UIKit/theme';
|
import theme from 'client/UIKit/theme';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
import { ThemeProvider } from 'styled-components';
|
import { ThemeProvider } from 'styled-components';
|
||||||
import './App.less';
|
|
||||||
import Layout from './Layout';
|
import Layout from './Layout';
|
||||||
|
|
||||||
message.config({
|
message.config({
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
@import '~antd/dist/antd.less';
|
|
||||||
@ -1,13 +1,8 @@
|
|||||||
import Result from 'client/Components/Result';
|
import withStores from 'client/hocs/withStores';
|
||||||
import Spinner from 'client/Components/Spinner';
|
|
||||||
import Button from 'client/Elements/Button';
|
|
||||||
import { CenterContent } from 'client/Elements/Wrapper';
|
|
||||||
import { useFetch } from 'client/hooks/Calculation/useFetch';
|
|
||||||
import { Box } from 'client/UIKit/grid';
|
import { Box } from 'client/UIKit/grid';
|
||||||
import mq from 'client/UIKit/mq';
|
import mq from 'client/UIKit/mq';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Info from './Info';
|
import Info from './Info';
|
||||||
import fetchData from './lib/fetchData';
|
|
||||||
import Results from './Results';
|
import Results from './Results';
|
||||||
import Sections from './Sections';
|
import Sections from './Sections';
|
||||||
|
|
||||||
@ -25,33 +20,12 @@ const Grid = styled(Box)`
|
|||||||
`}
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Calculation = () => {
|
const Calculation = () => (
|
||||||
const { isLoading, error, fetch } = useFetch({ fetchData });
|
<Grid>
|
||||||
|
<Sections width={['100vw', '100vw', '100%']} />
|
||||||
|
<Info width={['100vw', '100vw', '100%']} />
|
||||||
|
<Results minHeight="500px" width={['100vw', '100vw', '100%']} />
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
|
||||||
if (isLoading) {
|
export default withStores(Calculation, ['userStore', 'calculationStore']);
|
||||||
return (
|
|
||||||
<CenterContent>
|
|
||||||
<Spinner />
|
|
||||||
</CenterContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
const ServerError = Result[500];
|
|
||||||
return (
|
|
||||||
<ServerError
|
|
||||||
extra={[<Button text="Попробовать еще раз" action={fetch}></Button>]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Grid>
|
|
||||||
<Sections width={['100vw', '100vw', '100%']} />
|
|
||||||
<Info width={['100vw', '100vw', '100%']} />
|
|
||||||
<Results minHeight="500px" width={['100vw', '100vw', '100%']} />
|
|
||||||
</Grid>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Calculation;
|
|
||||||
|
|||||||
@ -1,26 +0,0 @@
|
|||||||
import UserStore from 'client/stores/UserStore';
|
|
||||||
import UserService from 'core/services/UserService';
|
|
||||||
|
|
||||||
function getUserFromLocalStorage() {
|
|
||||||
const user = ['username', 'domain'].reduce((acc, propName) => {
|
|
||||||
let prop = localStorage.getItem(propName);
|
|
||||||
if (!prop) {
|
|
||||||
prop = prompt('Enter ' + propName);
|
|
||||||
localStorage.setItem(propName, prop);
|
|
||||||
}
|
|
||||||
acc[propName] = prop;
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async () => {
|
|
||||||
let user;
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
|
||||||
user = getUserFromLocalStorage();
|
|
||||||
} else {
|
|
||||||
user = await UserService.fetchUser();
|
|
||||||
}
|
|
||||||
UserStore.setUser(user);
|
|
||||||
return user;
|
|
||||||
};
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
import CalculationStore from 'client/stores/CalculationStore';
|
|
||||||
import initialOptions from 'client/stores/CalculationStore/config/initialOptions';
|
|
||||||
import initialValues from 'client/stores/CalculationStore/config/initialValues';
|
|
||||||
import UserStore from 'client/stores/UserStore';
|
|
||||||
import CrmService from 'core/services/CrmService';
|
|
||||||
import { Process } from 'core/types/Calculation/Store/process';
|
|
||||||
import getUser from './getUser';
|
|
||||||
import insuranceQuery from './queries/insuranceQuery';
|
|
||||||
import optionsQuery from './queries/optionsQuery';
|
|
||||||
import initialOwnerQuery from './queries/ownerQuery';
|
|
||||||
import staticDataQuery from './queries/staticDataQuery';
|
|
||||||
import systemUserQuery from './queries/systemUserQuery';
|
|
||||||
|
|
||||||
export default () =>
|
|
||||||
new Promise(async (resolve, reject) => {
|
|
||||||
await getUser();
|
|
||||||
const domainname = UserStore.getDomainName();
|
|
||||||
const { calculationProcess } = CalculationStore.stores;
|
|
||||||
calculationProcess.addProcess(Process.Init);
|
|
||||||
Promise.all([
|
|
||||||
CrmService.crmgqlquery({
|
|
||||||
...initialOwnerQuery,
|
|
||||||
variables: {
|
|
||||||
statecode: 0,
|
|
||||||
domainname,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
CrmService.crmgqlquery(optionsQuery),
|
|
||||||
CrmService.crmgqlquery(staticDataQuery),
|
|
||||||
CrmService.crmgqlquery({
|
|
||||||
...systemUserQuery,
|
|
||||||
variables: { domainname },
|
|
||||||
}),
|
|
||||||
CrmService.crmgqlquery(insuranceQuery),
|
|
||||||
])
|
|
||||||
.then(
|
|
||||||
([
|
|
||||||
{ entities: ownerOptions },
|
|
||||||
{ entities: options },
|
|
||||||
{ entities: staticEntities },
|
|
||||||
{
|
|
||||||
entities: { systemuser },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
entities: { insuranceCompany },
|
|
||||||
},
|
|
||||||
]) => {
|
|
||||||
CalculationStore.applyOptions({
|
|
||||||
...initialOptions,
|
|
||||||
...ownerOptions,
|
|
||||||
...options,
|
|
||||||
});
|
|
||||||
CalculationStore.applyStaticData({
|
|
||||||
...staticEntities,
|
|
||||||
systemuser: [systemuser],
|
|
||||||
});
|
|
||||||
CalculationStore.setValues(initialValues, true);
|
|
||||||
CalculationStore.setTableColumns('tableInsurance')({
|
|
||||||
options: { insuranceCompany },
|
|
||||||
});
|
|
||||||
|
|
||||||
const supplierCurrency = CalculationStore.options.selectSupplierCurrency?.find(
|
|
||||||
x => x.isocurrencycode === 'RUB',
|
|
||||||
);
|
|
||||||
if (supplierCurrency)
|
|
||||||
CalculationStore.setValue(
|
|
||||||
'supplierCurrency',
|
|
||||||
supplierCurrency.transactioncurrencyid,
|
|
||||||
);
|
|
||||||
|
|
||||||
const evo_sot_coefficient_type = staticEntities.evo_sot_coefficient_type.find(
|
|
||||||
x => x.evo_id === 'BONUS_LEASING',
|
|
||||||
);
|
|
||||||
|
|
||||||
const evo_coefficient_bonus = staticEntities.evo_coefficient.find(
|
|
||||||
x =>
|
|
||||||
x.evo_job_titleid === systemuser.evo_job_titleid &&
|
|
||||||
x.evo_sot_coefficient_typeid ===
|
|
||||||
evo_sot_coefficient_type?.evo_sot_coefficient_typeid,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (
|
|
||||||
evo_coefficient_bonus &&
|
|
||||||
evo_coefficient_bonus.evo_sot_coefficient
|
|
||||||
) {
|
|
||||||
CalculationStore.setValue(
|
|
||||||
'saleBonus',
|
|
||||||
evo_coefficient_bonus.evo_sot_coefficient * 100,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
calculationProcess.deleteProcess(Process.Init);
|
|
||||||
|
|
||||||
resolve();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.catch(err => {
|
|
||||||
reject(err);
|
|
||||||
throw err;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
|
|
||||||
|
|
||||||
const query = gql`
|
|
||||||
query($evo_account_type: [Int!], $statecode: Int) {
|
|
||||||
insuranceCompanies: accounts(
|
|
||||||
evo_account_type: $evo_account_type
|
|
||||||
statecode: $statecode
|
|
||||||
) {
|
|
||||||
accountid
|
|
||||||
name
|
|
||||||
evo_type_ins_policy
|
|
||||||
evo_id_elt
|
|
||||||
evo_id_elt_smr
|
|
||||||
evo_id_elt_osago
|
|
||||||
evo_legal_region_calc
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const variables = { evo_account_type: [100000002], statecode: 0 };
|
|
||||||
const toOptions = ['insuranceCompanies'];
|
|
||||||
|
|
||||||
export default {
|
|
||||||
query,
|
|
||||||
variables,
|
|
||||||
toOptions,
|
|
||||||
} as IQueryToCRMGQL;
|
|
||||||
@ -1,396 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
import { currentISODate } from 'core/tools/date';
|
|
||||||
import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
|
|
||||||
|
|
||||||
const query = gql`
|
|
||||||
query(
|
|
||||||
$statecode: Int
|
|
||||||
$currentDate: DateTime
|
|
||||||
$supplier_account_type: [Int!]
|
|
||||||
$supplier_legal_form: Int
|
|
||||||
$dealer_account_type: [Int!]
|
|
||||||
$dealer_legal_form: Int
|
|
||||||
$account_account_type: [Int!]
|
|
||||||
$product_relation: [Int!]
|
|
||||||
$registration_product_type: Int
|
|
||||||
$nsib_product_type: Int
|
|
||||||
$tracker_product_type: Int
|
|
||||||
$telematic_product_type: Int
|
|
||||||
$fuelcard_product_type: Int
|
|
||||||
$techcard_product_type: Int
|
|
||||||
) {
|
|
||||||
selectSupplier: accounts(
|
|
||||||
evo_account_type: $supplier_account_type
|
|
||||||
statecode: $statecode
|
|
||||||
evo_legal_form: $supplier_legal_form
|
|
||||||
) {
|
|
||||||
name
|
|
||||||
accountid
|
|
||||||
evo_fin_department_accountid
|
|
||||||
}
|
|
||||||
selectSupplierCurrency: transactioncurrencies(statecode: $statecode) {
|
|
||||||
transactioncurrencyid
|
|
||||||
isocurrencycode
|
|
||||||
}
|
|
||||||
selectClientRisk: evo_client_risks(statecode: $statecode) {
|
|
||||||
evo_name
|
|
||||||
evo_client_riskid
|
|
||||||
evo_id
|
|
||||||
}
|
|
||||||
selectClientType: evo_client_types(statecode: $statecode) {
|
|
||||||
evo_name
|
|
||||||
evo_client_typeid
|
|
||||||
}
|
|
||||||
selectDealer: accounts(
|
|
||||||
evo_account_type: $dealer_account_type
|
|
||||||
statecode: $statecode
|
|
||||||
evo_legal_form: $dealer_legal_form
|
|
||||||
) {
|
|
||||||
name
|
|
||||||
accountid
|
|
||||||
}
|
|
||||||
selectGPSBrand: evo_gps_brands(statecode: $statecode) {
|
|
||||||
evo_name
|
|
||||||
evo_gps_brandid
|
|
||||||
}
|
|
||||||
selectRegionRegistration: evo_regions(statecode: $statecode) {
|
|
||||||
evo_name
|
|
||||||
evo_regionid
|
|
||||||
evo_fias_id
|
|
||||||
evo_businessunit_evolution
|
|
||||||
evo_oktmo
|
|
||||||
evo_kladr_id
|
|
||||||
}
|
|
||||||
selectLegalClientRegion: evo_regions(statecode: $statecode) {
|
|
||||||
evo_name
|
|
||||||
evo_regionid
|
|
||||||
evo_fias_id
|
|
||||||
evo_businessunit_evolution
|
|
||||||
evo_oktmo
|
|
||||||
evo_kladr_id
|
|
||||||
}
|
|
||||||
selectAccount: accounts(
|
|
||||||
evo_account_type: $account_account_type
|
|
||||||
statecode: $statecode
|
|
||||||
) {
|
|
||||||
name
|
|
||||||
accountid
|
|
||||||
evo_client_riskid
|
|
||||||
}
|
|
||||||
selectBrand: evo_brands(statecode: $statecode) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_brandid
|
|
||||||
evo_brand_owner
|
|
||||||
evo_importer_reward_perc
|
|
||||||
evo_importer_reward_rub
|
|
||||||
evo_vehicle_type
|
|
||||||
}
|
|
||||||
selectProduct: evo_baseproducts(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_relation: $product_relation
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_name
|
|
||||||
evo_baseproductid
|
|
||||||
evo_id
|
|
||||||
evo_leasingobject_types {
|
|
||||||
evo_name
|
|
||||||
evo_leasingobject_typeid
|
|
||||||
evo_id
|
|
||||||
}
|
|
||||||
evo_brands {
|
|
||||||
evo_name
|
|
||||||
evo_brandid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectRegistration: evo_addproduct_types(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_product_type: $registration_product_type
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_addproduct_typeid
|
|
||||||
evo_accountid
|
|
||||||
evo_graph_price_withoutnds
|
|
||||||
evo_cost_service_provider_withoutnds
|
|
||||||
evo_retro_bonus_withoutnds
|
|
||||||
evo_prime_cost
|
|
||||||
evo_graph_price
|
|
||||||
evo_max_period
|
|
||||||
evo_min_period
|
|
||||||
evo_controls_program
|
|
||||||
evo_towtruck
|
|
||||||
evo_pts_type
|
|
||||||
evo_description
|
|
||||||
evo_gibdd_region
|
|
||||||
evo_whom_register
|
|
||||||
}
|
|
||||||
selectInsNSIB: evo_addproduct_types(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_product_type: $nsib_product_type
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_addproduct_typeid
|
|
||||||
evo_accountid
|
|
||||||
evo_graph_price_withoutnds
|
|
||||||
evo_cost_service_provider_withoutnds
|
|
||||||
evo_retro_bonus_withoutnds
|
|
||||||
evo_prime_cost
|
|
||||||
evo_graph_price
|
|
||||||
evo_max_period
|
|
||||||
evo_min_period
|
|
||||||
evo_controls_program
|
|
||||||
}
|
|
||||||
selectTracker: evo_addproduct_types(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_product_type: $tracker_product_type
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_addproduct_typeid
|
|
||||||
evo_accountid
|
|
||||||
evo_graph_price_withoutnds
|
|
||||||
evo_cost_service_provider_withoutnds
|
|
||||||
evo_retro_bonus_withoutnds
|
|
||||||
evo_prime_cost
|
|
||||||
evo_graph_price
|
|
||||||
evo_max_period
|
|
||||||
evo_min_period
|
|
||||||
evo_controls_program
|
|
||||||
evo_planpayments {
|
|
||||||
evo_name
|
|
||||||
evo_cost_equipment_withoutnds
|
|
||||||
evo_cost_price_telematics_withoutnds
|
|
||||||
evo_cost_telematics_withoutnds
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectTelematic: evo_addproduct_types(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_product_type: $telematic_product_type
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_addproduct_typeid
|
|
||||||
evo_accountid
|
|
||||||
evo_graph_price_withoutnds
|
|
||||||
evo_cost_service_provider_withoutnds
|
|
||||||
evo_retro_bonus_withoutnds
|
|
||||||
evo_prime_cost
|
|
||||||
evo_graph_price
|
|
||||||
evo_max_period
|
|
||||||
evo_min_period
|
|
||||||
evo_controls_program
|
|
||||||
evo_planpayments {
|
|
||||||
evo_name
|
|
||||||
evo_cost_equipment_withoutnds
|
|
||||||
evo_cost_price_telematics_withoutnds
|
|
||||||
evo_cost_telematics_withoutnds
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectTechnicalCard: evo_addproduct_types(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_product_type: $techcard_product_type
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_addproduct_typeid
|
|
||||||
evo_accountid
|
|
||||||
evo_graph_price_withoutnds
|
|
||||||
evo_cost_service_provider_withoutnds
|
|
||||||
evo_retro_bonus_withoutnds
|
|
||||||
evo_prime_cost
|
|
||||||
evo_graph_price
|
|
||||||
evo_max_period
|
|
||||||
evo_min_period
|
|
||||||
evo_controls_program
|
|
||||||
evo_helpcard_type
|
|
||||||
evo_leasingobject_types {
|
|
||||||
evo_leasingobject_typeid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectTarif: evo_tarifs(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_name
|
|
||||||
evo_tarifid
|
|
||||||
evo_baseproductid
|
|
||||||
evo_irr
|
|
||||||
evo_max_irr
|
|
||||||
evo_min_profit
|
|
||||||
evo_min_irr
|
|
||||||
evo_irr_plan
|
|
||||||
evo_ins_type
|
|
||||||
evo_min_period
|
|
||||||
evo_max_period
|
|
||||||
evo_client_risks {
|
|
||||||
evo_name
|
|
||||||
evo_client_riskid
|
|
||||||
}
|
|
||||||
evo_client_types {
|
|
||||||
evo_name
|
|
||||||
evo_client_typeid
|
|
||||||
}
|
|
||||||
evo_leasingobject_types {
|
|
||||||
evo_name
|
|
||||||
evo_id
|
|
||||||
evo_leasingobject_typeid
|
|
||||||
}
|
|
||||||
evo_delivery_time
|
|
||||||
}
|
|
||||||
selectRate: evo_rates(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
createdon
|
|
||||||
evo_id
|
|
||||||
evo_rateid
|
|
||||||
evo_name
|
|
||||||
evo_base_rate
|
|
||||||
evo_coeff_12_23
|
|
||||||
evo_coeff_24_35
|
|
||||||
evo_coeff_36_47
|
|
||||||
evo_coeff_7_11
|
|
||||||
evo_coeff_48_60
|
|
||||||
evo_tarifs {
|
|
||||||
evo_tarifid
|
|
||||||
evo_name
|
|
||||||
}
|
|
||||||
evo_credit_period
|
|
||||||
}
|
|
||||||
selectLeaseObjectType: evo_leasingobject_types(statecode: $statecode) {
|
|
||||||
evo_name
|
|
||||||
evo_id
|
|
||||||
evo_leasingobject_typeid
|
|
||||||
evo_depreciation_rate1
|
|
||||||
evo_depreciation_rate2
|
|
||||||
evo_expluatation_period1
|
|
||||||
evo_expluatation_period2
|
|
||||||
evo_type_code
|
|
||||||
evo_category
|
|
||||||
evo_category_tr
|
|
||||||
evo_vehicle_type_tax
|
|
||||||
evo_vehicle_type
|
|
||||||
}
|
|
||||||
selectObjectRegionRegistration: evo_regions(statecode: $statecode) {
|
|
||||||
evo_name
|
|
||||||
evo_regionid
|
|
||||||
evo_fias_id
|
|
||||||
evo_businessunit_evolution
|
|
||||||
evo_oktmo
|
|
||||||
accounts {
|
|
||||||
accountid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectSubsidy: evo_subsidies(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_name
|
|
||||||
evo_subsidyid
|
|
||||||
evo_percent_subsidy
|
|
||||||
evo_subsidy_summ
|
|
||||||
evo_max_subsidy_summ
|
|
||||||
evo_get_subsidy_payment
|
|
||||||
evo_brands {
|
|
||||||
evo_brandid
|
|
||||||
}
|
|
||||||
evo_models {
|
|
||||||
evo_modelid
|
|
||||||
}
|
|
||||||
evo_leasingobject_types {
|
|
||||||
evo_leasingobject_typeid
|
|
||||||
}
|
|
||||||
accounts {
|
|
||||||
accountid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectFuelCard: evo_addproduct_types(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_product_type: $fuelcard_product_type
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_addproduct_typeid
|
|
||||||
evo_accountid
|
|
||||||
evo_graph_price_withoutnds
|
|
||||||
evo_cost_service_provider_withoutnds
|
|
||||||
evo_retro_bonus_withoutnds
|
|
||||||
evo_prime_cost
|
|
||||||
evo_graph_price
|
|
||||||
evo_max_period
|
|
||||||
evo_min_period
|
|
||||||
evo_controls_program
|
|
||||||
evo_helpcard_type
|
|
||||||
evo_leasingobject_types {
|
|
||||||
evo_leasingobject_typeid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const variables = {
|
|
||||||
currentDate: currentISODate,
|
|
||||||
statecode: 0,
|
|
||||||
supplier_account_type: [100000001],
|
|
||||||
supplier_legal_form: 100000001,
|
|
||||||
dealer_account_type: [100000001],
|
|
||||||
dealer_legal_form: 100000001,
|
|
||||||
account_account_type: [100000000],
|
|
||||||
product_relation: [100000000],
|
|
||||||
registration_product_type: 100000001,
|
|
||||||
nsib_product_type: 100000002,
|
|
||||||
tracker_product_type: 100000003,
|
|
||||||
telematic_product_type: 100000004,
|
|
||||||
techcard_product_type: 100000000,
|
|
||||||
fuelcard_product_type: 100000005,
|
|
||||||
};
|
|
||||||
|
|
||||||
const toOptions = [
|
|
||||||
'selectSupplier',
|
|
||||||
'selectSupplierCurrency',
|
|
||||||
'selectClientRisk',
|
|
||||||
'selectClientType',
|
|
||||||
'selectDealer',
|
|
||||||
'selectGPSBrand',
|
|
||||||
'selectRegionRegistration',
|
|
||||||
'selectAccount',
|
|
||||||
'selectBrand',
|
|
||||||
'selectProduct',
|
|
||||||
'selectRegistration',
|
|
||||||
'selectInsNSIB',
|
|
||||||
'selectTracker',
|
|
||||||
'selectTelematic',
|
|
||||||
'selectTechnicalCard',
|
|
||||||
'selectTarif',
|
|
||||||
'selectRate',
|
|
||||||
'selectLeaseObjectType',
|
|
||||||
'selectObjectRegionRegistration',
|
|
||||||
'selectLegalClientRegion',
|
|
||||||
'selectSubsidy',
|
|
||||||
'selectFuelCard',
|
|
||||||
];
|
|
||||||
|
|
||||||
export default {
|
|
||||||
query,
|
|
||||||
variables,
|
|
||||||
toOptions,
|
|
||||||
} as IQueryToCRMGQL;
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
|
|
||||||
|
|
||||||
const query = gql`
|
|
||||||
query($statecode: Int, $domainname: String) {
|
|
||||||
selectLead: leads(statecode: $statecode, owner_domainname: $domainname) {
|
|
||||||
customerid
|
|
||||||
leadid
|
|
||||||
fullname
|
|
||||||
evo_opportunityid
|
|
||||||
evo_agent_accountid
|
|
||||||
evo_double_agent_accountid
|
|
||||||
evo_broker_accountid
|
|
||||||
evo_fin_department_accountid
|
|
||||||
accountidData {
|
|
||||||
evo_address_legalidData {
|
|
||||||
evo_region_fias_id
|
|
||||||
evo_city_fias_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
evo_inn
|
|
||||||
link
|
|
||||||
}
|
|
||||||
selectOpportunity: opportunities(
|
|
||||||
statecode: $statecode
|
|
||||||
owner_domainname: $domainname
|
|
||||||
) {
|
|
||||||
opportunityid
|
|
||||||
name
|
|
||||||
accountid
|
|
||||||
evo_leadid
|
|
||||||
evo_client_riskid
|
|
||||||
parentaccountid
|
|
||||||
evo_programsolution
|
|
||||||
accountidData {
|
|
||||||
evo_address_legalidData {
|
|
||||||
evo_region_fias_id
|
|
||||||
evo_city_fias_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
link
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const toOptions = ['selectLead', 'selectOpportunity'];
|
|
||||||
|
|
||||||
export default {
|
|
||||||
query,
|
|
||||||
toOptions,
|
|
||||||
} as IQueryToCRMGQL;
|
|
||||||
@ -1,79 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
import { currentISODate } from 'core/tools/date';
|
|
||||||
import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
|
|
||||||
|
|
||||||
const query = gql`
|
|
||||||
query($statecode: Int, $currentDate: DateTime) {
|
|
||||||
evo_impairment_group: evo_impairment_groups(statecode: $statecode) {
|
|
||||||
evo_impairment_groupid
|
|
||||||
evo_name
|
|
||||||
}
|
|
||||||
evo_currencychange: evo_currencychanges(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_coursedate_param: { eq: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_currencychange
|
|
||||||
evo_ref_transactioncurrency
|
|
||||||
}
|
|
||||||
evo_coefficient: evo_coefficients(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_correction_coefficient
|
|
||||||
evo_graph_type
|
|
||||||
evo_season_type
|
|
||||||
evo_job_titleid
|
|
||||||
evo_sot_coefficient_typeid
|
|
||||||
evo_sot_coefficient
|
|
||||||
evo_corfficient_type
|
|
||||||
evo_min_period
|
|
||||||
evo_max_period
|
|
||||||
evo_graph_type
|
|
||||||
evo_season_type
|
|
||||||
evo_correction_coefficient
|
|
||||||
evo_client_riskid
|
|
||||||
evo_client_typeid
|
|
||||||
evo_risk_delta
|
|
||||||
evo_leasingobject_types {
|
|
||||||
evo_name
|
|
||||||
evo_id
|
|
||||||
evo_leasingobject_typeid
|
|
||||||
}
|
|
||||||
evo_businessunits {
|
|
||||||
evo_name
|
|
||||||
evo_businessunitid
|
|
||||||
evo_sale_businessunitid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
evo_sot_coefficient_type: evo_sot_coefficient_types(statecode: $statecode) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_sot_coefficient_typeid
|
|
||||||
}
|
|
||||||
evo_job_title: evo_job_titles(statecode: $statecode) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_job_titleid
|
|
||||||
}
|
|
||||||
evo_addproduct_type: evo_addproduct_types(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
) {
|
|
||||||
evo_product_type
|
|
||||||
evo_addproduct_typeid
|
|
||||||
evo_controls_program
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const variables = {
|
|
||||||
statecode: 0,
|
|
||||||
currentDate: currentISODate,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
query,
|
|
||||||
variables,
|
|
||||||
} as IQueryToCRMGQL;
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
query: gql`
|
|
||||||
query($domainname: String) {
|
|
||||||
systemuser(domainname: $domainname) {
|
|
||||||
evo_job_titleid
|
|
||||||
businessunitid
|
|
||||||
firstname
|
|
||||||
lastname
|
|
||||||
fullname
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
};
|
|
||||||
@ -11,7 +11,7 @@ export const openNotification = ({
|
|||||||
}: {
|
}: {
|
||||||
type: TNotification;
|
type: TNotification;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description?: string;
|
||||||
}) =>
|
}) =>
|
||||||
debounce(
|
debounce(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { Box, Flex } from 'client/UIKit/grid';
|
import { Box, Flex } from 'client/UIKit/grid';
|
||||||
import mq from 'client/UIKit/mq';
|
import mq from 'client/UIKit/mq';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import Routes from '../Routes';
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
import Routes from './routes';
|
|
||||||
|
|
||||||
const Main = styled(Box)`
|
const Main = styled(Box)`
|
||||||
${mq.laptop`
|
${mq.laptop`
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import Spinner from 'client/Components/Spinner';
|
import Spinner from 'client/Components/Spinner';
|
||||||
import { CenterContent } from 'client/Elements/Wrapper';
|
import { CenterContent } from 'client/Elements/Wrapper';
|
||||||
import paths from 'core/common/paths';
|
|
||||||
import { container as resolveContainer } from 'core/tools/resolve';
|
import { container as resolveContainer } from 'core/tools/resolve';
|
||||||
import { Suspense } from 'react';
|
import { Suspense } from 'react';
|
||||||
import { Route, Switch } from 'react-router-dom';
|
import { Route, Switch } from 'react-router-dom';
|
||||||
|
import paths from './paths';
|
||||||
|
|
||||||
export default () => (
|
export default () => (
|
||||||
<Suspense
|
<Suspense
|
||||||
33
src/client/hocs/withStores.jsx
Normal file
33
src/client/hocs/withStores.jsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import Result from 'client/Components/Result';
|
||||||
|
import Spinner from 'client/Components/Spinner';
|
||||||
|
import Button from 'client/Elements/Button';
|
||||||
|
import { CenterContent } from 'client/Elements/Wrapper';
|
||||||
|
import { useStores } from 'client/hooks/useStores';
|
||||||
|
import { useAsync } from 'react-async-hook';
|
||||||
|
|
||||||
|
export default (Component, storesList) => () => {
|
||||||
|
const stores = useStores();
|
||||||
|
const initStores = async function () {
|
||||||
|
for (const storeName of storesList) await stores[storeName].init();
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = useAsync(initStores, [storesList]);
|
||||||
|
|
||||||
|
if (res.loading) {
|
||||||
|
return (
|
||||||
|
<CenterContent>
|
||||||
|
<Spinner />
|
||||||
|
</CenterContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.error) {
|
||||||
|
const ServerError = Result[500];
|
||||||
|
const RetryButton = (
|
||||||
|
<Button text="Попробовать еще раз" action={() => res.execute()}></Button>
|
||||||
|
);
|
||||||
|
return <ServerError extra={[RetryButton]} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <Component />;
|
||||||
|
};
|
||||||
@ -1,28 +0,0 @@
|
|||||||
import { useEffect, useState } from 'react';
|
|
||||||
|
|
||||||
export const useFetch = ({ fetchData }) => {
|
|
||||||
const [response, setResponse] = useState();
|
|
||||||
const [error, setError] = useState();
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
|
||||||
|
|
||||||
function fetch() {
|
|
||||||
setError(false);
|
|
||||||
setResponse(undefined);
|
|
||||||
setIsLoading(true);
|
|
||||||
fetchData()
|
|
||||||
.then(res => {
|
|
||||||
setResponse(res);
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
setError(err);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
setIsLoading(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
fetch();
|
|
||||||
}, []);
|
|
||||||
return { response, isLoading, error, fetch };
|
|
||||||
};
|
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import valuesConstants from 'core/constants/values';
|
import valuesConstants from 'core/constants/values';
|
||||||
import { currentDate } from 'core/tools/date';
|
import { currentDate } from 'core/tools/date';
|
||||||
|
import { NIL } from 'core/tools/uuid';
|
||||||
import { PaymentRow, PreparedValues } from 'core/types/Calculation/Prepare';
|
import { PaymentRow, PreparedValues } from 'core/types/Calculation/Prepare';
|
||||||
import { IPreparedData } from 'core/types/Calculation/Requests';
|
import { IPreparedData } from 'core/types/Calculation/Requests';
|
||||||
import { ICalculationStore } from 'core/types/Calculation/Store';
|
import { ICalculationStore } from 'core/types/Calculation/Store';
|
||||||
import NIL from 'uuid/dist/nil';
|
|
||||||
import { convertPrice } from '../../lib/tools';
|
import { convertPrice } from '../../lib/tools';
|
||||||
|
|
||||||
export default function (this: ICalculationStore): IPreparedData {
|
export default function (this: ICalculationStore): IPreparedData {
|
||||||
|
|||||||
@ -1,139 +1,88 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
import { openNotification } from 'client/Elements/Notification';
|
import { openNotification } from 'client/Elements/Notification';
|
||||||
import UserStore from 'client/stores/UserStore';
|
import UserStore from 'client/stores/UserStore';
|
||||||
import { CRM_PROXY_URL } from 'core/constants/urls';
|
import { getQuotesByLeadQuery } from 'core/graphql/query/crm/quote';
|
||||||
import CrmService from 'core/services/CrmService';
|
import CrmService from 'core/services/CrmService';
|
||||||
import { ICalculationStore } from 'core/types/Calculation/Store';
|
import { ICalculationStore } from 'core/types/Calculation/Store';
|
||||||
|
import { IQuote } from 'core/types/Entities/crmEntities';
|
||||||
import { toJS } from 'mobx';
|
import { toJS } from 'mobx';
|
||||||
import customValues from '../lib/customValues';
|
import customValues from '../lib/customValues';
|
||||||
import { quoteFields } from '../lib/queries';
|
|
||||||
import calculate from './calculate';
|
import calculate from './calculate';
|
||||||
|
|
||||||
export default async function (this: ICalculationStore) {
|
async function composeRequest(this: ICalculationStore) {
|
||||||
const { values, tables } = this;
|
|
||||||
const { calculationUrls, ELTStore } = this.stores;
|
|
||||||
const calculationRes = await calculate.call(this);
|
const calculationRes = await calculate.call(this);
|
||||||
|
|
||||||
if (!calculationRes) {
|
if (!calculationRes) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
calculationUrls.setUrl({ name: 'kpUrl', url: undefined });
|
const insurances = this.tables.tableInsurance.rows.map(
|
||||||
|
insuranceRow =>
|
||||||
const insurances = tables.tableInsurance.rows.map(insuranceRow => {
|
Object.keys(insuranceRow).reduce((acc, v) => {
|
||||||
const resObj = {};
|
acc[v] = toJS(insuranceRow[v].value);
|
||||||
Object.keys(insuranceRow).forEach(prop => {
|
return acc;
|
||||||
resObj[prop] = insuranceRow[prop].value;
|
}, {}),
|
||||||
});
|
{},
|
||||||
return resObj;
|
);
|
||||||
});
|
|
||||||
|
|
||||||
const {
|
|
||||||
columns,
|
|
||||||
postValues,
|
|
||||||
preparedValues,
|
|
||||||
preparedPayments,
|
|
||||||
} = calculationRes;
|
|
||||||
|
|
||||||
const domainname = UserStore.getDomainName();
|
|
||||||
|
|
||||||
const elt = Object.assign(
|
const elt = Object.assign(
|
||||||
{},
|
{},
|
||||||
...['osago', 'kasko'].map(insType => ({
|
...['osago', 'kasko'].map(insType => ({
|
||||||
[insType]: toJS(ELTStore[insType].getCompany()),
|
[insType]: toJS(this.stores.ELTStore[insType].getCompany()),
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
CrmService.createKp(
|
const insKaskoPriceLeasePeriod =
|
||||||
toJS({
|
customValues.insKaskoPriceLeasePeriod.call(this);
|
||||||
domainName: domainname,
|
const calculationValues = Object.assign({}, toJS(this.values), {
|
||||||
calculation: {
|
insKaskoPriceLeasePeriod,
|
||||||
insurances,
|
});
|
||||||
preparedValues,
|
|
||||||
preparedPayments,
|
|
||||||
columns,
|
|
||||||
postValues,
|
|
||||||
calculationValues: {
|
|
||||||
...values,
|
|
||||||
insKaskoPriceLeasePeriod: customValues.insKaskoPriceLeasePeriod.call(
|
|
||||||
this,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
elt,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.then(({ quoteid }) => {
|
|
||||||
CrmService.crmgqlquery({
|
|
||||||
query: gql`
|
|
||||||
query($quoteid: Uuid!) {
|
|
||||||
quote(quoteId: $quoteid) {
|
|
||||||
${quoteFields}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
variables: {
|
|
||||||
quoteid,
|
|
||||||
},
|
|
||||||
toOptions: ['quote'],
|
|
||||||
}).then(async ({ entities: { quote: new_quote } }) => {
|
|
||||||
console.log('quote', new_quote);
|
|
||||||
if (!Array.isArray(new_quote)) {
|
|
||||||
message.success({
|
|
||||||
content: `КП ${new_quote?.evo_quotename || ''} создано!`,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (new_quote?.offerprintformapi) {
|
const domainname = UserStore.getDomainName();
|
||||||
calculationUrls.setUrl({
|
const payload = {
|
||||||
name: 'kpUrl',
|
domainName: domainname,
|
||||||
url: String.prototype.concat(
|
calculation: {
|
||||||
CRM_PROXY_URL,
|
insurances,
|
||||||
new_quote.offerprintformapi,
|
calculationValues,
|
||||||
),
|
...calculationRes,
|
||||||
});
|
},
|
||||||
}
|
elt,
|
||||||
this.setValue('recalcWithRevision', false);
|
};
|
||||||
let quotes = toJS(this.getOptions('selectQuote')) || [];
|
return payload;
|
||||||
//@ts-ignore
|
}
|
||||||
quotes = [new_quote].concat(quotes);
|
|
||||||
|
export default async function (this: ICalculationStore) {
|
||||||
const { quote: selected_quoteid } = this.values;
|
try {
|
||||||
const {
|
this.stores.calculationUrls.setUrl({ name: 'kpUrl', url: undefined });
|
||||||
entities: { quote: updated_quote },
|
const payload = await composeRequest.call(this);
|
||||||
} = await CrmService.crmgqlquery({
|
if (!payload) return;
|
||||||
query: gql`
|
|
||||||
query($quoteid: Uuid!) {
|
await CrmService.createKP(payload);
|
||||||
quote(quoteId: $quoteid) {
|
message.success({
|
||||||
${quoteFields}
|
content: 'КП создано!',
|
||||||
}
|
});
|
||||||
}
|
const leadid = this.getValue('lead');
|
||||||
`,
|
|
||||||
variables: {
|
CrmService.getCRMOptions<'quotes', IQuote>({
|
||||||
quoteid: selected_quoteid,
|
query: getQuotesByLeadQuery,
|
||||||
},
|
variables: {
|
||||||
toOptions: ['quote'],
|
leadid,
|
||||||
});
|
},
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
if (updated_quote && !Array.isArray(updated_quote)) {
|
}).then(({ quotes }) => {
|
||||||
const qIndex = quotes.findIndex(
|
if (!quotes || quotes?.length === 0) {
|
||||||
quote => quote.quoteid === updated_quote.quoteid,
|
throw new Error();
|
||||||
);
|
}
|
||||||
if (qIndex) quotes.splice(qIndex, 1, updated_quote);
|
|
||||||
}
|
this.setOptions('selectQuote', quotes);
|
||||||
|
});
|
||||||
this.setOptions('selectQuote', quotes);
|
} catch (err) {
|
||||||
}
|
openNotification({
|
||||||
});
|
type: 'error',
|
||||||
})
|
title: 'Ошибка во время создания КП!',
|
||||||
.catch(err => {
|
})();
|
||||||
openNotification({
|
|
||||||
type: 'error',
|
const { response } = err as AxiosError;
|
||||||
title: 'Ошибка во время создания КП!',
|
const error = response?.data || err;
|
||||||
description:
|
throw JSON.stringify(error);
|
||||||
err.response.data && JSON.stringify(err.response.data.errors),
|
}
|
||||||
})();
|
|
||||||
|
|
||||||
throw err.response.data;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
export const quoteFields = `
|
|
||||||
quoteid
|
|
||||||
name
|
|
||||||
evo_quotename
|
|
||||||
quotenumber
|
|
||||||
evo_recalc_limit
|
|
||||||
evo_object_count
|
|
||||||
evo_approved_first_payment
|
|
||||||
evo_statuscode: evo_statuscodeidData {
|
|
||||||
evo_id
|
|
||||||
}
|
|
||||||
evo_max_price_change
|
|
||||||
evo_max_mass
|
|
||||||
evo_seats
|
|
||||||
evo_year
|
|
||||||
offerprintformapi
|
|
||||||
evo_regionid
|
|
||||||
evo_legal_regionid
|
|
||||||
evo_legal_townid
|
|
||||||
link
|
|
||||||
evo_req_telematic
|
|
||||||
evo_req_telematic_accept
|
|
||||||
evo_one_year_insurance
|
|
||||||
evo_last_payment_perc
|
|
||||||
`;
|
|
||||||
@ -10,6 +10,7 @@ import {
|
|||||||
TElements,
|
TElements,
|
||||||
} from 'core/types/Calculation/Store/elements';
|
} from 'core/types/Calculation/Store/elements';
|
||||||
import { Process } from 'core/types/Calculation/Store/process';
|
import { Process } from 'core/types/Calculation/Store/process';
|
||||||
|
import { IEvoTown } from 'core/types/Entities/crmEntities';
|
||||||
import { ElementStatus } from 'core/types/statuses';
|
import { ElementStatus } from 'core/types/statuses';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
|
|
||||||
@ -462,7 +463,7 @@ const gibddReactions: IReactionEffect[] = [
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (evo_city_fias_id) {
|
if (evo_city_fias_id) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMEntities<'evo_town', IEvoTown, IEvoTown>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($evo_fias_id: String) {
|
query($evo_fias_id: String) {
|
||||||
evo_town(evo_fias_id: $evo_fias_id) {
|
evo_town(evo_fias_id: $evo_fias_id) {
|
||||||
@ -474,12 +475,9 @@ const gibddReactions: IReactionEffect[] = [
|
|||||||
variables: {
|
variables: {
|
||||||
evo_fias_id: evo_city_fias_id,
|
evo_fias_id: evo_city_fias_id,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ evo_town }) => {
|
||||||
if (entities.evo_town && !Array.isArray(entities.evo_town)) {
|
if (evo_town) {
|
||||||
calculationStore.setValue(
|
calculationStore.setValue('legalClientTown', evo_town.evo_townid);
|
||||||
'legalClientTown',
|
|
||||||
entities.evo_town.evo_townid,
|
|
||||||
);
|
|
||||||
calculationStore.setStatus(
|
calculationStore.setStatus(
|
||||||
'selectLegalClientTown',
|
'selectLegalClientTown',
|
||||||
ElementStatus.Disabled,
|
ElementStatus.Disabled,
|
||||||
@ -568,7 +566,7 @@ const gibddReactions: IReactionEffect[] = [
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (evo_city_fias_id && objectRegistration === 100000000) {
|
if (evo_city_fias_id && objectRegistration === 100000000) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMEntities<'evo_town', IEvoTown, IEvoTown>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($evo_fias_id: String) {
|
query($evo_fias_id: String) {
|
||||||
evo_town(evo_fias_id: $evo_fias_id) {
|
evo_town(evo_fias_id: $evo_fias_id) {
|
||||||
@ -580,12 +578,9 @@ const gibddReactions: IReactionEffect[] = [
|
|||||||
variables: {
|
variables: {
|
||||||
evo_fias_id: evo_city_fias_id,
|
evo_fias_id: evo_city_fias_id,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ evo_town }) => {
|
||||||
if (entities.evo_town && !Array.isArray(entities.evo_town)) {
|
if (evo_town && !Array.isArray(evo_town)) {
|
||||||
calculationStore.setValue(
|
calculationStore.setValue('townRegistration', evo_town.evo_townid);
|
||||||
'townRegistration',
|
|
||||||
entities.evo_town.evo_townid,
|
|
||||||
);
|
|
||||||
calculationStore.setStatus(
|
calculationStore.setStatus(
|
||||||
'selectTownRegistration',
|
'selectTownRegistration',
|
||||||
ElementStatus.Disabled,
|
ElementStatus.Disabled,
|
||||||
|
|||||||
@ -1,31 +1,36 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
import { resetIns } from 'client/Components/Calculation/ELT/Content/lib/resetIns';
|
import { resetIns } from 'client/Components/Calculation/ELT/Content/lib/resetIns';
|
||||||
import { numberElementsProps } from 'client/Containers/Calculation/lib/elements/elementsProps';
|
import { numberElementsProps } from 'client/Containers/Calculation/lib/elements/elementsProps';
|
||||||
import {
|
import {
|
||||||
getTitle,
|
getTitle,
|
||||||
getValueName
|
getValueName,
|
||||||
} from 'client/Containers/Calculation/lib/elements/tools';
|
} from 'client/Containers/Calculation/lib/elements/tools';
|
||||||
import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
|
import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
|
||||||
import { openNotification } from 'client/Elements/Notification';
|
import { openNotification } from 'client/Elements/Notification';
|
||||||
import initialValues from 'client/stores/CalculationStore/config/initialValues';
|
import initialValues from 'client/stores/CalculationStore/config/initialValues';
|
||||||
|
import {
|
||||||
|
getMainOptionsForQuote,
|
||||||
|
getQuoteQuery,
|
||||||
|
getSecondaryOptionsForQuote,
|
||||||
|
getSingleOptionsForQuote,
|
||||||
|
} from 'core/graphql/query/crm/quote';
|
||||||
import CrmService from 'core/services/CrmService';
|
import CrmService from 'core/services/CrmService';
|
||||||
import { currentISODate } from 'core/tools/date';
|
import { currentISODate } from 'core/tools/date';
|
||||||
import { IGetCRMEntitiesResponse } from 'core/types/Calculation/Responses';
|
import { NIL } from 'core/tools/uuid';
|
||||||
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
|
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
|
||||||
import {
|
import { ElementsNames } from 'core/types/Calculation/Store/elements';
|
||||||
ElementsNames,
|
|
||||||
TElements
|
|
||||||
} from 'core/types/Calculation/Store/elements';
|
|
||||||
import { Process } from 'core/types/Calculation/Store/process';
|
import { Process } from 'core/types/Calculation/Store/process';
|
||||||
import { ValuesNames } from 'core/types/Calculation/Store/values';
|
import { TValues, ValuesNames } from 'core/types/Calculation/Store/values';
|
||||||
import { IEvoGraph } from 'core/types/Entities/crmEntities';
|
import {
|
||||||
|
IAccount,
|
||||||
|
IEvoGraph,
|
||||||
|
IEvoTown,
|
||||||
|
IQuote,
|
||||||
|
TCRMEntity,
|
||||||
|
} from 'core/types/Entities/crmEntities';
|
||||||
import { ElementStatus } from 'core/types/statuses';
|
import { ElementStatus } from 'core/types/statuses';
|
||||||
import { get, invert, isEqual, isNil } from 'lodash';
|
import { get, invert, isEqual, isNil } from 'lodash';
|
||||||
import NIL from 'uuid/dist/nil';
|
|
||||||
import { getKpPropName } from './mapKpToValues';
|
import { getKpPropName } from './mapKpToValues';
|
||||||
import { mainOptionsQuery, secondaryOptionsQuery } from './optionsQuery';
|
|
||||||
import quoteQuery from './quoteQuery';
|
|
||||||
|
|
||||||
const map_add_product_types_to_values = {
|
const map_add_product_types_to_values = {
|
||||||
technicalCard: 100000000,
|
technicalCard: 100000000,
|
||||||
@ -83,19 +88,17 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
|
|
||||||
const { calculationProcess } = calculationStore.stores;
|
const { calculationProcess } = calculationStore.stores;
|
||||||
|
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMEntities<'quote', IQuote, keyof IQuote>({
|
||||||
query: quoteQuery,
|
query: getQuoteQuery,
|
||||||
variables: {
|
variables: {
|
||||||
quoteId,
|
quoteId,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(async ({ entities: { quote } }) => {
|
.then(async ({ quote }) => {
|
||||||
if (!quote) {
|
if (!quote) throw new Error('no quote');
|
||||||
throw new Error('No quote!');
|
|
||||||
}
|
|
||||||
calculationProcess.addProcess(Process.LoadKp);
|
calculationProcess.addProcess(Process.LoadKp);
|
||||||
if (!Array.isArray(quote)) {
|
if (!Array.isArray(quote)) {
|
||||||
const newValues = Object.assign(
|
const newValues: TValues<any> = Object.assign(
|
||||||
{},
|
{},
|
||||||
...(Object.values(elementsValues) as ValuesNames[]).map(
|
...(Object.values(elementsValues) as ValuesNames[]).map(
|
||||||
valueName => ({
|
valueName => ({
|
||||||
@ -105,12 +108,11 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const mainOptions = await CrmService.getCRMOptions<
|
||||||
entities: mainOptions,
|
ElementsNames,
|
||||||
}: IGetCRMEntitiesResponse & {
|
TCRMEntity
|
||||||
entities: TElements<any>;
|
>({
|
||||||
} = await CrmService.crmgqlquery({
|
query: getMainOptionsForQuote,
|
||||||
query: mainOptionsQuery,
|
|
||||||
variables: {
|
variables: {
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_brandid: quote.evo_brandid || NIL,
|
evo_brandid: quote.evo_brandid || NIL,
|
||||||
@ -119,7 +121,6 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
currentDate: currentISODate,
|
currentDate: currentISODate,
|
||||||
dealer_person_accountid: quote.evo_dealer_person_accountid || NIL,
|
dealer_person_accountid: quote.evo_dealer_person_accountid || NIL,
|
||||||
dealer_broker_accountid: quote.evo_dealer_broker_accountid || NIL,
|
dealer_broker_accountid: quote.evo_dealer_broker_accountid || NIL,
|
||||||
hasDealerBroker: quote.evo_dealer_broker_accountid ? true : false,
|
|
||||||
// ind_agent_accountid: quote.evo_agent_accountid || NIL,
|
// ind_agent_accountid: quote.evo_agent_accountid || NIL,
|
||||||
double_agent_accountid: quote.evo_double_agent_accountid || NIL,
|
double_agent_accountid: quote.evo_double_agent_accountid || NIL,
|
||||||
// broker_accountid: quote.evo_broker_accountid || NIL,
|
// broker_accountid: quote.evo_broker_accountid || NIL,
|
||||||
@ -129,26 +130,22 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
evo_regionid: quote.evo_regionid || NIL,
|
evo_regionid: quote.evo_regionid || NIL,
|
||||||
evo_legal_regionid: quote.evo_legal_regionid || NIL,
|
evo_legal_regionid: quote.evo_legal_regionid || NIL,
|
||||||
},
|
},
|
||||||
toOptions: [
|
});
|
||||||
'selectModel',
|
|
||||||
'selectConfiguration',
|
const { selectDealerBroker } = await CrmService.getCRMOptions<
|
||||||
'selectDealerPerson',
|
'selectDealerBroker',
|
||||||
'selectDealerRewardCondition',
|
IAccount
|
||||||
'selectDealerBroker',
|
>({
|
||||||
'selectDealerBrokerRewardCondition',
|
query: getSingleOptionsForQuote,
|
||||||
'selectIndAgentRewardCondition',
|
variables: {
|
||||||
'selectCalcDoubleAgentRewardCondition',
|
dealer_broker_accountid: quote.evo_dealer_broker_accountid || NIL,
|
||||||
'selectCalcBrokerRewardCondition',
|
hasDealerBroker: quote.evo_dealer_broker_accountid ? true : false,
|
||||||
'selectFinDepartmentRewardCondtion',
|
},
|
||||||
'selectGPSModel',
|
|
||||||
'selectTownRegistration',
|
|
||||||
'selectLegalClientTown',
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
calculationStore.applyOptions({
|
calculationStore.applyOptions({
|
||||||
...mainOptions,
|
...mainOptions,
|
||||||
selectDealerBroker: [mainOptions.selectDealerBroker],
|
selectDealerBroker,
|
||||||
});
|
});
|
||||||
|
|
||||||
// fill insurance table
|
// fill insurance table
|
||||||
@ -394,18 +391,16 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
}
|
}
|
||||||
// regionRegistration
|
// regionRegistration
|
||||||
|
|
||||||
const {
|
const secondaryOptions = await CrmService.getCRMOptions<
|
||||||
entities: secondaryOptions,
|
ElementsNames,
|
||||||
}: IGetCRMEntitiesResponse & {
|
keyof IEvoTown
|
||||||
entities: TElements<any>;
|
>({
|
||||||
} = await CrmService.crmgqlquery({
|
query: getSecondaryOptionsForQuote,
|
||||||
query: secondaryOptionsQuery,
|
|
||||||
variables: {
|
variables: {
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_regionid: regionRegistration || NIL,
|
evo_regionid: regionRegistration || NIL,
|
||||||
evo_legal_regionid: legalClientRegion || NIL,
|
evo_legal_regionid: legalClientRegion || NIL,
|
||||||
},
|
},
|
||||||
toOptions: ['selectTownRegistration', 'selectLegalClientTown'],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
calculationStore.applyOptions(secondaryOptions);
|
calculationStore.applyOptions(secondaryOptions);
|
||||||
@ -428,9 +423,10 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
secondaryOptions.selectLegalClientTown.findIndex(
|
(
|
||||||
x => x.evo_legal_townid === quote.evo_legal_townid,
|
secondaryOptions?.selectLegalClientTown as IEvoTown[]
|
||||||
) > -1
|
)?.findIndex(x => x.evo_townid === 'quote?.evo_legal_townid') >
|
||||||
|
-1
|
||||||
) {
|
) {
|
||||||
legalClientTown = quote.evo_legal_townid;
|
legalClientTown = quote.evo_legal_townid;
|
||||||
}
|
}
|
||||||
@ -444,9 +440,9 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
//townRegistration
|
//townRegistration
|
||||||
if (quote.evo_object_registration === 100000001) {
|
if (quote.evo_object_registration === 100000001) {
|
||||||
if (
|
if (
|
||||||
secondaryOptions.selectTownRegistration.findIndex(
|
(
|
||||||
x => x.evo_townid === quote.evo_townid,
|
secondaryOptions?.selectTownRegistration as IEvoTown[]
|
||||||
) > -1
|
)?.findIndex(x => x.evo_townid === quote.evo_townid) > -1
|
||||||
) {
|
) {
|
||||||
townRegistration = quote.evo_townid;
|
townRegistration = quote.evo_townid;
|
||||||
}
|
}
|
||||||
@ -474,9 +470,9 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
secondaryOptions.selectTownRegistration.findIndex(
|
(
|
||||||
x => x.evo_townid === quote.evo_townid,
|
secondaryOptions?.selectTownRegistration as IEvoTown[]
|
||||||
) > -1
|
)?.findIndex(x => x.evo_townid === quote.evo_townid) > -1
|
||||||
) {
|
) {
|
||||||
townRegistration = quote.evo_townid;
|
townRegistration = quote.evo_townid;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { TValues, ValuesNames } from 'core/types/Calculation/Store/values';
|
import { ValuesNames } from 'core/types/Calculation/Store/values';
|
||||||
import { IQuote } from 'core/types/Entities/crmEntities';
|
import { IQuote } from 'core/types/Entities/crmEntities';
|
||||||
|
|
||||||
const mapKPtoValues: TValues<keyof IQuote | string> = {
|
const mapKPtoValues: Partial<Record<ValuesNames, keyof IQuote | string>> = {
|
||||||
product: 'evo_baseproductid',
|
product: 'evo_baseproductid',
|
||||||
clientType: 'evo_client_typeid',
|
clientType: 'evo_client_typeid',
|
||||||
leaseObjectPrice: 'evo_supplier_currency_price',
|
leaseObjectPrice: 'evo_supplier_currency_price',
|
||||||
@ -96,8 +96,8 @@ const mapKPtoValues: TValues<keyof IQuote | string> = {
|
|||||||
subsidySum: 'evo_subsidy_summ',
|
subsidySum: 'evo_subsidy_summ',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getKpPropName(valueName: ValuesNames) {
|
export const getKpPropName = (
|
||||||
return mapKPtoValues[valueName];
|
valueName: ValuesNames,
|
||||||
}
|
): keyof IQuote | string | undefined => mapKPtoValues[valueName];
|
||||||
|
|
||||||
export default mapKPtoValues;
|
export default mapKPtoValues;
|
||||||
|
|||||||
@ -1,159 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
|
|
||||||
export const mainOptionsQuery = gql`
|
|
||||||
query(
|
|
||||||
$statecode: Int
|
|
||||||
$evo_brandid: Uuid
|
|
||||||
$evo_modelid: Uuid
|
|
||||||
$salonaccountid: Uuid!
|
|
||||||
$currentDate: DateTime
|
|
||||||
$dealer_person_accountid: Uuid!
|
|
||||||
$dealer_broker_accountid: Uuid!
|
|
||||||
$hasDealerBroker: Boolean!
|
|
||||||
# $ind_agent_accountid: Uuid!
|
|
||||||
$double_agent_accountid: Uuid!
|
|
||||||
# $broker_accountid: Uuid!
|
|
||||||
# $findepartment_accountid: Uuid!
|
|
||||||
$evo_gps_brandid: Uuid!
|
|
||||||
) {
|
|
||||||
selectModel: evo_models(statecode: $statecode, evo_brandid: $evo_brandid) {
|
|
||||||
evo_id
|
|
||||||
evo_name
|
|
||||||
evo_modelid
|
|
||||||
evo_leasingobject_risk
|
|
||||||
evo_importer_reward_perc
|
|
||||||
evo_importer_reward_rub
|
|
||||||
evo_impairment_groupid
|
|
||||||
evo_vehicle_type
|
|
||||||
evo_gps
|
|
||||||
evo_vehicle_body_typeidData {
|
|
||||||
evo_id_elt
|
|
||||||
}
|
|
||||||
evo_running_gear
|
|
||||||
}
|
|
||||||
selectConfiguration: evo_equipments(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_modelid: $evo_modelid
|
|
||||||
) {
|
|
||||||
evo_equipmentid
|
|
||||||
evo_name
|
|
||||||
evo_impairment_groupid
|
|
||||||
evo_leasingobject_risk
|
|
||||||
evo_start_production_year
|
|
||||||
}
|
|
||||||
selectDealerPerson: salon_providers(
|
|
||||||
statecode: $statecode
|
|
||||||
salonaccountid: $salonaccountid
|
|
||||||
) {
|
|
||||||
accountid
|
|
||||||
name
|
|
||||||
evo_broker_accountid
|
|
||||||
evo_kpp
|
|
||||||
evo_inn
|
|
||||||
}
|
|
||||||
selectDealerRewardCondition: evo_reward_conditions(
|
|
||||||
evo_agent_accountid: $dealer_person_accountid
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
statecode: $statecode
|
|
||||||
) {
|
|
||||||
evo_reward_conditionid
|
|
||||||
evo_name
|
|
||||||
evo_reward_summ
|
|
||||||
evo_reduce_reward
|
|
||||||
}
|
|
||||||
selectDealerBroker: account(accountid: $dealer_broker_accountid)
|
|
||||||
@include(if: $hasDealerBroker) {
|
|
||||||
accountid
|
|
||||||
name
|
|
||||||
}
|
|
||||||
selectDealerBrokerRewardCondition: evo_reward_conditions(
|
|
||||||
evo_agent_accountid: $dealer_broker_accountid
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
statecode: $statecode
|
|
||||||
) {
|
|
||||||
evo_reward_conditionid
|
|
||||||
evo_name
|
|
||||||
evo_reward_summ
|
|
||||||
evo_reduce_reward
|
|
||||||
}
|
|
||||||
# selectIndAgentRewardCondition: evo_reward_conditions(
|
|
||||||
# evo_agent_accountid: $ind_agent_accountid
|
|
||||||
# evo_datefrom_param: { lte: $currentDate }
|
|
||||||
# evo_dateto_param: { gte: $currentDate }
|
|
||||||
# statecode: $statecode
|
|
||||||
# ) {
|
|
||||||
# evo_reward_conditionid
|
|
||||||
# evo_name
|
|
||||||
# evo_double_agent_accountid
|
|
||||||
# evo_reward_summ
|
|
||||||
# evo_reduce_reward
|
|
||||||
# }
|
|
||||||
calcDoubleAgentRewardCondition: evo_reward_conditions(
|
|
||||||
evo_agent_accountid: $double_agent_accountid
|
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
|
||||||
evo_dateto_param: { gte: $currentDate }
|
|
||||||
statecode: $statecode
|
|
||||||
) {
|
|
||||||
evo_reward_conditionid
|
|
||||||
evo_name
|
|
||||||
evo_reward_summ
|
|
||||||
evo_reduce_reward
|
|
||||||
}
|
|
||||||
# calcBrokerRewardCondition: evo_reward_conditions(
|
|
||||||
# evo_agent_accountid: $broker_accountid
|
|
||||||
# evo_datefrom_param: { lte: $currentDate }
|
|
||||||
# evo_dateto_param: { gte: $currentDate }
|
|
||||||
# statecode: $statecode
|
|
||||||
# ) {
|
|
||||||
# evo_reward_conditionid
|
|
||||||
# evo_name
|
|
||||||
# evo_reward_summ
|
|
||||||
# evo_reduce_reward
|
|
||||||
# }
|
|
||||||
# selectFinDepartmentRewardCondtion: evo_reward_conditions(
|
|
||||||
# evo_agent_accountid: $findepartment_accountid
|
|
||||||
# evo_datefrom_param: { lte: $currentDate }
|
|
||||||
# evo_dateto_param: { gte: $currentDate }
|
|
||||||
# statecode: $statecode
|
|
||||||
# ) {
|
|
||||||
# evo_reward_conditionid
|
|
||||||
# evo_name
|
|
||||||
# evo_reward_summ
|
|
||||||
# evo_reduce_reward
|
|
||||||
# }
|
|
||||||
selectGPSModel: evo_gps_models(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_gps_brandid: $evo_gps_brandid
|
|
||||||
) {
|
|
||||||
evo_name
|
|
||||||
evo_gps_modelid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const secondaryOptionsQuery = gql`
|
|
||||||
query($statecode: Int, $evo_regionid: Uuid!, $evo_legal_regionid: Uuid!) {
|
|
||||||
selectTownRegistration: evo_towns(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_regionid: $evo_regionid
|
|
||||||
) {
|
|
||||||
evo_name
|
|
||||||
evo_townid
|
|
||||||
evo_fias_id
|
|
||||||
evo_kladr_id
|
|
||||||
evo_businessunit_evolution
|
|
||||||
}
|
|
||||||
selectLegalClientTown: evo_towns(
|
|
||||||
statecode: $statecode
|
|
||||||
evo_regionid: $evo_legal_regionid
|
|
||||||
) {
|
|
||||||
evo_name
|
|
||||||
evo_townid
|
|
||||||
evo_fias_id
|
|
||||||
evo_kladr_id
|
|
||||||
evo_businessunit_evolution
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
import mapKPtoValues from './mapKpToValues';
|
|
||||||
|
|
||||||
export default gql`
|
|
||||||
query($quoteId: Uuid!) {
|
|
||||||
quote(quoteId: $quoteId) {
|
|
||||||
${Object.values(mapKPtoValues).join(' ')}
|
|
||||||
evo_addproduct_types {
|
|
||||||
evo_product_type
|
|
||||||
evo_addproduct_typeid
|
|
||||||
}
|
|
||||||
evo_osago_accountid
|
|
||||||
evo_kasko_accountid
|
|
||||||
evo_osago_payer
|
|
||||||
evo_kasko_payer
|
|
||||||
evo_osago_price
|
|
||||||
evo_kasko_price
|
|
||||||
evo_dgo_price
|
|
||||||
evo_ns_price
|
|
||||||
evo_insurance_period
|
|
||||||
evo_graphs {
|
|
||||||
createdon
|
|
||||||
evo_sumpay_withnds
|
|
||||||
evo_planpayments {
|
|
||||||
evo_payment_ratio
|
|
||||||
}
|
|
||||||
}
|
|
||||||
evo_first_payment_perc
|
|
||||||
evo_last_payment_perc
|
|
||||||
evo_quotename
|
|
||||||
evo_rateid
|
|
||||||
evo_client_riskid
|
|
||||||
evo_regionid
|
|
||||||
evo_townid
|
|
||||||
evo_registration_regionid
|
|
||||||
evo_vehicle_tax_approved
|
|
||||||
evo_vehicle_tax_year
|
|
||||||
evo_category_tr
|
|
||||||
evo_vehicle_type_tax
|
|
||||||
evo_agent_accountid
|
|
||||||
evo_dealer_person_accountid
|
|
||||||
evo_dealer_broker_accountid
|
|
||||||
evo_double_agent_accountid
|
|
||||||
evo_broker_accountid
|
|
||||||
evo_fin_department_accountid
|
|
||||||
|
|
||||||
evo_kasko_accountid
|
|
||||||
evo_kasko_price
|
|
||||||
evo_id_elt_kasko
|
|
||||||
evo_id_kasko_calc
|
|
||||||
evo_franchise
|
|
||||||
evo_id_elt_osago
|
|
||||||
evo_osago_price
|
|
||||||
evo_legal_regionid
|
|
||||||
evo_legal_townid
|
|
||||||
evo_object_count
|
|
||||||
evo_recalc_limit
|
|
||||||
evo_req_telematic
|
|
||||||
evo_req_telematic_accept
|
|
||||||
evo_accept_control_addproduct_typeid
|
|
||||||
evo_payment_redemption_sum
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
@ -1,22 +1,29 @@
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
|
import { getQuotesByLeadQuery } from 'core/graphql/query/crm/quote';
|
||||||
import CrmService from 'core/services/CrmService';
|
import CrmService from 'core/services/CrmService';
|
||||||
import { currentISODate } from 'core/tools/date';
|
import { currentISODate } from 'core/tools/date';
|
||||||
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
|
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
|
||||||
import { Process } from 'core/types/Calculation/Store/process';
|
import { Process } from 'core/types/Calculation/Store/process';
|
||||||
|
import {
|
||||||
|
IAccount,
|
||||||
|
IEvoEquipment,
|
||||||
|
IEvoGPSModel,
|
||||||
|
IEvoModel,
|
||||||
|
IEvoRewardCondition,
|
||||||
|
IEvoTown,
|
||||||
|
IQuote,
|
||||||
|
ISalonProvider,
|
||||||
|
} from 'core/types/Entities/crmEntities';
|
||||||
import { ElementStatus } from 'core/types/statuses';
|
import { ElementStatus } from 'core/types/statuses';
|
||||||
import { quoteFields } from '../lib/queries';
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
(calculationStore, calculationProcess) => ({
|
(calculationStore, calculationProcess) => ({
|
||||||
expression: () => {
|
expression: () => calculationStore.getOption('selectLead'),
|
||||||
const { values } = calculationStore;
|
effect: async lead => {
|
||||||
return values.lead;
|
|
||||||
},
|
|
||||||
effect: async leadid => {
|
|
||||||
if (calculationProcess.hasProcess(Process.LoadKp)) {
|
if (calculationProcess.hasProcess(Process.LoadKp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!leadid) {
|
if (!lead) {
|
||||||
calculationStore.setValue('opportunity', null);
|
calculationStore.setValue('opportunity', null);
|
||||||
calculationStore.setFilter('selectOpportunity', undefined);
|
calculationStore.setFilter('selectOpportunity', undefined);
|
||||||
calculationStore.setValue('quote', null);
|
calculationStore.setValue('quote', null);
|
||||||
@ -32,184 +39,155 @@ export default [
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lead = calculationStore.getOption('selectLead', { leadid });
|
if (lead?.evo_opportunityid) {
|
||||||
if (lead) {
|
calculationStore.setValue('opportunity', lead.evo_opportunityid);
|
||||||
if (lead.evo_opportunityid) {
|
calculationStore.setFilter('selectOpportunity', opportunities =>
|
||||||
calculationStore.setValue('opportunity', lead.evo_opportunityid);
|
opportunities.filter(x => x.opportunityid === lead.evo_opportunityid),
|
||||||
calculationStore.setFilter('selectOpportunity', opportunities =>
|
);
|
||||||
opportunities.filter(
|
} else {
|
||||||
x => x.opportunityid === lead.evo_opportunityid,
|
calculationStore.setFilter('selectOpportunity', () => []);
|
||||||
),
|
calculationStore.setValue('opportunity', null);
|
||||||
);
|
}
|
||||||
} else {
|
|
||||||
calculationStore.setFilter('selectOpportunity', () => []);
|
|
||||||
calculationStore.setValue('opportunity', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lead.leadid) {
|
if (lead?.leadid) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'quotes', IQuote>({
|
||||||
query: gql`
|
query: getQuotesByLeadQuery,
|
||||||
query($leadid: Uuid) {
|
variables: {
|
||||||
quote: quotes(evo_leadid: $leadid) {
|
leadid: lead?.leadid,
|
||||||
${quoteFields}
|
},
|
||||||
}
|
}).then(({ quotes }) => {
|
||||||
|
if (quotes && quotes.length > 0) {
|
||||||
|
calculationStore.setOptions('selectQuote', quotes);
|
||||||
|
calculationStore.setValue('quote', null);
|
||||||
|
} else {
|
||||||
|
calculationStore.setOptions('selectQuote', []);
|
||||||
|
calculationStore.setValue('quote', null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
calculationStore.setOptions('selectQuote', []);
|
||||||
|
calculationStore.setValue('quote', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lead?.evo_agent_accountid) {
|
||||||
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
|
query: gql`
|
||||||
|
query selectIndAgent($evo_agent_accountid: Uuid!) {
|
||||||
|
accountOptions: account(accountid: $evo_agent_accountid) {
|
||||||
|
accountid
|
||||||
|
name
|
||||||
}
|
}
|
||||||
`,
|
}
|
||||||
variables: {
|
`,
|
||||||
leadid: leadid,
|
variables: {
|
||||||
},
|
evo_agent_accountid: lead.evo_agent_accountid,
|
||||||
toOptions: ['quote'],
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ accountOptions }) => {
|
||||||
if (
|
if (accountOptions && accountOptions.length > 0) {
|
||||||
entities.quote &&
|
calculationStore.setOptions('selectIndAgent', accountOptions);
|
||||||
Array.isArray(entities.quote) &&
|
calculationStore.setValue('indAgent', accountOptions[0].accountid);
|
||||||
entities.quote.length > 0
|
} else {
|
||||||
|
calculationStore.setValue('indAgent', null);
|
||||||
|
calculationStore.setOptions('selectIndAgent', []);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
calculationStore.setValue('indAgent', null);
|
||||||
|
calculationStore.setOptions('selectIndAgent', []);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lead?.evo_double_agent_accountid) {
|
||||||
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
|
query: gql`
|
||||||
|
query selectCalcDoubleAgent($evo_double_agent_accountid: Uuid!) {
|
||||||
|
accountOptions: account(accountid: $evo_double_agent_accountid) {
|
||||||
|
accountid
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
variables: {
|
||||||
|
evo_double_agent_accountid: lead.evo_double_agent_accountid,
|
||||||
|
},
|
||||||
|
}).then(({ accountOptions }) => {
|
||||||
|
if (accountOptions && accountOptions.length > 0) {
|
||||||
|
calculationStore.setOptions(
|
||||||
|
'selectCalcDoubleAgent',
|
||||||
|
accountOptions,
|
||||||
|
);
|
||||||
|
calculationStore.setValue(
|
||||||
|
'calcDoubleAgent',
|
||||||
|
accountOptions[0].accountid,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
calculationStore.setValue('calcDoubleAgent', null);
|
||||||
|
calculationStore.setOptions('selectCalcDoubleAgent', []);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
calculationStore.setValue('calcDoubleAgent', null);
|
||||||
|
calculationStore.setOptions('selectCalcDoubleAgent', []);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lead?.evo_broker_accountid) {
|
||||||
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
|
query: gql`
|
||||||
|
query selectCalcBroker($evo_broker_accountid: Uuid!) {
|
||||||
|
accountOptions: account(accountid: $evo_broker_accountid) {
|
||||||
|
accountid
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
variables: {
|
||||||
|
evo_broker_accountid: lead.evo_broker_accountid,
|
||||||
|
},
|
||||||
|
}).then(({ accountOptions }) => {
|
||||||
|
if (accountOptions && accountOptions.length > 0) {
|
||||||
|
calculationStore.setOptions('selectCalcBroker', accountOptions);
|
||||||
|
calculationStore.setValue(
|
||||||
|
'calcBroker',
|
||||||
|
accountOptions[0].accountid,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
calculationStore.setValue('calcBroker', null);
|
||||||
|
calculationStore.setOptions('selectCalcBroker', []);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lead?.evo_fin_department_accountid) {
|
||||||
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
|
query: gql`
|
||||||
|
query selectCalcFinDepartment(
|
||||||
|
$evo_fin_department_accountid: Uuid!
|
||||||
) {
|
) {
|
||||||
calculationStore.setOptions('selectQuote', entities.quote);
|
accountOptions: account(
|
||||||
calculationStore.setValue('quote', null);
|
accountid: $evo_fin_department_accountid
|
||||||
} else {
|
) {
|
||||||
calculationStore.setOptions('selectQuote', []);
|
accountid
|
||||||
calculationStore.setValue('quote', null);
|
name
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
calculationStore.setOptions('selectQuote', []);
|
|
||||||
calculationStore.setValue('quote', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lead.evo_agent_accountid) {
|
|
||||||
CrmService.crmgqlquery({
|
|
||||||
query: gql`
|
|
||||||
query($evo_agent_accountid: Uuid!) {
|
|
||||||
account(accountid: $evo_agent_accountid) {
|
|
||||||
accountid
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
variables: {
|
|
||||||
evo_agent_accountid: lead.evo_agent_accountid,
|
|
||||||
},
|
|
||||||
toOptions: ['account'],
|
|
||||||
}).then(({ entities }) => {
|
|
||||||
if (entities.account) {
|
|
||||||
if (!Array.isArray(entities.account)) {
|
|
||||||
calculationStore.setOptions('selectIndAgent', [
|
|
||||||
entities.account,
|
|
||||||
]);
|
|
||||||
calculationStore.setValue(
|
|
||||||
'indAgent',
|
|
||||||
entities.account.accountid,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
calculationStore.setValue('indAgent', null);
|
|
||||||
calculationStore.setOptions('selectIndAgent', []);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
calculationStore.setValue('indAgent', null);
|
|
||||||
calculationStore.setOptions('selectIndAgent', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lead.evo_double_agent_accountid) {
|
|
||||||
CrmService.crmgqlquery({
|
|
||||||
query: gql`
|
|
||||||
query($evo_double_agent_accountid: Uuid!) {
|
|
||||||
account(accountid: $evo_double_agent_accountid) {
|
|
||||||
accountid
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
variables: {
|
|
||||||
evo_double_agent_accountid: lead.evo_double_agent_accountid,
|
|
||||||
},
|
|
||||||
toOptions: ['account'],
|
|
||||||
}).then(({ entities }) => {
|
|
||||||
if (entities.account) {
|
|
||||||
if (!Array.isArray(entities.account)) {
|
|
||||||
calculationStore.setOptions('selectCalcDoubleAgent', [
|
|
||||||
entities.account,
|
|
||||||
]);
|
|
||||||
calculationStore.setValue(
|
|
||||||
'calcDoubleAgent',
|
|
||||||
entities.account.accountid,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
calculationStore.setValue('calcDoubleAgent', null);
|
|
||||||
calculationStore.setOptions('selectCalcDoubleAgent', []);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
calculationStore.setValue('calcDoubleAgent', null);
|
|
||||||
calculationStore.setOptions('selectCalcDoubleAgent', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lead.evo_broker_accountid) {
|
|
||||||
CrmService.crmgqlquery({
|
|
||||||
query: gql`
|
|
||||||
query($evo_broker_accountid: Uuid!) {
|
|
||||||
account(accountid: $evo_broker_accountid) {
|
|
||||||
accountid
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
variables: {
|
|
||||||
evo_broker_accountid: lead.evo_broker_accountid,
|
|
||||||
},
|
|
||||||
toOptions: ['account'],
|
|
||||||
}).then(({ entities }) => {
|
|
||||||
if (entities.account) {
|
|
||||||
if (!Array.isArray(entities.account)) {
|
|
||||||
calculationStore.setOptions('selectCalcBroker', [
|
|
||||||
entities.account,
|
|
||||||
]);
|
|
||||||
calculationStore.setValue(
|
|
||||||
'calcBroker',
|
|
||||||
entities.account.accountid,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
`,
|
||||||
} else {
|
variables: {
|
||||||
calculationStore.setValue('calcBroker', null);
|
evo_fin_department_accountid: lead.evo_fin_department_accountid,
|
||||||
calculationStore.setOptions('selectCalcBroker', []);
|
},
|
||||||
}
|
}).then(({ accountOptions }) => {
|
||||||
|
if (accountOptions && accountOptions.length > 0) {
|
||||||
if (lead.evo_fin_department_accountid) {
|
calculationStore.setOptions(
|
||||||
CrmService.crmgqlquery({
|
'selectCalcFinDepartment',
|
||||||
query: gql`
|
accountOptions,
|
||||||
query($evo_fin_department_accountid: Uuid!) {
|
);
|
||||||
account(accountid: $evo_fin_department_accountid) {
|
calculationStore.setValue(
|
||||||
accountid
|
'calcFinDepartment',
|
||||||
name
|
accountOptions[0].accountid,
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
`,
|
});
|
||||||
variables: {
|
} else {
|
||||||
evo_fin_department_accountid: lead.evo_fin_department_accountid,
|
calculationStore.setValue('calcFinDepartment', null);
|
||||||
},
|
calculationStore.setOptions('selectCalcFinDepartment', []);
|
||||||
toOptions: ['account'],
|
|
||||||
}).then(({ entities }) => {
|
|
||||||
if (entities.account) {
|
|
||||||
if (!Array.isArray(entities.account)) {
|
|
||||||
calculationStore.setOptions('selectCalcFinDepartment', [
|
|
||||||
entities.account,
|
|
||||||
]);
|
|
||||||
calculationStore.setValue(
|
|
||||||
'calcFinDepartment',
|
|
||||||
entities.account.accountid,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
calculationStore.setValue('calcFinDepartment', null);
|
|
||||||
calculationStore.setOptions('selectCalcFinDepartment', []);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -235,24 +213,20 @@ export default [
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (opportunity.parentaccountid)
|
if (opportunity.parentaccountid)
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMEntities<'account', IAccount, IAccount>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($accountid: Uuid!) {
|
query clientRisk_1($accountid: Uuid!) {
|
||||||
account(accountid: $accountid) {
|
account(accountid: $accountid) {
|
||||||
evo_client_riskid
|
evo_client_riskid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
variables: { accountid: opportunity.parentaccountid },
|
variables: { accountid: opportunity.parentaccountid },
|
||||||
}).then(({ entities }) => {
|
}).then(({ account }) => {
|
||||||
if (
|
if (account?.evo_client_riskid)
|
||||||
entities.account &&
|
|
||||||
!Array.isArray(entities.account) &&
|
|
||||||
entities.account.evo_client_riskid
|
|
||||||
)
|
|
||||||
calculationStore.setValue(
|
calculationStore.setValue(
|
||||||
'clientRisk',
|
'clientRisk',
|
||||||
entities.account.evo_client_riskid,
|
account.evo_client_riskid,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -262,24 +236,20 @@ export default [
|
|||||||
leadid,
|
leadid,
|
||||||
});
|
});
|
||||||
if (lead && lead.customerid) {
|
if (lead && lead.customerid) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMEntities<'account', IAccount, IAccount>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($customerid: Uuid!) {
|
query clientRisk_2($customerid: Uuid!) {
|
||||||
account(accountid: $customerid) {
|
account(accountid: $customerid) {
|
||||||
evo_client_riskid
|
evo_client_riskid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
variables: { customerid: lead.customerid },
|
variables: { customerid: lead.customerid },
|
||||||
}).then(({ entities }) => {
|
}).then(({ account }) => {
|
||||||
if (
|
if (account?.evo_client_riskid)
|
||||||
entities.account &&
|
|
||||||
!Array.isArray(entities.account) &&
|
|
||||||
entities.account.evo_client_riskid
|
|
||||||
)
|
|
||||||
calculationStore.setValue(
|
calculationStore.setValue(
|
||||||
'clientRisk',
|
'clientRisk',
|
||||||
entities.account.evo_client_riskid,
|
account.evo_client_riskid,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -327,14 +297,14 @@ export default [
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (indAgentId && !calculationProcess.hasProcess(Process.LoadKp))
|
if (indAgentId && !calculationProcess.hasProcess(Process.LoadKp))
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'evo_reward_conditions'>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query(
|
query selectIndAgentRewardCondition(
|
||||||
$statecode: Int
|
$statecode: Int
|
||||||
$currentDate: DateTime
|
$currentDate: DateTime
|
||||||
$evo_agent_accountid: Uuid
|
$evo_agent_accountid: Uuid
|
||||||
) {
|
) {
|
||||||
evo_reward_condition: evo_reward_conditions(
|
evo_reward_conditions(
|
||||||
evo_agent_accountid: $evo_agent_accountid
|
evo_agent_accountid: $evo_agent_accountid
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
evo_dateto_param: { gte: $currentDate }
|
evo_dateto_param: { gte: $currentDate }
|
||||||
@ -353,12 +323,11 @@ export default [
|
|||||||
currentDate: currentISODate,
|
currentDate: currentISODate,
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_reward_condition'],
|
}).then(({ evo_reward_conditions }) => {
|
||||||
}).then(({ entities: { evo_reward_condition } }) => {
|
if (evo_reward_conditions)
|
||||||
if (evo_reward_condition && Array.isArray(evo_reward_condition))
|
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions(
|
||||||
'selectIndAgentRewardCondition',
|
'selectIndAgentRewardCondition',
|
||||||
evo_reward_condition,
|
evo_reward_conditions,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -388,14 +357,17 @@ export default [
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (doubleAgentId && !calculationProcess.hasProcess(Process.LoadKp))
|
if (doubleAgentId && !calculationProcess.hasProcess(Process.LoadKp))
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<
|
||||||
|
'evo_reward_conditions',
|
||||||
|
IEvoRewardCondition
|
||||||
|
>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query(
|
query selectCalcDoubleAgentRewardCondition(
|
||||||
$statecode: Int
|
$statecode: Int
|
||||||
$currentDate: DateTime
|
$currentDate: DateTime
|
||||||
$evo_agent_accountid: Uuid
|
$evo_agent_accountid: Uuid
|
||||||
) {
|
) {
|
||||||
evo_reward_condition: evo_reward_conditions(
|
evo_reward_conditions(
|
||||||
evo_agent_accountid: $evo_agent_accountid
|
evo_agent_accountid: $evo_agent_accountid
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
evo_dateto_param: { gte: $currentDate }
|
evo_dateto_param: { gte: $currentDate }
|
||||||
@ -413,12 +385,11 @@ export default [
|
|||||||
currentDate: currentISODate,
|
currentDate: currentISODate,
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_reward_condition'],
|
}).then(({ evo_reward_conditions }) => {
|
||||||
}).then(({ entities: { evo_reward_condition } }) => {
|
if (evo_reward_conditions)
|
||||||
if (evo_reward_condition && Array.isArray(evo_reward_condition))
|
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions(
|
||||||
'selectCalcDoubleAgentRewardCondition',
|
'selectCalcDoubleAgentRewardCondition',
|
||||||
evo_reward_condition,
|
evo_reward_conditions,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -450,14 +421,17 @@ export default [
|
|||||||
ElementStatus.Default,
|
ElementStatus.Default,
|
||||||
);
|
);
|
||||||
if (calcFinDepartmentId)
|
if (calcFinDepartmentId)
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<
|
||||||
|
'evo_reward_conditions',
|
||||||
|
IEvoRewardCondition
|
||||||
|
>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query(
|
query selectFinDepartmentRewardCondtion(
|
||||||
$statecode: Int
|
$statecode: Int
|
||||||
$currentDate: DateTime
|
$currentDate: DateTime
|
||||||
$evo_agent_accountid: Uuid
|
$evo_agent_accountid: Uuid
|
||||||
) {
|
) {
|
||||||
evo_reward_condition: evo_reward_conditions(
|
evo_reward_conditions(
|
||||||
evo_agent_accountid: $evo_agent_accountid
|
evo_agent_accountid: $evo_agent_accountid
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
evo_dateto_param: { gte: $currentDate }
|
evo_dateto_param: { gte: $currentDate }
|
||||||
@ -475,12 +449,11 @@ export default [
|
|||||||
currentDate: currentISODate,
|
currentDate: currentISODate,
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_reward_condition'],
|
}).then(({ evo_reward_conditions }) => {
|
||||||
}).then(({ entities: { evo_reward_condition } }) => {
|
if (evo_reward_conditions)
|
||||||
if (evo_reward_condition && Array.isArray(evo_reward_condition))
|
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions(
|
||||||
'selectFinDepartmentRewardCondtion',
|
'selectFinDepartmentRewardCondtion',
|
||||||
evo_reward_condition,
|
evo_reward_conditions,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -510,14 +483,17 @@ export default [
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (calcBrokerId && !calculationProcess.hasProcess(Process.LoadKp))
|
if (calcBrokerId && !calculationProcess.hasProcess(Process.LoadKp))
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<
|
||||||
|
'evo_reward_conditions',
|
||||||
|
IEvoRewardCondition
|
||||||
|
>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query(
|
query selectCalcBrokerRewardCondition(
|
||||||
$statecode: Int
|
$statecode: Int
|
||||||
$currentDate: DateTime
|
$currentDate: DateTime
|
||||||
$evo_agent_accountid: Uuid
|
$evo_agent_accountid: Uuid
|
||||||
) {
|
) {
|
||||||
evo_reward_condition: evo_reward_conditions(
|
evo_reward_conditions(
|
||||||
evo_agent_accountid: $evo_agent_accountid
|
evo_agent_accountid: $evo_agent_accountid
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
evo_dateto_param: { gte: $currentDate }
|
evo_dateto_param: { gte: $currentDate }
|
||||||
@ -535,12 +511,11 @@ export default [
|
|||||||
currentDate: currentISODate,
|
currentDate: currentISODate,
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_reward_condition'],
|
}).then(({ evo_reward_conditions }) => {
|
||||||
}).then(({ entities: { evo_reward_condition } }) => {
|
if (evo_reward_conditions)
|
||||||
if (evo_reward_condition && Array.isArray(evo_reward_condition))
|
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions(
|
||||||
'selectCalcBrokerRewardCondition',
|
'selectCalcBrokerRewardCondition',
|
||||||
evo_reward_condition,
|
evo_reward_conditions,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -564,10 +539,13 @@ export default [
|
|||||||
accountid: dealerId,
|
accountid: dealerId,
|
||||||
});
|
});
|
||||||
if (dealer) {
|
if (dealer) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'salon_providers', ISalonProvider>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($statecode: Int, $salonaccountid: Uuid!) {
|
query selectDealerPerson(
|
||||||
selectDealerPerson: salon_providers(
|
$statecode: Int
|
||||||
|
$salonaccountid: Uuid!
|
||||||
|
) {
|
||||||
|
salon_providers(
|
||||||
statecode: $statecode
|
statecode: $statecode
|
||||||
salonaccountid: $salonaccountid
|
salonaccountid: $salonaccountid
|
||||||
) {
|
) {
|
||||||
@ -579,23 +557,19 @@ export default [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
toOptions: ['selectDealerPerson'],
|
|
||||||
variables: {
|
variables: {
|
||||||
salonaccountid: dealerId,
|
salonaccountid: dealerId,
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ salon_providers }) => {
|
||||||
// @ts-ignore
|
if (salon_providers && salon_providers.length > 0) {
|
||||||
const dealerPersons = entities.selectDealerPerson;
|
calculationStore.setOptions(
|
||||||
if (
|
'selectDealerPerson',
|
||||||
dealerPersons &&
|
salon_providers,
|
||||||
Array.isArray(dealerPersons) &&
|
);
|
||||||
dealerPersons.length > 0
|
|
||||||
) {
|
|
||||||
calculationStore.setOptions('selectDealerPerson', dealerPersons);
|
|
||||||
calculationStore.setValue(
|
calculationStore.setValue(
|
||||||
'dealerPerson',
|
'dealerPerson',
|
||||||
dealerPersons[0].accountid,
|
salon_providers[0].accountid,
|
||||||
);
|
);
|
||||||
calculationStore.setStatus(
|
calculationStore.setStatus(
|
||||||
'selectDealerPerson',
|
'selectDealerPerson',
|
||||||
@ -633,27 +607,24 @@ export default [
|
|||||||
accountid: dealerPersonId,
|
accountid: dealerPersonId,
|
||||||
});
|
});
|
||||||
if (dealerPerson && dealerPerson.evo_broker_accountid) {
|
if (dealerPerson && dealerPerson.evo_broker_accountid) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($accountid: Uuid!) {
|
query selectDealerBroker($accountid: Uuid!) {
|
||||||
account(accountid: $accountid) {
|
accountOptions: account(accountid: $accountid) {
|
||||||
accountid
|
accountid
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
toOptions: ['account'],
|
|
||||||
variables: {
|
variables: {
|
||||||
accountid: dealerPerson.evo_broker_accountid,
|
accountid: dealerPerson.evo_broker_accountid,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ accountOptions }) => {
|
||||||
if (entities.account && !Array.isArray(entities.account)) {
|
if (accountOptions && accountOptions.length > 0) {
|
||||||
calculationStore.setOptions('selectDealerBroker', [
|
calculationStore.setOptions('selectDealerBroker', accountOptions);
|
||||||
entities.account,
|
|
||||||
]);
|
|
||||||
calculationStore.setValue(
|
calculationStore.setValue(
|
||||||
'dealerBroker',
|
'dealerBroker',
|
||||||
entities.account.accountid,
|
accountOptions[0].accountid,
|
||||||
);
|
);
|
||||||
calculationStore.setStatus(
|
calculationStore.setStatus(
|
||||||
'selectDealerBroker',
|
'selectDealerBroker',
|
||||||
@ -686,14 +657,17 @@ export default [
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!calculationProcess.hasProcess(Process.LoadKp))
|
if (!calculationProcess.hasProcess(Process.LoadKp))
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<
|
||||||
|
'evo_reward_conditions',
|
||||||
|
IEvoRewardCondition
|
||||||
|
>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query(
|
query selectDealerBrokerRewardCondition(
|
||||||
$statecode: Int
|
$statecode: Int
|
||||||
$currentDate: DateTime
|
$currentDate: DateTime
|
||||||
$evo_agent_accountid: Uuid
|
$evo_agent_accountid: Uuid
|
||||||
) {
|
) {
|
||||||
evo_reward_condition: evo_reward_conditions(
|
evo_reward_conditions(
|
||||||
evo_agent_accountid: $evo_agent_accountid
|
evo_agent_accountid: $evo_agent_accountid
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
evo_dateto_param: { gte: $currentDate }
|
evo_dateto_param: { gte: $currentDate }
|
||||||
@ -711,12 +685,11 @@ export default [
|
|||||||
currentDate: currentISODate,
|
currentDate: currentISODate,
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_reward_condition'],
|
}).then(({ evo_reward_conditions }) => {
|
||||||
}).then(({ entities: { evo_reward_condition } }) => {
|
if (evo_reward_conditions)
|
||||||
if (evo_reward_condition && Array.isArray(evo_reward_condition))
|
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions(
|
||||||
'selectDealerBrokerRewardCondition',
|
'selectDealerBrokerRewardCondition',
|
||||||
evo_reward_condition,
|
evo_reward_conditions,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -745,14 +718,17 @@ export default [
|
|||||||
ElementStatus.Default,
|
ElementStatus.Default,
|
||||||
);
|
);
|
||||||
if (!calculationProcess.hasProcess(Process.LoadKp))
|
if (!calculationProcess.hasProcess(Process.LoadKp))
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<
|
||||||
|
'evo_reward_conditions',
|
||||||
|
IEvoRewardCondition
|
||||||
|
>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query(
|
query selectDealerRewardCondition(
|
||||||
$statecode: Int
|
$statecode: Int
|
||||||
$currentDate: DateTime
|
$currentDate: DateTime
|
||||||
$evo_agent_accountid: Uuid
|
$evo_agent_accountid: Uuid
|
||||||
) {
|
) {
|
||||||
evo_reward_condition: evo_reward_conditions(
|
evo_reward_conditions(
|
||||||
evo_agent_accountid: $evo_agent_accountid
|
evo_agent_accountid: $evo_agent_accountid
|
||||||
evo_datefrom_param: { lte: $currentDate }
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
evo_dateto_param: { gte: $currentDate }
|
evo_dateto_param: { gte: $currentDate }
|
||||||
@ -770,12 +746,11 @@ export default [
|
|||||||
currentDate: currentISODate,
|
currentDate: currentISODate,
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_reward_condition'],
|
}).then(({ evo_reward_conditions }) => {
|
||||||
}).then(({ entities: { evo_reward_condition } }) => {
|
if (evo_reward_conditions)
|
||||||
if (evo_reward_condition && Array.isArray(evo_reward_condition))
|
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions(
|
||||||
'selectDealerRewardCondition',
|
'selectDealerRewardCondition',
|
||||||
evo_reward_condition,
|
evo_reward_conditions,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -805,13 +780,10 @@ export default [
|
|||||||
calculationStore.setValue('model', null);
|
calculationStore.setValue('model', null);
|
||||||
|
|
||||||
if (brandId) {
|
if (brandId) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'evo_models', IEvoModel>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($statecode: Int, $evo_brandid: Uuid) {
|
query selectModel($statecode: Int, $evo_brandid: Uuid) {
|
||||||
evo_model: evo_models(
|
evo_models(statecode: $statecode, evo_brandid: $evo_brandid) {
|
||||||
statecode: $statecode
|
|
||||||
evo_brandid: $evo_brandid
|
|
||||||
) {
|
|
||||||
evo_id
|
evo_id
|
||||||
evo_name
|
evo_name
|
||||||
evo_modelid
|
evo_modelid
|
||||||
@ -832,14 +804,9 @@ export default [
|
|||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_brandid: brandId,
|
evo_brandid: brandId,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_model'],
|
}).then(({ evo_models }) => {
|
||||||
}).then(({ entities }) => {
|
if (evo_models) {
|
||||||
if (
|
calculationStore.setOptions('selectModel', evo_models);
|
||||||
entities.evo_model &&
|
|
||||||
Array.isArray(entities.evo_model) &&
|
|
||||||
entities.evo_model.length > 0
|
|
||||||
) {
|
|
||||||
calculationStore.setOptions('selectModel', entities.evo_model);
|
|
||||||
calculationStore.setValue('model', null);
|
calculationStore.setValue('model', null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -866,10 +833,10 @@ export default [
|
|||||||
evo_modelid: modelId,
|
evo_modelid: modelId,
|
||||||
});
|
});
|
||||||
if (model) {
|
if (model) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'evo_equipments', IEvoEquipment>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($statecode: Int, $evo_modelid: Uuid) {
|
query selectConfiguration($statecode: Int, $evo_modelid: Uuid) {
|
||||||
evo_equipment: evo_equipments(
|
evo_equipments(
|
||||||
statecode: $statecode
|
statecode: $statecode
|
||||||
evo_modelid: $evo_modelid
|
evo_modelid: $evo_modelid
|
||||||
) {
|
) {
|
||||||
@ -881,24 +848,19 @@ export default [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
toOptions: ['evo_equipment'],
|
|
||||||
variables: {
|
variables: {
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_modelid: modelId,
|
evo_modelid: modelId,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ evo_equipments }) => {
|
||||||
if (
|
if (evo_equipments) {
|
||||||
entities.evo_equipment &&
|
|
||||||
Array.isArray(entities.evo_equipment) &&
|
|
||||||
entities.evo_equipment.length > 0
|
|
||||||
) {
|
|
||||||
calculationStore.setStatus(
|
calculationStore.setStatus(
|
||||||
'selectConfiguration',
|
'selectConfiguration',
|
||||||
ElementStatus.Default,
|
ElementStatus.Default,
|
||||||
);
|
);
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions(
|
||||||
'selectConfiguration',
|
'selectConfiguration',
|
||||||
entities.evo_equipment,
|
evo_equipments,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -926,24 +888,24 @@ export default [
|
|||||||
accountid: supplierId,
|
accountid: supplierId,
|
||||||
});
|
});
|
||||||
if (supplier && supplier.evo_fin_department_accountid)
|
if (supplier && supplier.evo_fin_department_accountid)
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($accountid: Uuid!) {
|
query selectFinDepartment($accountid: Uuid!) {
|
||||||
account(accountid: $accountid) {
|
accountOptions: account(accountid: $accountid) {
|
||||||
accountid
|
accountid
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
toOptions: ['account'],
|
|
||||||
variables: {
|
variables: {
|
||||||
accountid: supplier.evo_fin_department_accountid,
|
accountid: supplier.evo_fin_department_accountid,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ accountOptions }) => {
|
||||||
if (entities.account && !Array.isArray(entities.account)) {
|
if (accountOptions) {
|
||||||
calculationStore.setOptions('selectFinDepartment', [
|
calculationStore.setOptions(
|
||||||
entities.account,
|
'selectFinDepartment',
|
||||||
]);
|
accountOptions,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -962,14 +924,14 @@ export default [
|
|||||||
calculationStore.setOptions('selectAgent', []);
|
calculationStore.setOptions('selectAgent', []);
|
||||||
calculationStore.setValue('agent', null);
|
calculationStore.setValue('agent', null);
|
||||||
if (channelId === 100000002) {
|
if (channelId === 100000002) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query(
|
query selectAgent_1(
|
||||||
$statecode: Int
|
$statecode: Int
|
||||||
$evo_account_type: [Int!]
|
$evo_account_type: [Int!]
|
||||||
$evo_legal_form: Int
|
$evo_legal_form: Int
|
||||||
) {
|
) {
|
||||||
account: accounts(
|
accountOptions: accounts(
|
||||||
statecode: $statecode
|
statecode: $statecode
|
||||||
evo_account_type: $evo_account_type
|
evo_account_type: $evo_account_type
|
||||||
evo_legal_form: $evo_legal_form
|
evo_legal_form: $evo_legal_form
|
||||||
@ -979,22 +941,21 @@ export default [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
toOptions: ['account'],
|
|
||||||
variables: {
|
variables: {
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_account_type: [100000005],
|
evo_account_type: [100000005],
|
||||||
evo_legal_form: 100000004,
|
evo_legal_form: 100000004,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ accountOptions }) => {
|
||||||
if (entities.account && Array.isArray(entities.account)) {
|
if (accountOptions) {
|
||||||
calculationStore.setOptions('selectAgent', entities.account);
|
calculationStore.setOptions('selectAgent', accountOptions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (supplierId) {
|
if (supplierId) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'accountOptions', IAccount>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($statecode: Int, $salonaccountid: Uuid!) {
|
query selectAgent_2($statecode: Int, $salonaccountid: Uuid!) {
|
||||||
account: salon_agents(
|
account: salon_agents(
|
||||||
statecode: $statecode
|
statecode: $statecode
|
||||||
salonaccountid: $salonaccountid
|
salonaccountid: $salonaccountid
|
||||||
@ -1004,14 +965,13 @@ export default [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
toOptions: ['account'],
|
|
||||||
variables: {
|
variables: {
|
||||||
statecode: 0,
|
statecode: 0,
|
||||||
salonaccountid: supplierId,
|
salonaccountid: supplierId,
|
||||||
},
|
},
|
||||||
}).then(({ entities }) => {
|
}).then(({ accountOptions }) => {
|
||||||
if (entities.account && Array.isArray(entities.account)) {
|
if (accountOptions) {
|
||||||
calculationStore.setOptions('selectAgent', entities.account);
|
calculationStore.setOptions('selectAgent', accountOptions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1037,10 +997,10 @@ export default [
|
|||||||
evo_gps_brandid: GPSBrandId,
|
evo_gps_brandid: GPSBrandId,
|
||||||
});
|
});
|
||||||
if (gpsBrand) {
|
if (gpsBrand) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'evo_gps_models', IEvoGPSModel>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($statecode: Int, $evo_gps_brandid: Uuid) {
|
query selectGPSModel($statecode: Int, $evo_gps_brandid: Uuid) {
|
||||||
evo_gps_model: evo_gps_models(
|
evo_gps_models(
|
||||||
statecode: $statecode
|
statecode: $statecode
|
||||||
evo_gps_brandid: $evo_gps_brandid
|
evo_gps_brandid: $evo_gps_brandid
|
||||||
) {
|
) {
|
||||||
@ -1054,21 +1014,13 @@ export default [
|
|||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_gps_brandid: GPSBrandId,
|
evo_gps_brandid: GPSBrandId,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_gps_model'],
|
}).then(({ evo_gps_models }) => {
|
||||||
}).then(({ entities }) => {
|
if (evo_gps_models) {
|
||||||
if (
|
|
||||||
entities.evo_gps_model &&
|
|
||||||
Array.isArray(entities.evo_gps_model) &&
|
|
||||||
entities.evo_gps_model.length > 0
|
|
||||||
) {
|
|
||||||
calculationStore.setStatus(
|
calculationStore.setStatus(
|
||||||
'selectGPSModel',
|
'selectGPSModel',
|
||||||
ElementStatus.Default,
|
ElementStatus.Default,
|
||||||
);
|
);
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions('selectGPSModel', evo_gps_models);
|
||||||
'selectGPSModel',
|
|
||||||
entities.evo_gps_model,
|
|
||||||
);
|
|
||||||
calculationStore.setValue('GPSModel', null);
|
calculationStore.setValue('GPSModel', null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1101,13 +1053,13 @@ export default [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (regionRegistration) {
|
if (regionRegistration) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'evo_towns', IEvoTown>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($statecode: Int, $evo_regionid: Uuid) {
|
query selectTownRegistration(
|
||||||
evo_town: evo_towns(
|
$statecode: Int
|
||||||
statecode: $statecode
|
$evo_regionid: Uuid
|
||||||
evo_regionid: $evo_regionid
|
) {
|
||||||
) {
|
evo_towns(statecode: $statecode, evo_regionid: $evo_regionid) {
|
||||||
evo_name
|
evo_name
|
||||||
evo_townid
|
evo_townid
|
||||||
evo_fias_id
|
evo_fias_id
|
||||||
@ -1120,21 +1072,13 @@ export default [
|
|||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_regionid: regionRegistrationId,
|
evo_regionid: regionRegistrationId,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_town'],
|
}).then(({ evo_towns }) => {
|
||||||
}).then(({ entities }) => {
|
if (evo_towns) {
|
||||||
if (
|
|
||||||
entities.evo_town &&
|
|
||||||
Array.isArray(entities.evo_town) &&
|
|
||||||
entities.evo_town.length > 0
|
|
||||||
) {
|
|
||||||
// calculationStore.setStatus(
|
// calculationStore.setStatus(
|
||||||
// 'selectTownRegistration',
|
// 'selectTownRegistration',
|
||||||
// ElementStatus.Default,
|
// ElementStatus.Default,
|
||||||
// );
|
// );
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions('selectTownRegistration', evo_towns);
|
||||||
'selectTownRegistration',
|
|
||||||
entities.evo_town,
|
|
||||||
);
|
|
||||||
// calculationStore.setValue('townRegistration', null);
|
// calculationStore.setValue('townRegistration', null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1167,13 +1111,13 @@ export default [
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (regionRegistration) {
|
if (regionRegistration) {
|
||||||
CrmService.crmgqlquery({
|
CrmService.getCRMOptions<'evo_towns', IEvoTown>({
|
||||||
query: gql`
|
query: gql`
|
||||||
query($statecode: Int, $evo_regionid: Uuid) {
|
query selectLegalClientTown(
|
||||||
evo_town: evo_towns(
|
$statecode: Int
|
||||||
statecode: $statecode
|
$evo_regionid: Uuid
|
||||||
evo_regionid: $evo_regionid
|
) {
|
||||||
) {
|
evo_towns(statecode: $statecode, evo_regionid: $evo_regionid) {
|
||||||
evo_name
|
evo_name
|
||||||
evo_townid
|
evo_townid
|
||||||
evo_fias_id
|
evo_fias_id
|
||||||
@ -1185,21 +1129,13 @@ export default [
|
|||||||
statecode: 0,
|
statecode: 0,
|
||||||
evo_regionid: legalClientRegionId,
|
evo_regionid: legalClientRegionId,
|
||||||
},
|
},
|
||||||
toOptions: ['evo_town'],
|
}).then(({ evo_towns }) => {
|
||||||
}).then(({ entities }) => {
|
if (evo_towns) {
|
||||||
if (
|
|
||||||
entities.evo_town &&
|
|
||||||
Array.isArray(entities.evo_town) &&
|
|
||||||
entities.evo_town.length > 0
|
|
||||||
) {
|
|
||||||
// calculationStore.setStatus(
|
// calculationStore.setStatus(
|
||||||
// 'selectLegalClientTown',
|
// 'selectLegalClientTown',
|
||||||
// ElementStatus.Default,
|
// ElementStatus.Default,
|
||||||
// );
|
// );
|
||||||
calculationStore.setOptions(
|
calculationStore.setOptions('selectLegalClientTown', evo_towns);
|
||||||
'selectLegalClientTown',
|
|
||||||
entities.evo_town,
|
|
||||||
);
|
|
||||||
// calculationStore.setValue('legalClientTown', null);
|
// calculationStore.setValue('legalClientTown', null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
import { IBaseOption } from 'core/services/CrmService/types/common';
|
||||||
import { TElements } from 'core/types/Calculation/Store/elements';
|
import { TElements } from 'core/types/Calculation/Store/elements';
|
||||||
import { IBaseOption } from 'core/types/Calculation/Store/options';
|
|
||||||
import { orderBy } from 'lodash';
|
import { orderBy } from 'lodash';
|
||||||
|
|
||||||
const initialOptions: TElements<IBaseOption[]> = {
|
const initialOptions: TElements<IBaseOption[]> = {
|
||||||
|
|||||||
@ -8,12 +8,13 @@ import autorunEffects from './Effects/autorun';
|
|||||||
import computedEffects from './Effects/computed';
|
import computedEffects from './Effects/computed';
|
||||||
import reactionEffects from './Effects/reactions';
|
import reactionEffects from './Effects/reactions';
|
||||||
import whenEffects from './Effects/when';
|
import whenEffects from './Effects/when';
|
||||||
|
import init from './init';
|
||||||
import subStores from './subStores';
|
import subStores from './subStores';
|
||||||
|
|
||||||
const { calculationProcess } = subStores;
|
const { calculationProcess } = subStores;
|
||||||
|
|
||||||
const CalculationStore: ICalculationStore = makeAutoObservable(
|
const CalculationStore: ICalculationStore = makeAutoObservable(
|
||||||
Object.assign({}, staticData, values, tables, computedEffects, {
|
Object.assign({ init }, staticData, values, tables, computedEffects, {
|
||||||
stores: subStores,
|
stores: subStores,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
54
src/client/stores/CalculationStore/init/index.ts
Normal file
54
src/client/stores/CalculationStore/init/index.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import { ICalculationStore } from 'core/types/Calculation/Store';
|
||||||
|
import { Process } from 'core/types/Calculation/Store/process';
|
||||||
|
import initialOptions from '../config/initialOptions';
|
||||||
|
import initialValues from '../config/initialValues';
|
||||||
|
import { composeRequests } from './requests';
|
||||||
|
|
||||||
|
export default async function (this: ICalculationStore) {
|
||||||
|
const { calculationProcess } = this.stores;
|
||||||
|
calculationProcess.addProcess(Process.Init);
|
||||||
|
|
||||||
|
const {
|
||||||
|
ownerOptionsRequest,
|
||||||
|
mainOptionsRequest,
|
||||||
|
staticDataRequest,
|
||||||
|
systemUserRequest,
|
||||||
|
insuranceRequest,
|
||||||
|
} = composeRequests();
|
||||||
|
|
||||||
|
const ownerOptions = await ownerOptionsRequest;
|
||||||
|
const mainOptions = await mainOptionsRequest;
|
||||||
|
this.applyOptions(Object.assign(initialOptions, ownerOptions, mainOptions));
|
||||||
|
|
||||||
|
const systemuser = await systemUserRequest;
|
||||||
|
const staticEntities = await staticDataRequest;
|
||||||
|
this.applyStaticData(Object.assign({ systemuser }, staticEntities));
|
||||||
|
|
||||||
|
const insuranceData = await insuranceRequest;
|
||||||
|
this.setTableColumns('tableInsurance')({
|
||||||
|
options: insuranceData,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.setValues(initialValues, true);
|
||||||
|
|
||||||
|
const supplierCurrency = this.options.selectSupplierCurrency?.find(
|
||||||
|
x => x.isocurrencycode === 'RUB',
|
||||||
|
);
|
||||||
|
this.setValue('supplierCurrency', supplierCurrency?.transactioncurrencyid);
|
||||||
|
|
||||||
|
const evo_sot_coefficient_type = staticEntities?.evo_sot_coefficient_type?.find(
|
||||||
|
x => x.evo_id === 'BONUS_LEASING',
|
||||||
|
);
|
||||||
|
|
||||||
|
const evo_coefficient_bonus = staticEntities?.evo_coefficient?.find(
|
||||||
|
x =>
|
||||||
|
x.evo_job_titleid === systemuser[0]?.evo_job_titleid &&
|
||||||
|
x.evo_sot_coefficient_typeid ===
|
||||||
|
evo_sot_coefficient_type?.evo_sot_coefficient_typeid,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (evo_coefficient_bonus?.evo_sot_coefficient)
|
||||||
|
this.setValue('saleBonus', evo_coefficient_bonus.evo_sot_coefficient * 100);
|
||||||
|
|
||||||
|
calculationProcess.deleteProcess(Process.Init);
|
||||||
|
}
|
||||||
77
src/client/stores/CalculationStore/init/requests.ts
Normal file
77
src/client/stores/CalculationStore/init/requests.ts
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import UserStore from 'client/stores/UserStore';
|
||||||
|
import {
|
||||||
|
getInsuranceOptionsQuery,
|
||||||
|
getMainOptionsQuery,
|
||||||
|
getOwnerOptionsQuery,
|
||||||
|
} from 'core/graphql/query/crm/options';
|
||||||
|
import {
|
||||||
|
getStaticDataQuery,
|
||||||
|
getSystemUserQuery,
|
||||||
|
} from 'core/graphql/query/crm/staticData';
|
||||||
|
import CrmService from 'core/services/CrmService';
|
||||||
|
import { ElementsNames } from 'core/types/Calculation/Store/elements';
|
||||||
|
import { TableValuesNames } from 'core/types/Calculation/Store/tables';
|
||||||
|
import {
|
||||||
|
IAccount,
|
||||||
|
ILead,
|
||||||
|
IOpportunity,
|
||||||
|
ISystemUser,
|
||||||
|
TCRMEntity,
|
||||||
|
} from 'core/types/Entities/crmEntities';
|
||||||
|
import { CRMEntityNames } from 'core/types/Entities/crmEntityNames';
|
||||||
|
import {
|
||||||
|
insuranceVariables,
|
||||||
|
mainOptionsVariables,
|
||||||
|
staticDataVariables,
|
||||||
|
} from './variables';
|
||||||
|
|
||||||
|
export function composeRequests() {
|
||||||
|
const mainOptionsRequest = CrmService.getCRMOptions<ElementsNames>({
|
||||||
|
query: getMainOptionsQuery,
|
||||||
|
variables: mainOptionsVariables,
|
||||||
|
});
|
||||||
|
|
||||||
|
const staticDataRequest = CrmService.getCRMEntities<
|
||||||
|
CRMEntityNames,
|
||||||
|
TCRMEntity[]
|
||||||
|
>({
|
||||||
|
query: getStaticDataQuery,
|
||||||
|
variables: staticDataVariables,
|
||||||
|
});
|
||||||
|
|
||||||
|
const domainname = UserStore.getDomainName();
|
||||||
|
|
||||||
|
const systemUserRequest = CrmService.getCRMEntities<
|
||||||
|
CRMEntityNames,
|
||||||
|
ISystemUser
|
||||||
|
>({
|
||||||
|
query: getSystemUserQuery,
|
||||||
|
variables: { domainname },
|
||||||
|
});
|
||||||
|
|
||||||
|
const ownerOptionsRequest = CrmService.getCRMOptions<
|
||||||
|
ElementsNames,
|
||||||
|
ILead & IOpportunity
|
||||||
|
>({
|
||||||
|
query: getOwnerOptionsQuery,
|
||||||
|
variables: {
|
||||||
|
statecode: 0,
|
||||||
|
domainname,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const insuranceRequest = CrmService.getCRMOptions<TableValuesNames, IAccount>(
|
||||||
|
{
|
||||||
|
query: getInsuranceOptionsQuery,
|
||||||
|
variables: insuranceVariables,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
mainOptionsRequest,
|
||||||
|
staticDataRequest,
|
||||||
|
systemUserRequest,
|
||||||
|
insuranceRequest,
|
||||||
|
ownerOptionsRequest,
|
||||||
|
};
|
||||||
|
}
|
||||||
31
src/client/stores/CalculationStore/init/variables.ts
Normal file
31
src/client/stores/CalculationStore/init/variables.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { OperationVariables } from '@apollo/client';
|
||||||
|
import { GQLVariables } from 'core/services/CrmService/types/request';
|
||||||
|
import { currentISODate } from 'core/tools/date';
|
||||||
|
import { IAccount, TCRMEntity } from 'core/types/Entities/crmEntities';
|
||||||
|
|
||||||
|
export const mainOptionsVariables: OperationVariables = {
|
||||||
|
currentDate: currentISODate,
|
||||||
|
statecode: 0,
|
||||||
|
supplier_account_type: [100000001],
|
||||||
|
supplier_legal_form: 100000001,
|
||||||
|
dealer_account_type: [100000001],
|
||||||
|
dealer_legal_form: 100000001,
|
||||||
|
account_account_type: [100000000],
|
||||||
|
product_relation: [100000000],
|
||||||
|
registration_product_type: 100000001,
|
||||||
|
nsib_product_type: 100000002,
|
||||||
|
tracker_product_type: 100000003,
|
||||||
|
telematic_product_type: 100000004,
|
||||||
|
techcard_product_type: 100000000,
|
||||||
|
fuelcard_product_type: 100000005,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const insuranceVariables: GQLVariables<IAccount> = {
|
||||||
|
evo_account_type: [100000002],
|
||||||
|
statecode: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const staticDataVariables: GQLVariables<keyof TCRMEntity> = {
|
||||||
|
statecode: 0,
|
||||||
|
currentDate: currentISODate,
|
||||||
|
};
|
||||||
@ -1,11 +1,23 @@
|
|||||||
|
import UserService from 'core/services/UserService';
|
||||||
import { makeAutoObservable } from 'mobx';
|
import { makeAutoObservable } from 'mobx';
|
||||||
|
import { __getUserFromLocalStorage } from './lib/user';
|
||||||
|
|
||||||
const UserStore = makeAutoObservable({
|
const UserStore = makeAutoObservable({
|
||||||
|
async init() {
|
||||||
|
let user;
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
user = __getUserFromLocalStorage();
|
||||||
|
} else {
|
||||||
|
user = await UserService.fetchUser();
|
||||||
|
}
|
||||||
|
this.setUser(user);
|
||||||
|
},
|
||||||
user: undefined,
|
user: undefined,
|
||||||
setUser(user) {
|
setUser(user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
},
|
},
|
||||||
getDomainName() {
|
getDomainName() {
|
||||||
|
if (!this.user) return '';
|
||||||
const { username, domain } = this.user;
|
const { username, domain } = this.user;
|
||||||
return `${domain}\\${username}`;
|
return `${domain}\\${username}`;
|
||||||
},
|
},
|
||||||
|
|||||||
12
src/client/stores/UserStore/lib/user.js
Normal file
12
src/client/stores/UserStore/lib/user.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export function __getUserFromLocalStorage() {
|
||||||
|
const user = ['username', 'domain'].reduce((acc, propName) => {
|
||||||
|
let prop = localStorage.getItem(propName);
|
||||||
|
if (!prop) {
|
||||||
|
prop = prompt('Enter ' + propName);
|
||||||
|
localStorage.setItem(propName, prop);
|
||||||
|
}
|
||||||
|
acc[propName] = prop;
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
return user;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
fragment evo_addproduct_types_fields on evo_addproduct_type {
|
||||||
|
evo_id
|
||||||
|
evo_name
|
||||||
|
evo_addproduct_typeid
|
||||||
|
evo_product_type
|
||||||
|
evo_accountid
|
||||||
|
evo_graph_price_withoutnds
|
||||||
|
evo_cost_service_provider_withoutnds
|
||||||
|
evo_retro_bonus_withoutnds
|
||||||
|
evo_prime_cost
|
||||||
|
evo_graph_price
|
||||||
|
evo_max_period
|
||||||
|
evo_min_period
|
||||||
|
evo_controls_program
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fragment evo_region_fields on evo_region {
|
||||||
|
evo_name
|
||||||
|
evo_regionid
|
||||||
|
evo_fias_id
|
||||||
|
evo_businessunit_evolution
|
||||||
|
evo_oktmo
|
||||||
|
evo_kladr_id
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
query GetInsuranceOptions($evo_account_type: [Int!], $statecode: Int) {
|
||||||
|
insuranceCompany: accounts(
|
||||||
|
evo_account_type: $evo_account_type
|
||||||
|
statecode: $statecode
|
||||||
|
) {
|
||||||
|
accountid
|
||||||
|
name
|
||||||
|
evo_type_ins_policy
|
||||||
|
evo_id_elt
|
||||||
|
evo_id_elt_smr
|
||||||
|
evo_id_elt_osago
|
||||||
|
evo_legal_region_calc
|
||||||
|
}
|
||||||
|
}
|
||||||
265
src/core/graphql/query/crm/options/getMainOptions.graphql
Normal file
265
src/core/graphql/query/crm/options/getMainOptions.graphql
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
#import '../fragments/evo_regions_fields.graphql'
|
||||||
|
#import '../fragments/evo_addproduct_types_fields.graphql'
|
||||||
|
|
||||||
|
query GetMainOptions(
|
||||||
|
$statecode: Int
|
||||||
|
$currentDate: DateTime
|
||||||
|
$supplier_account_type: [Int!]
|
||||||
|
$supplier_legal_form: Int
|
||||||
|
$dealer_account_type: [Int!]
|
||||||
|
$dealer_legal_form: Int
|
||||||
|
$account_account_type: [Int!]
|
||||||
|
$product_relation: [Int!]
|
||||||
|
$registration_product_type: Int
|
||||||
|
$nsib_product_type: Int
|
||||||
|
$tracker_product_type: Int
|
||||||
|
$telematic_product_type: Int
|
||||||
|
$fuelcard_product_type: Int
|
||||||
|
$techcard_product_type: Int
|
||||||
|
) {
|
||||||
|
selectSupplier: accounts(
|
||||||
|
evo_account_type: $supplier_account_type
|
||||||
|
statecode: $statecode
|
||||||
|
evo_legal_form: $supplier_legal_form
|
||||||
|
) {
|
||||||
|
name
|
||||||
|
accountid
|
||||||
|
evo_fin_department_accountid
|
||||||
|
}
|
||||||
|
selectSupplierCurrency: transactioncurrencies(statecode: $statecode) {
|
||||||
|
transactioncurrencyid
|
||||||
|
isocurrencycode
|
||||||
|
}
|
||||||
|
selectClientRisk: evo_client_risks(statecode: $statecode) {
|
||||||
|
evo_name
|
||||||
|
evo_client_riskid
|
||||||
|
evo_id
|
||||||
|
}
|
||||||
|
selectClientType: evo_client_types(statecode: $statecode) {
|
||||||
|
evo_name
|
||||||
|
evo_client_typeid
|
||||||
|
}
|
||||||
|
selectDealer: accounts(
|
||||||
|
evo_account_type: $dealer_account_type
|
||||||
|
statecode: $statecode
|
||||||
|
evo_legal_form: $dealer_legal_form
|
||||||
|
) {
|
||||||
|
name
|
||||||
|
accountid
|
||||||
|
}
|
||||||
|
selectGPSBrand: evo_gps_brands(statecode: $statecode) {
|
||||||
|
evo_name
|
||||||
|
evo_gps_brandid
|
||||||
|
}
|
||||||
|
selectRegionRegistration: evo_regions(statecode: $statecode) {
|
||||||
|
...evo_region_fields
|
||||||
|
}
|
||||||
|
selectLegalClientRegion: evo_regions(statecode: $statecode) {
|
||||||
|
...evo_region_fields
|
||||||
|
}
|
||||||
|
selectAccount: accounts(
|
||||||
|
evo_account_type: $account_account_type
|
||||||
|
statecode: $statecode
|
||||||
|
) {
|
||||||
|
name
|
||||||
|
accountid
|
||||||
|
evo_client_riskid
|
||||||
|
}
|
||||||
|
selectBrand: evo_brands(statecode: $statecode) {
|
||||||
|
evo_id
|
||||||
|
evo_name
|
||||||
|
evo_brandid
|
||||||
|
evo_brand_owner
|
||||||
|
evo_importer_reward_perc
|
||||||
|
evo_importer_reward_rub
|
||||||
|
evo_vehicle_type
|
||||||
|
}
|
||||||
|
selectProduct: evo_baseproducts(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_relation: $product_relation
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
evo_name
|
||||||
|
evo_baseproductid
|
||||||
|
evo_id
|
||||||
|
evo_leasingobject_types {
|
||||||
|
evo_name
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
evo_id
|
||||||
|
}
|
||||||
|
evo_brands {
|
||||||
|
evo_name
|
||||||
|
evo_brandid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectRegistration: evo_addproduct_types(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_product_type: $registration_product_type
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
...evo_addproduct_types_fields
|
||||||
|
evo_towtruck
|
||||||
|
evo_pts_type
|
||||||
|
evo_description
|
||||||
|
evo_gibdd_region
|
||||||
|
evo_whom_register
|
||||||
|
}
|
||||||
|
selectInsNSIB: evo_addproduct_types(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_product_type: $nsib_product_type
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
...evo_addproduct_types_fields
|
||||||
|
}
|
||||||
|
selectTracker: evo_addproduct_types(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_product_type: $tracker_product_type
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
...evo_addproduct_types_fields
|
||||||
|
evo_planpayments {
|
||||||
|
evo_name
|
||||||
|
evo_cost_equipment_withoutnds
|
||||||
|
evo_cost_price_telematics_withoutnds
|
||||||
|
evo_cost_telematics_withoutnds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectTelematic: evo_addproduct_types(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_product_type: $telematic_product_type
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
...evo_addproduct_types_fields
|
||||||
|
evo_planpayments {
|
||||||
|
evo_name
|
||||||
|
evo_cost_equipment_withoutnds
|
||||||
|
evo_cost_price_telematics_withoutnds
|
||||||
|
evo_cost_telematics_withoutnds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectTechnicalCard: evo_addproduct_types(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_product_type: $techcard_product_type
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
...evo_addproduct_types_fields
|
||||||
|
evo_helpcard_type
|
||||||
|
evo_leasingobject_types {
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectTarif: evo_tarifs(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
evo_name
|
||||||
|
evo_tarifid
|
||||||
|
evo_baseproductid
|
||||||
|
evo_irr
|
||||||
|
evo_max_irr
|
||||||
|
evo_min_profit
|
||||||
|
evo_min_irr
|
||||||
|
evo_irr_plan
|
||||||
|
evo_ins_type
|
||||||
|
evo_min_period
|
||||||
|
evo_max_period
|
||||||
|
evo_client_risks {
|
||||||
|
evo_name
|
||||||
|
evo_client_riskid
|
||||||
|
}
|
||||||
|
evo_client_types {
|
||||||
|
evo_name
|
||||||
|
evo_client_typeid
|
||||||
|
}
|
||||||
|
evo_leasingobject_types {
|
||||||
|
evo_name
|
||||||
|
evo_id
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
}
|
||||||
|
evo_delivery_time
|
||||||
|
}
|
||||||
|
selectRate: evo_rates(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
createdon
|
||||||
|
evo_id
|
||||||
|
evo_rateid
|
||||||
|
evo_name
|
||||||
|
evo_base_rate
|
||||||
|
evo_coeff_12_23
|
||||||
|
evo_coeff_24_35
|
||||||
|
evo_coeff_36_47
|
||||||
|
evo_coeff_7_11
|
||||||
|
evo_coeff_48_60
|
||||||
|
evo_tarifs {
|
||||||
|
evo_tarifid
|
||||||
|
evo_name
|
||||||
|
}
|
||||||
|
evo_credit_period
|
||||||
|
}
|
||||||
|
selectLeaseObjectType: evo_leasingobject_types(statecode: $statecode) {
|
||||||
|
evo_name
|
||||||
|
evo_id
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
evo_depreciation_rate1
|
||||||
|
evo_depreciation_rate2
|
||||||
|
evo_expluatation_period1
|
||||||
|
evo_expluatation_period2
|
||||||
|
evo_type_code
|
||||||
|
evo_category
|
||||||
|
evo_category_tr
|
||||||
|
evo_vehicle_type_tax
|
||||||
|
evo_vehicle_type
|
||||||
|
}
|
||||||
|
selectObjectRegionRegistration: evo_regions(statecode: $statecode) {
|
||||||
|
...evo_region_fields
|
||||||
|
accounts {
|
||||||
|
accountid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectSubsidy: evo_subsidies(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
evo_name
|
||||||
|
evo_subsidyid
|
||||||
|
evo_percent_subsidy
|
||||||
|
evo_subsidy_summ
|
||||||
|
evo_max_subsidy_summ
|
||||||
|
evo_get_subsidy_payment
|
||||||
|
evo_brands {
|
||||||
|
evo_brandid
|
||||||
|
}
|
||||||
|
evo_models {
|
||||||
|
evo_modelid
|
||||||
|
}
|
||||||
|
evo_leasingobject_types {
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
}
|
||||||
|
accounts {
|
||||||
|
accountid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectFuelCard: evo_addproduct_types(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_product_type: $fuelcard_product_type
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
...evo_addproduct_types_fields
|
||||||
|
evo_helpcard_type
|
||||||
|
evo_leasingobject_types {
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/core/graphql/query/crm/options/getOwnerOptions.graphql
Normal file
39
src/core/graphql/query/crm/options/getOwnerOptions.graphql
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
query GetOwnerOptions($statecode: Int, $domainname: String) {
|
||||||
|
selectLead: leads(statecode: $statecode, owner_domainname: $domainname) {
|
||||||
|
customerid
|
||||||
|
leadid
|
||||||
|
fullname
|
||||||
|
evo_opportunityid
|
||||||
|
evo_agent_accountid
|
||||||
|
evo_double_agent_accountid
|
||||||
|
evo_broker_accountid
|
||||||
|
evo_fin_department_accountid
|
||||||
|
accountidData {
|
||||||
|
evo_address_legalidData {
|
||||||
|
evo_region_fias_id
|
||||||
|
evo_city_fias_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evo_inn
|
||||||
|
link
|
||||||
|
}
|
||||||
|
selectOpportunity: opportunities(
|
||||||
|
statecode: $statecode
|
||||||
|
owner_domainname: $domainname
|
||||||
|
) {
|
||||||
|
opportunityid
|
||||||
|
name
|
||||||
|
accountid
|
||||||
|
evo_leadid
|
||||||
|
evo_client_riskid
|
||||||
|
parentaccountid
|
||||||
|
evo_programsolution
|
||||||
|
accountidData {
|
||||||
|
evo_address_legalidData {
|
||||||
|
evo_region_fias_id
|
||||||
|
evo_city_fias_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
link
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/core/graphql/query/crm/options/index.js
Normal file
5
src/core/graphql/query/crm/options/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { loader } from 'graphql.macro';
|
||||||
|
|
||||||
|
export const getMainOptionsQuery = loader('./getMainOptions.graphql');
|
||||||
|
export const getOwnerOptionsQuery = loader('./getOwnerOptions.graphql');
|
||||||
|
export const getInsuranceOptionsQuery = loader('./getInsuranceOptions.graphql');
|
||||||
126
src/core/graphql/query/crm/quote/fragments/quoteFields.graphql
Normal file
126
src/core/graphql/query/crm/quote/fragments/quoteFields.graphql
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
#import './quoteFieldsLite.graphql'
|
||||||
|
|
||||||
|
fragment quoteFields on quote {
|
||||||
|
...quoteFieldsLite
|
||||||
|
|
||||||
|
evo_addproduct_types {
|
||||||
|
evo_product_type
|
||||||
|
evo_addproduct_typeid
|
||||||
|
}
|
||||||
|
|
||||||
|
evo_insurance_type
|
||||||
|
evo_kasko_price_leasperiod
|
||||||
|
evo_insurance_decentral
|
||||||
|
evo_insurance_period
|
||||||
|
evo_osago_accountid
|
||||||
|
evo_kasko_accountid
|
||||||
|
evo_osago_payer
|
||||||
|
evo_kasko_payer
|
||||||
|
evo_osago_price
|
||||||
|
evo_kasko_price
|
||||||
|
evo_dgo_price
|
||||||
|
evo_ns_price
|
||||||
|
evo_graphs {
|
||||||
|
createdon
|
||||||
|
evo_sumpay_withnds
|
||||||
|
evo_planpayments {
|
||||||
|
evo_payment_ratio
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evo_first_payment_perc
|
||||||
|
evo_rateid
|
||||||
|
evo_client_riskid
|
||||||
|
evo_townid
|
||||||
|
evo_registration_regionid
|
||||||
|
evo_vehicle_tax_approved
|
||||||
|
evo_vehicle_tax_year
|
||||||
|
evo_category_tr
|
||||||
|
evo_vehicle_type_tax
|
||||||
|
|
||||||
|
evo_agent_accountid
|
||||||
|
evo_dealer_person_accountid
|
||||||
|
evo_dealer_broker_accountid
|
||||||
|
evo_double_agent_accountid
|
||||||
|
evo_dealer_reward_conditionid
|
||||||
|
evo_dealer_reward_total
|
||||||
|
evo_dealer_broker_reward_conditionid
|
||||||
|
evo_dealer_broker_reward_total
|
||||||
|
evo_agent_reward_conditionid
|
||||||
|
evo_agent_reward_total
|
||||||
|
evo_double_agent_reward_conditionid
|
||||||
|
evo_double_agent_reward_total
|
||||||
|
evo_broker_reward_conditionid
|
||||||
|
evo_broker_reward_total
|
||||||
|
evo_fin_department_reward_conditionid
|
||||||
|
evo_fin_department_reward_total
|
||||||
|
evo_broker_accountid
|
||||||
|
evo_fin_department_accountid
|
||||||
|
|
||||||
|
evo_kasko_accountid
|
||||||
|
evo_kasko_price
|
||||||
|
evo_id_elt_kasko
|
||||||
|
evo_id_kasko_calc
|
||||||
|
evo_id_elt_osago
|
||||||
|
evo_osago_price
|
||||||
|
evo_accept_control_addproduct_typeid
|
||||||
|
evo_payment_redemption_sum
|
||||||
|
|
||||||
|
evo_baseproductid
|
||||||
|
evo_client_typeid
|
||||||
|
evo_supplier_currency_price
|
||||||
|
evo_transactioncurrencyid
|
||||||
|
evo_discount_supplier_currency
|
||||||
|
evo_discount_perc
|
||||||
|
evo_last_payment_calc
|
||||||
|
evo_last_payment_rub
|
||||||
|
evo_balance_holder
|
||||||
|
evo_graph_type
|
||||||
|
evo_payments_decrease_perc
|
||||||
|
evo_seasons_type
|
||||||
|
evo_high_season
|
||||||
|
evo_comission_perc
|
||||||
|
evo_comission_rub
|
||||||
|
evo_sale_bonus
|
||||||
|
evo_period
|
||||||
|
evo_tarifid
|
||||||
|
evo_msfo_irr
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
evo_delivery_time
|
||||||
|
evo_brandid
|
||||||
|
evo_modelid
|
||||||
|
evo_equipmentid
|
||||||
|
evo_engine_type
|
||||||
|
evo_power
|
||||||
|
evo_engine_volume
|
||||||
|
evo_use_for
|
||||||
|
evo_trailer
|
||||||
|
evo_leasingobject_used
|
||||||
|
evo_max_speed
|
||||||
|
evo_supplier_accountid
|
||||||
|
|
||||||
|
evo_gps_brandid
|
||||||
|
evo_gps_modelid
|
||||||
|
evo_ins_legal_form
|
||||||
|
evo_franchise
|
||||||
|
evo_unlimit_drivers
|
||||||
|
evo_age_drivers
|
||||||
|
evo_exp_drivers
|
||||||
|
evo_last_payment_redemption
|
||||||
|
evo_price_with_discount
|
||||||
|
evo_cost_increace
|
||||||
|
evo_insurance
|
||||||
|
evo_registration_quote
|
||||||
|
evo_card_quote
|
||||||
|
evo_nsib_quote
|
||||||
|
evo_contact_name
|
||||||
|
evo_gender
|
||||||
|
evo_redemption_graph
|
||||||
|
evo_importer_reward_perc
|
||||||
|
evo_importer_reward_rub
|
||||||
|
evo_mileage
|
||||||
|
evo_price_without_discount_quote
|
||||||
|
evo_object_registration
|
||||||
|
evo_pts_type
|
||||||
|
evo_subsidyid
|
||||||
|
evo_subsidy_summ
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
fragment quoteFieldsLite on quote {
|
||||||
|
quoteid
|
||||||
|
name
|
||||||
|
evo_quotename
|
||||||
|
quotenumber
|
||||||
|
evo_recalc_limit
|
||||||
|
evo_object_count
|
||||||
|
evo_approved_first_payment
|
||||||
|
evo_statuscode: evo_statuscodeidData {
|
||||||
|
evo_id
|
||||||
|
}
|
||||||
|
evo_max_price_change
|
||||||
|
evo_max_mass
|
||||||
|
evo_seats
|
||||||
|
evo_year
|
||||||
|
offerprintformapi
|
||||||
|
evo_regionid
|
||||||
|
evo_legal_regionid
|
||||||
|
evo_legal_townid
|
||||||
|
link
|
||||||
|
evo_req_telematic
|
||||||
|
evo_req_telematic_accept
|
||||||
|
evo_one_year_insurance
|
||||||
|
evo_last_payment_perc
|
||||||
|
}
|
||||||
7
src/core/graphql/query/crm/quote/getQuote.graphql
Normal file
7
src/core/graphql/query/crm/quote/getQuote.graphql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#import './fragments/quoteFields.graphql'
|
||||||
|
|
||||||
|
query GetQuote($quoteId: Uuid!) {
|
||||||
|
quote(quoteId: $quoteId) {
|
||||||
|
...quoteFields
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/core/graphql/query/crm/quote/getQuotesByLead.graphql
Normal file
7
src/core/graphql/query/crm/quote/getQuotesByLead.graphql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#import './fragments/quoteFieldsLite.graphql'
|
||||||
|
|
||||||
|
query GetQuotesByLead($leadid: Uuid) {
|
||||||
|
quotes(evo_leadid: $leadid) {
|
||||||
|
...quoteFieldsLite
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/core/graphql/query/crm/quote/index.js
Normal file
14
src/core/graphql/query/crm/quote/index.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { loader } from 'graphql.macro';
|
||||||
|
|
||||||
|
export const getQuotesByLeadQuery = loader('./getQuotesByLead.graphql');
|
||||||
|
export const getQuoteQuery = loader('./getQuote.graphql');
|
||||||
|
|
||||||
|
export const getMainOptionsForQuote = loader(
|
||||||
|
'./options/getMainOptions.graphql',
|
||||||
|
);
|
||||||
|
export const getSecondaryOptionsForQuote = loader(
|
||||||
|
'./options/getSecondaryOptions.graphql',
|
||||||
|
);
|
||||||
|
export const getSingleOptionsForQuote = loader(
|
||||||
|
'./options/getSingleOptions.graphql',
|
||||||
|
);
|
||||||
124
src/core/graphql/query/crm/quote/options/getMainOptions.graphql
Normal file
124
src/core/graphql/query/crm/quote/options/getMainOptions.graphql
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
query GetMainOptionsForKP(
|
||||||
|
$statecode: Int
|
||||||
|
$evo_brandid: Uuid
|
||||||
|
$evo_modelid: Uuid
|
||||||
|
$salonaccountid: Uuid!
|
||||||
|
$currentDate: DateTime
|
||||||
|
$dealer_person_accountid: Uuid!
|
||||||
|
$dealer_broker_accountid: Uuid!
|
||||||
|
# $ind_agent_accountid: Uuid!
|
||||||
|
$double_agent_accountid: Uuid!
|
||||||
|
# $broker_accountid: Uuid!
|
||||||
|
# $findepartment_accountid: Uuid!
|
||||||
|
$evo_gps_brandid: Uuid!
|
||||||
|
) {
|
||||||
|
selectModel: evo_models(statecode: $statecode, evo_brandid: $evo_brandid) {
|
||||||
|
evo_id
|
||||||
|
evo_name
|
||||||
|
evo_modelid
|
||||||
|
evo_leasingobject_risk
|
||||||
|
evo_importer_reward_perc
|
||||||
|
evo_importer_reward_rub
|
||||||
|
evo_impairment_groupid
|
||||||
|
evo_vehicle_type
|
||||||
|
evo_gps
|
||||||
|
evo_vehicle_body_typeidData {
|
||||||
|
evo_id_elt
|
||||||
|
}
|
||||||
|
evo_running_gear
|
||||||
|
}
|
||||||
|
selectConfiguration: evo_equipments(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_modelid: $evo_modelid
|
||||||
|
) {
|
||||||
|
evo_equipmentid
|
||||||
|
evo_name
|
||||||
|
evo_impairment_groupid
|
||||||
|
evo_leasingobject_risk
|
||||||
|
evo_start_production_year
|
||||||
|
}
|
||||||
|
selectDealerPerson: salon_providers(
|
||||||
|
statecode: $statecode
|
||||||
|
salonaccountid: $salonaccountid
|
||||||
|
) {
|
||||||
|
accountid
|
||||||
|
name
|
||||||
|
evo_broker_accountid
|
||||||
|
evo_kpp
|
||||||
|
evo_inn
|
||||||
|
}
|
||||||
|
selectDealerRewardCondition: evo_reward_conditions(
|
||||||
|
evo_agent_accountid: $dealer_person_accountid
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
statecode: $statecode
|
||||||
|
) {
|
||||||
|
evo_reward_conditionid
|
||||||
|
evo_name
|
||||||
|
evo_reward_summ
|
||||||
|
evo_reduce_reward
|
||||||
|
}
|
||||||
|
selectDealerBrokerRewardCondition: evo_reward_conditions(
|
||||||
|
evo_agent_accountid: $dealer_broker_accountid
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
statecode: $statecode
|
||||||
|
) {
|
||||||
|
evo_reward_conditionid
|
||||||
|
evo_name
|
||||||
|
evo_reward_summ
|
||||||
|
evo_reduce_reward
|
||||||
|
}
|
||||||
|
# selectIndAgentRewardCondition: evo_reward_conditions(
|
||||||
|
# evo_agent_accountid: $ind_agent_accountid
|
||||||
|
# evo_datefrom_param: { lte: $currentDate }
|
||||||
|
# evo_dateto_param: { gte: $currentDate }
|
||||||
|
# statecode: $statecode
|
||||||
|
# ) {
|
||||||
|
# evo_reward_conditionid
|
||||||
|
# evo_name
|
||||||
|
# evo_double_agent_accountid
|
||||||
|
# evo_reward_summ
|
||||||
|
# evo_reduce_reward
|
||||||
|
# }
|
||||||
|
calcDoubleAgentRewardCondition: evo_reward_conditions(
|
||||||
|
evo_agent_accountid: $double_agent_accountid
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
statecode: $statecode
|
||||||
|
) {
|
||||||
|
evo_reward_conditionid
|
||||||
|
evo_name
|
||||||
|
evo_reward_summ
|
||||||
|
evo_reduce_reward
|
||||||
|
}
|
||||||
|
# calcBrokerRewardCondition: evo_reward_conditions(
|
||||||
|
# evo_agent_accountid: $broker_accountid
|
||||||
|
# evo_datefrom_param: { lte: $currentDate }
|
||||||
|
# evo_dateto_param: { gte: $currentDate }
|
||||||
|
# statecode: $statecode
|
||||||
|
# ) {
|
||||||
|
# evo_reward_conditionid
|
||||||
|
# evo_name
|
||||||
|
# evo_reward_summ
|
||||||
|
# evo_reduce_reward
|
||||||
|
# }
|
||||||
|
# selectFinDepartmentRewardCondtion: evo_reward_conditions(
|
||||||
|
# evo_agent_accountid: $findepartment_accountid
|
||||||
|
# evo_datefrom_param: { lte: $currentDate }
|
||||||
|
# evo_dateto_param: { gte: $currentDate }
|
||||||
|
# statecode: $statecode
|
||||||
|
# ) {
|
||||||
|
# evo_reward_conditionid
|
||||||
|
# evo_name
|
||||||
|
# evo_reward_summ
|
||||||
|
# evo_reduce_reward
|
||||||
|
# }
|
||||||
|
selectGPSModel: evo_gps_models(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_gps_brandid: $evo_gps_brandid
|
||||||
|
) {
|
||||||
|
evo_name
|
||||||
|
evo_gps_modelid
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
query GetSecondaryOptionsForKP(
|
||||||
|
$statecode: Int
|
||||||
|
$evo_regionid: Uuid!
|
||||||
|
$evo_legal_regionid: Uuid!
|
||||||
|
) {
|
||||||
|
selectTownRegistration: evo_towns(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_regionid: $evo_regionid
|
||||||
|
) {
|
||||||
|
evo_name
|
||||||
|
evo_townid
|
||||||
|
evo_fias_id
|
||||||
|
evo_kladr_id
|
||||||
|
evo_businessunit_evolution
|
||||||
|
}
|
||||||
|
selectLegalClientTown: evo_towns(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_regionid: $evo_legal_regionid
|
||||||
|
) {
|
||||||
|
evo_name
|
||||||
|
evo_townid
|
||||||
|
evo_fias_id
|
||||||
|
evo_kladr_id
|
||||||
|
evo_businessunit_evolution
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
query GetSingleOptionsForKP(
|
||||||
|
$dealer_broker_accountid: Uuid!
|
||||||
|
$hasDealerBroker: Boolean!
|
||||||
|
) {
|
||||||
|
selectDealerBroker: account(accountid: $dealer_broker_accountid)
|
||||||
|
@include(if: $hasDealerBroker) {
|
||||||
|
accountid
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
63
src/core/graphql/query/crm/staticData/getStaticData.graphql
Normal file
63
src/core/graphql/query/crm/staticData/getStaticData.graphql
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#import '../fragments/evo_addproduct_types_fields.graphql'
|
||||||
|
|
||||||
|
query GetStaticData($statecode: Int, $currentDate: DateTime) {
|
||||||
|
evo_impairment_group: evo_impairment_groups(statecode: $statecode) {
|
||||||
|
evo_impairment_groupid
|
||||||
|
evo_name
|
||||||
|
}
|
||||||
|
evo_currencychange: evo_currencychanges(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_coursedate_param: { eq: $currentDate }
|
||||||
|
) {
|
||||||
|
evo_currencychange
|
||||||
|
evo_ref_transactioncurrency
|
||||||
|
}
|
||||||
|
evo_coefficient: evo_coefficients(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
evo_correction_coefficient
|
||||||
|
evo_graph_type
|
||||||
|
evo_season_type
|
||||||
|
evo_job_titleid
|
||||||
|
evo_sot_coefficient_typeid
|
||||||
|
evo_sot_coefficient
|
||||||
|
evo_corfficient_type
|
||||||
|
evo_min_period
|
||||||
|
evo_max_period
|
||||||
|
evo_graph_type
|
||||||
|
evo_season_type
|
||||||
|
evo_correction_coefficient
|
||||||
|
evo_client_riskid
|
||||||
|
evo_client_typeid
|
||||||
|
evo_risk_delta
|
||||||
|
evo_leasingobject_types {
|
||||||
|
evo_name
|
||||||
|
evo_id
|
||||||
|
evo_leasingobject_typeid
|
||||||
|
}
|
||||||
|
evo_businessunits {
|
||||||
|
evo_name
|
||||||
|
evo_businessunitid
|
||||||
|
evo_sale_businessunitid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evo_sot_coefficient_type: evo_sot_coefficient_types(statecode: $statecode) {
|
||||||
|
evo_id
|
||||||
|
evo_name
|
||||||
|
evo_sot_coefficient_typeid
|
||||||
|
}
|
||||||
|
evo_job_title: evo_job_titles(statecode: $statecode) {
|
||||||
|
evo_id
|
||||||
|
evo_name
|
||||||
|
evo_job_titleid
|
||||||
|
}
|
||||||
|
evo_addproduct_type: evo_addproduct_types(
|
||||||
|
statecode: $statecode
|
||||||
|
evo_datefrom_param: { lte: $currentDate }
|
||||||
|
evo_dateto_param: { gte: $currentDate }
|
||||||
|
) {
|
||||||
|
...evo_addproduct_types_fields
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
query GetSystemUser($domainname: String) {
|
||||||
|
systemuser(domainname: $domainname) {
|
||||||
|
evo_job_titleid
|
||||||
|
businessunitid
|
||||||
|
firstname
|
||||||
|
lastname
|
||||||
|
fullname
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/core/graphql/query/crm/staticData/index.js
Normal file
4
src/core/graphql/query/crm/staticData/index.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import { loader } from 'graphql.macro';
|
||||||
|
|
||||||
|
export const getStaticDataQuery = loader('./getStaticData.graphql');
|
||||||
|
export const getSystemUserQuery = loader('./getSystemUser.graphql');
|
||||||
2263
src/core/graphql/schemas/crm.graphql
Normal file
2263
src/core/graphql/schemas/crm.graphql
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,30 @@
|
|||||||
import { TCRMEntity } from 'core/types/Entities/crmEntities';
|
import {
|
||||||
import { TEntities } from 'core/types/Entities/crmEntityNames';
|
IAccount,
|
||||||
|
IEvoAddproductType,
|
||||||
|
IEvoEquipment,
|
||||||
|
TCRMEntity,
|
||||||
|
} from 'core/types/Entities/crmEntities';
|
||||||
|
import { CRMEntityNames } from 'core/types/Entities/crmEntityNames';
|
||||||
|
|
||||||
const propsMap: TEntities<{
|
type TGetName = (entity: any, targetName: string) => string;
|
||||||
|
|
||||||
|
export type TEntityProps = Record<'value', keyof TCRMEntity> & {
|
||||||
name?: keyof TCRMEntity;
|
name?: keyof TCRMEntity;
|
||||||
value: keyof TCRMEntity;
|
getName?: TGetName;
|
||||||
getName?: (entity: TCRMEntity, targetName: string) => string | undefined;
|
};
|
||||||
}> = {
|
|
||||||
|
type ExcludeFromPropsMap =
|
||||||
|
| 'evo_currencychange'
|
||||||
|
| 'evo_sot_coefficient_type'
|
||||||
|
| 'evo_statuscode'
|
||||||
|
| 'systemuser';
|
||||||
|
|
||||||
|
const propsMap: Record<
|
||||||
|
Exclude<CRMEntityNames, ExcludeFromPropsMap>,
|
||||||
|
TEntityProps
|
||||||
|
> = {
|
||||||
account: {
|
account: {
|
||||||
getName: (account, targetName) => {
|
getName: (account: IAccount, targetName) => {
|
||||||
if (['selectDealerPerson'].includes(targetName)) {
|
if (['selectDealerPerson'].includes(targetName)) {
|
||||||
return `
|
return `
|
||||||
${account.name}
|
${account.name}
|
||||||
@ -62,7 +79,7 @@ const propsMap: TEntities<{
|
|||||||
value: 'evo_modelid',
|
value: 'evo_modelid',
|
||||||
},
|
},
|
||||||
evo_equipment: {
|
evo_equipment: {
|
||||||
getName: equipment =>
|
getName: (equipment: IEvoEquipment) =>
|
||||||
`${equipment.evo_name} (${equipment.evo_start_production_year})`,
|
`${equipment.evo_name} (${equipment.evo_start_production_year})`,
|
||||||
value: 'evo_equipmentid',
|
value: 'evo_equipmentid',
|
||||||
},
|
},
|
||||||
@ -103,7 +120,7 @@ const propsMap: TEntities<{
|
|||||||
value: 'evo_coefficientid',
|
value: 'evo_coefficientid',
|
||||||
},
|
},
|
||||||
evo_addproduct_type: {
|
evo_addproduct_type: {
|
||||||
getName: (productType, targetName) => {
|
getName: (productType: IEvoAddproductType, targetName) => {
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
'selectRegistration',
|
'selectRegistration',
|
||||||
@ -115,7 +132,7 @@ const propsMap: TEntities<{
|
|||||||
) {
|
) {
|
||||||
return `${productType.evo_name} (${productType.evo_graph_price} руб.)`;
|
return `${productType.evo_name} (${productType.evo_graph_price} руб.)`;
|
||||||
}
|
}
|
||||||
return productType.evo_name;
|
return `${productType.evo_name}`;
|
||||||
},
|
},
|
||||||
value: 'evo_addproduct_typeid',
|
value: 'evo_addproduct_typeid',
|
||||||
},
|
},
|
||||||
@ -1,122 +1,45 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
import { QueryOptions } from '@apollo/client';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { CRM_PROXY_URL } from 'core/constants/urls';
|
import { CRM_PROXY_URL } from 'core/constants/urls';
|
||||||
import {
|
import GQLClient from 'core/graphql/client';
|
||||||
ICreateKpRequest,
|
import { ElementsNames } from 'core/types/Calculation/Store/elements';
|
||||||
IMutateToCRMGQL,
|
|
||||||
IQueryToCRMGQL,
|
|
||||||
} from 'core/types/Calculation/Requests';
|
|
||||||
import { IGetCRMEntitiesResponse } from 'core/types/Calculation/Responses';
|
|
||||||
import { IBaseOption } from 'core/types/Calculation/Store/options';
|
|
||||||
import { IQuote, TCRMEntity } from 'core/types/Entities/crmEntities';
|
import { IQuote, TCRMEntity } from 'core/types/Entities/crmEntities';
|
||||||
import { TEntities } from 'core/types/Entities/crmEntityNames';
|
import { optionizeEntities } from './tools/entity';
|
||||||
import { cloneDeep } from 'lodash';
|
import { TOptionizedEntity } from './types/common';
|
||||||
import { isPlural, singular } from 'pluralize';
|
import { GQLVariables } from './types/request';
|
||||||
import client from './client';
|
|
||||||
import { convertEntityToOption } from './tools/entity';
|
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
static crmgqlquery = ({
|
public static getCRMEntities<K extends string, R, V = TCRMEntity>(
|
||||||
query,
|
options: QueryOptions<GQLVariables<V>, Record<K, R>>,
|
||||||
toOptions,
|
): Promise<Partial<Record<K, R>>> {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
GQLClient.query<Record<K, R>, GQLVariables<V>>(options).then(res =>
|
||||||
|
resolve(res.data),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getCRMOptions<
|
||||||
|
K extends string = ElementsNames,
|
||||||
|
R = TCRMEntity,
|
||||||
|
>({
|
||||||
variables,
|
variables,
|
||||||
}: IQueryToCRMGQL): Promise<IGetCRMEntitiesResponse> =>
|
...options
|
||||||
new Promise((resolve, reject) => {
|
}: QueryOptions<GQLVariables<R>, Record<K, R>>): Promise<
|
||||||
client
|
Partial<Record<K, TOptionizedEntity<R>[]>>
|
||||||
.query({
|
> {
|
||||||
query,
|
return new Promise(resolve =>
|
||||||
variables,
|
this.getCRMEntities<K, R | R[], keyof typeof variables>({
|
||||||
})
|
variables,
|
||||||
.then(res => {
|
...options,
|
||||||
if (!res.data || res.errors) {
|
}).then(entities => resolve(optionizeEntities<K, R>(entities))),
|
||||||
reject(res.error || res.errors);
|
);
|
||||||
}
|
}
|
||||||
const resEntities: TEntities<TCRMEntity | TCRMEntity[]> = cloneDeep(
|
|
||||||
res.data,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (toOptions)
|
public static createKP(data) {
|
||||||
Object.keys(resEntities).forEach(targetName => {
|
return axios.post<IQuote>(
|
||||||
const targetEnt: TCRMEntity | TCRMEntity[] =
|
String.prototype.concat(CRM_PROXY_URL, '/offer', '/leasingcalculator'),
|
||||||
resEntities[targetName];
|
data,
|
||||||
//@ts-ignore
|
);
|
||||||
if (toOptions.includes(targetName)) {
|
}
|
||||||
if (Array.isArray(targetEnt)) {
|
|
||||||
const optionatedEntities: (TCRMEntity & IBaseOption)[] = [];
|
|
||||||
for (const entity of targetEnt) {
|
|
||||||
const entityOption = convertEntityToOption(
|
|
||||||
targetName,
|
|
||||||
entity,
|
|
||||||
entity.__typename,
|
|
||||||
);
|
|
||||||
if (entityOption) {
|
|
||||||
optionatedEntities.push(entityOption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resEntities[
|
|
||||||
isPlural(targetName) ? singular(targetName) : targetName
|
|
||||||
] = optionatedEntities;
|
|
||||||
} else {
|
|
||||||
const entityOption = convertEntityToOption(
|
|
||||||
targetName,
|
|
||||||
targetEnt,
|
|
||||||
targetEnt.__typename,
|
|
||||||
);
|
|
||||||
|
|
||||||
resEntities[
|
|
||||||
isPlural(targetName) ? singular(targetName) : targetName
|
|
||||||
] = entityOption;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
resolve({ entities: resEntities });
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
static crmgqlmutaion = ({
|
|
||||||
mutation,
|
|
||||||
variables,
|
|
||||||
}: IMutateToCRMGQL): Promise<IGetCRMEntitiesResponse> =>
|
|
||||||
new Promise((resolve, reject) => {
|
|
||||||
client
|
|
||||||
.mutate({
|
|
||||||
mutation,
|
|
||||||
variables,
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (!res.data || res.errors) {
|
|
||||||
reject(res.errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve({ entities: res.data?.entities });
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
static createKp = (data: ICreateKpRequest): Promise<IQuote> =>
|
|
||||||
new Promise((resolve, reject) => {
|
|
||||||
console.log('createKp data: ', data);
|
|
||||||
axios
|
|
||||||
.post<IQuote>(
|
|
||||||
String.prototype.concat(
|
|
||||||
CRM_PROXY_URL,
|
|
||||||
'/offer',
|
|
||||||
'/leasingcalculator',
|
|
||||||
),
|
|
||||||
data,
|
|
||||||
)
|
|
||||||
.then(res => {
|
|
||||||
resolve(res.data);
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,42 +1,39 @@
|
|||||||
import { IBaseOption } from 'core/types/Calculation/Store/options';
|
import { CoreEntity } from 'core/types/Entities/crmEntities';
|
||||||
import { TCRMEntity } from 'core/types/Entities/crmEntities';
|
import entitiesProps, { TEntityProps } from '../common/entitiesProps';
|
||||||
import { CRMEntityNames } from 'core/types/Entities/crmEntityNames';
|
import { TOptionizedEntity } from '../types/common';
|
||||||
import propsMap from '../propsMap';
|
|
||||||
|
|
||||||
export function convertEntityToOption(
|
function convertEntityToOption<R extends any>(
|
||||||
targetName: string,
|
targetName: string,
|
||||||
entity: TCRMEntity,
|
entity: R,
|
||||||
entityName?: CRMEntityNames,
|
): TOptionizedEntity<R> {
|
||||||
): (TCRMEntity & IBaseOption) | undefined {
|
const entityName = (entity as CoreEntity).__typename;
|
||||||
if (!entityName) {
|
const entityProps: TEntityProps = entitiesProps[entityName];
|
||||||
throw new Error('entityName is missing');
|
if (!entityProps) {
|
||||||
|
throw new Error(`${entityName} was not found in propsMap!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity || !propsMap || !propsMap[entityName]) {
|
const { name: nameProp, getName, value: valueProp } = entitiesProps[
|
||||||
throw new Error(`${entityName} not found in propsMap!`);
|
entityName
|
||||||
}
|
];
|
||||||
|
|
||||||
const entityPropsMap = propsMap[entityName];
|
let name: string = entity[nameProp];
|
||||||
if (entityPropsMap) {
|
if (getName) name = getName(entity, targetName);
|
||||||
const { name: propName, getName, value: propValue } = entityPropsMap;
|
const value = entity[valueProp];
|
||||||
|
|
||||||
let name;
|
return Object.assign({}, entity, { name, value });
|
||||||
const value = entity[propValue];
|
}
|
||||||
if (propName) {
|
|
||||||
name = entity[propName];
|
export function optionizeEntities<K extends string, R>(
|
||||||
}
|
entities: Partial<Record<K, R | R[]>>,
|
||||||
if (getName) {
|
): Partial<Record<K, TOptionizedEntity<R>[]>> {
|
||||||
name = getName(entity, targetName);
|
return Object.keys(entities).reduce((acc, targetName) => {
|
||||||
}
|
let target: R[] = entities[targetName];
|
||||||
|
if (!Array.isArray(entities[targetName])) target = [entities[targetName]];
|
||||||
if (targetName) {
|
|
||||||
}
|
const optionizedEntities = target.map(entity =>
|
||||||
|
convertEntityToOption(targetName, entity),
|
||||||
const optionatedObject = {
|
);
|
||||||
...entity,
|
acc[targetName] = optionizedEntities;
|
||||||
name,
|
return acc;
|
||||||
value,
|
}, {} as Partial<Record<K, TOptionizedEntity<R>[]>>);
|
||||||
};
|
|
||||||
return optionatedObject;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/core/services/CrmService/types/common.ts
Normal file
8
src/core/services/CrmService/types/common.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { BaseEntity } from 'core/types/Entities/crmEntities';
|
||||||
|
export type IBaseOption = {
|
||||||
|
name: string;
|
||||||
|
value: any;
|
||||||
|
[prop: string]: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TOptionizedEntity<T = BaseEntity & IBaseOption> = T & IBaseOption;
|
||||||
4
src/core/services/CrmService/types/request.ts
Normal file
4
src/core/services/CrmService/types/request.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import { OperationVariables } from '@apollo/client';
|
||||||
|
|
||||||
|
export type GQLVariables<R> = Partial<Record<keyof R, any>> &
|
||||||
|
OperationVariables;
|
||||||
1
src/core/tools/uuid.js
Normal file
1
src/core/tools/uuid.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const NIL = '00000000-0000-0000-0000-000000000000';
|
||||||
@ -1,47 +1,13 @@
|
|||||||
import { ColumnsNames, IColumn, PostValues } from 'core/types/Calculation/Core';
|
|
||||||
import {
|
import {
|
||||||
PreparedPayments,
|
PreparedPayments,
|
||||||
PreparedValues,
|
PreparedValues,
|
||||||
} from 'core/types/Calculation/Prepare';
|
} from 'core/types/Calculation/Prepare';
|
||||||
import { ElementsNames } from 'core/types/Calculation/Store/elements';
|
|
||||||
import { TableProps } from 'core/types/Calculation/Store/tables';
|
|
||||||
import { TValues } from 'core/types/Calculation/Store/values';
|
|
||||||
import { TCRMEntity } from 'core/types/Entities/crmEntities';
|
|
||||||
import { CRMEntityNames } from 'core/types/Entities/crmEntityNames';
|
|
||||||
|
|
||||||
export interface IQueryToCRMGQL {
|
|
||||||
query: any;
|
|
||||||
toOptions?: CRMEntityNames[] | ElementsNames[];
|
|
||||||
variables?: {
|
|
||||||
[prop in keyof TCRMEntity]: any;
|
|
||||||
} & { [prop: string]: any };
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IMutateToCRMGQL {
|
|
||||||
mutation: any;
|
|
||||||
variables?: { [prop: string]: any };
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IPreparedData {
|
export interface IPreparedData {
|
||||||
preparedPayments: PreparedPayments;
|
preparedPayments: PreparedPayments;
|
||||||
preparedValues: PreparedValues;
|
preparedValues: PreparedValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICreateKpRequest {
|
|
||||||
domainName: string;
|
|
||||||
calculation: {
|
|
||||||
insurances: TableProps<any>[];
|
|
||||||
preparedValues: PreparedValues;
|
|
||||||
preparedPayments: PreparedPayments;
|
|
||||||
postValues: PostValues;
|
|
||||||
calculationValues: TValues<any>;
|
|
||||||
columns: { [column in ColumnsNames]?: IColumn };
|
|
||||||
};
|
|
||||||
elt: {
|
|
||||||
[insType: string]: any;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IGetTransTaxRequest {
|
export interface IGetTransTaxRequest {
|
||||||
calcDate: Date;
|
calcDate: Date;
|
||||||
OKTMO: string;
|
OKTMO: string;
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
import { TCRMEntity } from '../Entities/crmEntities';
|
|
||||||
import { TEntities } from '../Entities/crmEntityNames';
|
|
||||||
import { ColumnsNames, IColumn, PostValues } from './Core';
|
import { ColumnsNames, IColumn, PostValues } from './Core';
|
||||||
import { PreparedValues } from './Prepare';
|
import { PreparedValues } from './Prepare';
|
||||||
|
|
||||||
export interface IGetCRMEntitiesResponse {
|
|
||||||
entities: TEntities<TCRMEntity | TCRMEntity[]>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IGetCalculationResponse {
|
export interface IGetCalculationResponse {
|
||||||
columns: { [column in ColumnsNames]?: IColumn };
|
columns: { [column in ColumnsNames]?: IColumn };
|
||||||
postValues: PostValues;
|
postValues: PostValues;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
import { IBaseOption } from 'core/services/CrmService/types/common';
|
||||||
import { TCRMEntity } from 'core/types/Entities/crmEntities';
|
import { TCRMEntity } from 'core/types/Entities/crmEntities';
|
||||||
import { IBaseOption } from 'core/types/Calculation/Store/options';
|
|
||||||
export type TElementFilter = (
|
export type TElementFilter = (
|
||||||
options: (TCRMEntity & IBaseOption)[],
|
options: (TCRMEntity & IBaseOption)[],
|
||||||
) => (TCRMEntity & IBaseOption)[];
|
) => (TCRMEntity & IBaseOption)[];
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
import { TCalculationProcess } from 'client/stores/CalculationStore/subStores/calculationProcess';
|
import { TCalculationProcess } from 'client/stores/CalculationStore/subStores/calculationProcess';
|
||||||
import { TCalculationUrls } from 'client/stores/CalculationStore/subStores/calculationUrls';
|
import { TCalculationUrls } from 'client/stores/CalculationStore/subStores/calculationUrls';
|
||||||
import { TELTStore } from 'client/stores/CalculationStore/subStores/eltStore';
|
import { TELTStore } from 'client/stores/CalculationStore/subStores/eltStore';
|
||||||
|
import {
|
||||||
|
IBaseOption,
|
||||||
|
TOptionizedEntity,
|
||||||
|
} from 'core/services/CrmService/types/common';
|
||||||
import { TCRMEntity } from '../../Entities/crmEntities';
|
import { TCRMEntity } from '../../Entities/crmEntities';
|
||||||
import { CRMEntityNames } from '../../Entities/crmEntityNames';
|
import { CRMEntityNames } from '../../Entities/crmEntityNames';
|
||||||
import { ElementStatus } from '../../statuses';
|
import { ElementStatus } from '../../statuses';
|
||||||
import { ElementsNames, TElements } from './elements';
|
import { ElementsNames, TElements } from './elements';
|
||||||
import { TElementFilter } from './filters';
|
import { TElementFilter } from './filters';
|
||||||
import { IBaseOption } from './options';
|
|
||||||
import { TStaticData } from './staticData';
|
import { TStaticData } from './staticData';
|
||||||
import {
|
import {
|
||||||
ITable,
|
ITable,
|
||||||
@ -30,20 +33,20 @@ interface ICalculationValues {
|
|||||||
getStaticData: (dataName: CRMEntityNames) => TCRMEntity[];
|
getStaticData: (dataName: CRMEntityNames) => TCRMEntity[];
|
||||||
applyStaticData: (data: TStaticData) => void;
|
applyStaticData: (data: TStaticData) => void;
|
||||||
|
|
||||||
options: TElements<(IBaseOption & TCRMEntity)[]>;
|
options: TElements<IBaseOption & TCRMEntity[]>;
|
||||||
getOption: (
|
getOption: (
|
||||||
elementName: ElementsNames,
|
elementName: ElementsNames,
|
||||||
fields?: { [field in keyof (IBaseOption & TCRMEntity)]: any },
|
fields?: { [field in keyof (IBaseOption & TCRMEntity)]?: any },
|
||||||
) => (IBaseOption & TCRMEntity) | undefined;
|
) => (IBaseOption & TCRMEntity) | undefined;
|
||||||
getOptions: (
|
getOptions: (
|
||||||
elementName: ElementsNames,
|
elementName: ElementsNames,
|
||||||
fields?: { [field in keyof (IBaseOption & TCRMEntity)]: any },
|
fields?: { [field in keyof (IBaseOption & TCRMEntity)]?: any },
|
||||||
) => (IBaseOption & TCRMEntity)[] | undefined;
|
) => (IBaseOption & TCRMEntity)[] | undefined;
|
||||||
setOptions: (
|
setOptions: (
|
||||||
elementName: ElementsNames,
|
elementName: ElementsNames,
|
||||||
options: (IBaseOption & TCRMEntity)[],
|
options: TOptionizedEntity[],
|
||||||
) => void;
|
) => void;
|
||||||
applyOptions: (options: TElements<(IBaseOption & TCRMEntity)[]>) => void;
|
applyOptions: (options: TElements<TOptionizedEntity[]>) => void;
|
||||||
|
|
||||||
filters: TElements<TElementFilter>;
|
filters: TElements<TElementFilter>;
|
||||||
getFilter: (elementName: ElementsNames) => TElementFilter | undefined;
|
getFilter: (elementName: ElementsNames) => TElementFilter | undefined;
|
||||||
@ -116,11 +119,7 @@ interface ICalculationTables {
|
|||||||
setTableColumns: (
|
setTableColumns: (
|
||||||
tableName: TableNames,
|
tableName: TableNames,
|
||||||
override?: boolean,
|
override?: boolean,
|
||||||
) => ({
|
) => ({ options }: { options?: TableProps<TOptionizedEntity[]> }) => void;
|
||||||
options,
|
|
||||||
}: {
|
|
||||||
options?: TableProps<(IBaseOption & TCRMEntity)[]>;
|
|
||||||
}) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ICalculationStores {
|
interface ICalculationStores {
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
export type IBaseOption = {
|
|
||||||
/**
|
|
||||||
* TODO: Remove optional mark when remove fakes
|
|
||||||
*/
|
|
||||||
name?: string;
|
|
||||||
value?: string | number | boolean;
|
|
||||||
[prop: string]: any | any[];
|
|
||||||
};
|
|
||||||
@ -1,6 +1,4 @@
|
|||||||
import { CRMEntityNames } from '../../Entities/crmEntityNames';
|
|
||||||
import { TCRMEntity } from './../../Entities/crmEntities';
|
import { TCRMEntity } from './../../Entities/crmEntities';
|
||||||
|
import { TEntities } from './../../Entities/crmEntityNames';
|
||||||
|
|
||||||
export type TStaticData = {
|
export type TStaticData = TEntities<TCRMEntity[]>;
|
||||||
[dataName in CRMEntityNames]?: TCRMEntity[];
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import { TCalculationProcess } from 'client/stores/CalculationStore/subStores/calculationProcess';
|
import { TCalculationProcess } from 'client/stores/CalculationStore/subStores/calculationProcess';
|
||||||
|
import { IBaseOption } from 'core/services/CrmService/types/common';
|
||||||
import { Component } from 'core/types/Calculation/components';
|
import { Component } from 'core/types/Calculation/components';
|
||||||
import { ElementStatus } from '../../statuses';
|
import { ElementStatus } from '../../statuses';
|
||||||
import { ElementProps } from '../components';
|
import { ElementProps } from '../components';
|
||||||
import { ICalculationStore } from './';
|
import { ICalculationStore } from './';
|
||||||
import { TCRMEntity } from './../../Entities/crmEntities';
|
import { TCRMEntity } from './../../Entities/crmEntities';
|
||||||
import { TElementFilter } from './filters';
|
import { TElementFilter } from './filters';
|
||||||
import { IBaseOption } from './options';
|
|
||||||
|
|
||||||
export type TableNames = 'tableInsurance' | 'tablePayments' | 'tableResults';
|
export type TableNames = 'tableInsurance' | 'tablePayments' | 'tableResults';
|
||||||
export type TableValuesNames =
|
export type TableValuesNames =
|
||||||
|
|||||||
@ -1,12 +1,22 @@
|
|||||||
import { CRMEntityNames } from './crmEntityNames';
|
import { CRMEntityNames } from './crmEntityNames';
|
||||||
|
|
||||||
export interface IAccount {
|
export interface CoreEntity {
|
||||||
|
__typename: CRMEntityNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseEntity {
|
||||||
|
statecode?: number;
|
||||||
|
createdon?: Date;
|
||||||
|
evo_id?: string;
|
||||||
|
evo_name?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IAccount extends BaseEntity {
|
||||||
name?: string;
|
name?: string;
|
||||||
accountid?: string;
|
accountid?: string;
|
||||||
evo_inn?: string;
|
evo_inn?: string;
|
||||||
evo_account_type?: number;
|
evo_account_type?: number;
|
||||||
evo_supplier_type?: number;
|
evo_supplier_type?: number;
|
||||||
statecode?: number;
|
|
||||||
evo_fin_department_accountid?: string;
|
evo_fin_department_accountid?: string;
|
||||||
evo_legal_form?: number;
|
evo_legal_form?: number;
|
||||||
ownerid?: string;
|
ownerid?: string;
|
||||||
@ -21,18 +31,22 @@ export interface IAccount {
|
|||||||
evo_legal_region_calc?: boolean;
|
evo_legal_region_calc?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoAddress {
|
export interface ISalonProvider extends IAccount {
|
||||||
|
salonaccountid?: string;
|
||||||
|
}
|
||||||
|
export interface ISalonAgent extends ISalonProvider {}
|
||||||
|
|
||||||
|
export interface IEvoAddress extends BaseEntity {
|
||||||
evo_region_fias_id?: string;
|
evo_region_fias_id?: string;
|
||||||
evo_city_fias_id?: string;
|
evo_city_fias_id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILead {
|
export interface ILead extends BaseEntity {
|
||||||
leadid?: string;
|
leadid?: string;
|
||||||
fullname?: string;
|
fullname?: string;
|
||||||
evo_opportunityid?: string;
|
evo_opportunityid?: string;
|
||||||
account?: string;
|
account?: string;
|
||||||
ownerid?: string;
|
ownerid?: string;
|
||||||
statecode?: number;
|
|
||||||
evo_fin_department_accountid?: string;
|
evo_fin_department_accountid?: string;
|
||||||
evo_broker_accountid?: string;
|
evo_broker_accountid?: string;
|
||||||
evo_double_agent_accountid?: string;
|
evo_double_agent_accountid?: string;
|
||||||
@ -41,29 +55,37 @@ export interface ILead {
|
|||||||
owner_domainname?: string;
|
owner_domainname?: string;
|
||||||
evo_inn?: string;
|
evo_inn?: string;
|
||||||
link?: string;
|
link?: string;
|
||||||
|
evo_programsolution?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IOpportunity {
|
export interface IOpportunity extends BaseEntity {
|
||||||
opportunityid?: string;
|
opportunityid?: string;
|
||||||
accountid?: string;
|
accountid?: string;
|
||||||
evo_leadid?: string;
|
evo_leadid?: string;
|
||||||
evo_client_riskid?: string;
|
evo_client_riskid?: string;
|
||||||
ownerid?: string;
|
ownerid?: string;
|
||||||
statecode?: number;
|
|
||||||
accountidData?: IAccount;
|
accountidData?: IAccount;
|
||||||
parentaccountid?: string;
|
parentaccountid?: string;
|
||||||
evo_addproduct_types?: IEvoAddproductType[];
|
evo_addproduct_types?: IEvoAddproductType[];
|
||||||
link?: string;
|
link?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IQuote {
|
export interface IQuote extends BaseEntity {
|
||||||
|
evo_client_riskid?: string;
|
||||||
|
evo_addproduct_types?: IEvoAddproductType[];
|
||||||
|
evo_gps_brandid?: string;
|
||||||
|
evo_double_agent_accountid?: string;
|
||||||
|
evo_dealer_broker_accountid?: string;
|
||||||
|
evo_dealer_person_accountid?: string;
|
||||||
|
evo_supplier_accountid?: string;
|
||||||
|
evo_modelid?: string;
|
||||||
|
evo_brandid?: string;
|
||||||
quoteid?: string;
|
quoteid?: string;
|
||||||
quotenumber?: string;
|
quotenumber?: string;
|
||||||
evo_leadid?: string;
|
evo_leadid?: string;
|
||||||
evo_recalc_limit?: number;
|
evo_recalc_limit?: number;
|
||||||
evo_approved_first_payment?: number;
|
evo_approved_first_payment?: number;
|
||||||
ownerid?: string;
|
ownerid?: string;
|
||||||
statecode?: number;
|
|
||||||
evo_statuscodeid?: string;
|
evo_statuscodeid?: string;
|
||||||
evo_statuscode?: IEvoStatusCode;
|
evo_statuscode?: IEvoStatusCode;
|
||||||
evo_quotename?: string;
|
evo_quotename?: string;
|
||||||
@ -105,34 +127,26 @@ export interface IQuote {
|
|||||||
evo_payment_redemption_sum?: number;
|
evo_payment_redemption_sum?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoGraph {
|
export interface IEvoGraph extends BaseEntity {
|
||||||
createdon?: Date;
|
|
||||||
evo_sumpay_withnds?: number;
|
evo_sumpay_withnds?: number;
|
||||||
evo_planpayments?: IEvoPlanPayment[];
|
evo_planpayments?: IEvoPlanPayment[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITransactionCurrency {
|
export interface ITransactionCurrency extends BaseEntity {
|
||||||
transactioncurrencyid?: string;
|
transactioncurrencyid?: string;
|
||||||
statecode?: number;
|
|
||||||
isocurrencycode?: string;
|
isocurrencycode?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoClientType {
|
export interface IEvoClientType extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_client_typeid?: string;
|
evo_client_typeid?: string;
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoClientRisk {
|
export interface IEvoClientRisk extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_client_riskid?: string;
|
evo_client_riskid?: string;
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoBaseproduct {
|
export interface IEvoBaseproduct extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_baseproductid?: string;
|
evo_baseproductid?: string;
|
||||||
evo_id?: string;
|
|
||||||
evo_relation?: number;
|
evo_relation?: number;
|
||||||
evo_datefrom?: Date;
|
evo_datefrom?: Date;
|
||||||
evo_datefrom_param?: Date;
|
evo_datefrom_param?: Date;
|
||||||
@ -141,9 +155,7 @@ export interface IEvoBaseproduct {
|
|||||||
evo_brands?: IEvoBrand[];
|
evo_brands?: IEvoBrand[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoLeasingObjectType {
|
export interface IEvoLeasingObjectType extends BaseEntity {
|
||||||
evo_id?: string;
|
|
||||||
evo_name?: string;
|
|
||||||
evo_leasingobject_typeid?: string;
|
evo_leasingobject_typeid?: string;
|
||||||
evo_depreciation_rate1?: number;
|
evo_depreciation_rate1?: number;
|
||||||
evo_depreciation_rate2?: number;
|
evo_depreciation_rate2?: number;
|
||||||
@ -156,25 +168,21 @@ export interface IEvoLeasingObjectType {
|
|||||||
evo_vehicle_type_tax?: number;
|
evo_vehicle_type_tax?: number;
|
||||||
evo_vehicle_type?: number[];
|
evo_vehicle_type?: number[];
|
||||||
}
|
}
|
||||||
export interface IEvoBrand {
|
export interface IEvoBrand extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_brandid?: string;
|
evo_brandid?: string;
|
||||||
evo_brand_owner?: number;
|
evo_brand_owner?: number;
|
||||||
evo_importer_reward_perc?: number;
|
evo_importer_reward_perc?: number;
|
||||||
evo_importer_reward_rub?: number;
|
evo_importer_reward_rub?: number;
|
||||||
statecode?: number;
|
|
||||||
evo_vehicle_type?: number[];
|
evo_vehicle_type?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoModel {
|
export interface IEvoModel extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_brandid?: string;
|
evo_brandid?: string;
|
||||||
evo_modelid?: string;
|
evo_modelid?: string;
|
||||||
evo_impairment_groupid?: string;
|
evo_impairment_groupid?: string;
|
||||||
evo_leasingobject_risk?: number;
|
evo_leasingobject_risk?: number;
|
||||||
evo_importer_reward_perc?: number;
|
evo_importer_reward_perc?: number;
|
||||||
evo_importer_reward_rub?: number;
|
evo_importer_reward_rub?: number;
|
||||||
statecode?: number;
|
|
||||||
evo_baseproduct?: any;
|
evo_baseproduct?: any;
|
||||||
evo_vehicle_type?: number;
|
evo_vehicle_type?: number;
|
||||||
evo_gps?: boolean;
|
evo_gps?: boolean;
|
||||||
@ -184,118 +192,92 @@ export interface IEvoModel {
|
|||||||
evo_running_gear?: number;
|
evo_running_gear?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoEquipment {
|
export interface IEvoEquipment extends BaseEntity {
|
||||||
evo_equipmentid?: string;
|
evo_equipmentid?: string;
|
||||||
evo_name?: string;
|
|
||||||
evo_modelid?: string;
|
evo_modelid?: string;
|
||||||
evo_impairment_groupid?: string;
|
evo_impairment_groupid?: string;
|
||||||
evo_leasingobject_risk?: number;
|
evo_leasingobject_risk?: number;
|
||||||
evo_start_production_year?: number;
|
evo_start_production_year?: number;
|
||||||
statecode?: number;
|
|
||||||
evo_supplier_accountid?: string;
|
evo_supplier_accountid?: string;
|
||||||
evo_dealer_person_accountid?: string;
|
evo_dealer_person_accountid?: string;
|
||||||
evo_dealer_broker_accountid?: string;
|
evo_dealer_broker_accountid?: string;
|
||||||
evo_vehicle_type?: number;
|
evo_vehicle_type?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoRewardCondition {
|
export interface IEvoRewardCondition extends BaseEntity {
|
||||||
evo_reward_conditionid?: string;
|
evo_reward_conditionid?: string;
|
||||||
evo_name?: string;
|
|
||||||
evo_datefrom?: Date;
|
evo_datefrom?: Date;
|
||||||
evo_dateto?: Date;
|
evo_dateto?: Date;
|
||||||
evo_agent_accountid?: string;
|
evo_agent_accountid?: string;
|
||||||
evo_double_agent_accountid?: string;
|
evo_double_agent_accountid?: string;
|
||||||
evo_reward_summ?: number;
|
evo_reward_summ?: number;
|
||||||
statecode?: number;
|
|
||||||
evo_reduce_reward?: boolean;
|
evo_reduce_reward?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoGPSBrand {
|
export interface IEvoGPSBrand extends BaseEntity {
|
||||||
evo_gps_brandid?: string;
|
evo_gps_brandid?: string;
|
||||||
evo_name?: string;
|
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
export interface IEvoGPSModel {
|
export interface IEvoGPSModel extends BaseEntity {
|
||||||
evo_gps_modelid?: string;
|
evo_gps_modelid?: string;
|
||||||
evo_name?: string;
|
|
||||||
evo_gps_brandid?: string;
|
evo_gps_brandid?: string;
|
||||||
statecode?: number;
|
|
||||||
evo_moto?: boolean;
|
evo_moto?: boolean;
|
||||||
}
|
}
|
||||||
export interface IEvoRegion {
|
export interface IEvoRegion extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_regionid?: string;
|
evo_regionid?: string;
|
||||||
evo_fias_id?: string;
|
evo_fias_id?: string;
|
||||||
statecode?: number;
|
|
||||||
evo_businessunit_evolution?: boolean;
|
evo_businessunit_evolution?: boolean;
|
||||||
evo_oktmo?: string;
|
evo_oktmo?: string;
|
||||||
accounts?: IAccount[];
|
accounts?: IAccount[];
|
||||||
evo_kladr_id?: string;
|
evo_kladr_id?: string;
|
||||||
}
|
}
|
||||||
export interface IEvoTown {
|
export interface IEvoTown extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_townid?: string;
|
evo_townid?: string;
|
||||||
statecode?: number;
|
|
||||||
evo_fias_id?: string;
|
evo_fias_id?: string;
|
||||||
evo_kladr_id?: string;
|
evo_kladr_id?: string;
|
||||||
evo_businessunit_evolution?: boolean;
|
evo_businessunit_evolution?: boolean;
|
||||||
}
|
}
|
||||||
export interface IEvoContact {
|
export interface IEvoContact extends BaseEntity {
|
||||||
parentcustomerid?: string;
|
parentcustomerid?: string;
|
||||||
contactid?: string;
|
contactid?: string;
|
||||||
fullname?: string;
|
fullname?: string;
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConnection {
|
export interface IConnection extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
connectionid?: string;
|
connectionid?: string;
|
||||||
record1id?: string;
|
record1id?: string;
|
||||||
record2id?: string;
|
record2id?: string;
|
||||||
record2roleid?: string;
|
record2roleid?: string;
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoConnectionRole {
|
export interface IEvoConnectionRole extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_connection_roleid?: string;
|
evo_connection_roleid?: string;
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoImpairmentGroup {
|
export interface IEvoImpairmentGroup extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_impairment_groupid?: string;
|
evo_impairment_groupid?: string;
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoCurrencyChange {
|
export interface IEvoCurrencyChange extends BaseEntity {
|
||||||
evo_currencychangeid?: string;
|
evo_currencychangeid?: string;
|
||||||
evo_name?: string;
|
|
||||||
evo_ref_transactioncurrency?: string;
|
evo_ref_transactioncurrency?: string;
|
||||||
evo_currencychange?: number;
|
evo_currencychange?: number;
|
||||||
evo_coursedate?: Date;
|
evo_coursedate?: Date;
|
||||||
statecode?: number;
|
|
||||||
evo_coursedate_param?: any;
|
evo_coursedate_param?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoStatusCode {
|
export interface IEvoStatusCode extends BaseEntity {
|
||||||
evo_statuscodeid?: string;
|
evo_statuscodeid?: string;
|
||||||
evo_id?: string;
|
|
||||||
evo_name?: string;
|
|
||||||
importsequencenumber?: number;
|
importsequencenumber?: number;
|
||||||
statecode?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoBusinessunit {
|
export interface IEvoBusinessunit extends BaseEntity {
|
||||||
evo_name?: string;
|
|
||||||
evo_businessunitid?: string;
|
evo_businessunitid?: string;
|
||||||
evo_sale_businessunitid?: string;
|
evo_sale_businessunitid?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoCoefficient {
|
export interface IEvoCoefficient extends BaseEntity {
|
||||||
evo_coefficientid?: string;
|
evo_coefficientid?: string;
|
||||||
evo_corfficient_type?: number;
|
evo_corfficient_type?: number;
|
||||||
statecode?: number;
|
|
||||||
evo_datefrom?: Date;
|
evo_datefrom?: Date;
|
||||||
evo_dateto?: Date;
|
evo_dateto?: Date;
|
||||||
evo_min_period?: number;
|
evo_min_period?: number;
|
||||||
@ -313,13 +295,12 @@ export interface IEvoCoefficient {
|
|||||||
evo_businessunits?: IEvoBusinessunit[];
|
evo_businessunits?: IEvoBusinessunit[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoAddproductType {
|
export interface IEvoAddproductType extends BaseEntity {
|
||||||
evo_addproduct_typeid?: string;
|
evo_addproduct_typeid?: string;
|
||||||
evo_graph_price?: number;
|
evo_graph_price?: number;
|
||||||
evo_prime_cost?: number;
|
evo_prime_cost?: number;
|
||||||
evo_cost_service_provider?: number;
|
evo_cost_service_provider?: number;
|
||||||
evo_retro_bonus?: number;
|
evo_retro_bonus?: number;
|
||||||
statecode?: number;
|
|
||||||
evo_product_type?: number;
|
evo_product_type?: number;
|
||||||
evo_datefrom?: Date;
|
evo_datefrom?: Date;
|
||||||
evo_dateto?: Date;
|
evo_dateto?: Date;
|
||||||
@ -345,9 +326,7 @@ export interface IEvoAddproductType {
|
|||||||
evo_gibdd_region?: boolean;
|
evo_gibdd_region?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoTarif {
|
export interface IEvoTarif extends BaseEntity {
|
||||||
evo_id?: string;
|
|
||||||
evo_name?: string;
|
|
||||||
evo_tarifid?: string;
|
evo_tarifid?: string;
|
||||||
evo_baseproductid?: string;
|
evo_baseproductid?: string;
|
||||||
evo_irr?: number;
|
evo_irr?: number;
|
||||||
@ -367,7 +346,6 @@ export interface IEvoTarif {
|
|||||||
evo_dateto?: Date;
|
evo_dateto?: Date;
|
||||||
evo_irr_plan?: number;
|
evo_irr_plan?: number;
|
||||||
evo_used?: boolean;
|
evo_used?: boolean;
|
||||||
statecode?: number;
|
|
||||||
evo_ins_type?: number;
|
evo_ins_type?: number;
|
||||||
evo_client_risks?: IEvoClientRisk[];
|
evo_client_risks?: IEvoClientRisk[];
|
||||||
evo_leasingobject_types?: IEvoLeasingObjectType[];
|
evo_leasingobject_types?: IEvoLeasingObjectType[];
|
||||||
@ -377,10 +355,7 @@ export interface IEvoTarif {
|
|||||||
evo_delivery_time?: number[];
|
evo_delivery_time?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoRate {
|
export interface IEvoRate extends BaseEntity {
|
||||||
createdon?: Date;
|
|
||||||
evo_id?: string;
|
|
||||||
evo_name?: string;
|
|
||||||
evo_rateid?: string;
|
evo_rateid?: string;
|
||||||
evo_base_rate?: number;
|
evo_base_rate?: number;
|
||||||
evo_coeff_12_23?: number;
|
evo_coeff_12_23?: number;
|
||||||
@ -390,15 +365,13 @@ export interface IEvoRate {
|
|||||||
evo_coeff_7_11?: number;
|
evo_coeff_7_11?: number;
|
||||||
evo_datefrom?: Date;
|
evo_datefrom?: Date;
|
||||||
evo_dateto?: Date;
|
evo_dateto?: Date;
|
||||||
statecode?: number;
|
|
||||||
evo_brands?: IEvoBrand[];
|
evo_brands?: IEvoBrand[];
|
||||||
evo_credit_period?: number;
|
evo_credit_period?: number;
|
||||||
evo_tarifs?: IEvoTarif[];
|
evo_tarifs?: IEvoTarif[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoPlanPayment {
|
export interface IEvoPlanPayment extends BaseEntity {
|
||||||
evo_planpaymentid?: string;
|
evo_planpaymentid?: string;
|
||||||
evo_name?: string;
|
|
||||||
evo_cost_telematics_withoutnds?: number;
|
evo_cost_telematics_withoutnds?: number;
|
||||||
evo_cost_price_telematics_withoutnds?: number;
|
evo_cost_price_telematics_withoutnds?: number;
|
||||||
evo_cost_equipment_withoutnds?: number;
|
evo_cost_equipment_withoutnds?: number;
|
||||||
@ -406,31 +379,25 @@ export interface IEvoPlanPayment {
|
|||||||
evo_payment_ratio?: number;
|
evo_payment_ratio?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISystemUser {
|
export interface ISystemUser extends BaseEntity {
|
||||||
domainname?: string;
|
domainname?: string;
|
||||||
systemuserid?: string;
|
systemuserid?: string;
|
||||||
evo_job_titleid?: string;
|
evo_job_titleid?: string;
|
||||||
statecode?: number;
|
|
||||||
firstname?: string;
|
firstname?: string;
|
||||||
lastname?: string;
|
lastname?: string;
|
||||||
fullname?: string;
|
fullname?: string;
|
||||||
businessunitid?: string;
|
businessunitid?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoSotCoefficientType {
|
export interface IEvoSotCoefficientType extends BaseEntity {
|
||||||
evo_id?: string;
|
|
||||||
statecode?: number;
|
|
||||||
evo_sot_coefficient_typeid?: string;
|
evo_sot_coefficient_typeid?: string;
|
||||||
evo_name?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoJobTitle {
|
export interface IEvoJobTitle extends BaseEntity {
|
||||||
evo_id?: string;
|
|
||||||
evo_name?: string;
|
|
||||||
evo_job_titleid?: string;
|
evo_job_titleid?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvoSubsidy {
|
export interface IEvoSubsidy extends BaseEntity {
|
||||||
evo_subsidy_summ?: number;
|
evo_subsidy_summ?: number;
|
||||||
evo_percent_subsidy?: number;
|
evo_percent_subsidy?: number;
|
||||||
evo_max_subsidy_summ?: number;
|
evo_max_subsidy_summ?: number;
|
||||||
@ -441,12 +408,7 @@ export interface IEvoSubsidy {
|
|||||||
accounts?: IAccount[];
|
accounts?: IAccount[];
|
||||||
}
|
}
|
||||||
|
|
||||||
type BaseEntity = {
|
export type TCRMEntity = IAccount &
|
||||||
__typename?: CRMEntityNames;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type TCRMEntity = BaseEntity &
|
|
||||||
IAccount &
|
|
||||||
ILead &
|
ILead &
|
||||||
IOpportunity &
|
IOpportunity &
|
||||||
IQuote &
|
IQuote &
|
||||||
|
|||||||
Reference in New Issue
Block a user