organize exports pt 2
This commit is contained in:
parent
4a71384fcd
commit
9e225d897e
45
apps/web/config/process/default.ts
Normal file
45
apps/web/config/process/default.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import * as bonuses from '@/process/bonuses';
|
||||
import * as calculate from '@/process/calculate';
|
||||
import * as configurator from '@/process/configurator';
|
||||
import * as createKP from '@/process/create-kp';
|
||||
import * as fingap from '@/process/fingap';
|
||||
import { useProcess } from '@/process/hooks';
|
||||
import * as leadOpportunity from '@/process/lead-opportunity';
|
||||
import * as leasingObject from '@/process/leasing-object';
|
||||
import * as leasingWithoutKasko from '@/process/leasing-without-kasko';
|
||||
import * as loadKP from '@/process/load-kp';
|
||||
import * as payments from '@/process/payments';
|
||||
import * as price from '@/process/price';
|
||||
import * as subsidy from '@/process/subsidy';
|
||||
import * as subsidyImportProgram from '@/process/subsidy-import-program';
|
||||
import * as supplierAgent from '@/process/supplier-agent';
|
||||
import * as usedPl from '@/process/used-pl';
|
||||
|
||||
export default function useReactions() {
|
||||
useProcess(leadOpportunity.common);
|
||||
useProcess(leadOpportunity.urls);
|
||||
useProcess(loadKP.common);
|
||||
useProcess(calculate.common);
|
||||
useProcess(calculate.validation);
|
||||
useProcess(supplierAgent.common);
|
||||
useProcess(supplierAgent.validation);
|
||||
useProcess(price.common);
|
||||
useProcess(price.computed);
|
||||
useProcess(price.validation);
|
||||
useProcess(fingap.common);
|
||||
useProcess(fingap.validation);
|
||||
useProcess(loadKP.common);
|
||||
useProcess(leasingWithoutKasko.common);
|
||||
useProcess(subsidy.common);
|
||||
useProcess(leasingObject.common);
|
||||
useProcess(leasingObject.validation);
|
||||
useProcess(configurator.filters);
|
||||
useProcess(configurator.values);
|
||||
useProcess(configurator.validation);
|
||||
useProcess(createKP.common);
|
||||
useProcess(bonuses.common);
|
||||
useProcess(bonuses.validation);
|
||||
useProcess(usedPl.common);
|
||||
useProcess(subsidyImportProgram.common);
|
||||
useProcess(payments.common);
|
||||
}
|
||||
1
apps/web/config/process/index.ts
Normal file
1
apps/web/config/process/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { default as useDefaultReactions } from './default';
|
||||
@ -3,16 +3,14 @@ import initializeApollo from '@/apollo/client';
|
||||
import * as Calculation from '@/Components/Calculation';
|
||||
import { CRMError } from '@/Components/Common/Error';
|
||||
import Output from '@/Components/Output';
|
||||
import * as getData from '@/process/init/get-data';
|
||||
import { useReactions } from '@/process/init/inject-reactions/hooks';
|
||||
import { useDefaultReactions } from '@/config/process';
|
||||
import * as init from '@/process/init';
|
||||
import { min } from '@/styles/mq';
|
||||
import { dehydrate, QueryClient } from '@tanstack/react-query';
|
||||
import Head from 'next/head';
|
||||
import styled from 'styled-components';
|
||||
import { Box } from 'ui/grid';
|
||||
|
||||
const { getInitialData, useInsuranceData, useMainData } = getData;
|
||||
|
||||
const Grid = styled(Box)`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -38,9 +36,9 @@ const Grid = styled(Box)`
|
||||
`;
|
||||
|
||||
function Home({ error }) {
|
||||
useMainData();
|
||||
useInsuranceData();
|
||||
useReactions();
|
||||
init.useMainData();
|
||||
init.useInsuranceData();
|
||||
useDefaultReactions();
|
||||
|
||||
if (error) return <CRMError error={error} />;
|
||||
|
||||
@ -71,7 +69,7 @@ export const getServerSideProps = async ({ req }) => {
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
try {
|
||||
const { values, options } = await getInitialData(apolloClient, user);
|
||||
const { values, options } = await init.getInitialData(apolloClient, user);
|
||||
|
||||
return {
|
||||
props: {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type { ReactionsContext } from '../../types';
|
||||
import type { ProcessContext } from '../../types';
|
||||
import helper from './lib/helper';
|
||||
import { makeDisposable } from '@/../../packages/tools';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
@ -9,7 +9,7 @@ import { reaction } from 'mobx';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
export default function reactions(context: ReactionsContext) {
|
||||
export default function reactions(context: ProcessContext) {
|
||||
const { store, apolloClient } = context;
|
||||
const { $calculation, $process } = store;
|
||||
const { getCoefficient } = helper(context);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type { ReactionsContext } from '../../../types';
|
||||
import type { ProcessContext } from '../../../types';
|
||||
import { getUser } from '@/api/user/query';
|
||||
import type { ElementsTypes } from '@/Components/Calculation/config/map/values';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
@ -8,7 +8,7 @@ import dayjs from 'dayjs';
|
||||
|
||||
export type ProductId = ElementsTypes['selectProduct'];
|
||||
|
||||
export default function helper({ apolloClient, queryClient }: ReactionsContext) {
|
||||
export default function helper({ apolloClient, queryClient }: ProcessContext) {
|
||||
return {
|
||||
async getCoefficient(productId: ProductId) {
|
||||
if (!productId) {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import helper from './lib/helper';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import { round } from 'tools';
|
||||
|
||||
export default function reactions(context: ReactionsContext) {
|
||||
export default function reactions(context: ProcessContext) {
|
||||
const { store } = context;
|
||||
const { $calculation } = store;
|
||||
const { getCoefficient } = helper(context);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import { formatter } from 'tools';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import types from '@/Components/Calculation/config/elements-types';
|
||||
import type * as Values from '@/Components/Calculation/config/map/values';
|
||||
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import type { BaseOption } from 'ui/elements/types';
|
||||
|
||||
@ -13,7 +13,7 @@ function hasInvalidValueOrOptions(value: unknown, options: Array<BaseOption<unkn
|
||||
return (value && !options?.length) || !options.some((x) => x.value === value);
|
||||
}
|
||||
|
||||
export default function reactions({ store }: ReactionsContext) {
|
||||
export default function reactions({ store }: ProcessContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { radioGraphType, selectSeasonType } from '@/config/default-options';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { SEASON_TYPES } from '@/process/payments/lib/seasons-constants';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
@ -11,7 +11,7 @@ import { normalizeOptions } from 'tools';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
/**
|
||||
* На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
@ -8,7 +8,7 @@ import { makeDisposable, normalizeOptions } from 'tools';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
export default function valuesReactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function valuesReactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { ReactionsContext } from '../types';
|
||||
import type { ProcessContext } from '../types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export function common({ store }: ReactionsContext) {
|
||||
export function common({ store }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -4,7 +4,7 @@ import type { RequestFinGAP } from '@/api/core/types';
|
||||
import type { Risk } from '@/Components/Calculation/Form/Insurance/FinGAPTable/types';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import type * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import dayjs from 'dayjs';
|
||||
@ -14,7 +14,7 @@ import { flatten } from 'tools/object';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
export default function reactions({ store, apolloClient, queryClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
// Расчет итоговой суммы ФинГАП и запись в таблицу страхования
|
||||
reaction(
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export default function reactions({ store }: ReactionsContext) {
|
||||
export default function reactions({ store }: ProcessContext) {
|
||||
const { $tables } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import injectDefaultReactions from './default';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { trpcPureClient } from '@/trpc/client';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
export function useReactions() {
|
||||
export function useProcess(reactions: (context: ProcessContext) => void) {
|
||||
const store = useStore();
|
||||
const apolloClient = useApolloClient();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
injectDefaultReactions({
|
||||
reactions({
|
||||
apolloClient,
|
||||
queryClient,
|
||||
store,
|
||||
@ -1,3 +0,0 @@
|
||||
export { getInitialData } from './get-initial-data';
|
||||
export { useInsuranceData } from './get-insurance-data';
|
||||
export { useMainData } from './get-main-data';
|
||||
3
apps/web/process/init/index.js
Normal file
3
apps/web/process/init/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './get-initial-data';
|
||||
export * from './get-insurance-data';
|
||||
export * from './get-main-data';
|
||||
@ -1,42 +0,0 @@
|
||||
import * as bonuses from '../../bonuses';
|
||||
import * as calculate from '../../calculate';
|
||||
import * as configurator from '../../configurator';
|
||||
import * as createKP from '../../create-kp';
|
||||
import * as fingap from '../../fingap';
|
||||
import * as leadOpportunity from '../../lead-opportunity';
|
||||
import * as leasingObject from '../../leasing-object';
|
||||
import * as leasingWithoutKasko from '../../leasing-without-kasko';
|
||||
import * as loadKP from '../../load-kp';
|
||||
import * as price from '../../price';
|
||||
import * as subsidy from '../../subsidy';
|
||||
import * as subsidyImportProgram from '../../subsidy-import-program';
|
||||
import * as agents from '../../supplier-agent';
|
||||
import * as usedPl from '../../used-pl';
|
||||
|
||||
export default function injectDefaultReactions(context) {
|
||||
leadOpportunity.common(context);
|
||||
leadOpportunity.urls(context);
|
||||
loadKP.common(context);
|
||||
calculate.validation(context);
|
||||
calculate.common(context);
|
||||
agents.common(context);
|
||||
agents.validation(context);
|
||||
price.computed(context);
|
||||
price.common(context);
|
||||
price.validation(context);
|
||||
fingap.common(context);
|
||||
fingap.validation(context);
|
||||
loadKP.common(context);
|
||||
leasingWithoutKasko.common(context);
|
||||
subsidy.common(context);
|
||||
leasingObject.common(context);
|
||||
leasingObject.validation(context);
|
||||
configurator.filters(context);
|
||||
configurator.values(context);
|
||||
configurator.validation(context);
|
||||
createKP.common(context);
|
||||
bonuses.common(context);
|
||||
bonuses.validation(context);
|
||||
usedPl.common(context);
|
||||
subsidyImportProgram.common(context);
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import { normalizeOptions } from 'tools/entity';
|
||||
import { makeDisposable } from 'tools/mobx';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable no-negated-condition */
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import type { DocumentNode } from '@apollo/client';
|
||||
import { gql } from '@apollo/client';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import { intersects } from 'radash';
|
||||
import { normalizeOptions } from 'tools';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { autorun, reaction } from 'mobx';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
@ -42,7 +42,7 @@ const QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export function common({ store, apolloClient }: ReactionsContext) {
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import extend from '@/stores/tables/insurance/tools';
|
||||
import { reaction } from 'mobx';
|
||||
import message from 'ui/elements/message';
|
||||
|
||||
const key = 'KP_LOADING_INFO';
|
||||
|
||||
export function common({ store, trpcClient }: ReactionsContext) {
|
||||
export function common({ store, trpcClient }: ProcessContext) {
|
||||
const { $calculation, $process, $tables } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -2,7 +2,7 @@ import * as seasonsConstants from '../lib/seasons-constants';
|
||||
import * as seasonsTools from '../lib/seasons-tools';
|
||||
import { selectHighSeasonStart } from '@/config/default-options';
|
||||
import { MIN_PAYMENT } from '@/constants/values';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import type { Row } from '@/stores/tables/payments/types';
|
||||
import { comparer, reaction, toJS } from 'mobx';
|
||||
import { shift } from 'radash';
|
||||
@ -20,7 +20,7 @@ const {
|
||||
const { DEFAULT_SEASONS_VALUES, FORBIDDEN_HIGH_SEASON_START, SEASONS_PERIOD_NUMBER } =
|
||||
seasonsConstants;
|
||||
|
||||
export default function reactions({ store }: ReactionsContext) {
|
||||
export default function reactions({ store }: ProcessContext) {
|
||||
const { $calculation, $tables, $process } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import validatePaymentsTable from '../lib/validation';
|
||||
import { MIN_LASTPAYMENT_NSIB } from '@/constants/values';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { comparer, reaction, toJS } from 'mobx';
|
||||
|
||||
export default function reactions({ store }: ReactionsContext) {
|
||||
export default function reactions({ store }: ProcessContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
|
||||
const validationHelper = new ValidationHelper();
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { VAT } from '@/constants/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import { makeDisposable } from 'tools';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { autorun } from 'mobx';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
autorun(
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { VAT } from '@/constants/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import { round } from 'tools';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ReactionsContext) {
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/* eslint-disable no-negated-condition */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type { ReactionsContext } from '../types';
|
||||
import type { ProcessContext } from '../types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export function common({ store, apolloClient }: ReactionsContext) {
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
/**
|
||||
@ -19,7 +19,7 @@ import { reaction } from 'mobx';
|
||||
*/
|
||||
/* eslint-enable */
|
||||
|
||||
export function common({ store, apolloClient }: ReactionsContext) {
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import * as createReactions from '../lib/create-reactions';
|
||||
import * as fillAgentsFromLead from '../lib/fill-agents-from-lead';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { autorun, reaction } from 'mobx';
|
||||
@ -29,7 +29,7 @@ class Helper {
|
||||
};
|
||||
}
|
||||
|
||||
export function common({ store, apolloClient }: ReactionsContext) {
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
/**
|
||||
@ -522,7 +522,7 @@ export function common({ store, apolloClient }: ReactionsContext) {
|
||||
}
|
||||
}
|
||||
|
||||
export function validation({ store, apolloClient }: ReactionsContext) {
|
||||
export function validation({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
validateAgentRewardSumm(store, apolloClient, {
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import * as agents from './agents';
|
||||
import * as leaseback from './leaseback';
|
||||
import * as supplier from './supplier';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
|
||||
function common(context: ReactionsContext) {
|
||||
function common(context: ProcessContext) {
|
||||
agents.common(context);
|
||||
leaseback.common(context);
|
||||
supplier.common(context);
|
||||
}
|
||||
|
||||
function validation(context: ReactionsContext) {
|
||||
function validation(context: ProcessContext) {
|
||||
agents.validation(context);
|
||||
supplier.validation(context);
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { autorun, reaction } from 'mobx';
|
||||
|
||||
export function common({ store, apolloClient }: ReactionsContext) {
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
/**
|
||||
* Дополнить реакцию на изменение поля Салон приобретения selectDealer:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as createReactions from '../lib/create-reactions';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ReactionsContext } from '@/process/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
@ -9,7 +9,7 @@ import { normalizeOptions } from 'tools/entity';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
export function common({ store, apolloClient }: ReactionsContext) {
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
/**
|
||||
@ -158,7 +158,7 @@ export function common({ store, apolloClient }: ReactionsContext) {
|
||||
);
|
||||
}
|
||||
|
||||
export function validation({ store, apolloClient }: ReactionsContext) {
|
||||
export function validation({ store, apolloClient }: ProcessContext) {
|
||||
createReactions.validateAgentRewardSumm(store, apolloClient, {
|
||||
rewardConditionField: 'selectDealerRewardCondition',
|
||||
rewardSummField: 'tbxDealerRewardSumm',
|
||||
|
||||
@ -3,7 +3,7 @@ import type { TRPCPureClient } from '@/trpc/types';
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
import type { QueryClient } from '@tanstack/react-query';
|
||||
|
||||
export type ReactionsContext = {
|
||||
export type ProcessContext = {
|
||||
apolloClient: ApolloClient<object>;
|
||||
queryClient: QueryClient;
|
||||
store: RootStore;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type { ReactionsContext } from '../types';
|
||||
import type { ProcessContext } from '../types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export function common({ store, apolloClient }: ReactionsContext) {
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
/**
|
||||
|
||||
@ -6,7 +6,7 @@ import * as bonuses from '@/process/bonuses';
|
||||
import * as configurator from '@/process/configurator';
|
||||
import * as fingapProcess from '@/process/fingap';
|
||||
import * as leasingObject from '@/process/leasing-object';
|
||||
import { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } from '@/process/load-kp';
|
||||
import * as loadKP from '@/process/load-kp';
|
||||
import * as paymentsProcess from '@/process/payments';
|
||||
import * as price from '@/process/price';
|
||||
import * as supplierAgent from '@/process/supplier-agent';
|
||||
@ -15,6 +15,8 @@ import { shake } from 'radash';
|
||||
const DEFAULT_OSAGO_ROW = defaultInsuranceValues.find((x) => x.key === 'osago');
|
||||
const DEFAULT_KASKO_ROW = defaultInsuranceValues.find((x) => x.key === 'kasko');
|
||||
|
||||
const { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } = loadKP;
|
||||
|
||||
const quoteRouter = t.router({
|
||||
getData: t.procedure
|
||||
.input(GetQuoteDataInputSchema)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user