diff --git a/src/client/Components/Result.jsx b/src/client/Components/Result.jsx
index 2b6ed63..e2686f2 100644
--- a/src/client/Components/Result.jsx
+++ b/src/client/Components/Result.jsx
@@ -4,6 +4,6 @@ import React from 'react';
export default {
404: () => ,
500: () => (
-
+
),
};
diff --git a/src/client/Containers/Calculation/Results/index.jsx b/src/client/Containers/Calculation/Results/index.jsx
index 97bcae7..8f867e7 100644
--- a/src/client/Containers/Calculation/Results/index.jsx
+++ b/src/client/Containers/Calculation/Results/index.jsx
@@ -1,4 +1,3 @@
-import { Divider } from 'antd';
import { renderGroups } from 'client/Containers/Calculation/lib/renderSections';
import Background from 'client/Elements/Background';
import { Box, Flex } from 'client/UIKit/grid';
diff --git a/src/client/Containers/Calculation/lib/fetchData.js b/src/client/Containers/Calculation/lib/fetchData.js
deleted file mode 100644
index dc25cfe..0000000
--- a/src/client/Containers/Calculation/lib/fetchData.js
+++ /dev/null
@@ -1,137 +0,0 @@
-import { gql } from '@apollo/client';
-import { currentDate } from 'client/tools/date';
-import CalculationService from 'client/services/CalculationService';
-import CalculationStore from 'client/stores/CalculationStore';
-import { getUser } from 'client/tools/user';
-import initialOptions from 'core/Data/initialOptions';
-
-export default () =>
- new Promise((resolve, reject) => {
- getUser().then(({ UserName, DomainName }) => {
- Promise.all([
- CalculationService.getEntities({
- queries: initialOptions,
- }),
- CalculationService.crmgqlquery({
- 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_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
- }
- }
- `,
- variables: {
- statecode: 0,
- currentDate,
- },
- }),
- CalculationService.crmgqlquery({
- query: gql`
- query($username: String) {
- systemuser(domainname: $username) {
- evo_job_titleid
- businessunitid
- firstname
- lastname
- fullname
- }
- }
- `,
- variables: { username: `${DomainName}\\${UserName}` },
- }),
- CalculationService.getEntities({
- queries: [
- {
- //@ts-ignore
- alias: 'insuranceCompany',
- entityName: 'account',
- where: { evo_account_type: 100000002, statecode: 0 },
- fields: ['accountid', 'name', 'evo_type_ins_policy'],
- many: true,
- toOption: true,
- },
- ],
- }),
- ])
- .then(
- ([
- { entities: initialOptions },
- { entities: staticEntities },
- {
- entities: { systemuser },
- },
- { entities: insuranceCompanies },
- ]) => {
- CalculationStore.applyOptions(initialOptions);
- CalculationStore.applyStaticData(staticEntities);
- CalculationStore.applyStaticData({ systemuser: [systemuser] });
- CalculationStore.setTableColumns('tableInsurance')({
- options: { ...insuranceCompanies },
- });
-
- var supplierCurrency = CalculationStore.options.selectSupplierCurrency?.find(
- x => x.isocurrencycode === 'RUB',
- );
- if (supplierCurrency)
- CalculationStore.setValue(
- 'supplierCurrency',
- supplierCurrency.transactioncurrencyid,
- );
-
- resolve();
- },
- )
- .catch(err => {
- reject(err);
- throw err;
- });
- });
- });
diff --git a/src/client/Containers/Calculation/lib/fetchData/index.js b/src/client/Containers/Calculation/lib/fetchData/index.js
new file mode 100644
index 0000000..5ab0c45
--- /dev/null
+++ b/src/client/Containers/Calculation/lib/fetchData/index.js
@@ -0,0 +1,70 @@
+import CrmService from 'client/services/CrmService';
+import CalculationStore from 'client/stores/CalculationStore';
+import { currentDate } from 'client/tools/date';
+import { getUser } from 'client/tools/user';
+import insuranceQuery from './queries/insuranceQuery';
+import optionsQuery from './queries/optionsQuery';
+import staticDataQuery from './queries/staticDataQuery';
+import systemUserQuery from './queries/systemUserQuery';
+
+export default () =>
+ new Promise((resolve, reject) => {
+ getUser()
+ .then(({ UserName, DomainName }) => {
+ Promise.all([
+ CrmService.getEntities({
+ queries: optionsQuery,
+ }),
+ CrmService.crmgqlquery({
+ query: staticDataQuery,
+ variables: {
+ statecode: 0,
+ currentDate,
+ },
+ }),
+ CrmService.crmgqlquery({
+ query: systemUserQuery,
+ variables: { username: `${DomainName}\\${UserName}` },
+ }),
+ CrmService.getEntities({
+ queries: insuranceQuery,
+ }),
+ ])
+ .then(
+ ([
+ { entities: initialOptions },
+ { entities: staticEntities },
+ {
+ entities: { systemuser },
+ },
+ { entities: insuranceCompanies },
+ ]) => {
+ CalculationStore.applyOptions(initialOptions);
+ CalculationStore.applyStaticData(staticEntities);
+ CalculationStore.applyStaticData({ systemuser: [systemuser] });
+ CalculationStore.setTableColumns('tableInsurance')({
+ options: { ...insuranceCompanies },
+ });
+
+ var supplierCurrency = CalculationStore.options.selectSupplierCurrency?.find(
+ x => x.isocurrencycode === 'RUB',
+ );
+ if (supplierCurrency)
+ CalculationStore.setValue(
+ 'supplierCurrency',
+ supplierCurrency.transactioncurrencyid,
+ );
+
+ resolve();
+ },
+ )
+ .catch(err => {
+ reject(err);
+ throw err;
+ });
+ })
+ .catch(err => {
+ reject(err);
+ throw err;
+ });
+ });
diff --git a/src/client/Containers/Calculation/lib/fetchData/queries/insuranceQuery.ts b/src/client/Containers/Calculation/lib/fetchData/queries/insuranceQuery.ts
new file mode 100644
index 0000000..6feee58
--- /dev/null
+++ b/src/client/Containers/Calculation/lib/fetchData/queries/insuranceQuery.ts
@@ -0,0 +1,14 @@
+import { TEntityQuery } from 'core/types/Entities/query';
+const insuranceQuery: TEntityQuery[] = [
+ {
+ //@ts-ignore
+ alias: 'insuranceCompany',
+ entityName: 'account',
+ where: { evo_account_type: 100000002, statecode: 0 },
+ fields: ['accountid', 'name', 'evo_type_ins_policy'],
+ many: true,
+ toOption: true,
+ },
+];
+
+export default insuranceQuery;
diff --git a/src/core/Data/initialOptions.ts b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts
similarity index 99%
rename from src/core/Data/initialOptions.ts
rename to src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts
index 0127ec6..3e303a1 100644
--- a/src/core/Data/initialOptions.ts
+++ b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts
@@ -1,7 +1,7 @@
import { TEntityQuery } from 'core/types/Entities/query';
import { currentDate } from 'client/tools/date';
-const initialOptions: TEntityQuery[] = [
+const initialOptionsQuery: TEntityQuery[] = [
{
alias: 'selectLead',
entityName: 'lead',
@@ -453,4 +453,4 @@ const initialOptions: TEntityQuery[] = [
},
];
-export default initialOptions;
+export default initialOptionsQuery;
diff --git a/src/client/Containers/Calculation/lib/fetchData/queries/staticDataQuery.ts b/src/client/Containers/Calculation/lib/fetchData/queries/staticDataQuery.ts
new file mode 100644
index 0000000..706e762
--- /dev/null
+++ b/src/client/Containers/Calculation/lib/fetchData/queries/staticDataQuery.ts
@@ -0,0 +1,53 @@
+import { gql } from '@apollo/client';
+
+export default 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_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
+ }
+ }
+`;
diff --git a/src/client/Containers/Calculation/lib/fetchData/queries/systemUserQuery.ts b/src/client/Containers/Calculation/lib/fetchData/queries/systemUserQuery.ts
new file mode 100644
index 0000000..c14576e
--- /dev/null
+++ b/src/client/Containers/Calculation/lib/fetchData/queries/systemUserQuery.ts
@@ -0,0 +1,13 @@
+import { gql } from '@apollo/client';
+
+export default gql`
+ query($username: String) {
+ systemuser(domainname: $username) {
+ evo_job_titleid
+ businessunitid
+ firstname
+ lastname
+ fullname
+ }
+ }
+`;
diff --git a/src/core/constants/debounce.js b/src/client/constants/debounce.js
similarity index 100%
rename from src/core/constants/debounce.js
rename to src/client/constants/debounce.js
diff --git a/src/core/constants/errorMessages.js b/src/client/constants/errorMessages.js
similarity index 100%
rename from src/core/constants/errorMessages.js
rename to src/client/constants/errorMessages.js
diff --git a/src/client/hooks/Calculation/useValidation.ts b/src/client/hooks/Calculation/useValidation.ts
index 7e8478d..34fd755 100644
--- a/src/client/hooks/Calculation/useValidation.ts
+++ b/src/client/hooks/Calculation/useValidation.ts
@@ -1,7 +1,7 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { ValidateStatus } from 'antd/lib/form/FormItem';
-import { INVALID_INPUT as INVALID_INPUT_MESSAGE } from 'core/constants/errorMessages';
+import { INVALID_INPUT as INVALID_INPUT_MESSAGE } from 'client/constants/errorMessages';
import { ElementsNames } from 'core/types/Calculation/Store/elements';
import {
TableNames,
diff --git a/src/client/hooks/Calculation/useValue.js b/src/client/hooks/Calculation/useValue.js
index dc3e869..4c54d81 100644
--- a/src/client/hooks/Calculation/useValue.js
+++ b/src/client/hooks/Calculation/useValue.js
@@ -1,5 +1,5 @@
/* eslint-disable react-hooks/exhaustive-deps */
-import { DEFAULT_DEBOUNCE_DELAY } from 'core/constants/debounce';
+import { DEFAULT_DEBOUNCE_DELAY } from 'client/constants/debounce';
import { useEffect, useState } from 'react';
import { useDebounce } from 'use-debounce/lib';
import { useStores } from '../useStores';
diff --git a/src/client/services/CalculationService/index.ts b/src/client/services/CalculationService/index.ts
new file mode 100644
index 0000000..d72eb19
--- /dev/null
+++ b/src/client/services/CalculationService/index.ts
@@ -0,0 +1,46 @@
+import axios from 'axios';
+import { getServerUrl } from 'client/common/urls';
+import { CORE_PROXY_URL } from 'core/constants/urls';
+import { IGetCalculationRequest } from 'core/types/Calculation/Requests';
+import {
+ IGetCalculationResponse,
+ IGetUserResponse,
+} from 'core/types/Calculation/Responses';
+
+export default class {
+ static getUser = (): Promise =>
+ new Promise((resolve, reject) => {
+ axios
+ .get('/api/users/getUser')
+ .then(res => {
+ resolve(res.data);
+ })
+ .catch(err => {
+ reject(err);
+ });
+ });
+
+ static calculate = (
+ preparedData: IGetCalculationRequest,
+ ): Promise =>
+ new Promise((resolve, reject) => {
+ axios
+ .post(
+ getServerUrl(
+ '/proxy',
+ CORE_PROXY_URL,
+ '/api',
+ '/v1',
+ '/calculation',
+ '/calculate',
+ ),
+ preparedData,
+ )
+ .then(res => {
+ resolve(res.data);
+ })
+ .catch(err => {
+ reject(err);
+ });
+ });
+}
diff --git a/src/client/services/CrmService/client.ts b/src/client/services/CrmService/client.ts
new file mode 100644
index 0000000..dd4a22a
--- /dev/null
+++ b/src/client/services/CrmService/client.ts
@@ -0,0 +1,19 @@
+import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client';
+import { getServerUrl } from 'client/common/urls';
+import { CRM_URL, CRM_PROXY_URL } from 'core/constants/urls';
+
+export default new ApolloClient({
+ uri: CRM_URL,
+ cache: new InMemoryCache(),
+
+ link: new HttpLink({
+ uri: getServerUrl('/proxy', CRM_PROXY_URL),
+ }),
+
+ defaultOptions: {
+ query: {
+ fetchPolicy: 'no-cache',
+ errorPolicy: 'all',
+ },
+ },
+});
diff --git a/src/client/services/CalculationService.ts b/src/client/services/CrmService/index.ts
similarity index 77%
rename from src/client/services/CalculationService.ts
rename to src/client/services/CrmService/index.ts
index 7dc29e4..af0319e 100644
--- a/src/client/services/CalculationService.ts
+++ b/src/client/services/CrmService/index.ts
@@ -1,81 +1,23 @@
-import { ApolloClient, gql, HttpLink, InMemoryCache } from '@apollo/client';
+import { gql } from '@apollo/client';
import axios from 'axios';
import { getServerUrl } from 'client/common/urls';
-import { CORE_PROXY_URL, CRM_PROXY_URL, CRM_URL } from 'core/constants/urls';
-import { convertEntityToOption } from 'core/tools/entities';
-import { convertJSONToGQLQuery } from 'core/tools/query';
+import { CRM_PROXY_URL } from 'core/constants/urls';
+import { convertEntityToOption } from './tools/entity';
+import { convertJSONToGQLQuery } from './tools/query';
import {
- IGetCalculationRequest,
+ ICreateKpRequest,
IGetEntitiesRequest,
+ IMutateToCRMGQL,
IQueryToCRMGQL,
} from 'core/types/Calculation/Requests';
-import {
- IGetCalculationResponse,
- IGetEntitiesResponse,
- IGetUserResponse,
-} from 'core/types/Calculation/Responses';
+import { IGetEntitiesResponse } from 'core/types/Calculation/Responses';
import { IBaseOption } from 'core/types/Calculation/Store/options';
import { IQuote, TCRMEntity } from 'core/types/Entities/crmEntities';
import { TEntities } from 'core/types/Entities/crmEntityNames';
+import client from './client';
import { isPlural, singular } from 'pluralize';
-import {
- ICreateKpRequest,
- IMutateToCRMGQL,
-} from './../../core/types/Calculation/Requests';
-
-const client = new ApolloClient({
- uri: CRM_URL,
- cache: new InMemoryCache(),
-
- link: new HttpLink({
- uri: getServerUrl('/proxy', CRM_PROXY_URL),
- }),
-
- defaultOptions: {
- query: {
- fetchPolicy: 'no-cache',
- errorPolicy: 'all',
- },
- },
-});
-
-class CalculationService {
- static getUser = (): Promise =>
- new Promise((resolve, reject) => {
- axios
- .get('/api/users/getUser')
- .then(res => {
- resolve(res.data);
- })
- .catch(err => {
- throw err;
- });
- });
-
- static calculate = (
- preparedData: IGetCalculationRequest,
- ): Promise =>
- new Promise((resolve, reject) => {
- axios
- .post(
- getServerUrl(
- '/proxy',
- CORE_PROXY_URL,
- '/api',
- '/v1',
- '/calculation',
- '/calculate',
- ),
- preparedData,
- )
- .then(res => {
- resolve(res.data);
- })
- .catch(err => {
- reject(err);
- });
- });
+export default class {
static crmgqlquery = ({
query,
toOptions,
@@ -252,5 +194,3 @@ class CalculationService {
});
});
}
-
-export default CalculationService;
diff --git a/src/core/Data/propsMap.ts b/src/client/services/CrmService/propsMap.ts
similarity index 97%
rename from src/core/Data/propsMap.ts
rename to src/client/services/CrmService/propsMap.ts
index e2769a3..77a37a8 100644
--- a/src/core/Data/propsMap.ts
+++ b/src/client/services/CrmService/propsMap.ts
@@ -1,5 +1,5 @@
import { TCRMEntity } from 'core/types/Entities/crmEntities';
-import { TEntities } from '../types/Entities/crmEntityNames';
+import { TEntities } from 'core/types/Entities/crmEntityNames';
const propsMap: TEntities<{
name: keyof TCRMEntity;
diff --git a/src/core/tools/entities.ts b/src/client/services/CrmService/tools/entity.ts
similarity index 72%
rename from src/core/tools/entities.ts
rename to src/client/services/CrmService/tools/entity.ts
index 2f56b99..47c6c47 100644
--- a/src/core/tools/entities.ts
+++ b/src/client/services/CrmService/tools/entity.ts
@@ -1,7 +1,7 @@
-import propsMap from '../Data/propsMap';
-import { IBaseOption } from '../types/Calculation/Store/options';
-import { TCRMEntity } from '../types/Entities/crmEntities';
-import { CRMEntityNames } from '../types/Entities/crmEntityNames';
+import propsMap from '../propsMap';
+import { IBaseOption } from 'core/types/Calculation/Store/options';
+import { TCRMEntity } from 'core/types/Entities/crmEntities';
+import { CRMEntityNames } from 'core/types/Entities/crmEntityNames';
export function convertEntityToOption(
entity: TCRMEntity,
diff --git a/src/core/tools/query.ts b/src/client/services/CrmService/tools/query.ts
similarity index 94%
rename from src/core/tools/query.ts
rename to src/client/services/CrmService/tools/query.ts
index ef97a17..f8f929e 100644
--- a/src/core/tools/query.ts
+++ b/src/client/services/CrmService/tools/query.ts
@@ -1,10 +1,11 @@
+import { stringifyObject } from 'core/tools/string';
import {
+ ComparisonOperators,
+ TBaseEntityQuery,
+ TEntitiesKeys,
TEntityQuery,
TWhere,
- ComparisonOperators,
} from 'core/types/Entities/query';
-import { TBaseEntityQuery, TEntitiesKeys } from './../types/Entities/query';
-import { stringifyObject } from './string';
import { plural } from 'pluralize';
const convert = {
diff --git a/src/client/stores/CalculationStore/Data/tables.js b/src/client/stores/CalculationStore/Data/tables.js
index d135dbc..1929bb4 100644
--- a/src/client/stores/CalculationStore/Data/tables.js
+++ b/src/client/stores/CalculationStore/Data/tables.js
@@ -1,4 +1,4 @@
-import initialTables from 'core/config/initialTables';
+import initialTables from 'client/stores/CalculationStore/config/initialTables';
const tablesData = {
tables: initialTables,
diff --git a/src/client/stores/CalculationStore/Data/values.js b/src/client/stores/CalculationStore/Data/values.js
index bcf68dd..84bc694 100644
--- a/src/client/stores/CalculationStore/Data/values.js
+++ b/src/client/stores/CalculationStore/Data/values.js
@@ -1,7 +1,7 @@
-import initialFilters from 'core/config/initialFilters';
-import initialOptions from 'core/config/initialOptions';
-import initialStatuses from 'core/config/initialStatuses';
-import initialValues from 'core/config/initialValues';
+import initialFilters from 'client/stores/CalculationStore/config/initialFilters';
+import initialOptions from 'client/stores/CalculationStore/config/initialOptions';
+import initialStatuses from 'client/stores/CalculationStore/config/initialStatuses';
+import initialValues from 'client/stores/CalculationStore/config/initialValues';
const valuesData = {
values: initialValues,
diff --git a/src/client/stores/CalculationStore/Effects/action.ts b/src/client/stores/CalculationStore/Effects/action.ts
index 7c414e9..f5682a1 100644
--- a/src/client/stores/CalculationStore/Effects/action.ts
+++ b/src/client/stores/CalculationStore/Effects/action.ts
@@ -3,7 +3,7 @@ import { gql } from '@apollo/client';
import { message } from 'antd';
import { openNotification } from 'client/Elements/Notification';
import CalculationService from 'client/services/CalculationService';
-import { prepareCalculationData } from 'client/services/prepareData';
+import prepareCalculationData from './lib/prepareData';
import CalculationStore from 'client/stores/CalculationStore';
import { getUser } from 'client/tools/user';
import { TAction } from 'core/types/Calculation/Store/effect';
diff --git a/src/client/services/prepareData.ts b/src/client/stores/CalculationStore/Effects/lib/prepareData.ts
similarity index 99%
rename from src/client/services/prepareData.ts
rename to src/client/stores/CalculationStore/Effects/lib/prepareData.ts
index 1389f55..0ef39c1 100644
--- a/src/client/services/prepareData.ts
+++ b/src/client/stores/CalculationStore/Effects/lib/prepareData.ts
@@ -1,11 +1,11 @@
-import { calcPrice } from 'client/stores/CalculationStore/Effects/lib/tools';
+import { calcPrice } from './tools';
import valuesConstants from 'core/constants/values';
import { PaymentRow, PreparedValues } from 'core/types/Calculation/Prepare';
import { IGetCalculationRequest } from 'core/types/Calculation/Requests';
import { ICalculationStore } from 'core/types/Calculation/Store';
import { DateTime } from 'luxon';
-export const prepareCalculationData = ({
+export default ({
calculationStore,
}: {
calculationStore: ICalculationStore;
diff --git a/src/client/stores/CalculationStore/Effects/reaction.ts b/src/client/stores/CalculationStore/Effects/reaction.ts
index 1ddd130..c7089ac 100644
--- a/src/client/stores/CalculationStore/Effects/reaction.ts
+++ b/src/client/stores/CalculationStore/Effects/reaction.ts
@@ -1,13 +1,13 @@
+import { gql } from '@apollo/client';
import { openNotification } from 'client/Elements/Notification';
-import CalculationService from 'client/services/CalculationService';
+import CrmService from 'client/services/CrmService';
+import { currentDate } from 'client/tools/date';
import { shift, shiftRight } from 'core/tools/array';
import { IReactionEffect } from 'core/types/Calculation/Store/effect';
-import { Status } from 'core/types/statuses';
import { ITableCell, TableProps } from 'core/types/Calculation/Store/tables';
+import { Status } from 'core/types/statuses';
import { toJS } from 'mobx';
import { calcPrice, calculatePerc, calculateRub } from './lib/tools';
-import { gql } from '@apollo/client';
-import { currentDate } from 'client/tools/date';
const reactionEffects: IReactionEffect[] = [
calculationStore => ({
@@ -49,7 +49,7 @@ const reactionEffects: IReactionEffect[] = [
}
if (lead.leadid) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($leadid: Uuid) {
quote: quotes(evo_leadid: $leadid) {
@@ -88,7 +88,7 @@ const reactionEffects: IReactionEffect[] = [
}
if (lead.evo_agent_accountid) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($evo_agent_accountid: Uuid!) {
account(accountid: $evo_agent_accountid) {
@@ -123,7 +123,7 @@ const reactionEffects: IReactionEffect[] = [
}
if (lead.evo_double_agent_accountid) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($evo_double_agent_accountid: Uuid!) {
account(accountid: $evo_double_agent_accountid) {
@@ -158,7 +158,7 @@ const reactionEffects: IReactionEffect[] = [
}
if (lead.evo_broker_accountid) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($evo_broker_accountid: Uuid!) {
account(accountid: $evo_broker_accountid) {
@@ -190,7 +190,7 @@ const reactionEffects: IReactionEffect[] = [
}
if (lead.evo_fin_department_accountid) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($evo_fin_department_accountid: Uuid!) {
account(accountid: $evo_fin_department_accountid) {
@@ -272,7 +272,7 @@ const reactionEffects: IReactionEffect[] = [
);
} else {
if (opportunity.parentaccountid)
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($accountid: Uuid!) {
account(accountid: $accountid) {
@@ -300,7 +300,7 @@ const reactionEffects: IReactionEffect[] = [
);
if (lead) {
if (lead.customerid) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($customerid: Uuid!) {
account(accountid: $customerid) {
@@ -467,7 +467,7 @@ const reactionEffects: IReactionEffect[] = [
);
if (indAgentId)
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query(
$statecode: Int
@@ -528,7 +528,7 @@ const reactionEffects: IReactionEffect[] = [
);
if (doubleAgentId)
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query(
$statecode: Int
@@ -587,7 +587,7 @@ const reactionEffects: IReactionEffect[] = [
Status.Default,
);
if (calcFinDepartmentId)
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query(
$statecode: Int
@@ -647,7 +647,7 @@ const reactionEffects: IReactionEffect[] = [
);
if (calcBrokerId)
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query(
$statecode: Int
@@ -1317,7 +1317,7 @@ const reactionEffects: IReactionEffect[] = [
x => x.accountid === dealerId,
);
if (dealer) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($statecode: Int, $salonaccountid: Uuid!) {
account: salon_providers(
@@ -1378,7 +1378,7 @@ const reactionEffects: IReactionEffect[] = [
x => x.accountid === dealerPersonId,
);
if (dealerPerson && dealerPerson.evo_broker_accountid) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($accountid: Uuid!) {
account(accountid: $accountid) {
@@ -1427,7 +1427,7 @@ const reactionEffects: IReactionEffect[] = [
Status.Default,
);
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query(
$statecode: Int
@@ -1486,7 +1486,7 @@ const reactionEffects: IReactionEffect[] = [
Status.Default,
);
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query(
$statecode: Int
@@ -1720,7 +1720,7 @@ const reactionEffects: IReactionEffect[] = [
x => x.evo_brandid === brandId,
);
if (brand) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($statecode: Int, $evo_brandid: Uuid) {
evo_model: evo_models(
@@ -1773,7 +1773,7 @@ const reactionEffects: IReactionEffect[] = [
x => x.evo_modelid === modelId,
);
if (model) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($statecode: Int, $evo_modelid: Uuid) {
evo_equipment: evo_equipments(
@@ -2849,7 +2849,7 @@ const reactionEffects: IReactionEffect[] = [
x => x.accountid === supplierId,
);
if (supplier && supplier.evo_fin_department_accountid)
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($accountid: Uuid!) {
account(accountid: $accountid) {
@@ -2882,7 +2882,7 @@ const reactionEffects: IReactionEffect[] = [
calculationStore.setOptions('selectAgent', []);
calculationStore.setValue('agent', null);
if (channelId === 100000002) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query(
$statecode: Int
@@ -2912,7 +2912,7 @@ const reactionEffects: IReactionEffect[] = [
});
} else {
if (supplierId) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($statecode: Int, $salonaccountid: Uuid!) {
account: salon_agents(
@@ -2978,7 +2978,7 @@ const reactionEffects: IReactionEffect[] = [
x => x.evo_gps_brandid === GPSBrandId,
);
if (gpsBrand) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($statecode: Int, $evo_gps_brandid: Uuid) {
evo_gps_model: evo_gps_models(
@@ -3030,7 +3030,7 @@ const reactionEffects: IReactionEffect[] = [
x => x.evo_regionid === regionRegistrationId,
);
if (regionRegistration) {
- CalculationService.crmgqlquery({
+ CrmService.crmgqlquery({
query: gql`
query($statecode: Int, $evo_regionid: Uuid) {
evo_town: evo_towns(
diff --git a/src/core/config/initialFilters.ts b/src/client/stores/CalculationStore/config/initialFilters.ts
similarity index 100%
rename from src/core/config/initialFilters.ts
rename to src/client/stores/CalculationStore/config/initialFilters.ts
diff --git a/src/core/config/initialOptions.ts b/src/client/stores/CalculationStore/config/initialOptions.ts
similarity index 97%
rename from src/core/config/initialOptions.ts
rename to src/client/stores/CalculationStore/config/initialOptions.ts
index b687c3b..7d9f0a8 100644
--- a/src/core/config/initialOptions.ts
+++ b/src/client/stores/CalculationStore/config/initialOptions.ts
@@ -1,5 +1,5 @@
-import { TElements } from '../types/Calculation/Store/elements';
-import { IBaseOption } from '../types/Calculation/Store/options';
+import { TElements } from 'core/types/Calculation/Store/elements';
+import { IBaseOption } from 'core/types/Calculation/Store/options';
const initialOptions: TElements = {
selectChannel: [
diff --git a/src/core/config/initialStatuses.ts b/src/client/stores/CalculationStore/config/initialStatuses.ts
similarity index 100%
rename from src/core/config/initialStatuses.ts
rename to src/client/stores/CalculationStore/config/initialStatuses.ts
diff --git a/src/core/config/initialTables/index.ts b/src/client/stores/CalculationStore/config/initialTables/index.ts
similarity index 100%
rename from src/core/config/initialTables/index.ts
rename to src/client/stores/CalculationStore/config/initialTables/index.ts
diff --git a/src/core/config/initialTables/tableInsurance.ts b/src/client/stores/CalculationStore/config/initialTables/tableInsurance.ts
similarity index 100%
rename from src/core/config/initialTables/tableInsurance.ts
rename to src/client/stores/CalculationStore/config/initialTables/tableInsurance.ts
diff --git a/src/core/config/initialTables/tablePayments.ts b/src/client/stores/CalculationStore/config/initialTables/tablePayments.ts
similarity index 100%
rename from src/core/config/initialTables/tablePayments.ts
rename to src/client/stores/CalculationStore/config/initialTables/tablePayments.ts
diff --git a/src/core/config/initialTables/tableResults.ts b/src/client/stores/CalculationStore/config/initialTables/tableResults.ts
similarity index 100%
rename from src/core/config/initialTables/tableResults.ts
rename to src/client/stores/CalculationStore/config/initialTables/tableResults.ts
diff --git a/src/core/config/initialValues.ts b/src/client/stores/CalculationStore/config/initialValues.ts
similarity index 100%
rename from src/core/config/initialValues.ts
rename to src/client/stores/CalculationStore/config/initialValues.ts