diff --git a/.env b/.env index b47d5a6..d630622 100644 --- a/.env +++ b/.env @@ -8,4 +8,5 @@ USERS_SUPER=["akalinina","vchikalkin"] ####### URLS ######## URL_GET_USER_DIRECT= URL_CRM_GRAPHQL_DIRECT= -URL_CORE_FINGAP_DIRECT= \ No newline at end of file +URL_CORE_FINGAP_DIRECT= +URL_1C_TRANSTAX_DIRECT= \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index f1660f3..a0e6f3e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,7 +14,8 @@ "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll": true, - "source.fixAll.eslint": true + "source.fixAll.eslint": true, + "source.removeUnusedImports": true }, "workbench.editor.labelFormat": "short", "eslint.workingDirectories": [{ "directory": "apps/web", "changeProcessCWD": true }], diff --git a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx index 74d61fb..8b9d71a 100644 --- a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx +++ b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx @@ -49,7 +49,7 @@ export const columns: ColumnsType = [ min={0} parser={parser} precision={2} - step={1_000} + step={1000} /> ); }, diff --git a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/hooks.js b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/hooks.js index 4dfd576..4ee4c53 100644 --- a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/hooks.js +++ b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/hooks.js @@ -13,7 +13,7 @@ export function useInsuranceValue(key, valueName) { const [value, setValue] = useState(storeValue); - const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1_000 }); + const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1000 }); useEffect(() => { if (storeValue !== value) { diff --git a/apps/web/Components/Calculation/Form/LeasingObject/config.ts b/apps/web/Components/Calculation/Form/LeasingObject/config.ts index f54f62f..232b605 100644 --- a/apps/web/Components/Calculation/Form/LeasingObject/config.ts +++ b/apps/web/Components/Calculation/Form/LeasingObject/config.ts @@ -14,5 +14,5 @@ export const rows: FormTabRows = [ [['tbxLeaseObjectCount', 'selectEngineType', 'tbxMaxSpeed']], [['tbxLeaseObjectYear', 'tbxLeaseObjectMotorPower', 'tbxCountSeats']], [['selectLeaseObjectCategory', 'tbxEngineVolume', 'tbxMileage']], - [['tbxMaxMass', 'tbxEngineHours']], + [['tbxMaxMass', 'tbxEngineHours', 'tbxVIN']], ]; diff --git a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx index 391e807..ba50492 100644 --- a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx +++ b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx @@ -24,14 +24,7 @@ export const columns: ColumnsType = [ render: (_value, payment) => { const Component = buildValueComponent(payment.num, InputNumber); - return ( - - ); + return ; }, }, ]; diff --git a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/hooks.js b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/hooks.js index 4cb3295..0d7f308 100644 --- a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/hooks.js +++ b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/hooks.js @@ -6,7 +6,7 @@ export function usePaymentValue(index) { const [storeValue, setStoreValue] = useRowValue(index); const [value, setValue] = useState(storeValue); - const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1_000 }); + const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1000 }); useEffect(() => { if (storeValue !== value) { diff --git a/apps/web/Components/Calculation/builders/build-action.tsx b/apps/web/Components/Calculation/builders/build-action.tsx index 2cd6282..37df9e1 100644 --- a/apps/web/Components/Calculation/builders/build-action.tsx +++ b/apps/web/Components/Calculation/builders/build-action.tsx @@ -10,14 +10,14 @@ type BuilderProps = { export default function buildAction( Component: ComponentType, - { elementName, valueName: actionName }: BuilderProps + { elementName, valueName: processName }: BuilderProps ) { return observer((props: T) => { const status = useStatus(elementName); return ( import(`process/${actionName}`).then((module) => module.default())} + action={() => import(`process/${processName}/action`).then((module) => module.action())} status={status} {...props} /> diff --git a/apps/web/Components/Calculation/builders/hooks.js b/apps/web/Components/Calculation/builders/hooks.js index baaf214..60958fd 100644 --- a/apps/web/Components/Calculation/builders/hooks.js +++ b/apps/web/Components/Calculation/builders/hooks.js @@ -6,7 +6,7 @@ export function useStoreValue(valueName) { const [storeValue, setStoreValue] = useValue(valueName); const [value, setValue] = useState(storeValue); - const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1_000 }); + const debouncedSetStoreValue = useDebouncedCallback(setStoreValue, 350, { maxWait: 1000 }); useEffect(() => { if (storeValue !== value) { diff --git a/apps/web/Components/Calculation/config/elements-components.ts b/apps/web/Components/Calculation/config/elements-components.ts index 6e9b5ed..52f00df 100644 --- a/apps/web/Components/Calculation/config/elements-components.ts +++ b/apps/web/Components/Calculation/config/elements-components.ts @@ -133,6 +133,7 @@ const components = wrapComponentsMap({ tbxMinPriceChange: e.InputNumber, tbxBonusCoefficient: e.InputNumber, selectLeasingWithoutKasko: e.Select, + tbxVIN: e.Input, /** Readonly Elements */ labelLeaseObjectRisk: e.Text, diff --git a/apps/web/Components/Calculation/config/elements-props.ts b/apps/web/Components/Calculation/config/elements-props.tsx similarity index 98% rename from apps/web/Components/Calculation/config/elements-props.ts rename to apps/web/Components/Calculation/config/elements-props.tsx index 332a35c..e4933e5 100644 --- a/apps/web/Components/Calculation/config/elements-props.ts +++ b/apps/web/Components/Calculation/config/elements-props.tsx @@ -48,7 +48,7 @@ const props: Partial = { precision: 2, parser, formatter, - addonAfter: '₽', + addonAfter: CurrencyAddon, }, tbxSupplierDiscountPerc: { min: 0, @@ -199,7 +199,7 @@ const props: Partial = { }, tbxEngineVolume: { min: 0, - max: 99.999_9, + max: 99.9999, step: 0.5, precision: 4, parser, @@ -217,8 +217,8 @@ const props: Partial = { tbxCountSeats: { min: 0, max: 2000, + precision: 0, parser, - formatter, }, tbxMaxSpeed: { min: 0, @@ -356,7 +356,7 @@ const props: Partial = { tbxIRR_Perc: { min: 0, max: 500, - step: 0.000_1, + step: 0.0001, precision: 6, parser, formatter: formatterExtra, @@ -365,7 +365,7 @@ const props: Partial = { linkDownloadKp: { type: 'primary', text: 'Скачать КП', - icon: DownloadOutlined, + icon: , }, tbxMileage: { min: 0, diff --git a/apps/web/Components/Calculation/config/elements-render/override.tsx b/apps/web/Components/Calculation/config/elements-render/override.tsx index d13e504..ad30059 100644 --- a/apps/web/Components/Calculation/config/elements-render/override.tsx +++ b/apps/web/Components/Calculation/config/elements-render/override.tsx @@ -7,8 +7,10 @@ import map from '../map'; import type { RenderProps } from './types'; import { Container, Head } from '@/Components/Layout/Element'; import { useStore } from '@/stores/hooks'; +import { useIsFetching } from '@tanstack/react-query'; import { observer } from 'mobx-react-lite'; import type { ComponentProps } from 'react'; +import { LoadingOutlined } from 'ui/elements/icons'; import Link from 'ui/elements/Link'; import Tooltip from 'ui/elements/Tooltip'; @@ -192,14 +194,24 @@ const overrideRender: Partial> = { valueName, }); - return ( - - - - - - - ); + function RenderedComponent() { + const isFetching = useIsFetching({ queryKey: ['1c', 'trans-tax'] }); + + return ( + + + + } + /> + + + ); + } + + return ; }, }, }; diff --git a/apps/web/Components/Calculation/config/elements-titles.ts b/apps/web/Components/Calculation/config/elements-titles.ts index d6d9e15..ef7dd2a 100644 --- a/apps/web/Components/Calculation/config/elements-titles.ts +++ b/apps/web/Components/Calculation/config/elements-titles.ts @@ -127,6 +127,7 @@ const titles: Record = { tbxVATInLeaseObjectPrice: 'НДС в стоимости ПЛ', tbxBonusCoefficient: 'Коэффициент снижения бонуса', selectLeasingWithoutKasko: 'Лизинг без КАСКО', + tbxVIN: 'VIN', /** Link Elements */ linkDownloadKp: '', diff --git a/apps/web/Components/Calculation/config/elements-types.ts b/apps/web/Components/Calculation/config/elements-types.ts index c2ec977..3fdc4ed 100644 --- a/apps/web/Components/Calculation/config/elements-types.ts +++ b/apps/web/Components/Calculation/config/elements-types.ts @@ -164,6 +164,7 @@ const types = wrapElementsTypes({ radioTypePTS: t.Options, tbxBonusCoefficient: t.Value, selectLeasingWithoutKasko: t.Options, + tbxVIN: t.Value, labelLeaseObjectRisk: t.Readonly, tbxInsKaskoPriceLeasePeriod: t.Readonly, diff --git a/apps/web/Components/Calculation/config/map/values.ts b/apps/web/Components/Calculation/config/map/values.ts index c2d541e..ed7a9fd 100644 --- a/apps/web/Components/Calculation/config/map/values.ts +++ b/apps/web/Components/Calculation/config/map/values.ts @@ -130,6 +130,7 @@ const elementsToValues = wrapElementsMap({ selectFuelCard: 'fuelCard', tbxMinPriceChange: 'minPriceChange', tbxBonusCoefficient: 'bonusCoefficient', + tbxVIN: 'vin', /** Readonly Elements */ labelLeaseObjectRisk: 'leaseObjectRiskName', diff --git a/apps/web/api/1c/query.ts b/apps/web/api/1c/query.ts new file mode 100644 index 0000000..820d387 --- /dev/null +++ b/apps/web/api/1c/query.ts @@ -0,0 +1,12 @@ +import type { RequestTransTax, ResponseTransTax } from './types'; +import getUrls from '@/config/urls'; +import type { QueryFunctionContext } from '@tanstack/react-query'; +import axios from 'axios'; + +const { URL_1C_TRANSTAX } = getUrls(); + +export async function getTransTax(payload: RequestTransTax, { signal }: QueryFunctionContext) { + const { data } = await axios.post(URL_1C_TRANSTAX, payload, { signal }); + + return data; +} diff --git a/apps/web/api/1c/types.ts b/apps/web/api/1c/types.ts new file mode 100644 index 0000000..8bff49c --- /dev/null +++ b/apps/web/api/1c/types.ts @@ -0,0 +1,11 @@ +export type RequestTransTax = { + OKTMO: string; + calcDate: Date; + carCategory: string; + power: number; + year: number; +}; +export type ResponseTransTax = { + error: string; + tax: number; +}; diff --git a/apps/web/api/user/query.ts b/apps/web/api/user/query.ts index e19a7e3..dfc6aab 100644 --- a/apps/web/api/user/query.ts +++ b/apps/web/api/user/query.ts @@ -6,6 +6,6 @@ import axios from 'axios'; const { URL_GET_USER } = getUrls(); -export async function getUser(config: AxiosRequestConfig) { +export async function getUser(config?: AxiosRequestConfig) { return await axios.get(URL_GET_USER, config).then((res) => love(res.data)); } diff --git a/apps/web/config/default-options.ts b/apps/web/config/default-options.ts index 417a93b..3951f64 100644 --- a/apps/web/config/default-options.ts +++ b/apps/web/config/default-options.ts @@ -67,10 +67,36 @@ export const radioGraphType = [ { label: 'легкий старт', value: 100_000_004, - disabled: true, }, ]; +export const selectObjectCategoryTax = [ + 'M1', + 'M2', + 'M3', + 'M1G', + 'M2G', + 'M3G', + 'N1', + 'N2', + 'N3', + 'N1G', + 'N2G', + 'N3G', + 'O1', + 'O2', + 'O3', + 'O4', + 'L1', + 'L2', + 'L3', + 'L4', + 'L5', +].map((label, i) => ({ + label, + value: 100_000_000 + i, +})); + const defaultOptions: CalculationOptions = { radioLastPaymentRule: [ { @@ -345,32 +371,7 @@ const defaultOptions: CalculationOptions = { value: 100_000_001, }, ], - selectObjectCategoryTax: [ - 'M1', - 'M2', - 'M3', - 'M1G', - 'M2G', - 'M3G', - 'N1', - 'N2', - 'N3', - 'N1G', - 'N2G', - 'N3G', - 'O1', - 'O2', - 'O3', - 'O4', - 'L1', - 'L2', - 'L3', - 'L4', - 'L5', - ].map((label, i) => ({ - label, - value: 100_000_000 + i, - })), + selectObjectCategoryTax, selectObjectTypeTax: [ { label: 'Автобус', @@ -508,6 +509,7 @@ const defaultOptions: CalculationOptions = { linkQuoteUrl: [], tbxBonusCoefficient: [], selectLeasingWithoutKasko: [], + tbxVIN: [], }; export default defaultOptions; diff --git a/apps/web/config/default-statuses.ts b/apps/web/config/default-statuses.ts index dfa5acd..b47b4d4 100644 --- a/apps/web/config/default-statuses.ts +++ b/apps/web/config/default-statuses.ts @@ -132,8 +132,9 @@ const defaultStatuses: CalculationStatuses = { tbxSubsidySum: 'Default', tbxSupplierDiscountPerc: 'Default', tbxSupplierDiscountRub: 'Default', - tbxTotalPayments: 'Default', + tbxTotalPayments: 'Disabled', tbxVATInLeaseObjectPrice: 'Default', + tbxVIN: 'Disabled', tbxVehicleTaxInLeasingPeriod: 'Disabled', tbxVehicleTaxInYear: 'Default', }; diff --git a/apps/web/config/default-values.ts b/apps/web/config/default-values.ts index d29e818..7f4dee4 100644 --- a/apps/web/config/default-values.ts +++ b/apps/web/config/default-values.ts @@ -40,7 +40,7 @@ const defaultValues: CalculationValues = { engineVolume: 0, finDepartmentRewardCondtion: null, finDepartmentRewardSumm: 0, - firstPaymentPerc: 25, + firstPaymentPerc: 0, firstPaymentRub: 0, fuelCard: null, fullPriceWithDiscount: false, @@ -113,13 +113,13 @@ const defaultValues: CalculationValues = { quoteUrl: null, rate: null, recalcWithRevision: false, - redemptionPaymentSum: 1_000, + redemptionPaymentSum: 1000, regionRegistration: null, registration: null, registrationDescription: '-', registrationQuote: true, requirementTelematic: 100_000_000, - saleBonus: 1.3, + saleBonus: 0, seasonType: null, showFinGAP: true, subsidy: null, @@ -134,11 +134,12 @@ const defaultValues: CalculationValues = { totalPayments: 0, townRegistration: null, tracker: null, - typePTS: 100_000_001, + typePTS: null, VATInLeaseObjectPrice: 0, vehicleTaxInLeasingPeriod: 0, vehicleTaxInYear: 0, withTrailer: false, + vin: null, }; export default defaultValues; diff --git a/apps/web/config/process/default.ts b/apps/web/config/process/default.ts new file mode 100644 index 0000000..66e22e7 --- /dev/null +++ b/apps/web/config/process/default.ts @@ -0,0 +1,37 @@ +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 * as gibdd from '@/process/gibdd'; +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); + useProcess(loadKP); + useProcess(calculate); + useProcess(supplierAgent); + useProcess(price); + useProcess(fingap); + useProcess(loadKP); + useProcess(leasingWithoutKasko); + useProcess(subsidy); + useProcess(leasingObject); + useProcess(configurator); + useProcess(createKP); + useProcess(bonuses); + useProcess(usedPl); + useProcess(subsidyImportProgram); + useProcess(payments); + useProcess(gibdd); +} diff --git a/apps/web/config/process/index.ts b/apps/web/config/process/index.ts new file mode 100644 index 0000000..ab201ad --- /dev/null +++ b/apps/web/config/process/index.ts @@ -0,0 +1 @@ +export { default as useDefaultReactions } from './default'; diff --git a/apps/web/config/schema/env.js b/apps/web/config/schema/env.js index 090d8f5..8d54d22 100644 --- a/apps/web/config/schema/env.js +++ b/apps/web/config/schema/env.js @@ -3,6 +3,7 @@ const { z } = require('zod'); const envSchema = z.object({ BASE_PATH: z.string().optional().default(''), PORT: z.string().optional(), + URL_1C_TRANSTAX_DIRECT: z.string(), URL_CORE_FINGAP_DIRECT: z.string(), URL_CRM_GRAPHQL_DIRECT: z.string(), URL_GET_USER_DIRECT: z.string(), diff --git a/apps/web/config/schema/runtime-config.js b/apps/web/config/schema/runtime-config.js index 0a66682..49a7c87 100644 --- a/apps/web/config/schema/runtime-config.js +++ b/apps/web/config/schema/runtime-config.js @@ -9,6 +9,7 @@ const publicRuntimeConfigSchema = envSchema.pick({ const serverRuntimeConfigSchema = envSchema.pick({ BASE_PATH: true, PORT: true, + URL_1C_TRANSTAX_DIRECT: true, URL_CORE_FINGAP_DIRECT: true, URL_CRM_GRAPHQL_DIRECT: true, URL_GET_USER_DIRECT: true, diff --git a/apps/web/config/schema/values.ts b/apps/web/config/schema/values.ts index 7c1d583..f05826c 100644 --- a/apps/web/config/schema/values.ts +++ b/apps/web/config/schema/values.ts @@ -126,6 +126,7 @@ const ValuesSchema = z vehicleTaxInLeasingPeriod: z.number(), vehicleTaxInYear: z.number(), withTrailer: z.boolean(), + vin: z.string().nullable(), /** * Link Values diff --git a/apps/web/config/tables/insurance-table.ts b/apps/web/config/tables/insurance-table.ts index 89418f5..e737deb 100644 --- a/apps/web/config/tables/insurance-table.ts +++ b/apps/web/config/tables/insurance-table.ts @@ -33,31 +33,37 @@ export const defaultOptions: Record = { fingap: defaultRowOptions, }; +export const DEFAULT_OSAGO_ROW: Insurance.RowValues = { + key: 'osago', + policyType: 'ОСАГО', + insuranceCompany: null, + insured: 100_000_000, + insCost: 0, + insTerm: 100_000_000, +}; + +export const DEFAULT_KASKO_ROW: Insurance.RowValues = { + key: 'kasko', + policyType: 'КАСКО', + insuranceCompany: null, + insured: 100_000_000, + insCost: 0, + insTerm: null, +}; + +export const DEFAULT_FINGAP_ROW: Insurance.RowValues = { + key: 'fingap', + policyType: 'Safe Finance', + insuranceCompany: null, + insured: 100_000_000, + insCost: 0, + insTerm: null, +}; + export const defaultValues: Insurance.RowValues[] = [ - { - key: 'osago', - policyType: 'ОСАГО', - insuranceCompany: null, - insured: 100_000_000, - insCost: 0, - insTerm: 100_000_000, - }, - { - key: 'kasko', - policyType: 'КАСКО', - insuranceCompany: null, - insured: 100_000_000, - insCost: 0, - insTerm: null, - }, - { - key: 'fingap', - policyType: 'Safe Finance', - insuranceCompany: null, - insured: 100_000_000, - insCost: 0, - insTerm: null, - }, + DEFAULT_OSAGO_ROW, + DEFAULT_KASKO_ROW, + DEFAULT_FINGAP_ROW, ]; export const defaultStatuses: Record = { diff --git a/apps/web/config/urls.ts b/apps/web/config/urls.ts index 0e18a17..7805e49 100644 --- a/apps/web/config/urls.ts +++ b/apps/web/config/urls.ts @@ -9,12 +9,18 @@ function getUrls() { const { BASE_PATH } = publicRuntimeConfigSchema.parse(publicRuntimeConfig); if (isServer()) { - const { URL_CRM_GRAPHQL_DIRECT, URL_GET_USER_DIRECT, URL_CORE_FINGAP_DIRECT, PORT } = - serverRuntimeConfigSchema.parse(serverRuntimeConfig); + const { + URL_CRM_GRAPHQL_DIRECT, + URL_GET_USER_DIRECT, + URL_CORE_FINGAP_DIRECT, + URL_1C_TRANSTAX_DIRECT, + PORT, + } = serverRuntimeConfigSchema.parse(serverRuntimeConfig); return { BASE_PATH, PORT, + URL_1C_TRANSTAX: URL_1C_TRANSTAX_DIRECT, URL_CORE_FINGAP: URL_CORE_FINGAP_DIRECT, URL_CRM_GRAPHQL: URL_CRM_GRAPHQL_DIRECT, URL_GET_USER: URL_GET_USER_DIRECT, @@ -27,6 +33,7 @@ function getUrls() { return { BASE_PATH, + URL_1C_TRANSTAX: withBasePath(urls.URL_1C_TRANSTAX_PROXY), URL_CORE_FINGAP: withBasePath(urls.URL_CORE_FINGAP_PROXY), URL_CRM_GRAPHQL: withBasePath(urls.URL_CRM_GRAPHQL_PROXY), URL_GET_USER: withBasePath(urls.URL_GET_USER_PROXY), diff --git a/apps/web/constants/urls.js b/apps/web/constants/urls.js index 2a50a7b..7fa1269 100644 --- a/apps/web/constants/urls.js +++ b/apps/web/constants/urls.js @@ -1,4 +1,5 @@ module.exports = { + URL_1C_TRANSTAX_PROXY: '/api/1c/transtax', URL_CORE_FINGAP_PROXY: '/api/core/fingap', URL_CRM_GRAPHQL_PROXY: '/api/graphql/crm', URL_GET_USER_PROXY: '/api/auth/user', diff --git a/apps/web/constants/values.js b/apps/web/constants/values.js index 5af532c..ae2d4ca 100644 --- a/apps/web/constants/values.js +++ b/apps/web/constants/values.js @@ -5,3 +5,5 @@ export const MIN_INSURANCE = 3000; export const RATE = 7.75; export const MAX_LEASING_PERIOD = 60; export const MIN_LASTPAYMENT_NSIB = 3500; +export const MIN_PAYMENT = 3; +export const VAT = 0.2; diff --git a/apps/web/graphql/crm.query.graphql b/apps/web/graphql/crm.query.graphql index 9300aa6..a03234a 100644 --- a/apps/web/graphql/crm.query.graphql +++ b/apps/web/graphql/crm.query.graphql @@ -22,6 +22,13 @@ query GetCurrencyChanges($currentDate: DateTime) { } } +query GetLeads($domainname: String) { + leads(owner_domainname: $domainname) { + label: fullname + value: leadid + } +} + query GetLead($leadid: Uuid!) { lead(leadid: $leadid) { evo_agent_accountid @@ -32,12 +39,32 @@ query GetLead($leadid: Uuid!) { label: name value: opportunityid } + evo_inn + accountidData { + evo_address_legalidData { + evo_region_fias_id + evo_city_fias_id + } + } } } query GetOpportunity($opportunityid: Uuid!) { opportunity(opportunityid: $opportunityid) { evo_leadid + accountidData { + evo_address_legalidData { + evo_region_fias_id + evo_city_fias_id + } + } + } +} + +query GetOpportunities($domainname: String) { + opportunities(owner_domainname: $domainname) { + label: name + value: opportunityid } } @@ -81,6 +108,9 @@ query GetTarif($tarifId: Uuid!) { evo_graphtype_exception evo_seasons_type_exception evo_min_decreasing_perc + evo_min_irr + evo_cut_irr_with_bonus_coefficient + evo_max_irr } } @@ -99,6 +129,12 @@ query GetRates($currentDate: DateTime) { } } +query GetRate($rateId: Uuid!) { + evo_rate(evo_rateid: $rateId) { + evo_base_rate + } +} + query GetProducts($currentDate: DateTime) { evo_baseproducts( statecode: 0 @@ -124,6 +160,9 @@ query GetProduct($productId: Uuid!) { evo_brands { evo_brandid } + evo_sale_without_nds + evo_cut_proportion_bonus_director + evo_cut_irr_with_bonus } } @@ -180,6 +219,26 @@ query GetRegions { evo_regions { label: evo_name value: evo_regionid + evo_fias_id + evo_businessunit_evolution + } +} + +query GetRegion($regionId: Uuid!) { + evo_region(evo_regionid: $regionId) { + evo_oktmo + accounts { + accountid + } + } +} + +query GetTowns($regionId: Uuid!) { + evo_towns(evo_regionid: $regionId) { + evo_fias_id + label: evo_name + value: evo_townid + evo_businessunit_evolution } } @@ -199,8 +258,12 @@ query GetLeaseObjectTypes { } query GetLeaseObjectType($leaseObjectTypeId: Uuid!) { - leaseObjectType: evo_leasingobject_type(evo_leasingobject_typeid: $leaseObjectTypeId) { + evo_leasingobject_type(evo_leasingobject_typeid: $leaseObjectTypeId) { evo_vehicle_type + evo_id + evo_category + evo_vehicle_type_tax + evo_category_tr } } @@ -213,6 +276,13 @@ query GetBrands { } } +query GetBrand($brandId: Uuid!) { + evo_brand(evo_brandid: $brandId) { + evo_importer_reward_perc + evo_importer_reward_rub + } +} + query GetModels($brandId: Uuid!) { evo_models(statecode: 0, evo_brandid: $brandId) { label: evo_name @@ -222,13 +292,31 @@ query GetModels($brandId: Uuid!) { } } -query GetConfigurations($modelId: Uuid) { +query GetModel($modelId: Uuid!) { + evo_model(evo_modelid: $modelId) { + evo_impairment_groupidData { + evo_name + } + evo_importer_reward_perc + evo_importer_reward_rub + } +} + +query GetConfigurations($modelId: Uuid!) { evo_equipments(statecode: 0, evo_modelid: $modelId) { label: evo_name value: evo_equipmentid } } +query GetConfiguration($configurationId: Uuid!) { + evo_equipment(evo_equipmentid: $configurationId) { + evo_impairment_groupidData { + evo_name + } + } +} + query GetDealers { dealers: accounts(evo_account_type: [100000001], statecode: 0, evo_legal_form: 100000001) { label: name @@ -286,3 +374,70 @@ query GetRewardCondition($conditionId: Uuid!) { } } } + +query GetSotCoefficientType($evo_id: String) { + evo_sot_coefficient_type(evo_id: $evo_id) { + evo_sot_coefficient_typeid + } +} +query GetCoefficients($currentDate: DateTime, $jobTitleId: Uuid!) { + evo_coefficients( + statecode: 0 + evo_datefrom_param: { lte: $currentDate } + evo_dateto_param: { gte: $currentDate } + evo_job_titleid: $jobTitleId + ) { + evo_job_titleid + evo_sot_coefficient_typeid + evo_baseproducts { + evo_baseproductid + } + evo_sot_coefficient + } +} + +query GetSystemUser($domainname: String) { + systemuser(domainname: $domainname) { + evo_job_titleid + } +} + +query GetAddproductTypes($currentDate: DateTime) { + evo_addproduct_types( + statecode: 0 + evo_datefrom_param: { lte: $currentDate } + evo_dateto_param: { gte: $currentDate } + ) { + label: evo_name + value: evo_addproduct_typeid + evo_graph_price + evo_product_type + } +} + +query GetRegistrationTypes($currentDate: DateTime) { + evo_addproduct_types( + statecode: 0 + evo_datefrom_param: { lte: $currentDate } + evo_dateto_param: { gte: $currentDate } + evo_product_type: 100000001 + ) { + label: evo_name + value: evo_addproduct_typeid + evo_graph_price + evo_leasingobject_types { + evo_leasingobject_typeid + } + evo_whom_register + evo_gibdd_region + evo_pts_type + evo_accountid + evo_towtruck + } +} + +query GetAddProductType($addproductTypeId: Uuid!) { + evo_addproduct_type(evo_addproduct_typeid: $addproductTypeId) { + evo_description + } +} diff --git a/apps/web/graphql/crm.schema.graphql b/apps/web/graphql/crm.schema.graphql index f0ebe3e..77f91f3 100644 --- a/apps/web/graphql/crm.schema.graphql +++ b/apps/web/graphql/crm.schema.graphql @@ -38,6 +38,7 @@ type Query { evo_businessunits(statecode: Int): [evo_businessunit] evo_client_risks(statecode: Int): [evo_client_risk] evo_client_types(statecode: Int): [evo_client_type] + evo_coefficient(evo_coefficientid: Uuid!): evo_coefficient evo_coefficients(evo_client_riskid: Uuid, evo_client_typeid: Uuid, evo_corfficient_type: Int, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_job_titleid: Uuid, evo_max_period_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, statecode: Int): [evo_coefficient] evo_contract(evo_contractid: Uuid!): evo_contract evo_contracts(evo_accountid: Uuid, evo_name: String, orderby: OrderByInput, statecode: Int): [evo_contract] @@ -48,6 +49,7 @@ type Query { evo_debtwork_contracts(evo_accountid: Uuid, evo_statuscodeid: Uuid, statecode: Int): [evo_debtwork_contract] evo_documenttype(evo_documenttypeid: Uuid!): evo_documenttype evo_documenttypes(evo_code_wm: String, statecode: Int): [evo_documenttype] + evo_equipment(evo_equipmentid: Uuid!): evo_equipment evo_equipments(evo_modelid: Uuid, statecode: Int): [evo_equipment] evo_external_supplier_codes(evo_id: String, statecode: Int): [evo_external_supplier_code] evo_external_system_request(evo_external_system_requestid: Uuid!): evo_external_system_request @@ -77,6 +79,7 @@ type Query { evo_rates(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_rate] """Регион. statecode по умолчанию 0""" + evo_region(evo_regionid: Uuid!): evo_region evo_regions(evo_businessunit_evolution: Boolean, evo_creditregistry_id: Int, statecode: Int): [evo_region] evo_request_client(evo_request_clientid: Uuid!): evo_request_client evo_request_payment(evo_request_paymentid: Uuid!): evo_request_payment @@ -85,6 +88,7 @@ type Query { evo_reward_conditions(evo_agency_agreementid_param: GuidParamInput, evo_agent_accountid: Uuid, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_reward_condition] evo_scheduled_call(evo_scheduled_callid: Uuid!): evo_scheduled_call evo_scheduled_calls(evo_inn: String, evo_status: [Int!], evo_telephone1: String, evo_telephone2: String, statecode: Int): [evo_scheduled_call] + evo_sot_coefficient_type(evo_id: String, evo_sot_coefficient_typeid: Uuid): evo_sot_coefficient_type evo_sot_coefficient_types(statecode: Int): [evo_sot_coefficient_type] evo_statuscode(evo_id: String, evo_statuscodeid: Uuid): evo_statuscode evo_statuscodes(statecode: Int): [evo_statuscode] @@ -93,7 +97,7 @@ type Query { evo_subsidy(evo_subsidyid: Uuid!): evo_subsidy evo_tarif(evo_tarifid: Uuid!): evo_tarif evo_tarifs(evo_balance_holder: [Int!], evo_baseproductid: Uuid, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_graphtype_exception: [Int!], evo_ins_type: [Int!], evo_max_first_payment_param: DecimalParamInput, evo_max_last_payment_param: DecimalParamInput, evo_max_period_param: DecimalParamInput, evo_min_first_payment_param: DecimalParamInput, evo_min_last_payment_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, evo_used: Boolean, statecode: Int): [evo_tarif] - evo_town(evo_fias_id: String, evo_townid: Uuid): evo_town + evo_town(evo_townid: Uuid!): evo_town """Города. statecode по умолчанию 0""" evo_towns(evo_regionid: Uuid, statecode: Int): [evo_town] @@ -113,13 +117,14 @@ type Query { leads(evo_opportunityid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [lead] opportunities(evo_leadid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [opportunity] opportunity(opportunityid: Uuid!): opportunity - queue(emailaddress: String): queue + queue(emailaddress: String, evo_id: String): queue quote(quoteId: Uuid!): quote """ Предложения. statecode по умолчанию 0, можно отфильтровать по ownerid и/или domainName """ quotes(condition: ConditionInput, evo_leadid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [quote] + roles(name: String): [role] """Агенты салона. statecode по умолчанию 0""" salon_agents(salonaccountid: Uuid!, statecode: Int): [account] @@ -140,25 +145,325 @@ type Mutation { by(systemuserid: Uuid): MutationBy } -type evo_typedocpackage { +type evo_addcontract { createdon: DateTime - evo_account: Boolean - evo_addcontract: Boolean - evo_agency_agreement: Boolean - evo_contract: Boolean - evo_debtwork_contract: Boolean - evo_finegibdd: Boolean - evo_id: String - evo_incident: Boolean - evo_insurance_period: Boolean + evo_accountid: Uuid + evo_accountidData: account + evo_accountid_new: Uuid + evo_account_change: Boolean + evo_acquisition_costs: Decimal + evo_activdate_1c: DateTime + evo_activdate_crm: DateTime + evo_activdate_insurance: DateTime + evo_addcontractid: Uuid + evo_add_bonus_summ: Decimal + evo_add_director_bonus: Decimal + evo_add_region_director_bonus: Decimal + evo_agent_reward: Decimal + evo_agent_reward_summ: Decimal + evo_agent_reward_tech: Decimal + evo_age_drivers: Int + evo_age_drivers_new: Int + evo_approv_business_analyst: Boolean + evo_balance: Int + evo_balance_change: Boolean + evo_balance_new: Int + evo_bank_detailsid: Uuid + evo_bank_detailsid_new: Uuid + evo_ban_edit_date: DateTime + evo_base: String + evo_base_bonus: Decimal + evo_base_calc_pay: Decimal + evo_base_new: String + evo_broker_reward: Decimal + evo_broker_reward_summ: Decimal + evo_broker_reward_tech: Decimal + evo_businessunitid: Uuid + evo_calculation_method: Int + evo_calculator_type: Int + evo_calc_checks_disable: Boolean + evo_calc_profit: Decimal + evo_category: Int + evo_category_new: Int + evo_category_tr: Int + evo_category_tr_new: Int + evo_certificate: String + evo_certificate_date: DateTime + evo_certificate_date_new: DateTime + evo_certificate_issued: String + evo_certificate_issued_new: String + evo_certificate_new: String + evo_change_payment_date: Boolean + evo_chassis: String + evo_chassis_new: String + evo_color: String + evo_color_new: String + evo_contractid: Uuid + evo_contract_term_change: Boolean + evo_cost_change: Boolean + evo_cost_currency_change: Boolean + evo_dateend: DateTime + evo_date_addcontract: DateTime + evo_date_calculation_done: DateTime + evo_date_offset_change: Boolean + evo_deadline_date: DateTime + evo_dealer_broker_accountid: Uuid + evo_dealer_broker_accountid_new: Uuid + evo_dealer_broker_reward: Decimal + evo_dealer_broker_reward_conditionid: Uuid + evo_dealer_broker_reward_conditionid_new: Uuid + evo_dealer_broker_reward_new: Decimal + evo_dealer_broker_reward_summ: Decimal + evo_dealer_broker_reward_summ_new: Decimal + evo_dealer_broker_reward_tech: Decimal + evo_dealer_person_accountid: Uuid + evo_dealer_person_accountid_new: Uuid + evo_dealer_person_reward: Decimal + evo_dealer_person_reward_conditionid: Uuid + evo_dealer_person_reward_conditionid_new: Uuid + evo_dealer_person_reward_new: Decimal + evo_dealer_person_reward_summ: Decimal + evo_dealer_person_reward_summ_new: Decimal + evo_dealer_person_reward_tech: Decimal + evo_deviation_investments_withoutnds: Decimal + evo_deviation_irr: Decimal + evo_dgo_price: Decimal + evo_dgo_price_new: Decimal + evo_director_bonus: Decimal + evo_discount_perc: Decimal + evo_discount_perc_new: Decimal + evo_discount_supplier_currency: Decimal + evo_discount_supplier_currency_new: Decimal + evo_documents: [evo_document] + evo_dog_credit: Decimal + evo_dog_credit_new: Decimal + evo_double_agent_reward: Decimal + evo_double_agent_reward_summ: Decimal + evo_double_agent_reward_tech: Decimal + evo_driving_axle: String + evo_driving_axle_new: String + evo_early_change_discount: Boolean + evo_early_discount_perc: Decimal + evo_early_partly_type: Int + evo_early_redemption_change: Boolean + evo_early_sum: Decimal + evo_ecological_class: Int + evo_ecological_class_new: Int + evo_economic: Decimal + evo_economic_with_nds: Decimal + evo_emailaddress: String + evo_emailaddress_new: String + evo_engine_model: String + evo_engine_model_new: String + evo_engine_power: Decimal + evo_engine_power_kvt: Decimal + evo_engine_power_kvt_new: Decimal + evo_engine_power_new: Decimal + evo_engine_type: Int + evo_engine_type_new: Int + evo_engine_volume: Decimal + evo_engine_volume_new: Decimal + evo_equip_price: Decimal + evo_equip_price_new: Decimal + evo_evokasko_addproduct_typeid: Uuid + evo_evokasko_addproduct_typeid_new: Uuid + evo_evokasko_price_new: Decimal + evo_exp_drivers: Int + evo_exp_drivers_new: Int + evo_fin_department_reward: Decimal + evo_fin_department_reward_conditionid: Uuid + evo_fin_department_reward_conditionid_new: Uuid + evo_fin_department_reward_new: Decimal + evo_fin_department_reward_summ: Decimal + evo_fin_department_reward_summ_new: Decimal + evo_fin_department_reward_tech: Decimal + evo_fix_last_payment: Boolean + evo_franchise: Decimal + evo_franchise_new: Decimal + evo_gos_akt: String + evo_gos_akt_new: String + evo_graph_irr: Decimal + evo_importer_reward_rub: Decimal + evo_insurance_change: Boolean + evo_insurance_checking: Boolean + evo_insurance_period: Int + evo_insurance_period_new: Int + evo_insurance_price_result: Decimal + evo_insurance_price_result_new: Decimal + evo_insurer_kasko_accountid: Uuid + evo_insurer_kasko_accountid_new: Uuid + evo_insurer_osago_accountid: Uuid + evo_insurer_osago_accountid_new: Uuid + evo_ins_period_evokasko_date: DateTime + evo_ins_period_evokasko_number: Int + evo_ins_period_kasko_date: DateTime + evo_ins_period_kasko_number: Int + evo_ins_period_osago_date: DateTime + evo_ins_period_osago_number: Int + evo_irr_msfo_final: Decimal + evo_irr_msfo_final2: Decimal + evo_kasko_elt_id: String + evo_kasko_elt_id_new: String + evo_kasko_id_elt_calc: String + evo_kasko_id_elt_calc_new: String + evo_kasko_price: Decimal + evo_kasko_price_new: Decimal + evo_last_day_month: Boolean + evo_last_payment_change: Boolean + evo_last_payment_redemption: Boolean + evo_last_payment_redemption_new: Boolean + evo_leasingobjectid: Uuid + evo_leasingobject_specification: String + evo_leasingobject_specification_new: String + evo_leasing_bonus_summ: Decimal + evo_log_activdate_1c: String + evo_loss_kv: Decimal + evo_maker: String + evo_maker_new: String + evo_max_mass: Decimal + evo_max_mass_new: Decimal + evo_max_speed: Decimal + evo_max_speed_new: Decimal + evo_motor_power_1: String + evo_motor_power_1_new: String + evo_msfo_irr: Decimal evo_name: String - evo_opportunity: Boolean - evo_parking: Boolean - evo_programsolution: [Int!] - evo_request_client: Boolean - evo_request_payment: Boolean - evo_typedocpackageid: Uuid + evo_nds_in_price_calc: Decimal + evo_nds_in_price_supplier_currency: Decimal + evo_nds_in_price_supplier_currency_new: Decimal + evo_nds_perc: Decimal + evo_nds_perc_new: Decimal + evo_net_irr: Decimal + evo_niatinception_msfo: Decimal + evo_ni_at_inception: Decimal + evo_not_require_signing: Boolean + evo_not_require_signing_send_date: DateTime + evo_npvni_msfo: Decimal + evo_npvni_msfo_final: Decimal + evo_ns_bonus_summ: Decimal + evo_ns_price: Decimal + evo_ns_price_new: Decimal + evo_number_paydate: DateTime + evo_number_planpaymentid: Uuid + evo_object_number: String + evo_object_number_new: String + evo_osago_elt_id: String + evo_osago_elt_id_new: String + evo_osago_id_elt_calc: String + evo_osago_id_elt_calc_new: String + evo_osago_price: Decimal + evo_osago_price_new: Decimal + evo_passport_address: String + evo_passport_address_new: String + evo_passport_brand_model: String + evo_passport_brand_model_new: String + evo_passport_company: String + evo_passport_company_new: String + evo_passport_date: DateTime + evo_passport_date_new: DateTime + evo_passport_engine_type: String + evo_passport_engine_type_new: String + evo_passport_name: String + evo_passport_name_new: String + evo_passport_number: String + evo_passport_number_new: String + evo_passport_seria: String + evo_passport_seria_new: String + evo_passport_type: Int + evo_passport_type_new: Int + evo_payer_evokasko: Int + evo_payer_evokasko_new: Int + evo_payer_kasko: Int + evo_payer_kasko_new: Int + evo_payer_osago: Int + evo_payer_osago_new: Int + evo_payment_redemption: Int + evo_period: Int + evo_period_new: Int + evo_price_calc: Decimal + evo_price_without_discount: Decimal + evo_price_without_discount_new: Decimal + evo_price_without_discount_supplier_rub: Decimal + evo_price_without_discount_supplier_rub_new: Decimal + evo_price_without_disc_supplier_currency: Decimal + evo_price_without_disc_supplier_currency_new: Decimal + evo_price_wthout_disc_nds_sup_currency: Decimal + evo_price_wthout_disc_nds_sup_currency_new: Decimal + evo_program_import_subsidy_sum: Decimal + evo_program_import_subsidy_sum_new: Decimal + evo_prop_type: String + evo_prop_type_new: String + evo_pts_change: Boolean + evo_pts_type: Int + evo_pts_type_new: Int + evo_quoteid: Uuid + evo_reasons_calc: [Int!] + evo_recalculate_demand: Boolean + evo_refuse_reason: Int + evo_regionid: Uuid + evo_regionid_new: Uuid + evo_region_director_bonus: Decimal + evo_registration: Int + evo_registration_addproduct_typeid: Uuid + evo_registration_addproduct_typeid_new: Uuid + evo_registration_change: Boolean + evo_registration_new: Int + evo_registration_regionid: Uuid + evo_registration_regionid_new: Uuid + evo_remove_restrictions: Boolean + evo_seats: Int + evo_seats_new: Int + evo_signatory_evo_systemuserid: Uuid + evo_signatory_lp_contactid: Uuid + evo_signatory_lp_contactid_new: Uuid + evo_source: Int + evo_specification_change: Boolean + evo_statuscodeid: Uuid + evo_statuscodeidData: evo_statuscode + evo_statuscode_reason: String + evo_storage: String + evo_sum_pay_change: Boolean + evo_supplier_accountid: Uuid + evo_supplier_accountid_new: Uuid + evo_supplier_bank_detailsid: Uuid + evo_supplier_bank_detailsid_new: Uuid + evo_supplier_change: Boolean + evo_supplier_currency_price: Decimal + evo_supplier_currency_price_new: Decimal + evo_supplier_pay_actual: Decimal + evo_supplier_pay_actual_currency: Decimal + evo_supplier_signer_contactid_new: Uuid + evo_suspend_contract_change: Boolean + evo_telematics_addproduct_typeid: Uuid + evo_telematics_addproduct_typeid_new: Uuid + evo_townid: Uuid + evo_townid_new: Uuid + evo_tracking_addproduct_typeid: Uuid + evo_tracking_addproduct_typeid_new: Uuid + evo_tracking_control_change: Boolean + evo_transmission_number: String + evo_transmission_number_new: String + evo_type_agreement: Int + evo_type_change_registration: Int + evo_type_change_telematics: Int + evo_type_change_tracking: Int + evo_unlimit_drivers: Boolean + evo_unlimit_drivers_new: Boolean + evo_vacation_number_months: Int + evo_vehicle_tax_approved: Decimal + evo_vehicle_tax_approved_new: Decimal + evo_vehicle_tax_period: Decimal + evo_vehicle_tax_period_new: Decimal + evo_vehicle_tax_year: Decimal + evo_vehicle_tax_year_new: Decimal + evo_vehicle_type_tax: Int + evo_vehicle_type_tax_new: Int + evo_vin: String + evo_vin_new: String + evo_year: Int + evo_year_new: Int modifiedon: DateTime + ownerid: Uuid toObjectString: String } @@ -204,6 +509,89 @@ input GuidParamInput { """The built-in `Decimal` scalar type.""" scalar Decimal +type email { + activityid: Uuid + createdon: DateTime + description: String + email_activity_parties: [activityparty] + evo_accountid: Uuid + modifiedon: DateTime + regardingobjectid_account: Uuid + regardingobjectid_evo_contract: Uuid + regardingobjectid_evo_insurance_period: Uuid + regardingobjectid_evo_insurance_policy: Uuid + regardingobjectid_evo_insurance_policyData: evo_insurance_policy + regardingobjectid_evo_list: Uuid + regardingobjectid_incident: Uuid + regardingobjectid_opportunity: Uuid + statecode: Int + statuscode: Int + subject: String + templateid: Uuid + toObjectString: String +} + +type evo_bank_details { + createdon: DateTime + evo_accountid: Uuid + evo_bankid: Uuid + evo_bankidData: account + evo_bank_code: String + evo_bank_detailsid: Uuid + evo_contactid: Uuid + evo_corresponding_account: String + evo_datefrom: DateTime + evo_kbk: String + evo_name: String + evo_payment_account: String + link: String + modifiedon: DateTime + toObjectString: String +} + +type queue { + createdon: DateTime + emailaddress: String + evo_id: String + modifiedon: DateTime + name: String + queueid: Uuid + teams: [team] + toObjectString: String +} + +type template { + body: String + createdon: DateTime + description: String + modifiedon: DateTime + subject: String + templateid: Uuid + toObjectString: String +} + +type evo_typedocpackage { + createdon: DateTime + evo_account: Boolean + evo_addcontract: Boolean + evo_agency_agreement: Boolean + evo_contract: Boolean + evo_debtwork_contract: Boolean + evo_finegibdd: Boolean + evo_id: String + evo_incident: Boolean + evo_insurance_period: Boolean + evo_name: String + evo_opportunity: Boolean + evo_parking: Boolean + evo_programsolution: [Int!] + evo_request_client: Boolean + evo_request_payment: Boolean + evo_typedocpackageid: Uuid + modifiedon: DateTime + toObjectString: String +} + type evo_debtwork_contract { createdon: DateTime evo_accountid: Uuid @@ -281,10 +669,10 @@ type evo_debtwork_contract { evo_term_act_storage_get_systemuseridData: systemuser evo_term_act_storage_get_type: Int evo_term_act_storage_get_unload_date: DateTime - evo_term_act_withdrawal: Boolean - evo_term_act_withdrawal_pl_systemuserid: Uuid - evo_term_act_withdrawal_pl_systemuseridData: systemuser - evo_term_act_withdrawal_pl_unload_date: DateTime + evo_term_act_storage_pl: Boolean + evo_term_act_storage_pl_systemuserid: Uuid + evo_term_act_storage_pl_systemuseridData: systemuser + evo_term_act_storage_pl_unload_date: DateTime evo_term_notice_inspection: Boolean evo_term_notice_inspection_systemuserid: Uuid evo_term_notice_inspection_systemuseridData: systemuser @@ -300,6 +688,7 @@ type evo_debtwork_contract { evo_withdrawal_issue_done_date: DateTime evo_withdrawal_parking_addressid: Uuid evo_withdrawal_plan_date: DateTime + evo_withdrawal_storage_doc_keys: [Int!] evo_withdrawal_systemuserid: Uuid evo_withdrawal_systemuseridData: systemuser link: String @@ -403,11 +792,15 @@ type evo_question_credit_committee { evo_description_general_solution: String evo_opportunityid: Uuid evo_ownerid_systemuser: Uuid + evo_qcc_number: String evo_question_credit_committeeid: Uuid evo_statuscodeid: Uuid + evo_storage: String evo_summary_judgment: Int modifiedon: DateTime quotes: [quote] + statecode: Int + statuscode: Int toObjectString: String } @@ -434,11 +827,24 @@ type entity_schema { picklists: [picklist] } +type role { + createdon: DateTime + evo_connection_roleData: evo_connection_role + evo_documenttypes: [evo_documenttype] + modifiedon: DateTime + name: String + roleid: Uuid + systemusers: [systemuser] + toObjectString: String +} + type account { accountid: Uuid childcontacts(statecode: Int): [contact] createdon: DateTime emailaddress1: String + evo_1c_date_state: Int + evo_1c_date_update: DateTime evo_accnumber: String evo_account_type: [Int!] evo_address_factid: Uuid @@ -489,6 +895,7 @@ type account { evo_legal_region_calc: Boolean evo_licenses_list: String evo_lk_regdate: DateTime + evo_log_activdate_1c: String evo_management_disqualified: Boolean evo_ogrn: String evo_ogrn_date: DateTime @@ -510,7 +917,7 @@ type account { evo_state_liquidation_date: DateTime evo_state_registration_date: DateTime evo_state_status: Int - evo_state_status_code: String + evo_state_status_code: Int evo_storage: String evo_subsidies(statecode: Int): [evo_subsidy] evo_supplier_financing_accept: Boolean @@ -839,6 +1246,7 @@ type evo_orglegalform { evo_nko: Boolean evo_not_financing: Boolean evo_orglegalformid: Uuid + evo_risk_policy_evaluation: Int modifiedon: DateTime toObjectString: String } @@ -1285,6 +1693,7 @@ type quote { evo_leasingobject_typeid: Uuid evo_leasingobject_used: Boolean evo_leasing_bonus_summ: Decimal + evo_leasing_profit: Decimal evo_legal_regionid: Uuid evo_legal_townid: Uuid evo_lessor_bank_detailsid: Uuid @@ -1584,6 +1993,7 @@ type evo_scheduled_call { createdon: DateTime evo_accountid: Uuid evo_channel: String + evo_closing_reason: Int evo_comment: String evo_company_name: String evo_contact_jobtitle: String @@ -1607,7 +2017,9 @@ type evo_scheduled_call { evo_utm_source: String evo_utm_term: String modifiedon: DateTime - ownerid: Uuid + owneridtype: Int + ownerid_systemuser: Uuid + ownerid_team: Uuid toObjectString: String } @@ -1772,6 +2184,7 @@ type evo_contract { evo_businessunitid: Uuid evo_calc_irr: Decimal evo_calc_profit: Decimal + evo_call_systemuserid: Uuid evo_cancel_contract: Boolean evo_card_bonus_summ: Decimal evo_cession_opportunityid: Uuid @@ -1789,6 +2202,7 @@ type evo_contract { evo_dateend: DateTime evo_date_of_pledge_claim: DateTime evo_date_of_pledge_leasobject: DateTime + evo_date_of_sending_dkp: DateTime evo_date_sor: DateTime evo_date_termination: DateTime evo_dealer_broker_accountid: Uuid @@ -1883,6 +2297,7 @@ type evo_contract { evo_last_payment_redemption: Boolean evo_leasingobjectid: Uuid evo_leasingobjectidData: evo_leasingobject + evo_leasing_bonus_pay_date: DateTime evo_leasing_bonus_summ: Decimal evo_leasing_pledge_agreementid: Uuid evo_lessor_bank_detailsid: Uuid @@ -1930,6 +2345,9 @@ type evo_contract { evo_registration_addproductidData: evo_addproduct evo_registration_addproduct_typeid: Uuid evo_request_payments: [evo_request_payment] + evo_returnsum_supplier_fact: Decimal + evo_returnsum_supplier_full_date: DateTime + evo_returnsum_supplier_plan: Decimal evo_return_leasing: Boolean evo_sale_without_nds: Boolean evo_signer_different_contactid: Uuid @@ -1951,6 +2369,7 @@ type evo_contract { evo_supplier_bank_detailsid: Uuid evo_supplier_bank_detailsidData: evo_bank_details evo_supplier_currency_price: Decimal + evo_supplier_email: String evo_supplier_financing: Boolean evo_supplier_pay1_sum: Decimal evo_supplier_pay2_sum: Decimal @@ -1976,6 +2395,7 @@ type evo_contract { evo_trade_in_cost_pre: Decimal evo_transactioncurrencyid: Uuid evo_transactioncurrencyidData: transactioncurrency + evo_transfer_newdkp_sum: Decimal evo_uncritical_scan: Boolean evo_vehicle_tax_period: Decimal evo_vehicle_tax_year: Decimal @@ -2010,6 +2430,7 @@ type evo_external_system_request { evo_opportunityid: Uuid evo_path_report: String evo_prima_requestid: String + evo_question_credit_committeeid: Uuid evo_request_paymentid: Uuid evo_request_paymentidData: evo_request_payment evo_system: Int @@ -2076,6 +2497,7 @@ type evo_coefficient { evo_season_type: Int evo_sot_coefficient: Decimal evo_sot_coefficient_typeid: Uuid + evo_sot_coefficient_typeidData: evo_sot_coefficient_type modifiedon: DateTime statecode: Int toObjectString: String @@ -2179,6 +2601,7 @@ type evo_rate { type evo_sot_coefficient_type { createdon: DateTime + evo_coefficients: [evo_coefficient] evo_id: String evo_name: String evo_sot_coefficient_typeid: Uuid @@ -2270,6 +2693,7 @@ type systemuser { evo_available_assignment_director: Boolean evo_baseproducts(statecode: Int): [evo_baseproduct] evo_callrecords_access: Boolean + evo_call_standard: Int evo_can_export_cre: Boolean evo_can_import_sheduled_calls: Boolean evo_datebirth: DateTime @@ -2282,6 +2706,7 @@ type systemuser { evo_identity_documents: [evo_identity_document] evo_job_titleid: Uuid evo_loader: String + evo_mps_co: Boolean evo_role_treasury: Boolean evo_sfm: Boolean evo_underwriting_purchases_rules: Boolean @@ -2409,430 +2834,15 @@ type evo_agency_agreement { toObjectString: String } -type evo_addcontract { - createdon: DateTime - evo_accountid: Uuid - evo_accountid_new: Uuid - evo_account_change: Boolean - evo_acquisition_costs: Decimal - evo_activdate_1c: DateTime - evo_activdate_crm: DateTime - evo_activdate_insurance: DateTime - evo_addcontractid: Uuid - evo_add_bonus_summ: Decimal - evo_add_director_bonus: Decimal - evo_add_region_director_bonus: Decimal - evo_agent_reward: Decimal - evo_agent_reward_summ: Decimal - evo_agent_reward_tech: Decimal - evo_age_drivers: Int - evo_age_drivers_new: Int - evo_approv_business_analyst: Boolean - evo_balance: Int - evo_balance_change: Boolean - evo_balance_new: Int - evo_bank_detailsid: Uuid - evo_bank_detailsid_new: Uuid - evo_ban_edit_date: DateTime - evo_base: String - evo_base_bonus: Decimal - evo_base_calc_pay: Decimal - evo_base_new: String - evo_broker_reward: Decimal - evo_broker_reward_summ: Decimal - evo_broker_reward_tech: Decimal - evo_businessunitid: Uuid - evo_calculation_method: Int - evo_calculator_type: Int - evo_calc_checks_disable: Boolean - evo_calc_profit: Decimal - evo_category: Int - evo_category_new: Int - evo_category_tr: Int - evo_category_tr_new: Int - evo_certificate: String - evo_certificate_date: DateTime - evo_certificate_date_new: DateTime - evo_certificate_issued: String - evo_certificate_issued_new: String - evo_certificate_new: String - evo_change_payment_date: Boolean - evo_chassis: String - evo_chassis_new: String - evo_color: String - evo_color_new: String - evo_contractid: Uuid - evo_contract_term_change: Boolean - evo_cost_change: Boolean - evo_cost_currency_change: Boolean - evo_dateend: DateTime - evo_date_addcontract: DateTime - evo_date_calculation_done: DateTime - evo_date_offset_change: Boolean - evo_deadline_date: DateTime - evo_dealer_broker_accountid: Uuid - evo_dealer_broker_accountid_new: Uuid - evo_dealer_broker_reward: Decimal - evo_dealer_broker_reward_conditionid: Uuid - evo_dealer_broker_reward_conditionid_new: Uuid - evo_dealer_broker_reward_new: Decimal - evo_dealer_broker_reward_summ: Decimal - evo_dealer_broker_reward_summ_new: Decimal - evo_dealer_broker_reward_tech: Decimal - evo_dealer_person_accountid: Uuid - evo_dealer_person_accountid_new: Uuid - evo_dealer_person_reward: Decimal - evo_dealer_person_reward_conditionid: Uuid - evo_dealer_person_reward_conditionid_new: Uuid - evo_dealer_person_reward_new: Decimal - evo_dealer_person_reward_summ: Decimal - evo_dealer_person_reward_summ_new: Decimal - evo_dealer_person_reward_tech: Decimal - evo_deviation_investments_withoutnds: Decimal - evo_deviation_irr: Decimal - evo_dgo_price: Decimal - evo_dgo_price_new: Decimal - evo_director_bonus: Decimal - evo_discount_perc: Decimal - evo_discount_perc_new: Decimal - evo_discount_supplier_currency: Decimal - evo_discount_supplier_currency_new: Decimal - evo_dog_credit: Decimal - evo_dog_credit_new: Decimal - evo_double_agent_reward: Decimal - evo_double_agent_reward_summ: Decimal - evo_double_agent_reward_tech: Decimal - evo_driving_axle: String - evo_driving_axle_new: String - evo_early_change_discount: Boolean - evo_early_discount_perc: Decimal - evo_early_partly_type: Int - evo_early_redemption_change: Boolean - evo_early_sum: Decimal - evo_ecological_class: Int - evo_ecological_class_new: Int - evo_economic: Decimal - evo_economic_with_nds: Decimal - evo_emailaddress: String - evo_emailaddress_new: String - evo_engine_model: String - evo_engine_model_new: String - evo_engine_power: Decimal - evo_engine_power_kvt: Decimal - evo_engine_power_kvt_new: Decimal - evo_engine_power_new: Decimal - evo_engine_type: Int - evo_engine_type_new: Int - evo_engine_volume: Decimal - evo_engine_volume_new: Decimal - evo_equip_price: Decimal - evo_equip_price_new: Decimal - evo_evokasko_addproduct_typeid: Uuid - evo_evokasko_addproduct_typeid_new: Uuid - evo_evokasko_price_new: Decimal - evo_exp_drivers: Int - evo_exp_drivers_new: Int - evo_fin_department_reward: Decimal - evo_fin_department_reward_conditionid: Uuid - evo_fin_department_reward_conditionid_new: Uuid - evo_fin_department_reward_new: Decimal - evo_fin_department_reward_summ: Decimal - evo_fin_department_reward_summ_new: Decimal - evo_fin_department_reward_tech: Decimal - evo_fix_last_payment: Boolean - evo_franchise: Decimal - evo_franchise_new: Decimal - evo_gos_akt: String - evo_gos_akt_new: String - evo_graph_irr: Decimal - evo_importer_reward_rub: Decimal - evo_insurance_change: Boolean - evo_insurance_checking: Boolean - evo_insurance_period: Int - evo_insurance_period_new: Int - evo_insurance_price_result: Decimal - evo_insurance_price_result_new: Decimal - evo_insurer_kasko_accountid: Uuid - evo_insurer_kasko_accountid_new: Uuid - evo_insurer_osago_accountid: Uuid - evo_insurer_osago_accountid_new: Uuid - evo_ins_period_evokasko_date: DateTime - evo_ins_period_evokasko_number: Int - evo_ins_period_kasko_date: DateTime - evo_ins_period_kasko_number: Int - evo_ins_period_osago_date: DateTime - evo_ins_period_osago_number: Int - evo_irr_msfo_final: Decimal - evo_irr_msfo_final2: Decimal - evo_kasko_elt_id: String - evo_kasko_elt_id_new: String - evo_kasko_id_elt_calc: String - evo_kasko_id_elt_calc_new: String - evo_kasko_price: Decimal - evo_kasko_price_new: Decimal - evo_last_day_month: Boolean - evo_last_payment_change: Boolean - evo_last_payment_redemption: Boolean - evo_last_payment_redemption_new: Boolean - evo_leasingobjectid: Uuid - evo_leasingobject_specification: String - evo_leasingobject_specification_new: String - evo_leasing_bonus_summ: Decimal - evo_log_activdate_1c: String - evo_loss_kv: Decimal - evo_maker: String - evo_maker_new: String - evo_max_mass: Decimal - evo_max_mass_new: Decimal - evo_max_speed: Decimal - evo_max_speed_new: Decimal - evo_motor_power_1: String - evo_motor_power_1_new: String - evo_msfo_irr: Decimal - evo_name: String - evo_nds_in_price_calc: Decimal - evo_nds_in_price_supplier_currency: Decimal - evo_nds_in_price_supplier_currency_new: Decimal - evo_nds_perc: Decimal - evo_nds_perc_new: Decimal - evo_net_irr: Decimal - evo_niatinception_msfo: Decimal - evo_ni_at_inception: Decimal - evo_not_require_signing: Boolean - evo_not_require_signing_send_date: DateTime - evo_npvni_msfo: Decimal - evo_npvni_msfo_final: Decimal - evo_ns_bonus_summ: Decimal - evo_ns_price: Decimal - evo_ns_price_new: Decimal - evo_number_paydate: DateTime - evo_number_planpaymentid: Uuid - evo_object_number: String - evo_object_number_new: String - evo_osago_elt_id: String - evo_osago_elt_id_new: String - evo_osago_id_elt_calc: String - evo_osago_id_elt_calc_new: String - evo_osago_price: Decimal - evo_osago_price_new: Decimal - evo_passport_address: String - evo_passport_address_new: String - evo_passport_brand_model: String - evo_passport_brand_model_new: String - evo_passport_company: String - evo_passport_company_new: String - evo_passport_date: DateTime - evo_passport_date_new: DateTime - evo_passport_engine_type: String - evo_passport_engine_type_new: String - evo_passport_name: String - evo_passport_name_new: String - evo_passport_number: String - evo_passport_number_new: String - evo_passport_seria: String - evo_passport_seria_new: String - evo_passport_type: Int - evo_passport_type_new: Int - evo_payer_evokasko: Int - evo_payer_evokasko_new: Int - evo_payer_kasko: Int - evo_payer_kasko_new: Int - evo_payer_osago: Int - evo_payer_osago_new: Int - evo_payment_redemption: Int - evo_period: Int - evo_period_new: Int - evo_price_calc: Decimal - evo_price_without_discount: Decimal - evo_price_without_discount_new: Decimal - evo_price_without_discount_supplier_rub: Decimal - evo_price_without_discount_supplier_rub_new: Decimal - evo_price_without_disc_supplier_currency: Decimal - evo_price_without_disc_supplier_currency_new: Decimal - evo_price_wthout_disc_nds_sup_currency: Decimal - evo_price_wthout_disc_nds_sup_currency_new: Decimal - evo_program_import_subsidy_sum: Decimal - evo_program_import_subsidy_sum_new: Decimal - evo_prop_type: String - evo_prop_type_new: String - evo_pts_change: Boolean - evo_pts_type: Int - evo_pts_type_new: Int - evo_quoteid: Uuid - evo_reasons_calc: [Int!] - evo_recalculate_demand: Boolean - evo_refuse_reason: Int - evo_regionid: Uuid - evo_regionid_new: Uuid - evo_region_director_bonus: Decimal - evo_registration: Int - evo_registration_addproduct_typeid: Uuid - evo_registration_addproduct_typeid_new: Uuid - evo_registration_change: Boolean - evo_registration_new: Int - evo_registration_regionid: Uuid - evo_registration_regionid_new: Uuid - evo_remove_restrictions: Boolean - evo_seats: Int - evo_seats_new: Int - evo_signatory_evo_systemuserid: Uuid - evo_signatory_lp_contactid: Uuid - evo_signatory_lp_contactid_new: Uuid - evo_source: Int - evo_specification_change: Boolean - evo_statuscodeid: Uuid - evo_statuscodeidData: evo_statuscode - evo_statuscode_reason: String - evo_storage: String - evo_sum_pay_change: Boolean - evo_supplier_accountid: Uuid - evo_supplier_accountid_new: Uuid - evo_supplier_bank_detailsid: Uuid - evo_supplier_bank_detailsid_new: Uuid - evo_supplier_change: Boolean - evo_supplier_currency_price: Decimal - evo_supplier_currency_price_new: Decimal - evo_supplier_pay_actual: Decimal - evo_supplier_pay_actual_currency: Decimal - evo_supplier_signer_contactid_new: Uuid - evo_suspend_contract_change: Boolean - evo_telematics_addproduct_typeid: Uuid - evo_telematics_addproduct_typeid_new: Uuid - evo_townid: Uuid - evo_townid_new: Uuid - evo_tracking_addproduct_typeid: Uuid - evo_tracking_addproduct_typeid_new: Uuid - evo_tracking_control_change: Boolean - evo_transmission_number: String - evo_transmission_number_new: String - evo_type_agreement: Int - evo_type_change_registration: Int - evo_type_change_telematics: Int - evo_type_change_tracking: Int - evo_unlimit_drivers: Boolean - evo_unlimit_drivers_new: Boolean - evo_vacation_number_months: Int - evo_vehicle_tax_approved: Decimal - evo_vehicle_tax_approved_new: Decimal - evo_vehicle_tax_period: Decimal - evo_vehicle_tax_period_new: Decimal - evo_vehicle_tax_year: Decimal - evo_vehicle_tax_year_new: Decimal - evo_vehicle_type_tax: Int - evo_vehicle_type_tax_new: Int - evo_vin: String - evo_vin_new: String - evo_year: Int - evo_year_new: Int - modifiedon: DateTime - ownerid: Uuid - toObjectString: String -} - -type email { - activityid: Uuid - createdon: DateTime - description: String - email_activity_parties: [activityparty] - evo_accountid: Uuid - modifiedon: DateTime - regardingobjectid_account: Uuid - regardingobjectid_evo_contract: Uuid - regardingobjectid_evo_insurance_period: Uuid - regardingobjectid_evo_insurance_policy: Uuid - regardingobjectid_evo_insurance_policyData: evo_insurance_policy - regardingobjectid_evo_list: Uuid - regardingobjectid_incident: Uuid - regardingobjectid_opportunity: Uuid - statecode: Int - statuscode: Int - subject: String - templateid: Uuid - toObjectString: String -} - -type evo_bank_details { - createdon: DateTime - evo_accountid: Uuid - evo_bankid: Uuid - evo_bankidData: account - evo_bank_code: String - evo_bank_detailsid: Uuid - evo_contactid: Uuid - evo_corresponding_account: String - evo_datefrom: DateTime - evo_kbk: String - evo_name: String - evo_payment_account: String - link: String - modifiedon: DateTime - toObjectString: String -} - -type queue { - createdon: DateTime - emailaddress: String - evo_id: String - modifiedon: DateTime - name: String - queueid: Uuid - toObjectString: String -} - -type template { - body: String - createdon: DateTime - description: String - modifiedon: DateTime - subject: String - templateid: Uuid - toObjectString: String -} - type MutationBy { associateBankDetailsAndAgencyAgreement_(evo_agency_agreementid: Uuid!, evo_bank_detailsid: Uuid!): Entity createEntity(data: EntityDataInput): Uuid! createIncident_(contracts: [Uuid!], customerid_account: Uuid, description: String, evo_fast_advice: Boolean, evo_subject_incidentid: Uuid, subjectid: Uuid, title: String): Entity - createScheduledCall_(evo_accountid: Uuid, evo_channel: String, evo_company_name: String, evo_contact_lastname: String, evo_contact_name: String, evo_inn: String, evo_name: String, evo_note: String, evo_scheduled_time: DateTime, evo_status: Int, evo_telephone1: String, ownerid: Uuid): Entity + createScheduledCall_(evo_accountid: Uuid, evo_channel: String, evo_company_name: String, evo_contact_lastname: String, evo_contact_name: String, evo_inn: String, evo_name: String, evo_note: String, evo_scheduled_time: DateTime, evo_status: Int, evo_telephone1: String, ownerid_systemuser: Uuid, ownerid_team: Uuid): Entity updateAccount_(accountid: Uuid!, evo_agency_agreementid: Uuid): Entity updateEntity(data: EntityDataInput): Boolean! } -"""The `DateTime` scalar represents an ISO-8601 compliant date time type.""" -scalar DateTime - -enum SortingType { - DESC - ASC -} - -input FilterInput { - fieldname: String - guidvalues: [Uuid] - intvalues: [Int!] - operation: FilterOperation! - stringvalues: [String] -} - -enum LogicOperation { - AND - OR -} - -type businessunit { - businessunitid: Uuid - createdon: DateTime - evo_addressid: Uuid - evo_boss_systemuserid: Uuid - evo_deputy_director_systemuserid: Uuid - evo_director_systemuserid: Uuid - evo_region_director_systgemuserid: Uuid - evo_region_director_systgemuseridname: String - modifiedon: DateTime - name: String - toObjectString: String -} - type evo_document { createdon: DateTime evo_accountid: Uuid @@ -2862,54 +2872,25 @@ type evo_document { toObjectString: String } -type picklist { - name: String - values: [picklist_value] +"""The `DateTime` scalar represents an ISO-8601 compliant date time type.""" +scalar DateTime + +enum SortingType { + DESC + ASC } -type team { - createdon: DateTime - evo_baseproducts(statecode: Int): [evo_baseproduct] - evo_identity_documents: [evo_identity_document] - modifiedon: DateTime - name: String - teamid: Uuid - toObjectString: String +input FilterInput { + fieldname: String + guidvalues: [Uuid] + intvalues: [Int!] + operation: FilterOperation! + stringvalues: [String] } -type evo_edo { - createdon: DateTime - evo_accountid: Uuid - evo_accountidData: account - evo_activation_status: Int - evo_activation_statusname: String - evo_box_edoid: Uuid - evo_box_edoidData: evo_edo - evo_box_id: String - evo_box_name: String - evo_contractid: Uuid - evo_contractidData: evo_contract - evo_documentid: Uuid - evo_documenttypeid: Uuid - evo_edoid: Uuid - evo_edo_department: Int - evo_edo_status: Int - evo_edo_statusname: String - evo_edo_type: Int - evo_edo_typeename: String - evo_formalized: Boolean - evo_invite_crm_status: Int - evo_invite_crm_statusname: String - evo_legal_status: Int - evo_name: String - evo_project_documenttypeid: Uuid - evo_signer_systemuserid: Uuid - evo_sign_required: Boolean - evo_statuscodeid: Uuid - evo_statuscodeidData: evo_statuscode - evo_use_box: Boolean - modifiedon: DateTime - toObjectString: String +enum LogicOperation { + AND + OR } type evo_insurance_policy { @@ -2940,6 +2921,93 @@ type evo_insurance_policy { toObjectString: String } +type activityparty { + addressused: String + createdon: DateTime + modifiedon: DateTime + participationtypemask: Int + partyid_account: Uuid + partyid_contact: Uuid + partyid_evo_contract: Uuid + partyid_queue: Uuid + partyid_systemuser: Uuid + toObjectString: String +} + +type team { + createdon: DateTime + evo_baseproducts(statecode: Int): [evo_baseproduct] + evo_identity_documents: [evo_identity_document] + modifiedon: DateTime + name: String + teamid: Uuid + toObjectString: String +} + +type businessunit { + businessunitid: Uuid + createdon: DateTime + evo_addressid: Uuid + evo_boss_systemuserid: Uuid + evo_deputy_director_systemuserid: Uuid + evo_director_systemuserid: Uuid + evo_region_director_systgemuserid: Uuid + evo_region_director_systgemuseridname: String + modifiedon: DateTime + name: String + toObjectString: String +} + +type picklist { + name: String + values: [picklist_value] +} + +type evo_connection_role { + createdon: DateTime + evo_connection_roleid: Uuid + evo_edo_department: Int + modifiedon: DateTime + toObjectString: String +} + +type evo_edo { + createdon: DateTime + evo_accountid: Uuid + evo_accountidData: account + evo_activation_status: Int + evo_activation_statusname: String + evo_addcontractid: Uuid + evo_box_edoid: Uuid + evo_box_edoidData: evo_edo + evo_box_id: String + evo_box_name: String + evo_contractid: Uuid + evo_contractidData: evo_contract + evo_documentid: Uuid + evo_documenttypeid: Uuid + evo_edoid: Uuid + evo_edo_department: Int + evo_edo_status: Int + evo_edo_statusname: String + evo_edo_type: Int + evo_edo_typeename: String + evo_formalized: Boolean + evo_invite_crm_status: Int + evo_invite_crm_statusname: String + evo_legal_status: Int + evo_name: String + evo_project_documenttypeid: Uuid + evo_signer_systemuserid: Uuid + evo_sign_date: DateTime + evo_sign_required: Boolean + evo_statuscodeid: Uuid + evo_statuscodeidData: evo_statuscode + evo_use_box: Boolean + modifiedon: DateTime + toObjectString: String +} + type evo_addproductnumber { createdon: DateTime evo_accountid: Uuid @@ -2958,6 +3026,7 @@ type evo_approvallog { evo_agency_agreementid: Uuid evo_approvallogid: Uuid evo_contractid: Uuid + evo_debtwork_contractid: Uuid evo_incidentid: Uuid evo_insurance_policyid: Uuid evo_leadid: Uuid @@ -2983,16 +3052,6 @@ type tisa_phonecallprocessing { toObjectString: String } -type role { - createdon: DateTime - evo_connection_roleData: evo_connection_role - evo_documenttypes: [evo_documenttype] - modifiedon: DateTime - name: String - roleid: Uuid - toObjectString: String -} - type picklist_value { color: String label: String @@ -3000,19 +3059,6 @@ type picklist_value { value: Int! } -type activityparty { - addressused: String - createdon: DateTime - modifiedon: DateTime - participationtypemask: Int - partyid_account: Uuid - partyid_contact: Uuid - partyid_evo_contract: Uuid - partyid_queue: Uuid - partyid_systemuser: Uuid - toObjectString: String -} - input EntityDataInput { fields: [EntityFieldInput] id: Uuid @@ -3035,14 +3081,6 @@ enum FilterOperation { LESSOREQUALTHEN } -type evo_connection_role { - createdon: DateTime - evo_connection_roleid: Uuid - evo_edo_department: Int - modifiedon: DateTime - toObjectString: String -} - input EntityFieldInput { activitypartiesvalue: [activitypartyInput] boolvalue: Boolean diff --git a/apps/web/graphql/crm.types.ts b/apps/web/graphql/crm.types.ts index 07c7aeb..d3aa73f 100644 --- a/apps/web/graphql/crm.types.ts +++ b/apps/web/graphql/crm.types.ts @@ -135,19 +135,33 @@ export type GetCurrencyChangesQueryVariables = Exact<{ export type GetCurrencyChangesQuery = { __typename?: 'Query', evo_currencychanges: Array<{ __typename?: 'evo_currencychange', evo_currencychange: number | null, evo_ref_transactioncurrency: string | null } | null> | null }; +export type GetLeadsQueryVariables = Exact<{ + domainname: InputMaybe; +}>; + + +export type GetLeadsQuery = { __typename?: 'Query', leads: Array<{ __typename?: 'lead', label: string | null, value: string | null } | null> | null }; + export type GetLeadQueryVariables = Exact<{ leadid: Scalars['Uuid']; }>; -export type GetLeadQuery = { __typename?: 'Query', lead: { __typename?: 'lead', evo_agent_accountid: string | null, evo_double_agent_accountid: string | null, evo_broker_accountid: string | null, evo_fin_department_accountid: string | null, evo_opportunityidData: { __typename?: 'opportunity', label: string | null, value: string | null } | null } | null }; +export type GetLeadQuery = { __typename?: 'Query', lead: { __typename?: 'lead', evo_agent_accountid: string | null, evo_double_agent_accountid: string | null, evo_broker_accountid: string | null, evo_fin_department_accountid: string | null, evo_inn: string | null, evo_opportunityidData: { __typename?: 'opportunity', label: string | null, value: string | null } | null, accountidData: { __typename?: 'account', evo_address_legalidData: { __typename?: 'evo_address', evo_region_fias_id: string | null, evo_city_fias_id: string | null } | null } | null } | null }; export type GetOpportunityQueryVariables = Exact<{ opportunityid: Scalars['Uuid']; }>; -export type GetOpportunityQuery = { __typename?: 'Query', opportunity: { __typename?: 'opportunity', evo_leadid: string | null } | null }; +export type GetOpportunityQuery = { __typename?: 'Query', opportunity: { __typename?: 'opportunity', evo_leadid: string | null, accountidData: { __typename?: 'account', evo_address_legalidData: { __typename?: 'evo_address', evo_region_fias_id: string | null, evo_city_fias_id: string | null } | null } | null } | null }; + +export type GetOpportunitiesQueryVariables = Exact<{ + domainname: InputMaybe; +}>; + + +export type GetOpportunitiesQuery = { __typename?: 'Query', opportunities: Array<{ __typename?: 'opportunity', label: string | null, value: string | null } | null> | null }; export type GetQuotesQueryVariables = Exact<{ leadid: Scalars['Uuid']; @@ -175,7 +189,7 @@ export type GetTarifQueryVariables = Exact<{ }>; -export type GetTarifQuery = { __typename?: 'Query', evo_tarif: { __typename?: 'evo_tarif', evo_irr: number | null, evo_graphtype_exception: Array | null, evo_seasons_type_exception: Array | null, evo_min_decreasing_perc: number | null } | null }; +export type GetTarifQuery = { __typename?: 'Query', evo_tarif: { __typename?: 'evo_tarif', evo_irr: number | null, evo_graphtype_exception: Array | null, evo_seasons_type_exception: Array | null, evo_min_decreasing_perc: number | null, evo_min_irr: number | null, evo_cut_irr_with_bonus_coefficient: number | null, evo_max_irr: number | null } | null }; export type GetRatesQueryVariables = Exact<{ currentDate: InputMaybe; @@ -184,6 +198,13 @@ export type GetRatesQueryVariables = Exact<{ export type GetRatesQuery = { __typename?: 'Query', evo_rates: Array<{ __typename?: 'evo_rate', evo_id: string | null, label: string | null, value: string | null, evo_tarifs: Array<{ __typename?: 'evo_tarif', evo_tarifid: string | null } | null> | null } | null> | null }; +export type GetRateQueryVariables = Exact<{ + rateId: Scalars['Uuid']; +}>; + + +export type GetRateQuery = { __typename?: 'Query', evo_rate: { __typename?: 'evo_rate', evo_base_rate: number | null } | null }; + export type GetProductsQueryVariables = Exact<{ currentDate: InputMaybe; }>; @@ -196,7 +217,7 @@ export type GetProductQueryVariables = Exact<{ }>; -export type GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null } | null }; +export type GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array | null, evo_sale_without_nds: boolean | null, evo_cut_proportion_bonus_director: boolean | null, evo_cut_irr_with_bonus: boolean | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null } | null }; export type GetSubsidiesQueryVariables = Exact<{ currentDate: InputMaybe; @@ -222,7 +243,21 @@ export type GetImportProgramQuery = { __typename?: 'Query', importProgram: { __t export type GetRegionsQueryVariables = Exact<{ [key: string]: never; }>; -export type GetRegionsQuery = { __typename?: 'Query', evo_regions: Array<{ __typename?: 'evo_region', label: string | null, value: string | null } | null> | null }; +export type GetRegionsQuery = { __typename?: 'Query', evo_regions: Array<{ __typename?: 'evo_region', evo_fias_id: string | null, evo_businessunit_evolution: boolean | null, label: string | null, value: string | null } | null> | null }; + +export type GetRegionQueryVariables = Exact<{ + regionId: Scalars['Uuid']; +}>; + + +export type GetRegionQuery = { __typename?: 'Query', evo_region: { __typename?: 'evo_region', evo_oktmo: string | null, accounts: Array<{ __typename?: 'account', accountid: string | null } | null> | null } | null }; + +export type GetTownsQueryVariables = Exact<{ + regionId: Scalars['Uuid']; +}>; + + +export type GetTownsQuery = { __typename?: 'Query', evo_towns: Array<{ __typename?: 'evo_town', evo_fias_id: string | null, evo_businessunit_evolution: boolean | null, label: string | null, value: string | null } | null> | null }; export type GetGpsBrandsQueryVariables = Exact<{ [key: string]: never; }>; @@ -239,13 +274,20 @@ export type GetLeaseObjectTypeQueryVariables = Exact<{ }>; -export type GetLeaseObjectTypeQuery = { __typename?: 'Query', leaseObjectType: { __typename?: 'evo_leasingobject_type', evo_vehicle_type: Array | null } | null }; +export type GetLeaseObjectTypeQuery = { __typename?: 'Query', evo_leasingobject_type: { __typename?: 'evo_leasingobject_type', evo_vehicle_type: Array | null, evo_id: string | null, evo_category: number | null, evo_vehicle_type_tax: number | null, evo_category_tr: Array | null } | null }; export type GetBrandsQueryVariables = Exact<{ [key: string]: never; }>; export type GetBrandsQuery = { __typename?: 'Query', evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null, evo_vehicle_type: Array | null, label: string | null, value: string | null } | null> | null }; +export type GetBrandQueryVariables = Exact<{ + brandId: Scalars['Uuid']; +}>; + + +export type GetBrandQuery = { __typename?: 'Query', evo_brand: { __typename?: 'evo_brand', evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null } | null }; + export type GetModelsQueryVariables = Exact<{ brandId: Scalars['Uuid']; }>; @@ -253,13 +295,27 @@ export type GetModelsQueryVariables = Exact<{ export type GetModelsQuery = { __typename?: 'Query', evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null, evo_vehicle_type: number | null, label: string | null, value: string | null } | null> | null }; +export type GetModelQueryVariables = Exact<{ + modelId: Scalars['Uuid']; +}>; + + +export type GetModelQuery = { __typename?: 'Query', evo_model: { __typename?: 'evo_model', evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null, evo_impairment_groupidData: { __typename?: 'evo_impairment_group', evo_name: string | null } | null } | null }; + export type GetConfigurationsQueryVariables = Exact<{ - modelId: InputMaybe; + modelId: Scalars['Uuid']; }>; export type GetConfigurationsQuery = { __typename?: 'Query', evo_equipments: Array<{ __typename?: 'evo_equipment', label: string | null, value: string | null } | null> | null }; +export type GetConfigurationQueryVariables = Exact<{ + configurationId: Scalars['Uuid']; +}>; + + +export type GetConfigurationQuery = { __typename?: 'Query', evo_equipment: { __typename?: 'evo_equipment', evo_impairment_groupidData: { __typename?: 'evo_impairment_group', evo_name: string | null } | null } | null }; + export type GetDealersQueryVariables = Exact<{ [key: string]: never; }>; @@ -301,33 +357,27 @@ export type GetRewardConditionQueryVariables = Exact<{ export type GetRewardConditionQuery = { __typename?: 'Query', evo_reward_condition: { __typename?: 'evo_reward_condition', evo_reward_summ: number | null, evo_reduce_reward: boolean | null, evo_min_reward_summ: number | null, evo_agency_agreementidData: { __typename?: 'evo_agency_agreement', evo_required_reward: boolean | null, evo_reward_without_other_agent: boolean | null } | null } | null }; -export type GetConfiguratorDataFromQuoteQueryVariables = Exact<{ - quoteId: Scalars['Uuid']; +export type GetSotCoefficientTypeQueryVariables = Exact<{ + evo_id: InputMaybe; }>; -export type GetConfiguratorDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null } | null }; +export type GetSotCoefficientTypeQuery = { __typename?: 'Query', evo_sot_coefficient_type: { __typename?: 'evo_sot_coefficient_type', evo_sot_coefficient_typeid: string | null } | null }; -export type GetFingapDataFromQuoteQueryVariables = Exact<{ - quoteId: Scalars['Uuid']; -}>; - - -export type GetFingapDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null } | null }; - -export type GetFinGapAddProductTypesQueryVariables = Exact<{ +export type GetCoefficientsQueryVariables = Exact<{ currentDate: InputMaybe; + jobTitleId: Scalars['Uuid']; }>; -export type GetFinGapAddProductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null, evo_name: string | null, evo_type_calc_cerebellum: number | null, evo_cost_service_provider_withoutnds: number | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null } | null> | null } | null> | null }; +export type GetCoefficientsQuery = { __typename?: 'Query', evo_coefficients: Array<{ __typename?: 'evo_coefficient', evo_job_titleid: string | null, evo_sot_coefficient_typeid: string | null, evo_sot_coefficient: number | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null } | null> | null }; -export type GetInsuranceDataQueryVariables = Exact<{ - evo_account_type: InputMaybe | Scalars['Int']>; +export type GetSystemUserQueryVariables = Exact<{ + domainname: InputMaybe; }>; -export type GetInsuranceDataQuery = { __typename?: 'Query', osago: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, kasko: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, fingap: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null }; +export type GetSystemUserQuery = { __typename?: 'Query', systemuser: { __typename?: 'systemuser', evo_job_titleid: string | null } | null }; export type GetAddproductTypesQueryVariables = Exact<{ currentDate: InputMaybe; @@ -336,12 +386,75 @@ export type GetAddproductTypesQueryVariables = Exact<{ export type GetAddproductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, evo_product_type: number | null, label: string | null, value: string | null } | null> | null }; -export type GetOwnerDataQueryVariables = Exact<{ - domainname: InputMaybe; +export type GetRegistrationTypesQueryVariables = Exact<{ + currentDate: InputMaybe; }>; -export type GetOwnerDataQuery = { __typename?: 'Query', selectLead: Array<{ __typename?: 'lead', label: string | null, value: string | null } | null> | null, selectOpportunity: Array<{ __typename?: 'opportunity', label: string | null, value: string | null } | null> | null }; +export type GetRegistrationTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, evo_whom_register: number | null, evo_gibdd_region: boolean | null, evo_pts_type: Array | null, evo_accountid: string | null, evo_towtruck: boolean | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null> | null }; + +export type GetAddProductTypeQueryVariables = Exact<{ + addproductTypeId: Scalars['Uuid']; +}>; + + +export type GetAddProductTypeQuery = { __typename?: 'Query', evo_addproduct_type: { __typename?: 'evo_addproduct_type', evo_description: string | null } | null }; + +export type GetQuoteBonusDataQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetQuoteBonusDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_sale_bonus: number | null } | null }; + +export type GetQuoteConfiguratorDataQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetQuoteConfiguratorDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null } | null }; + +export type GetQuoteFingapDataQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetQuoteFingapDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null } | null }; + +export type GetFinGapAddProductTypesQueryVariables = Exact<{ + currentDate: InputMaybe; +}>; + + +export type GetFinGapAddProductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null, evo_name: string | null, evo_type_calc_cerebellum: number | null, evo_cost_service_provider_withoutnds: number | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null } | null> | null } | null> | null }; + +export type GetQuoteGibddDataQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetQuoteGibddDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_db_accept_registration: number | null, evo_object_registration: number | null, evo_pts_type: number | null, evo_vehicle_tax_year: number | null, evo_vehicle_tax_approved: number | null, evo_category_tr: number | null, evo_vehicle_type_tax: number | null, evo_regionid: string | null, evo_townid: string | null, evo_legal_regionid: string | null, evo_legal_townid: string | null, evo_registration_regionid: string | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_addproduct_typeid: string | null } | null> | null } | null }; + +export type GetQuoteRegionTownQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetQuoteRegionTownQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_regionid: string | null, evo_townid: string | null, evo_legal_regionid: string | null, evo_legal_townid: string | null } | null }; + +export type GetInsuranceDataQueryVariables = Exact<{ + evo_account_type: InputMaybe | Scalars['Int']>; +}>; + + +export type GetInsuranceDataQuery = { __typename?: 'Query', osago: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, kasko: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, fingap: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null }; + +export type GetQuoteInsuranceDataQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetQuoteInsuranceDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_osago_accountid: string | null, evo_osago_payer: number | null, evo_osago_price: number | null, evo_kasko_accountid: string | null, evo_kasko_payer: number | null, evo_kasko_price: number | null, evo_insurance_period: number | null, evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null } | null }; export type GetLeadUrlQueryVariables = Exact<{ id: Scalars['Uuid']; @@ -364,12 +477,12 @@ export type GetQuoteUrlQueryVariables = Exact<{ export type GetQuoteUrlQuery = { __typename?: 'Query', entity: { __typename?: 'quote', link: string | null } | null }; -export type GetLeasingObjectDataFromQuoteQueryVariables = Exact<{ +export type GetQuoteLeasingObjectDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetLeasingObjectDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_modelid: string | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | null } | null }; +export type GetQuoteLeasingObjectDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_category: number | null, evo_delivery_time: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_max_mass: number | null, evo_max_speed: number | null, evo_mileage: number | null, evo_modelid: string | null, evo_object_count: number | null, evo_power: number | null, evo_recalc_limit: number | null, evo_seats: number | null, evo_trailer: boolean | null, evo_use_for: number | null, evo_vin: string | null, evo_year: number | null } | null }; export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{ currentDate: InputMaybe; @@ -378,19 +491,26 @@ export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{ export type GetLeasingWithoutKaskoOptionsQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_min_period: number | null, evo_max_period: number | null, evo_min_price: number | null, evo_max_price: number | null, evo_visible_calc: boolean | null, evo_min_first_payment_perc: number | null, evo_max_first_payment_perc: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null } | null> | null }; -export type GetPaymentsDataFromQuoteQueryVariables = Exact<{ +export type GetQuotePaymentsDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetPaymentsDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_period: number | null, evo_accept_period: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_graphs: Array<{ __typename?: 'evo_graph', createdon: string | null, evo_sumpay_withnds: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_payment_ratio: number | null } | null> | null } | null> | null } | null }; +export type GetQuotePaymentsDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_period: number | null, evo_accept_period: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_graphs: Array<{ __typename?: 'evo_graph', createdon: string | null, evo_sumpay_withnds: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_payment_ratio: number | null } | null> | null } | null> | null } | null }; -export type GetPriceDataFromQuoteQueryVariables = Exact<{ +export type GetQuotePriceDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetPriceDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_supplier_currency_price: number | null, evo_price_without_nds_supplier_currency: number | null, evo_nds_in_price_supplier_currency: number | null, evo_last_payment_rub: number | null, evo_last_payment_calc: number | null, evo_transactioncurrencyid: string | null, evo_discount_supplier_currency: number | null, evo_discount_perc: number | null, evo_comission_perc: number | null, evo_comission_rub: number | null, evo_sale_bonus: number | null } | null }; +export type GetQuotePriceDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_comission_rub: number | null, evo_comission_perc: number | null, evo_discount_perc: number | null, evo_discount_supplier_currency: number | null, evo_first_payment_perc: number | null, evo_last_payment_calc: number | null, evo_last_payment_perc: number | null, evo_last_payment_rub: number | null, evo_nds_in_price_supplier_currency: number | null, evo_price_without_nds_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_transactioncurrencyid: string | null } | null }; + +export type GetQuoteSubsidyDataQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetQuoteSubsidyDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_subsidyid: string | null, evo_program_import_subsidyid: string | null } | null }; export type GetRewardRulesQueryVariables = Exact<{ conditionId: Scalars['Uuid']; @@ -399,54 +519,71 @@ export type GetRewardRulesQueryVariables = Exact<{ export type GetRewardRulesQuery = { __typename?: 'Query', evo_reward_condition: { __typename?: 'evo_reward_condition', evo_calc_reward_rules: number | null } | null }; -export type GetAgentsDataFromQuoteQueryVariables = Exact<{ +export type GetQuoteAgentsDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; -export type GetAgentsDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_supplier_accountid: string | null, evo_dealer_person_accountid: string | null, evo_dealer_reward_conditionid: string | null, evo_dealer_reward_total: number | null, evo_dealer_reward_summ: number | null, evo_dealer_broker_accountid: string | null, evo_dealer_broker_reward_conditionid: string | null, evo_dealer_broker_reward_total: number | null, evo_dealer_broker_reward_summ: number | null, evo_agent_accountid: string | null, evo_agent_reward_conditionid: string | null, evo_agent_reward_total: number | null, evo_agent_reward_summ: number | null, evo_double_agent_accountid: string | null, evo_double_agent_reward_conditionid: string | null, evo_double_agent_reward_total: number | null, evo_double_agent_reward_summ: number | null, evo_broker_accountid: string | null, evo_broker_reward_conditionid: string | null, evo_broker_reward_total: number | null, evo_broker_reward_summ: number | null, evo_fin_department_accountid: string | null, evo_fin_department_reward_conditionid: string | null, evo_fin_department_reward_total: number | null, evo_fin_department_reward_summ: number | null } | null }; +export type GetQuoteAgentsDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_supplier_accountid: string | null, evo_dealer_person_accountid: string | null, evo_dealer_reward_conditionid: string | null, evo_dealer_reward_total: number | null, evo_dealer_reward_summ: number | null, evo_dealer_broker_accountid: string | null, evo_dealer_broker_reward_conditionid: string | null, evo_dealer_broker_reward_total: number | null, evo_dealer_broker_reward_summ: number | null, evo_agent_accountid: string | null, evo_agent_reward_conditionid: string | null, evo_agent_reward_total: number | null, evo_agent_reward_summ: number | null, evo_double_agent_accountid: string | null, evo_double_agent_reward_conditionid: string | null, evo_double_agent_reward_total: number | null, evo_double_agent_reward_summ: number | null, evo_broker_accountid: string | null, evo_broker_reward_conditionid: string | null, evo_broker_reward_total: number | null, evo_broker_reward_summ: number | null, evo_fin_department_accountid: string | null, evo_fin_department_reward_conditionid: string | null, evo_fin_department_reward_total: number | null, evo_fin_department_reward_summ: number | null } | null }; export const GetTransactionCurrenciesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransactionCurrencies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactioncurrencies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"currencyname"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"isocurrencycode"}},{"kind":"Field","name":{"kind":"Name","value":"currencysymbol"}}]}}]}}]} as unknown as DocumentNode; export const GetTransactionCurrencyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransactionCurrency"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currencyid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactioncurrency"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"transactioncurrencyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currencyid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencysymbol"}},{"kind":"Field","name":{"kind":"Name","value":"isocurrencycode"}}]}}]}}]} as unknown as DocumentNode; export const GetCurrencyChangesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrencyChanges"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_currencychanges"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_coursedate_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_currencychange"}},{"kind":"Field","name":{"kind":"Name","value":"evo_ref_transactioncurrency"}}]}}]}}]} as unknown as DocumentNode; -export const GetLeadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLead"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_opportunityidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"opportunityid"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetOpportunityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leadid"}}]}}]}}]} as unknown as DocumentNode; +export const GetLeadsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeads"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"leads"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"owner_domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"fullname"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"leadid"}}]}}]}}]} as unknown as DocumentNode; +export const GetLeadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLead"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_opportunityidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"opportunityid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","name":{"kind":"Name","value":"accountidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_address_legalidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_city_fias_id"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetOpportunityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leadid"}},{"kind":"Field","name":{"kind":"Name","value":"accountidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_address_legalidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_city_fias_id"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetOpportunitiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunities"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"owner_domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"opportunityid"}}]}}]}}]} as unknown as DocumentNode; export const GetQuotesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quotes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_quotename"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"quoteid"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode; export const GetTarifsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarifs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_used"}}]}}]}}]} as unknown as DocumentNode; -export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarif"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarif"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_tarifid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphtype_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_decreasing_perc"}}]}}]}}]} as unknown as DocumentNode; +export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarif"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarif"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_tarifid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphtype_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_decreasing_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus_coefficient"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_irr"}}]}}]}}]} as unknown as DocumentNode; export const GetRatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRates"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_rateid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_base_rate"}}]}}]}}]} as unknown as DocumentNode; export const GetProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProducts"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_relation"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode; -export const GetProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_baseproductid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_calculation_method"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_baseproductid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_calculation_method"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_proportion_bonus_director"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus"}}]}}]}}]} as unknown as DocumentNode; export const GetSubsidiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidies"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidies"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_type"}}]}}]}}]} as unknown as DocumentNode; export const GetSubsidyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidy"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_percent_subsidy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_subsidy_summ"}}]}}]}}]} as unknown as DocumentNode; export const GetImportProgramDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetImportProgram"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"importProgram"},"name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetRegionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_regionid"}}]}}]}}]} as unknown as DocumentNode; +export const GetRegionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunit_evolution"}}]}}]}}]} as unknown as DocumentNode; +export const GetRegionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_oktmo"}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetTownsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTowns"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_towns"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunit_evolution"}}]}}]}}]} as unknown as DocumentNode; export const GetGpsBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_brandid"}}]}}]}}]} as unknown as DocumentNode; export const GetLeaseObjectTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode; -export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"leaseObjectType"},"name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode; +export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}}]}}]}}]} as unknown as DocumentNode; export const GetBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode; +export const GetBrandDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrand"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brand"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}}]}}]}}]} as unknown as DocumentNode; export const GetModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode; -export const GetConfigurationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfigurations"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_equipmentid"}}]}}]}}]} as unknown as DocumentNode; +export const GetModelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_model"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}}]}}]}}]} as unknown as DocumentNode; +export const GetConfigurationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfigurations"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_equipmentid"}}]}}]}}]} as unknown as DocumentNode; +export const GetConfigurationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguration"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_equipmentid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetDealersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealers"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_legal_form"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]} as unknown as DocumentNode; export const GetDealerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealer"},"name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_return_leasing_dealer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}}]}}]}}]} as unknown as DocumentNode; export const GetDealerPersonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealerPersons"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealerPersons"},"name":{"kind":"Name","value":"salon_providers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"salonaccountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kpp"}}]}}]}}]} as unknown as DocumentNode; export const GetAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agent"},"name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardConditionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardConditions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_conditions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_agent_accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_agency_agreementid_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"has"},"value":{"kind":"BooleanValue","value":true}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reward_summ"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardConditionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardCondition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reduce_reward"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agency_agreementidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_required_reward"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reward_without_other_agent"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetConfiguratorDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguratorDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode; -export const GetFingapDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFingapDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetFinGapAddProductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFinGAPAddProductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000006"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type_calc_cerebellum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetInsuranceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"osago"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"kasko"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"fingap"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000002"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; +export const GetSotCoefficientTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSotCoefficientType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evo_id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}}]}}]}}]} as unknown as DocumentNode; +export const GetCoefficientsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoefficients"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_coefficients"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_job_titleid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient"}}]}}]}}]} as unknown as DocumentNode; +export const GetSystemUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSystemUser"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"systemuser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}}]}}]}}]} as unknown as DocumentNode; export const GetAddproductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddproductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}}]}}]}}]} as unknown as DocumentNode; -export const GetOwnerDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOwnerData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"selectLead"},"name":{"kind":"Name","value":"leads"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"owner_domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"fullname"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"leadid"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"selectOpportunity"},"name":{"kind":"Name","value":"opportunities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"owner_domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"opportunityid"}}]}}]}}]} as unknown as DocumentNode; +export const GetRegistrationTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegistrationTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_whom_register"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gibdd_region"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_towtruck"}}]}}]}}]} as unknown as DocumentNode; +export const GetAddProductTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddProductType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_addproduct_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_description"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteBonusDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteBonusData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteConfiguratorDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteConfiguratorData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteFingapDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteFingapData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetFinGapAddProductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFinGAPAddProductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000006"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type_calc_cerebellum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteGibddDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteGibddData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_approved"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_regionid"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteRegionTownDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteRegionTown"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}}]}}]}}]} as unknown as DocumentNode; +export const GetInsuranceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"osago"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"kasko"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"fingap"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000002"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteInsuranceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteInsuranceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_osago_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_period"}}]}}]}}]} as unknown as DocumentNode; export const GetLeadUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeadUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; export const GetOpportunityUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunityUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; -export const GetLeasingObjectDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingObjectDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteLeasingObjectDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteLeasingObjectData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vin"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}}]}}]}}]} as unknown as DocumentNode; export const GetLeasingWithoutKaskoOptionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoOptions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000007"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetPaymentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentsDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetPriceDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPriceDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_nds_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuotePaymentsDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePaymentsData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetQuotePriceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePriceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_comission_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_nds_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteSubsidyDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteSubsidyData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidyid"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardRulesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardRules"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_calc_reward_rules"}}]}}]}}]} as unknown as DocumentNode; -export const GetAgentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentsDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_person_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_summ"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const GetQuoteAgentsDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteAgentsData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_person_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_summ"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/apps/web/mocks/handlers.js b/apps/web/mocks/handlers.js index 45fcd36..970451d 100644 --- a/apps/web/mocks/handlers.js +++ b/apps/web/mocks/handlers.js @@ -23,7 +23,7 @@ const users = { }, }; -const { URL_GET_USER, URL_CORE_FINGAP, URL_CRM_GRAPHQL } = getUrls(); +const { URL_GET_USER, URL_CORE_FINGAP, URL_1C_TRANSTAX } = getUrls(); export const handlers = [ rest.get(URL_GET_USER, (req, res, ctx) => { @@ -37,6 +37,15 @@ export const handlers = [ }) ); }), + rest.post(URL_1C_TRANSTAX, (req, res, ctx) => { + return res( + ctx.json({ + error: null, + tax: _.random(100000, 200000), + }) + ); + }), + // rest.post(URL_CRM_GRAPHQL, (req, res, ctx) => { // return res(ctx.status(503)); // }), diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 20bb334..2bed37a 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -52,6 +52,10 @@ const nextConfig = { destination: env.URL_CORE_FINGAP_DIRECT, source: urls.URL_CORE_FINGAP_PROXY, }, + { + destination: env.URL_1C_TRANSTAX_DIRECT, + source: urls.URL_1C_TRANSTAX_PROXY, + }, ...favicons.map((fileName) => buildFaviconRewrite(`/${fileName}`)), ]; }, diff --git a/apps/web/package.json b/apps/web/package.json index f0900b2..32ca0d7 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -9,6 +9,7 @@ "lint:fix": "next lint -- --fix", "start": "next start", "graphql:update": "node ./scripts/graphql-update.js", + "graphql:codegen": "node ./scripts/graphql-codegen.js", "test": "jest" }, "dependencies": { diff --git a/apps/web/pages/index.jsx b/apps/web/pages/index.jsx index ab62819..3cb4704 100644 --- a/apps/web/pages/index.jsx +++ b/apps/web/pages/index.jsx @@ -3,8 +3,8 @@ import initializeApollo from '@/apollo/client'; import * as Calculation from '@/Components/Calculation'; import { CRMError } from '@/Components/Common/Error'; import Output from '@/Components/Output'; -import { getOwnerData, useInsuranceData, useMainData } from '@/process/init/get-data'; -import { useReactions } from '@/process/init/inject-reactions/hooks'; +import { 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'; @@ -36,9 +36,9 @@ const Grid = styled(Box)` `; function Home({ error }) { - useMainData(); - useInsuranceData(); - useReactions(); + init.useMainData(); + init.useInsuranceData(); + useDefaultReactions(); if (error) return ; @@ -69,12 +69,13 @@ export const getServerSideProps = async ({ req }) => { const apolloClient = initializeApollo(); try { - const { data } = await getOwnerData(apolloClient, user); + const { values, options } = await init.getInitialData(apolloClient, user); return { props: { calculation: { - options: data, + options, + values, }, initialApolloState: apolloClient.cache.extract(), initialQueryState: dehydrate(queryClient), diff --git a/apps/web/process/bonuses/get-kp-data.ts b/apps/web/process/bonuses/get-kp-data.ts new file mode 100644 index 0000000..249845c --- /dev/null +++ b/apps/web/process/bonuses/get-kp-data.ts @@ -0,0 +1,34 @@ +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; +import initializeApollo from '@/apollo/client'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; +import { gql } from '@apollo/client'; + +const QUERY_GET_QUOTE_BONUS_DATA = gql` + query GetQuoteBonusData($quoteId: Uuid!) { + quote(quoteId: $quoteId) { + evo_sale_bonus + } + } +`; + +export async function getKPData({ + values: { quote: quoteId }, +}: GetQuoteInputData): Promise { + const apolloClient = initializeApollo(); + + const { + data: { quote }, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteBonusDataDocument, + variables: { + quoteId, + }, + }); + + return { + values: { + saleBonus: quote?.evo_sale_bonus ?? defaultValues.saleBonus, + }, + }; +} diff --git a/apps/web/process/bonuses/index.ts b/apps/web/process/bonuses/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/bonuses/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/bonuses/reactions/common.ts b/apps/web/process/bonuses/reactions/common.ts new file mode 100644 index 0000000..93a4fdc --- /dev/null +++ b/apps/web/process/bonuses/reactions/common.ts @@ -0,0 +1,96 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import type { ProcessContext } from '../../types'; +import helper from './lib/helper'; +import { makeDisposable } from '@/../../packages/tools'; +import * as CRMTypes from '@/graphql/crm.types'; +import dayjs from 'dayjs'; +import utc from 'dayjs/plugin/utc'; +import { reaction } from 'mobx'; + +dayjs.extend(utc); + +export default function reactions(context: ProcessContext) { + const { store, apolloClient } = context; + const { $calculation, $process } = store; + const { getCoefficient } = helper(context); + + /** + * При изменении значения необходимо значение поля tbxSaleBonus сравнивать со значением из записи Коэффициент + * для расчета evo_coefficient как сейчас + данная запись должна быть связана с Продуктом product + * из поля Продукт selectProduct evo_evo_coefficient_evo_baseproduct + * Если продукта нет или нет коэффициента по условиям, то поле tbxSaleBonus = 0 и закрыто для редактирования + */ + + makeDisposable( + () => + reaction( + () => $calculation.element('selectProduct').getValue(), + async (productId) => { + if (!productId) { + $calculation.element('tbxSaleBonus').resetValue().block(); + + return; + } + + const coefficient = await getCoefficient(productId); + + if (!coefficient?.evo_sot_coefficient) { + $calculation.element('tbxSaleBonus').resetValue().block(); + + return; + } + + const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; + $calculation.element('tbxSaleBonus').setValue(maxBonus).unblock(); + }, + { + fireImmediately: true, + } + ), + () => $process.has('LoadKP') + ); + + /** + * если в Продукте evo_cut_proportion_bonus_director " = Да, + * то tbxBonusCoefficient = tbxSaleBonus/evo_sot_coefficient, + * иначе tbxBonusCoefficient = 1 + * где evo_sot_coefficient ищем так: + * в справочнике Коэффициент для расчета (evo_coefficient) найти запись, у которой: + * + * Тип коэффициента (evo_corfficient_type) = СОТ (100 000 002) + * Статус (statecode) = активный (0) + * Начало действия (evo_datefrom) меньше или равно текущей даты + * Окончание действия (evo_dateto) больше или равно текущей даты + * Должность (evo_evo_job_title_evo_coefficient_job_titleid) = Должности (evo_job_titleid) текущего пользователя (systemuser) + * Тип коэффициента для СОТ (evo_sot_coefficient_typeid) = (evo_sot_coefficient_type.evo_id=BONUS_LEASING) + * данная запись должна быть связана с Продуктом product из поля Продукт selectProduct + */ + reaction( + () => $calculation.$values.getValues(['product', 'saleBonus']), + async ({ product: productId, saleBonus }) => { + if (!productId) { + $calculation.element('tbxBonusCoefficient').resetValue(); + + return; + } + + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + + if (evo_baseproduct?.evo_cut_proportion_bonus_director) { + const coefficient = await getCoefficient(productId); + const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; + + $calculation.element('tbxBonusCoefficient').setValue(maxBonus ? saleBonus / maxBonus : 0); + } else { + $calculation.element('tbxBonusCoefficient').resetValue(); + } + } + ); +} diff --git a/apps/web/process/fingap/reactions/index.js b/apps/web/process/bonuses/reactions/index.ts similarity index 100% rename from apps/web/process/fingap/reactions/index.js rename to apps/web/process/bonuses/reactions/index.ts diff --git a/apps/web/process/bonuses/reactions/lib/helper.ts b/apps/web/process/bonuses/reactions/lib/helper.ts new file mode 100644 index 0000000..4536fee --- /dev/null +++ b/apps/web/process/bonuses/reactions/lib/helper.ts @@ -0,0 +1,64 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +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'; +import * as CRMTypes from '@/graphql/crm.types'; +import dayjs from 'dayjs'; + +export type ProductId = ElementsTypes['selectProduct']; + +export default function helper({ apolloClient, queryClient }: ProcessContext) { + return { + async getCoefficient(productId: ProductId) { + if (!productId) { + return null; + } + + const user = await queryClient.fetchQuery(['user'], () => getUser(), { + staleTime: STALE_TIME, + }); + + const { + data: { systemuser }, + } = await apolloClient.query({ + query: CRMTypes.GetSystemUserDocument, + variables: { + domainname: user.domainName, + }, + }); + + if (!systemuser?.evo_job_titleid) { + return null; + } + + const currentDate = dayjs().utc(false).toISOString(); + + const { + data: { evo_coefficients }, + } = await apolloClient.query({ + query: CRMTypes.GetCoefficientsDocument, + variables: { + currentDate, + jobTitleId: systemuser?.evo_job_titleid, + }, + }); + + const { + data: { evo_sot_coefficient_type }, + } = await apolloClient.query({ + query: CRMTypes.GetSotCoefficientTypeDocument, + variables: { + evo_id: 'BONUS_LEASING', + }, + }); + + return evo_coefficients?.find( + (evo_coefficient) => + evo_coefficient?.evo_sot_coefficient_typeid === + evo_sot_coefficient_type?.evo_sot_coefficient_typeid && + evo_coefficient?.evo_baseproducts?.some((x) => x?.evo_baseproductid === productId) + ); + }, + }; +} diff --git a/apps/web/process/bonuses/reactions/validation.ts b/apps/web/process/bonuses/reactions/validation.ts new file mode 100644 index 0000000..961c169 --- /dev/null +++ b/apps/web/process/bonuses/reactions/validation.ts @@ -0,0 +1,23 @@ +import helper from './lib/helper'; +import type { ProcessContext } from '@/process/types'; +import { reaction } from 'mobx'; +import { round } from 'tools'; + +export default function reactions(context: ProcessContext) { + const { store } = context; + const { $calculation } = store; + const { getCoefficient } = helper(context); + + reaction( + () => $calculation.$values.getValues(['product', 'saleBonus']), + async ({ product: productId, saleBonus }) => { + const coefficient = await getCoefficient(productId); + const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; + + $calculation.element('tbxSaleBonus').validate({ + invalid: round(saleBonus, 2) > round(maxBonus, 2), + message: 'Размер бонуса МПЛ не может быть выше установленного по СОТ', + }); + } + ); +} diff --git a/apps/web/process/calculate/action.ts b/apps/web/process/calculate/action.ts new file mode 100644 index 0000000..6761e50 --- /dev/null +++ b/apps/web/process/calculate/action.ts @@ -0,0 +1 @@ +export function action() {} diff --git a/apps/web/process/calculate/index.ts b/apps/web/process/calculate/index.ts index 2d1ec23..facb8da 100644 --- a/apps/web/process/calculate/index.ts +++ b/apps/web/process/calculate/index.ts @@ -1 +1,2 @@ -export default () => {}; +export * from './action'; +export * as reactions from './reactions'; diff --git a/apps/web/process/calculate/reactions/common.ts b/apps/web/process/calculate/reactions/common.ts new file mode 100644 index 0000000..aa940f3 --- /dev/null +++ b/apps/web/process/calculate/reactions/common.ts @@ -0,0 +1,68 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import * as CRMTypes from '@/graphql/crm.types'; +import type { ProcessContext } from '@/process/types'; +import { reaction } from 'mobx'; +import { formatter } from 'tools'; + +export default function reactions({ store, apolloClient }: ProcessContext) { + const { $calculation } = store; + + reaction( + () => $calculation.element('radioCalcType').getValue(), + (calcType) => { + switch (calcType) { + case 100_000_001: { + $calculation.element('tbxIRR_Perc').block(); + $calculation.element('tbxTotalPayments').unblock(); + break; + } + case 100_000_000: + default: { + $calculation.element('tbxIRR_Perc').unblock(); + $calculation.element('tbxTotalPayments').block(); + break; + } + } + }, + { + fireImmediately: true, + } + ); + + reaction( + () => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']), + async ({ product: productId, tarif: tarifId, bonusCoefficient }) => { + let max = 0; + let min = 0; + + if (productId && tarifId) { + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + + const { + data: { evo_tarif }, + } = await apolloClient.query({ + query: CRMTypes.GetTarifDocument, + variables: { + tarifId, + }, + }); + + min = evo_tarif?.evo_min_irr ?? 0; + max = evo_tarif?.evo_max_irr ?? 0; + + if (evo_baseproduct?.evo_cut_irr_with_bonus && bonusCoefficient < 1) { + min -= (1 - bonusCoefficient) * (evo_tarif?.evo_cut_irr_with_bonus_coefficient ?? 0); + } + } + + $calculation.element('labelIrrInfo').setValue(`${formatter(min)}% - ${formatter(max)}%`); + } + ); +} diff --git a/apps/web/process/leasing-object/reactions/index.js b/apps/web/process/calculate/reactions/index.ts similarity index 100% rename from apps/web/process/leasing-object/reactions/index.js rename to apps/web/process/calculate/reactions/index.ts diff --git a/apps/web/process/calculate/reactions/validation.ts b/apps/web/process/calculate/reactions/validation.ts index 1f7624a..1ace7fb 100644 --- a/apps/web/process/calculate/reactions/validation.ts +++ b/apps/web/process/calculate/reactions/validation.ts @@ -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 x.value === value); } -export default function validationReactions({ store }: ReactionsContext) { +export default function reactions({ store }: ProcessContext) { const { $calculation, $tables } = store; reaction( diff --git a/apps/web/process/configurator/get-kp-data.ts b/apps/web/process/configurator/get-kp-data.ts index 8b31c57..a440c94 100644 --- a/apps/web/process/configurator/get-kp-data.ts +++ b/apps/web/process/configurator/get-kp-data.ts @@ -1,32 +1,25 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE = gql` - query GetConfiguratorDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_CONFIGURATOR_DATA = gql` + query GetQuoteConfiguratorData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_baseproductid } } `; -type QuotePaymentsProcessData = { - values: Partial; -}; - -export default async function getConfiguratorDataFromKP({ +export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetConfiguratorDataFromQuoteQuery, - CRMTypes.GetConfiguratorDataFromQuoteQueryVariables - >({ - query: QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteConfiguratorDataDocument, variables: { quoteId, }, diff --git a/apps/web/process/configurator/index.ts b/apps/web/process/configurator/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/configurator/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/configurator/reactions/filters.ts b/apps/web/process/configurator/reactions/filters.ts index 29acf7f..0959194 100644 --- a/apps/web/process/configurator/reactions/filters.ts +++ b/apps/web/process/configurator/reactions/filters.ts @@ -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,22 +11,18 @@ import { normalizeOptions } from 'tools'; dayjs.extend(utc); -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation } = store; reaction( - () => { - const { product, subsidy, importProgram, dealer } = $calculation.$values.values; - - return { - dealerId: dealer, - importProgramId: importProgram, - productId: product, - subsidyId: subsidy, - }; - }, - // eslint-disable-next-line sonarjs/cognitive-complexity - async ({ productId, subsidyId, importProgramId, dealerId }) => { + () => $calculation.$values.getValues(['dealer', 'importProgram', 'product', 'subsidy']), + async ({ + product: productId, + subsidy: subsidyId, + importProgram: importProgramId, + dealer: dealerId, + // eslint-disable-next-line sonarjs/cognitive-complexity + }) => { /** * #1 * DYN-190 При выборе значения в поле selectSubsidy необходимо добавить @@ -351,9 +347,9 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex }, }); - const allowedProducts = evo_baseproduct?.evo_baseproducts?.map( - (product) => product?.evo_baseproductid - ); + const allowedProducts = evo_baseproduct?.evo_baseproducts + ?.map((product) => product?.evo_baseproductid) + .concat(quote.evo_baseproductid); const filteredSelectProductOptions = normalizeOptions( evo_baseproducts?.filter((product) => diff --git a/apps/web/process/configurator/reactions/index.js b/apps/web/process/configurator/reactions/index.ts similarity index 100% rename from apps/web/process/configurator/reactions/index.js rename to apps/web/process/configurator/reactions/index.ts diff --git a/apps/web/process/configurator/reactions/validation.ts b/apps/web/process/configurator/reactions/validation.ts index 9b2618c..9e24896 100644 --- a/apps/web/process/configurator/reactions/validation.ts +++ b/apps/web/process/configurator/reactions/validation.ts @@ -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 validationReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation } = store; /** * На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку: diff --git a/apps/web/process/configurator/reactions/values.ts b/apps/web/process/configurator/reactions/values.ts index 4072860..26c217c 100644 --- a/apps/web/process/configurator/reactions/values.ts +++ b/apps/web/process/configurator/reactions/values.ts @@ -1,27 +1,34 @@ /* 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, reaction } from 'mobx'; +import { reaction } from 'mobx'; 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; - autorun( - async () => { - const { - product, - leasingPeriod, - leaseObjectUsed, - deliveryTime, - firstPaymentPerc, - lastPaymentPerc, - } = $calculation.$values.values; - + reaction( + () => + $calculation.$values.getValues([ + 'product', + 'leasingPeriod', + 'leaseObjectUsed', + 'deliveryTime', + 'firstPaymentPerc', + 'lastPaymentPerc', + ]), + async ({ + product, + leasingPeriod, + leaseObjectUsed, + deliveryTime, + firstPaymentPerc, + lastPaymentPerc, + }) => { const currentDate = dayjs().utc(false).toISOString(); let { @@ -74,6 +81,7 @@ export default function valuesReactions({ store, apolloClient }: ReactionsContex }, { delay: 10, + fireImmediately: true, } ); @@ -138,4 +146,32 @@ export default function valuesReactions({ store, apolloClient }: ReactionsContex .setValue(baseRate?.value ?? null); } ); + + reaction( + () => $calculation.element('selectRate').getValue(), + async (rateId) => { + if (!rateId) { + $calculation.element('tbxCreditRate').resetValue(); + + return; + } + + const { + data: { evo_rate }, + } = await apolloClient.query({ + query: CRMTypes.GetRateDocument, + variables: { + rateId, + }, + }); + + if (evo_rate?.evo_base_rate === null || evo_rate?.evo_base_rate === undefined) { + $calculation.element('tbxCreditRate').resetValue(); + + return; + } + + $calculation.element('tbxCreditRate').setValue(evo_rate?.evo_base_rate); + } + ); } diff --git a/apps/web/process/create-kp/action.ts b/apps/web/process/create-kp/action.ts new file mode 100644 index 0000000..6761e50 --- /dev/null +++ b/apps/web/process/create-kp/action.ts @@ -0,0 +1 @@ +export function action() {} diff --git a/apps/web/process/create-kp/index.ts b/apps/web/process/create-kp/index.ts index 2d1ec23..facb8da 100644 --- a/apps/web/process/create-kp/index.ts +++ b/apps/web/process/create-kp/index.ts @@ -1 +1,2 @@ -export default () => {}; +export * from './action'; +export * as reactions from './reactions'; diff --git a/apps/web/process/create-kp/reactions.ts b/apps/web/process/create-kp/reactions.ts new file mode 100644 index 0000000..c3370ea --- /dev/null +++ b/apps/web/process/create-kp/reactions.ts @@ -0,0 +1,19 @@ +import type { ProcessContext } from '../types'; +import { reaction } from 'mobx'; + +export function common({ store }: ProcessContext) { + const { $calculation } = store; + + reaction( + () => $calculation.element('radioBalanceHolder').getValue(), + (balanceHolder) => { + if (balanceHolder) { + if (balanceHolder === 100_000_001) { + $calculation.element('cbxLastPaymentRedemption').setValue(true).block(); + } else { + $calculation.element('cbxLastPaymentRedemption').unblock(); + } + } + } + ); +} diff --git a/apps/web/process/fingap/get-kp-data.ts b/apps/web/process/fingap/get-kp-data.ts index 97f05ae..afed1d8 100644 --- a/apps/web/process/fingap/get-kp-data.ts +++ b/apps/web/process/fingap/get-kp-data.ts @@ -1,18 +1,12 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import { defaultValues } from '@/config/tables/insurance-table'; -import type * as CRMTypes from '@/graphql/crm.types'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const DEFAULT_FINGAP_ROW = defaultValues.find((x) => x.key === 'fingap')!; - -const QUERY_GET_FINGAP_DATA_FROM_QUOTE = gql` - query GetFingapDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_FINGAP_DATA = gql` + query GetQuoteFingapData($quoteId: Uuid!) { quote(quoteId: $quoteId) { - evo_fingap_accountid - evo_fingap_payer - evo_fingap_period evo_product_risks { evo_addproduct_typeid } @@ -20,25 +14,15 @@ const QUERY_GET_FINGAP_DATA_FROM_QUOTE = gql` } `; -type QuoteFingapProcessData = { - fingap: GetQuoteDataOutput['fingap']; - insurance: { - values: Pick; - }; -}; - -export default async function getFingapDataFromKP({ +export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetFingapDataFromQuoteQuery, - CRMTypes.GetFingapDataFromQuoteQueryVariables - >({ - query: QUERY_GET_FINGAP_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteFingapDataDocument, variables: { quoteId, }, @@ -55,15 +39,5 @@ export default async function getFingapDataFromKP({ fingap: { keys, }, - insurance: { - values: { - fingap: { - ...DEFAULT_FINGAP_ROW, - insTerm: quote?.evo_fingap_period || null, - insuranceCompany: quote?.evo_fingap_accountid || null, - insured: quote?.evo_fingap_payer || null, - }, - }, - }, }; } diff --git a/apps/web/process/fingap/index.ts b/apps/web/process/fingap/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/fingap/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/fingap/reactions/common.ts b/apps/web/process/fingap/reactions/common.ts index c6be69e..2d43f07 100644 --- a/apps/web/process/fingap/reactions/common.ts +++ b/apps/web/process/fingap/reactions/common.ts @@ -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 commonReactions({ store, apolloClient, queryClient }: ReactionsContext) { +export default function reactions({ store, apolloClient, queryClient }: ProcessContext) { const { $calculation, $tables } = store; // Расчет итоговой суммы ФинГАП и запись в таблицу страхования reaction( diff --git a/apps/web/process/calculate/reactions/index.js b/apps/web/process/fingap/reactions/index.ts similarity index 54% rename from apps/web/process/calculate/reactions/index.js rename to apps/web/process/fingap/reactions/index.ts index 5aaa2fd..cc8d68a 100644 --- a/apps/web/process/calculate/reactions/index.js +++ b/apps/web/process/fingap/reactions/index.ts @@ -1 +1,2 @@ +export { default as common } from './common'; export { default as validation } from './validation'; diff --git a/apps/web/process/fingap/reactions/validation.ts b/apps/web/process/fingap/reactions/validation.ts index cd160d8..3f8df5f 100644 --- a/apps/web/process/fingap/reactions/validation.ts +++ b/apps/web/process/fingap/reactions/validation.ts @@ -1,7 +1,7 @@ -import type { ReactionsContext } from '@/process/types'; +import type { ProcessContext } from '@/process/types'; import { reaction } from 'mobx'; -export default function validationReactions({ store }: ReactionsContext) { +export default function reactions({ store }: ProcessContext) { const { $tables } = store; reaction( @@ -19,6 +19,10 @@ export default function validationReactions({ store }: ReactionsContext) { invalid: finGAPInsuranceCompany !== null && hasPaymentsErrors, message: 'Неверно заполнены платежи', }); + + if (hasPaymentsErrors) { + $tables.fingap.clear(); + } }, { fireImmediately: true, diff --git a/apps/web/process/gibdd/get-kp-data.ts b/apps/web/process/gibdd/get-kp-data.ts new file mode 100644 index 0000000..ca6975c --- /dev/null +++ b/apps/web/process/gibdd/get-kp-data.ts @@ -0,0 +1,99 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; +import helper from './lib/helper'; +import initializeApollo from '@/apollo/client'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; +import { gql } from '@apollo/client'; + +const QUERY_GET_QUOTE_GIBDD_DATA = gql` + query GetQuoteGibddData($quoteId: Uuid!) { + quote(quoteId: $quoteId) { + evo_db_accept_registration + evo_object_registration + evo_pts_type + evo_vehicle_tax_year + evo_vehicle_tax_approved + evo_addproduct_types { + evo_product_type + evo_addproduct_typeid + } + evo_category_tr + evo_vehicle_type_tax + evo_regionid + evo_townid + evo_legal_regionid + evo_legal_townid + evo_registration_regionid + } + } +`; + +export async function getKPData({ values }: GetQuoteInputData): Promise { + const { quote: quoteId, recalcWithRevision, lead: leadId, opportunity: opportunityId } = values; + + const apolloClient = initializeApollo(); + + const { + data: { quote }, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteGibddDataDocument, + variables: { + quoteId, + }, + }); + + const { getLegalRegion, getLegalTown, getRegion, getTown } = helper({ + apolloClient, + }); + + const legalRegionId = await getLegalRegion({ + lead: leadId, + opportunity: opportunityId, + quote: quoteId, + }); + + const legalTownId = await getLegalTown({ + lead: leadId, + opportunity: opportunityId, + quote: quoteId, + regionId: legalRegionId, + }); + + const regionId = await getRegion({ + lead: leadId, + opportunity: opportunityId, + quote: quoteId, + }); + + const townId = await getTown({ + lead: leadId, + opportunity: opportunityId, + quote: quoteId, + regionId, + }); + + const registration = quote?.evo_addproduct_types?.find( + (x) => x?.evo_product_type === 100_000_001 + )?.evo_addproduct_typeid; + + return { + values: { + legalClientRegion: legalRegionId, + legalClientTown: legalTownId, + objectCategoryTax: quote?.evo_category_tr, + objectRegionRegistration: quote?.evo_registration_regionid, + objectRegistration: recalcWithRevision + ? quote?.evo_db_accept_registration + : quote?.evo_object_registration, + objectTypeTax: quote?.evo_vehicle_type_tax, + regionRegistration: regionId, + registration, + townRegistration: townId, + typePTS: quote?.evo_pts_type, + vehicleTaxInYear: + (recalcWithRevision ? quote?.evo_vehicle_tax_approved : quote?.evo_vehicle_tax_year) ?? + defaultValues.vehicleTaxInYear, + }, + }; +} diff --git a/apps/web/process/gibdd/index.ts b/apps/web/process/gibdd/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/gibdd/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/gibdd/lib/helper.ts b/apps/web/process/gibdd/lib/helper.ts new file mode 100644 index 0000000..5a5eae9 --- /dev/null +++ b/apps/web/process/gibdd/lib/helper.ts @@ -0,0 +1,288 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import * as CRMTypes from '@/graphql/crm.types'; +import type { ProcessContext } from '@/process/types'; +import type { CalculationValues } from '@/stores/calculation/values/types'; +import { gql } from '@apollo/client'; + +const QUERY_GET_QUOTE_REGION_TOWN = gql` + query GetQuoteRegionTown($quoteId: Uuid!) { + quote(quoteId: $quoteId) { + evo_regionid + evo_townid + evo_legal_regionid + evo_legal_townid + } + } +`; + +export default function helper({ apolloClient }: Pick) { + return { + async getLegalRegion({ + lead: leadid, + opportunity: opportunityid, + quote: quoteId, + }: Pick) { + let regionId: string | null | undefined; + + const { + data: { evo_regions }, + } = await apolloClient.query({ + query: CRMTypes.GetRegionsDocument, + }); + + if (leadid) { + const { + data: { lead }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { leadid }, + }); + if (lead?.accountidData?.evo_address_legalidData?.evo_region_fias_id) { + const region = evo_regions?.find( + (x) => + x?.evo_fias_id === lead?.accountidData?.evo_address_legalidData?.evo_region_fias_id + ); + regionId = region?.value; + } + } + + if (opportunityid) { + const { + data: { opportunity }, + } = await apolloClient.query({ + query: CRMTypes.GetOpportunityDocument, + variables: { opportunityid }, + }); + + if (!regionId && opportunity?.accountidData?.evo_address_legalidData?.evo_region_fias_id) { + const region = evo_regions?.find( + (x) => + x?.evo_fias_id === + opportunity?.accountidData?.evo_address_legalidData?.evo_region_fias_id + ); + regionId = region?.value; + } + } + + if (!regionId && quoteId) { + const { + data: { quote }, + } = await apolloClient.query< + CRMTypes.GetQuoteRegionTownQuery, + CRMTypes.GetQuoteRegionTownQueryVariables + >({ + query: QUERY_GET_QUOTE_REGION_TOWN, + variables: { quoteId }, + }); + regionId = quote?.evo_legal_regionid; + } + + return regionId; + }, + + async getLegalTown({ + lead: leadid, + opportunity: opportunityid, + quote: quoteId, + regionId, + }: Pick & { + regionId: string | null | undefined; + }) { + if (!regionId) { + return null; + } + + let townId: string | null | undefined; + + const { + data: { evo_towns }, + } = await apolloClient.query({ + query: CRMTypes.GetTownsDocument, + variables: { regionId }, + }); + + if (leadid) { + const { + data: { lead }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { leadid }, + }); + if (lead?.accountidData?.evo_address_legalidData?.evo_city_fias_id) { + const town = evo_towns?.find( + (x) => x?.evo_fias_id === lead?.accountidData?.evo_address_legalidData?.evo_city_fias_id + ); + townId = town?.value; + } + } + + if (opportunityid) { + const { + data: { opportunity }, + } = await apolloClient.query({ + query: CRMTypes.GetOpportunityDocument, + variables: { opportunityid }, + }); + + if (!townId && opportunity?.accountidData?.evo_address_legalidData?.evo_city_fias_id) { + const town = evo_towns?.find( + (x) => + x?.evo_fias_id === + opportunity?.accountidData?.evo_address_legalidData?.evo_city_fias_id + ); + townId = town?.value; + } + } + + if (!townId && quoteId) { + const { + data: { quote }, + } = await apolloClient.query< + CRMTypes.GetQuoteRegionTownQuery, + CRMTypes.GetQuoteRegionTownQueryVariables + >({ + query: QUERY_GET_QUOTE_REGION_TOWN, + variables: { quoteId }, + }); + townId = quote?.evo_legal_townid; + } + + return townId; + }, + + async getRegion({ + lead: leadid, + opportunity: opportunityid, + quote: quoteId, + }: Pick) { + let regionId: string | null | undefined; + + const { + data: { evo_regions }, + } = await apolloClient.query({ + query: CRMTypes.GetRegionsDocument, + }); + + if (leadid) { + const { + data: { lead }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { leadid }, + }); + if (lead?.accountidData?.evo_address_legalidData?.evo_region_fias_id) { + const region = evo_regions?.find( + (x) => + x?.evo_fias_id === lead?.accountidData?.evo_address_legalidData?.evo_region_fias_id + ); + regionId = region?.value; + } + } + + if (opportunityid) { + const { + data: { opportunity }, + } = await apolloClient.query({ + query: CRMTypes.GetOpportunityDocument, + variables: { opportunityid }, + }); + + if (!regionId && opportunity?.accountidData?.evo_address_legalidData?.evo_region_fias_id) { + const region = evo_regions?.find( + (x) => + x?.evo_fias_id === + opportunity?.accountidData?.evo_address_legalidData?.evo_region_fias_id + ); + regionId = region?.value; + } + } + + if (!regionId && quoteId) { + const { + data: { quote }, + } = await apolloClient.query< + CRMTypes.GetQuoteRegionTownQuery, + CRMTypes.GetQuoteRegionTownQueryVariables + >({ + query: QUERY_GET_QUOTE_REGION_TOWN, + variables: { quoteId }, + }); + regionId = quote?.evo_regionid; + } + + return regionId; + }, + + async getTown({ + lead: leadid, + opportunity: opportunityid, + quote: quoteId, + regionId, + }: Pick & { + regionId: string | null | undefined; + }) { + if (!regionId) { + return null; + } + + let townId: string | null | undefined; + + const { + data: { evo_towns }, + } = await apolloClient.query({ + query: CRMTypes.GetTownsDocument, + variables: { regionId }, + }); + + if (leadid) { + const { + data: { lead }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { leadid }, + }); + if (lead?.accountidData?.evo_address_legalidData?.evo_city_fias_id) { + const town = evo_towns?.find( + (x) => x?.evo_fias_id === lead?.accountidData?.evo_address_legalidData?.evo_city_fias_id + ); + townId = town?.value; + } + } + + if (opportunityid) { + const { + data: { opportunity }, + } = await apolloClient.query({ + query: CRMTypes.GetOpportunityDocument, + variables: { opportunityid }, + }); + + if (!townId && opportunity?.accountidData?.evo_address_legalidData?.evo_city_fias_id) { + const town = evo_towns?.find( + (x) => + x?.evo_fias_id === + opportunity?.accountidData?.evo_address_legalidData?.evo_city_fias_id + ); + townId = town?.value; + } + } + + if (quoteId) { + const { + data: { quote }, + } = await apolloClient.query< + CRMTypes.GetQuoteRegionTownQuery, + CRMTypes.GetQuoteRegionTownQueryVariables + >({ + query: QUERY_GET_QUOTE_REGION_TOWN, + variables: { quoteId }, + }); + if (!townId && quote?.evo_townid) { + townId = quote?.evo_townid; + } + } + + return townId; + }, + }; +} diff --git a/apps/web/process/gibdd/reactions.ts b/apps/web/process/gibdd/reactions.ts new file mode 100644 index 0000000..216c670 --- /dev/null +++ b/apps/web/process/gibdd/reactions.ts @@ -0,0 +1,592 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import type { ProcessContext } from '../types'; +import helper from './lib/helper'; +import { getTransTax } from '@/api/1c/query'; +import { selectObjectCategoryTax } from '@/config/default-options'; +import { STALE_TIME } from '@/constants/request'; +import * as CRMTypes from '@/graphql/crm.types'; +import ValidationHelper from '@/stores/validation/helper'; +import type { QueryFunctionContext } from '@tanstack/react-query'; +import dayjs from 'dayjs'; +import utc from 'dayjs/plugin/utc'; +import { reaction } from 'mobx'; +import { makeDisposable, normalizeOptions } from 'tools'; + +dayjs.extend(utc); + +export function common({ store, apolloClient, queryClient }: ProcessContext) { + const { $calculation, $process } = store; + + reaction( + () => $calculation.element('selectLeaseObjectType').getValue(), + async (leaseObjectTypeId) => { + if (!leaseObjectTypeId) { + $calculation.element('radioObjectRegistration').resetValue().unblock(); + + return; + } + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + if ( + evo_leasingobject_type?.evo_id && + ['6', '9', '10', '11'].includes(evo_leasingobject_type.evo_id) + ) { + $calculation.element('radioObjectRegistration').setValue(100_000_000).block(); + } else { + $calculation.element('radioObjectRegistration').unblock(); + } + } + ); + + reaction( + () => $calculation.$values.getValues(['objectRegistration', 'vehicleTaxInYear']), + ({ objectRegistration, vehicleTaxInYear }) => { + if (objectRegistration === 100_000_001) { + $calculation.element('tbxVehicleTaxInYear').unblock(); + } else { + $calculation.element('tbxVehicleTaxInYear').resetValue().block(); + } + $calculation.element('tbxVehicleTaxInYear').validate({ + invalid: objectRegistration === 100_000_001 && !(vehicleTaxInYear > 0), + message: 'Значение должно быть больше 0', + }); + } + ); + + reaction( + () => $calculation.$values.getValues(['objectRegistration', 'typePTS']), + ({ objectRegistration, typePTS }) => { + if (objectRegistration === 100_000_001) { + $calculation.element('radioTypePTS').unblock(); + } else { + $calculation.element('radioTypePTS').resetValue().block(); + } + $calculation.element('radioTypePTS').validate({ + invalid: objectRegistration === 100_000_001 && !typePTS, + message: 'Не заполнено поле', + }); + } + ); + + makeDisposable( + () => + reaction( + () => + $calculation.$values.getValues([ + 'leaseObjectType', + 'objectCategoryTax', + 'objectRegistration', + ]), + async ({ leaseObjectType: leaseObjectTypeId, objectRegistration, objectCategoryTax }) => { + if (objectRegistration === 100_000_001) { + if (objectCategoryTax && [100_000_006, 100_000_009].includes(objectCategoryTax)) { + $calculation.element('selectObjectTypeTax').setValue(100_000_002); + } else if (leaseObjectTypeId) { + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + if (evo_leasingobject_type?.evo_vehicle_type_tax) { + $calculation + .element('selectObjectTypeTax') + .setValue(evo_leasingobject_type?.evo_vehicle_type_tax); + } else { + $calculation.element('selectObjectTypeTax').resetValue(); + } + } + } else { + $calculation.element('selectObjectTypeTax').resetValue(); + } + } + ), + () => $process.has('LoadKP') + ); + + reaction( + () => + $calculation.$values.getValues([ + 'leaseObjectType', + 'leaseObjectCategory', + 'typePTS', + 'objectRegistration', + ]), + async ({ + leaseObjectType: leaseObjectTypeId, + leaseObjectCategory, + typePTS, + objectRegistration, + }) => { + if (objectRegistration === 100_000_001 && typePTS === 100_000_001) { + $calculation.element('selectObjectCategoryTax').unblock(); + if (leaseObjectTypeId) { + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + if (leaseObjectCategory && leaseObjectCategory === evo_leasingobject_type?.evo_category) { + $calculation + .element('selectObjectCategoryTax') + .setOptions( + selectObjectCategoryTax.filter((option) => + evo_leasingobject_type?.evo_category_tr?.includes(option.value) + ) + ); + } else { + $calculation.element('selectObjectCategoryTax').resetOptions(); + } + } + } else { + $calculation.element('selectObjectCategoryTax').resetValue().block(); + } + } + ); + + reaction( + () => $calculation.$values.getValues(['leasingPeriod', 'vehicleTaxInYear']), + ({ leasingPeriod, vehicleTaxInYear }) => { + if (vehicleTaxInYear > 0) { + $calculation + .element('tbxVehicleTaxInLeasingPeriod') + .setValue((vehicleTaxInYear / 12) * leasingPeriod); + } else { + $calculation.element('tbxVehicleTaxInLeasingPeriod').resetValue(); + } + } + ); + + const mapObjectTypeTaxToCategory = { + 100_000_000: 'D', + 100_000_001: 'B', + 100_000_002: 'C', + 100_000_003: 'T', + 100_000_004: 'A', + }; + + function getCarCategory(objectTypeTax: number) { + return mapObjectTypeTaxToCategory[objectTypeTax as keyof typeof mapObjectTypeTaxToCategory]; + } + + makeDisposable( + () => + reaction( + () => + $calculation.$values.getValues([ + 'objectRegistration', + 'objectTypeTax', + 'regionRegistration', + 'leaseObjectYear', + 'leaseObjectMotorPower', + ]), + async ({ + objectRegistration, + objectTypeTax, + regionRegistration, + leaseObjectYear, + leaseObjectMotorPower, + }) => { + if ( + objectRegistration === null || + objectRegistration !== 100_000_001 || + objectTypeTax === null || + regionRegistration === null || + leaseObjectYear === 0 || + leaseObjectMotorPower === 0 + ) { + $calculation.element('tbxVehicleTaxInYear').resetValue(); + + return; + } + + const { + data: { evo_region }, + } = await apolloClient.query({ + query: CRMTypes.GetRegionDocument, + variables: { + regionId: regionRegistration, + }, + }); + + const OKTMO = evo_region?.evo_oktmo; + const carCategory = getCarCategory(objectTypeTax); + + if (OKTMO) { + const currentDate = dayjs().utc(false).toDate(); + + const request = (context: QueryFunctionContext) => + getTransTax( + { + OKTMO, + calcDate: currentDate, + carCategory, + power: leaseObjectMotorPower, + year: leaseObjectYear, + }, + context + ); + const { tax, error } = await queryClient.fetchQuery(['1c', 'trans-tax'], request, { + staleTime: STALE_TIME, + }); + + if (!error && tax) { + $calculation.element('tbxVehicleTaxInYear').setValue(tax); + } else { + $calculation.element('tbxVehicleTaxInYear').resetValue(); + } + } else { + $calculation.element('tbxVehicleTaxInYear').resetValue(); + } + } + ), + () => $process.has('LoadKP') + ); + + reaction( + () => + $calculation.$values.getValues([ + 'objectRegionRegistration', + 'objectRegistration', + 'regionRegistration', + 'typePTS', + 'leaseObjectCategory', + 'leaseObjectType', + ]), + async ({ + objectRegistration, + objectRegionRegistration: objectRegionRegistrationId, + regionRegistration: regionRegistrationId, + typePTS, + leaseObjectCategory, + leaseObjectType, + }) => { + if (!objectRegionRegistrationId || !regionRegistrationId) { + $calculation.element('selectRegistration').resetValue(); + + return; + } + const currentDate = dayjs().utc(false).toISOString(); + + const { + data: { evo_region }, + } = await apolloClient.query({ + query: CRMTypes.GetRegionDocument, + variables: { regionId: objectRegionRegistrationId }, + }); + + const { + data: { evo_addproduct_types }, + } = await apolloClient.query({ + query: CRMTypes.GetRegistrationTypesDocument, + variables: { currentDate }, + }); + + const options = evo_addproduct_types + ?.filter( + (x) => + x?.evo_leasingobject_types?.find( + (evo_leasingobject_type) => + evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType + ) && + x.evo_whom_register === objectRegistration && + Boolean( + leaseObjectCategory === 100_000_001 + ? x.evo_towtruck === true || x.evo_towtruck === false + : x.evo_towtruck === false + ) && + x.evo_gibdd_region === (objectRegionRegistrationId === regionRegistrationId) && + Boolean(typePTS && x.evo_pts_type?.includes(typePTS)) && + Boolean( + x.evo_accountid && + evo_region?.accounts?.some( + (evo_region_account) => evo_region_account?.accountid === x.evo_accountid + ) + ) + ) + .map((x) => ({ + ...x, + label: `${x?.label} (${x?.evo_graph_price} руб.)`, + })); + + $calculation.element('selectRegistration').setOptions(normalizeOptions(options)); + } + ); + + reaction( + () => $calculation.element('selectRegistration').getValue(), + async (registrationId) => { + if (!registrationId) { + $calculation.element('labelRegistrationDescription').resetValue(); + + return; + } + + const { + data: { evo_addproduct_type }, + } = await apolloClient.query({ + query: CRMTypes.GetAddProductTypeDocument, + variables: { addproductTypeId: registrationId }, + }); + + if (evo_addproduct_type?.evo_description) { + $calculation + .element('labelRegistrationDescription') + .setValue(evo_addproduct_type?.evo_description); + } else { + $calculation.element('labelRegistrationDescription').resetValue(); + } + } + ); + + reaction( + () => $calculation.element('selectLegalClientRegion').getValue(), + async (regionId) => { + if (!regionId) { + $calculation.element('selectLegalClientTown').resetOptions(); + + return; + } + const { + data: { evo_towns }, + } = await apolloClient.query({ + query: CRMTypes.GetTownsDocument, + variables: { regionId }, + }); + + $calculation.element('selectLegalClientTown').setOptions(normalizeOptions(evo_towns)); + } + ); + + reaction( + () => $calculation.$values.getValues(['regionRegistration', 'objectRegistration']), + async ({ regionRegistration: regionId, objectRegistration }) => { + if (!regionId) { + $calculation.element('selectTownRegistration').resetOptions(); + + return; + } + const { + data: { evo_towns }, + } = await apolloClient.query({ + query: CRMTypes.GetTownsDocument, + variables: { regionId }, + }); + + if (objectRegistration === 100_000_001) { + const towns = evo_towns?.filter((x) => x?.evo_businessunit_evolution === true); + $calculation.element('selectTownRegistration').setOptions(normalizeOptions(towns)); + } else { + $calculation.element('selectTownRegistration').setOptions(normalizeOptions(evo_towns)); + } + } + ); + + const { getLegalRegion, getLegalTown, getRegion, getTown } = helper({ apolloClient }); + + reaction( + () => $calculation.$values.getValues(['lead', 'opportunity']), + async ({ lead, opportunity }) => { + if (!lead && !opportunity) { + $calculation.element('selectLegalClientRegion').resetValue().unblock(); + $calculation.element('selectRegionRegistration').resetValue().unblock(); + + return; + } + + const quote = $calculation.element('selectQuote').getValue(); + + const legalRegionId = await getLegalRegion({ + lead, + opportunity, + quote, + }); + if (legalRegionId) { + $calculation.element('selectLegalClientRegion').setValue(legalRegionId).block(); + } else { + $calculation.element('selectLegalClientRegion').resetValue().unblock(); + } + + const regionId = await getRegion({ + lead, + opportunity, + quote, + }); + if (regionId) { + $calculation.element('selectRegionRegistration').setValue(regionId).block(); + } else { + $calculation.element('selectRegionRegistration').resetValue().unblock(); + } + }, + { + delay: 10, + } + ); + + reaction( + () => $calculation.element('selectLegalClientRegion').getValue(), + async (regionId) => { + if (!regionId) { + $calculation.element('selectLegalClientTown').resetValue().unblock(); + + return; + } + + const lead = $calculation.element('selectLead').getValue(); + const opportunity = $calculation.element('selectOpportunity').getValue(); + const quote = $calculation.element('selectQuote').getValue(); + + const townId = await getLegalTown({ + lead, + opportunity, + quote, + regionId, + }); + if (townId) { + $calculation.element('selectLegalClientTown').setValue(townId).block(); + } else { + $calculation.element('selectLegalClientTown').resetValue().unblock(); + } + } + ); + + reaction( + () => $calculation.$values.getValues(['regionRegistration', 'objectRegistration']), + async ({ regionRegistration: regionId, objectRegistration }) => { + if (!regionId) { + $calculation.element('selectTownRegistration').resetValue().unblock(); + + return; + } + + const lead = $calculation.element('selectLead').getValue(); + const opportunity = $calculation.element('selectOpportunity').getValue(); + const quote = $calculation.element('selectQuote').getValue(); + + const townId = await getTown({ + lead, + opportunity, + quote, + regionId, + }); + + if (townId && objectRegistration === 100_000_000) { + $calculation.element('selectTownRegistration').setValue(townId).block(); + } else { + $calculation.element('selectTownRegistration').resetValue().unblock(); + } + } + ); + + reaction( + () => $calculation.element('radioObjectRegistration').getValue(), + async (objectRegistration) => { + const { + data: { evo_regions }, + } = await apolloClient.query({ + query: CRMTypes.GetRegionsDocument, + }); + + if (objectRegistration === 100_000_001) { + const regions = evo_regions?.filter((x) => x?.evo_businessunit_evolution === true); + $calculation.element('selectRegionRegistration').setOptions(normalizeOptions(regions)); + } else { + $calculation.element('selectRegionRegistration').setOptions(normalizeOptions(evo_regions)); + } + } + ); +} + +export function validation({ store, apolloClient }: ProcessContext) { + const { $calculation } = store; + + reaction( + () => $calculation.$values.getValues(['leaseObjectCategory', 'maxMass']), + ({ leaseObjectCategory, maxMass }) => { + $calculation.element('tbxMaxMass').validate({ + invalid: leaseObjectCategory === 100_000_001 && maxMass > 3500, + message: 'При категории ТС = В Разрешенная макс.масса не может быть больше 3500 кг', + }); + $calculation.element('tbxMaxMass').validate({ + invalid: leaseObjectCategory === 100_000_002 && maxMass <= 3500, + message: 'При категории ТС = С Разрешенная макс.масса не может быть меньше 3500 кг', + }); + } + ); + + { + const validationHelper = new ValidationHelper(); + reaction( + () => + $calculation.$values.getValues([ + 'typePTS', + 'objectRegistration', + 'objectCategoryTax', + 'leaseObjectType', + ]), + async ({ + leaseObjectType: leaseObjectTypeId, + typePTS, + objectRegistration, + objectCategoryTax, + }) => { + if (!leaseObjectTypeId) { + validationHelper.removeErrors(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + $calculation.element('selectObjectCategoryTax').validate({ + helper: validationHelper, + invalid: + objectRegistration === 100_000_001 && + typePTS === 100_000_001 && + objectCategoryTax === null && + Boolean(evo_leasingobject_type?.evo_category_tr?.length), + message: 'Необходимо из ЭПТС указать Категорию в соответствии с ТР ТС 018/2011', + }); + } + ); + } + + { + const validationHelper = new ValidationHelper(); + reaction( + () => $calculation.$values.getValues(['leaseObjectType', 'insNSIB']), + async ({ insNSIB, leaseObjectType: leaseObjectTypeId }) => { + if (!leaseObjectTypeId) { + validationHelper.removeErrors(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + $calculation.element('selectInsNSIB').validate({ + helper: validationHelper, + invalid: evo_leasingobject_type?.evo_id === '11' && !insNSIB, + message: 'Страхование НСИБ обязательно для мотоциклистов', + }); + } + ); + } +} diff --git a/apps/web/process/init/inject-reactions/hooks.js b/apps/web/process/hooks.ts similarity index 51% rename from apps/web/process/init/inject-reactions/hooks.js rename to apps/web/process/hooks.ts index f9edc69..00ba40a 100644 --- a/apps/web/process/init/inject-reactions/hooks.js +++ b/apps/web/process/hooks.ts @@ -1,18 +1,21 @@ -import injectDefaultReactions from './default'; +import type { Process } 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 }: Process) { const store = useStore(); const apolloClient = useApolloClient(); const queryClient = useQueryClient(); - injectDefaultReactions({ - apolloClient, - queryClient, - store, - trpcClient: trpcPureClient, + Object.keys(reactions).forEach((name) => { + const injector = reactions[name]; + injector({ + apolloClient, + queryClient, + store, + trpcClient: trpcPureClient, + }); }); } diff --git a/apps/web/process/init/get-data/get-owner-data.ts b/apps/web/process/init/get-data/get-owner-data.ts deleted file mode 100644 index fcb3ba4..0000000 --- a/apps/web/process/init/get-data/get-owner-data.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { User } from '@/api/user/types'; -import type { GetOwnerDataQuery, GetOwnerDataQueryVariables } from '@/graphql/crm.types'; -import type { ApolloClient } from '@apollo/client'; -import { gql } from '@apollo/client'; - -const QUERY_GET_OWNER_DATA = gql` - query GetOwnerData($domainname: String) { - selectLead: leads(owner_domainname: $domainname) { - label: fullname - value: leadid - } - selectOpportunity: opportunities(owner_domainname: $domainname) { - label: name - value: opportunityid - } - } -`; - -export async function getOwnerData({ query }: ApolloClient, user: User) { - return query({ - query: QUERY_GET_OWNER_DATA, - variables: { - domainname: user?.domainName, - }, - }); -} diff --git a/apps/web/process/init/get-data/index.js b/apps/web/process/init/get-data/index.js deleted file mode 100644 index 0dbd66f..0000000 --- a/apps/web/process/init/get-data/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export { useInsuranceData } from './get-insurance-data'; -export { useMainData } from './get-main-data'; -export { getOwnerData } from './get-owner-data'; diff --git a/apps/web/process/init/get-initial-data.ts b/apps/web/process/init/get-initial-data.ts new file mode 100644 index 0000000..b585d3d --- /dev/null +++ b/apps/web/process/init/get-initial-data.ts @@ -0,0 +1,44 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import type { User } from '@/api/user/types'; +import * as CRMTypes from '@/graphql/crm.types'; +import type { ApolloClient } from '@apollo/client'; + +export async function getInitialData({ query }: ApolloClient, user: User) { + const { + data: { leads }, + } = await query({ query: CRMTypes.GetLeadsDocument, variables: { domainname: user.domainName } }); + + const { + data: { opportunities }, + } = await query({ + query: CRMTypes.GetOpportunitiesDocument, + variables: { domainname: user.domainName }, + }); + + const { + data: { transactioncurrencies }, + } = await query({ + query: CRMTypes.GetTransactionCurrenciesDocument, + }); + + const transactioncurrency_rub = transactioncurrencies?.find((x) => x?.isocurrencycode === 'RUB'); + + if (transactioncurrency_rub?.transactioncurrencyid) + await query({ + query: CRMTypes.GetTransactionCurrencyDocument, + variables: { + currencyid: transactioncurrency_rub?.transactioncurrencyid, + }, + }); + + return { + options: { + selectLead: leads, + selectOpportunity: opportunities, + selectSupplierCurrency: transactioncurrencies, + }, + values: { + supplierCurrency: transactioncurrency_rub?.transactioncurrencyid ?? null, + }, + }; +} diff --git a/apps/web/process/init/get-data/get-insurance-data.js b/apps/web/process/init/get-insurance-data.js similarity index 100% rename from apps/web/process/init/get-data/get-insurance-data.js rename to apps/web/process/init/get-insurance-data.js diff --git a/apps/web/process/init/get-data/get-main-data.js b/apps/web/process/init/get-main-data.js similarity index 80% rename from apps/web/process/init/get-data/get-main-data.js rename to apps/web/process/init/get-main-data.js index 4241708..dcfc861 100644 --- a/apps/web/process/init/get-data/get-main-data.js +++ b/apps/web/process/init/get-main-data.js @@ -1,7 +1,7 @@ /* eslint-disable canonical/sort-keys */ import * as CRMTypes from '@/graphql/crm.types'; import { useStore } from '@/stores/hooks'; -import { gql, useApolloClient } from '@apollo/client'; +import { useApolloClient } from '@apollo/client'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { useEffect } from 'react'; @@ -9,21 +9,6 @@ import { normalizeOptions } from 'tools'; dayjs.extend(utc); -const QUERY_GET_ADDPRODUCT_TYPES = gql` - query GetAddproductTypes($currentDate: DateTime) { - evo_addproduct_types( - statecode: 0 - evo_datefrom_param: { lte: $currentDate } - evo_dateto_param: { gte: $currentDate } - ) { - label: evo_name - value: evo_addproduct_typeid - evo_graph_price - evo_product_type - } - } -`; - const currentDate = dayjs().utc(false).toISOString(); /** @@ -32,17 +17,6 @@ const currentDate = dayjs().utc(false).toISOString(); * @param {*} onCompleted */ function getMainData({ query }, onCompleted) { - query({ - query: CRMTypes.GetTransactionCurrenciesDocument, - variables: { - currentDate, - }, - }).then(({ data }) => { - onCompleted({ - selectSupplierCurrency: data?.transactioncurrencies, - }); - }); - query({ query: CRMTypes.GetLeaseObjectTypesDocument, variables: { @@ -50,7 +24,7 @@ function getMainData({ query }, onCompleted) { }, }).then(({ data }) => { onCompleted({ - selectLeaseObjectType: data?.evo_baseproducts, + selectLeaseObjectType: data?.evo_leasingobject_types, }); }); @@ -124,17 +98,17 @@ function getMainData({ query }, onCompleted) { }); query({ - query: QUERY_GET_ADDPRODUCT_TYPES, + query: CRMTypes.GetAddproductTypesDocument, variables: { currentDate, }, }).then(({ data }) => { - const selectRegistration = data.evo_addproduct_types - ?.filter((x) => x?.evo_product_type === 100_000_001) - .map((x) => ({ - ...x, - label: `${x?.label} (${x?.evo_graph_price} руб.)`, - })); + // const selectRegistration = data.evo_addproduct_types + // ?.filter((x) => x?.evo_product_type === 100_000_001) + // .map((x) => ({ + // ...x, + // label: `${x?.label} (${x?.evo_graph_price} руб.)`, + // })); const selectTechnicalCard = data.evo_addproduct_types ?.filter((x) => x?.evo_product_type === 100_000_000) @@ -166,7 +140,7 @@ function getMainData({ query }, onCompleted) { ); onCompleted({ - selectRegistration, + // selectRegistration, selectTechnicalCard, selectTelematic, selectTracker, diff --git a/apps/web/process/init/index.js b/apps/web/process/init/index.js new file mode 100644 index 0000000..eee9f13 --- /dev/null +++ b/apps/web/process/init/index.js @@ -0,0 +1,3 @@ +export * from './get-initial-data'; +export * from './get-insurance-data'; +export * from './get-main-data'; diff --git a/apps/web/process/init/inject-reactions/default.js b/apps/web/process/init/inject-reactions/default.js deleted file mode 100644 index 85bc5ba..0000000 --- a/apps/web/process/init/inject-reactions/default.js +++ /dev/null @@ -1,41 +0,0 @@ -import * as calculateReactions from '../../calculate/reactions'; -import * as configurator from '../../configurator/reactions'; -import * as fingapReactions from '../../fingap/reactions'; -import * as leadOpportunityReactions from '../../lead-opportunity/reactions'; -import * as leasingObject from '../../leasing-object/reactions'; -import * as leasingWithoutKaskoReactions from '../../leasing-without-kasko/reactions'; -import paymentsReactions from '../../payments/reactions'; -import * as priceReactions from '../../price/reactions'; -import * as subsidyReactions from '../../subsidy/reactions'; -import * as agentsReactions from '../../supplier-agent/reactions/agents'; -import leasebackReactions from '../../supplier-agent/reactions/leaseback'; -import * as supplierReactions from '../../supplier-agent/reactions/supplier'; -import setInitialValuesReactions from '../set-values/reactions'; -import loadKpReactions from '@/process/load-kp/reactions'; - -export default function injectDefaultReactions(context) { - leadOpportunityReactions.common(context); - leadOpportunityReactions.urls(context); - paymentsReactions(context); - calculateReactions.validation(context); - supplierReactions.commonReactions(context); - supplierReactions.validationReactions(context); - agentsReactions.fillReactions(context); - agentsReactions.commonReactions(context); - agentsReactions.validationReactions(context); - leasebackReactions(context); - priceReactions.computed(context); - priceReactions.common(context); - fingapReactions.common(context); - fingapReactions.validation(context); - setInitialValuesReactions(context); - loadKpReactions(context); - leasingWithoutKaskoReactions.common(context); - subsidyReactions.computedReactions(context); - subsidyReactions.commonReactions(context); - leasingObject.common(context); - leasingObject.validation(context); - configurator.filters(context); - configurator.values(context); - configurator.validation(context); -} diff --git a/apps/web/process/init/set-values/reactions.ts b/apps/web/process/init/set-values/reactions.ts deleted file mode 100644 index 17d700f..0000000 --- a/apps/web/process/init/set-values/reactions.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ -import { GetTransactionCurrenciesDocument } from '@/graphql/crm.types'; -import type { ReactionsContext } from '@/process/types'; -import { when } from 'mobx'; - -export default function setInitialValuesReactions({ store, apolloClient }: ReactionsContext) { - const { $calculation } = store; - - when( - () => $calculation.$options.getOptions('selectSupplierCurrency').length > 0, - async () => { - const { - data: { transactioncurrencies }, - } = await apolloClient.query({ - query: GetTransactionCurrenciesDocument, - }); - - const transactioncurrency_rub = transactioncurrencies?.find( - (x) => x?.isocurrencycode === 'RUB' - ); - if (transactioncurrency_rub) { - $calculation - .element('selectSupplierCurrency') - .setValue(transactioncurrency_rub.transactioncurrencyid); - } - } - ); -} diff --git a/apps/web/process/insurance/get-kp-data.ts b/apps/web/process/insurance/get-kp-data.ts new file mode 100644 index 0000000..74ca1b8 --- /dev/null +++ b/apps/web/process/insurance/get-kp-data.ts @@ -0,0 +1,64 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; +import initializeApollo from '@/apollo/client'; +import * as insuranceTable from '@/config/tables/insurance-table'; +import * as CRMTypes from '@/graphql/crm.types'; +import { gql } from '@apollo/client'; + +const { DEFAULT_FINGAP_ROW, DEFAULT_KASKO_ROW, DEFAULT_OSAGO_ROW } = insuranceTable; + +const QUERY_GET_QUOTE_INSURANCE_DATA = gql` + query GetQuoteInsuranceData($quoteId: Uuid!) { + quote(quoteId: $quoteId) { + evo_osago_accountid + evo_osago_payer + evo_osago_price + evo_kasko_accountid + evo_kasko_payer + evo_kasko_price + evo_insurance_period + evo_fingap_accountid + evo_fingap_payer + evo_fingap_period + } + } +`; + +export async function getKPData({ + values: { quote: quoteId }, +}: GetQuoteInputData): Promise { + const apolloClient = initializeApollo(); + + const { + data: { quote }, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteInsuranceDataDocument, + variables: { + quoteId, + }, + }); + + return { + insurance: { + values: { + fingap: Object.assign(DEFAULT_FINGAP_ROW, { + insTerm: quote?.evo_fingap_period, + insuranceCompany: quote?.evo_fingap_accountid, + insured: quote?.evo_fingap_payer, + }), + kasko: Object.assign(DEFAULT_KASKO_ROW, { + insCost: quote?.evo_kasko_price, + insTerm: quote?.evo_insurance_period, + insuranceCompany: quote?.evo_kasko_accountid, + insured: quote?.evo_kasko_payer, + }), + osago: Object.assign(DEFAULT_OSAGO_ROW, { + insCost: quote?.evo_osago_price, + insTerm: quote?.evo_insurance_period, + insuranceCompany: quote?.evo_osago_accountid, + insured: quote?.evo_osago_payer, + }), + }, + }, + }; +} diff --git a/apps/web/process/insurance/index.ts b/apps/web/process/insurance/index.ts new file mode 100644 index 0000000..f5291d5 --- /dev/null +++ b/apps/web/process/insurance/index.ts @@ -0,0 +1 @@ +export * from './get-kp-data'; diff --git a/apps/web/process/lead-opportunity/index.ts b/apps/web/process/lead-opportunity/index.ts new file mode 100644 index 0000000..88c740a --- /dev/null +++ b/apps/web/process/lead-opportunity/index.ts @@ -0,0 +1 @@ +export * as reactions from './reactions'; diff --git a/apps/web/process/lead-opportunity/reactions/common.ts b/apps/web/process/lead-opportunity/reactions/common.ts index 8308e76..5cff530 100644 --- a/apps/web/process/lead-opportunity/reactions/common.ts +++ b/apps/web/process/lead-opportunity/reactions/common.ts @@ -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 commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation, $process } = store; /** @@ -110,4 +110,28 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex } } ); + + reaction( + () => $calculation.element('selectLead').getValue(), + async (leadid) => { + if (!leadid) { + $calculation.element('tbxINNForCalc').resetValue(); + + return; + } + + const { + data: { lead }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { leadid }, + }); + + if (lead?.evo_inn) { + $calculation.element('tbxINNForCalc').setValue(Number.parseInt(lead?.evo_inn, 10)); + } else { + $calculation.element('tbxINNForCalc').resetValue(); + } + } + ); } diff --git a/apps/web/process/lead-opportunity/reactions/index.js b/apps/web/process/lead-opportunity/reactions/index.ts similarity index 100% rename from apps/web/process/lead-opportunity/reactions/index.js rename to apps/web/process/lead-opportunity/reactions/index.ts diff --git a/apps/web/process/lead-opportunity/reactions/urls.ts b/apps/web/process/lead-opportunity/reactions/urls.ts index 228183c..a369178 100644 --- a/apps/web/process/lead-opportunity/reactions/urls.ts +++ b/apps/web/process/lead-opportunity/reactions/urls.ts @@ -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 urlsReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation } = store; /** diff --git a/apps/web/process/leasing-object/get-kp-data.ts b/apps/web/process/leasing-object/get-kp-data.ts index e16ca30..d6f1db9 100644 --- a/apps/web/process/leasing-object/get-kp-data.ts +++ b/apps/web/process/leasing-object/get-kp-data.ts @@ -1,55 +1,76 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE = gql` - query GetLeasingObjectDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_LEASING_OBJECT_DATA = gql` + query GetQuoteLeasingObjectData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_brandid - evo_modelid + evo_category + evo_delivery_time + evo_engine_hours + evo_engine_type + evo_engine_volume evo_equipmentid evo_leasingobject_typeid + evo_leasingobject_used + evo_max_mass + evo_max_speed + evo_mileage + evo_modelid + evo_object_count + evo_power + evo_recalc_limit + evo_seats + evo_trailer + evo_use_for + evo_vin + evo_year } } `; -export type Quote = NonNullable; - -type QuoteLeasingObjectProcessData = { - values: Partial; -}; - -export default async function getLeasingObjectDataFromKP({ - values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +export async function getKPData({ + values: { quote: quoteId, recalcWithRevision }, +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetLeasingObjectDataFromQuoteQuery, - CRMTypes.GetLeasingObjectDataFromQuoteQueryVariables - >({ - query: QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteLeasingObjectDataDocument, variables: { quoteId, }, }); - if (!quote) { - throw new Error('Quote is empty'); - } - - const { evo_brandid, evo_modelid, evo_equipmentid, evo_leasingobject_typeid } = quote; - return { values: { - brand: evo_brandid, - configuration: evo_equipmentid, - leaseObjectType: evo_leasingobject_typeid, - model: evo_modelid, + brand: quote?.evo_brandid, + configuration: quote?.evo_equipmentid, + countSeats: quote?.evo_seats ?? defaultValues.countSeats, + deliveryTime: quote?.evo_delivery_time, + engineHours: quote?.evo_engine_hours ?? defaultValues.engineHours, + engineType: quote?.evo_engine_type, + engineVolume: quote?.evo_engine_volume ?? defaultValues.engineVolume, + leaseObjectCategory: quote?.evo_category, + leaseObjectCount: + (recalcWithRevision ? quote?.evo_recalc_limit : quote?.evo_object_count) ?? + defaultValues.leaseObjectCount, + leaseObjectMotorPower: quote?.evo_power ?? defaultValues.leaseObjectMotorPower, + leaseObjectType: quote?.evo_leasingobject_typeid, + leaseObjectUseFor: quote?.evo_use_for, + leaseObjectUsed: quote?.evo_leasingobject_used ?? defaultValues.leaseObjectUsed, + leaseObjectYear: quote?.evo_year ?? defaultValues.leaseObjectYear, + maxMass: quote?.evo_max_mass ?? defaultValues.maxMass, + maxSpeed: quote?.evo_max_speed ?? defaultValues.maxSpeed, + mileage: quote?.evo_mileage ?? defaultValues.mileage, + model: quote?.evo_modelid, + vin: quote?.evo_vin, + withTrailer: quote?.evo_trailer ?? defaultValues.withTrailer, }, }; } diff --git a/apps/web/process/leasing-object/index.ts b/apps/web/process/leasing-object/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/leasing-object/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/leasing-object/reactions/common.ts b/apps/web/process/leasing-object/reactions/common.ts index 0a20f97..7e0ec09 100644 --- a/apps/web/process/leasing-object/reactions/common.ts +++ b/apps/web/process/leasing-object/reactions/common.ts @@ -1,26 +1,22 @@ /* 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 commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation } = store; reaction( - () => { - const { brand, subsidy, importProgram, leaseObjectType } = $calculation.$values.values; - - return { - brandId: brand, - importProgramId: importProgram, - leaseObjectTypeId: leaseObjectType, - subsidyId: subsidy, - }; - }, - // eslint-disable-next-line sonarjs/cognitive-complexity - async ({ brandId, subsidyId, importProgramId, leaseObjectTypeId }) => { + () => $calculation.$values.getValues(['brand', 'importProgram', 'leaseObjectType', 'subsidy']), + async ({ + brand: brandId, + importProgram: importProgramId, + leaseObjectType: leaseObjectTypeId, + subsidy: subsidyId, + // eslint-disable-next-line sonarjs/cognitive-complexity + }) => { if (!brandId) { $calculation.element('selectModel').reset(); @@ -31,9 +27,7 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex data: { evo_models }, } = await apolloClient.query({ query: CRMTypes.GetModelsDocument, - variables: { - brandId, - }, + variables: { brandId }, }); let models = evo_models; @@ -46,18 +40,16 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex if (leaseObjectTypeId) { const { - data: { leaseObjectType }, + data: { evo_leasingobject_type }, } = await apolloClient.query({ query: CRMTypes.GetLeaseObjectTypeDocument, - variables: { - leaseObjectTypeId, - }, + variables: { leaseObjectTypeId }, }); models = models?.filter((model) => { if ( model?.evo_vehicle_type && - leaseObjectType?.evo_vehicle_type?.includes(model.evo_vehicle_type) + evo_leasingobject_type?.evo_vehicle_type?.includes(model.evo_vehicle_type) ) { return model; } @@ -71,9 +63,7 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex data: { evo_subsidy: subsidy }, } = await apolloClient.query({ query: CRMTypes.GetSubsidyDocument, - variables: { - subsidyId, - }, + variables: { subsidyId }, }); models = models?.filter((model) => { @@ -96,9 +86,7 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex data: { importProgram }, } = await apolloClient.query({ query: CRMTypes.GetImportProgramDocument, - variables: { - importProgramId, - }, + variables: { importProgramId }, }); models = models?.filter((model) => { @@ -122,18 +110,14 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex ); reaction( - () => { - const { product, subsidy, importProgram, leaseObjectType } = $calculation.$values.values; - - return { - importProgramId: importProgram, - leaseObjectTypeId: leaseObjectType, - productId: product, - subsidyId: subsidy, - }; - }, - // eslint-disable-next-line sonarjs/cognitive-complexity - async ({ productId, subsidyId, importProgramId, leaseObjectTypeId }) => { + () => + $calculation.$values.getValues(['importProgram', 'leaseObjectType', 'product', 'subsidy']), + async ({ + importProgram: importProgramId, + leaseObjectType: leaseObjectTypeId, + product: productId, + subsidy: subsidyId, + }) => { const { data: { evo_brands }, } = await apolloClient.query({ @@ -153,9 +137,7 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex data: { evo_baseproduct }, } = await apolloClient.query({ query: CRMTypes.GetProductDocument, - variables: { - productId, - }, + variables: { productId }, }); brands = brands?.filter( @@ -169,21 +151,19 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex if (leaseObjectTypeId) { const { - data: { leaseObjectType }, + data: { evo_leasingobject_type }, } = await apolloClient.query({ query: CRMTypes.GetLeaseObjectTypeDocument, - variables: { - leaseObjectTypeId, - }, + variables: { leaseObjectTypeId }, }); brands = brands?.filter( (brand) => brand?.evo_vehicle_type?.length && - leaseObjectType?.evo_vehicle_type && + evo_leasingobject_type?.evo_vehicle_type && intersects( brand.evo_vehicle_type?.filter((x) => x > 0), - leaseObjectType?.evo_vehicle_type + evo_leasingobject_type?.evo_vehicle_type ) ); } @@ -193,9 +173,7 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex data: { evo_subsidy: subsidy }, } = await apolloClient.query({ query: CRMTypes.GetSubsidyDocument, - variables: { - subsidyId, - }, + variables: { subsidyId }, }); brands = brands?.filter( @@ -212,9 +190,7 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex data: { importProgram }, } = await apolloClient.query({ query: CRMTypes.GetImportProgramDocument, - variables: { - importProgramId, - }, + variables: { importProgramId }, }); brands = brands?.filter( @@ -253,12 +229,180 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex data: { evo_equipments }, } = await apolloClient.query({ query: CRMTypes.GetConfigurationsDocument, - variables: { - modelId, - }, + variables: { modelId }, }); $calculation.element('selectConfiguration').setOptions(normalizeOptions(evo_equipments)); } ); + + reaction( + () => $calculation.element('cbxLeaseObjectUsed').getValue(), + (leaseObjectUsed) => { + if (leaseObjectUsed) { + $calculation.element('tbxLeaseObjectCount').setValue(1).block(); + } else { + $calculation.element('tbxLeaseObjectCount').unblock(); + } + } + ); + + reaction( + () => $calculation.element('selectLeaseObjectType').getValue(), + async (leaseObjectTypeId) => { + if (!leaseObjectTypeId) { + $calculation.element('cbxWithTrailer').resetValue(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + $calculation.element('cbxWithTrailer').setValue(evo_leasingobject_type?.evo_id === '7'); + } + ); + + reaction( + () => $calculation.$values.getValues(['model', 'configuration']), + async ({ model: modelId, configuration: configurationId }) => { + $calculation.element('labelDepreciationGroup').resetValue(); + + if (configurationId) { + const { + data: { evo_equipment }, + } = await apolloClient.query({ + query: CRMTypes.GetConfigurationDocument, + variables: { configurationId }, + }); + + if (evo_equipment?.evo_impairment_groupidData?.evo_name) { + $calculation + .element('labelDepreciationGroup') + .setValue(evo_equipment?.evo_impairment_groupidData?.evo_name); + + return; + } + } + + if (modelId) { + const { + data: { evo_model }, + } = await apolloClient.query({ + query: CRMTypes.GetModelDocument, + variables: { modelId }, + }); + + if (evo_model?.evo_impairment_groupidData?.evo_name) { + $calculation + .element('labelDepreciationGroup') + .setValue(evo_model?.evo_impairment_groupidData?.evo_name); + } + } + } + ); + + reaction( + () => $calculation.element('selectLeaseObjectCategory').getValue(), + (leaseObjectCategory) => { + if ( + leaseObjectCategory !== null && + [100_000_001, 100_000_003].includes(leaseObjectCategory) + ) { + $calculation.element('cbxWithTrailer').setValue(false).block(); + } else { + $calculation.element('cbxWithTrailer').unblock(); + } + } + ); + + reaction( + () => $calculation.$values.getValues(['brand', 'model', 'leaseObjectUsed']), + async ({ brand: brandId, model: modelId, leaseObjectUsed }) => { + const tbxImporterRewardPerc = $calculation.element('tbxImporterRewardPerc'); + const tbxImporterRewardRub = $calculation.element('tbxImporterRewardRub'); + + if (leaseObjectUsed) { + tbxImporterRewardPerc.resetValue(); + tbxImporterRewardRub.resetValue(); + + return; + } + + if (modelId) { + const { + data: { evo_model }, + } = await apolloClient.query({ + query: CRMTypes.GetModelDocument, + variables: { modelId }, + }); + + if (evo_model?.evo_importer_reward_perc) { + tbxImporterRewardPerc.setValue(evo_model?.evo_importer_reward_perc); + } else { + tbxImporterRewardPerc.resetValue(); + } + + if (evo_model?.evo_importer_reward_rub) { + tbxImporterRewardRub.setValue(evo_model?.evo_importer_reward_rub); + } else { + tbxImporterRewardRub.resetValue(); + } + } else if (brandId) { + const { + data: { evo_brand }, + } = await apolloClient.query({ + query: CRMTypes.GetBrandDocument, + variables: { brandId }, + }); + + if (evo_brand?.evo_importer_reward_perc) { + tbxImporterRewardPerc.setValue(evo_brand?.evo_importer_reward_perc); + } else { + tbxImporterRewardPerc.resetValue(); + } + + if (evo_brand?.evo_importer_reward_rub) { + tbxImporterRewardRub.setValue(evo_brand?.evo_importer_reward_rub); + } else { + tbxImporterRewardRub.resetValue(); + } + } else { + tbxImporterRewardPerc.resetValue(); + tbxImporterRewardRub.resetValue(); + } + } + ); + + reaction( + () => $calculation.element('selectLeaseObjectType').getValue(), + async (leaseObjectTypeId) => { + if (!leaseObjectTypeId) { + $calculation.element('selectLeaseObjectCategory').resetValue(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { + leaseObjectTypeId, + }, + }); + + if (evo_leasingobject_type?.evo_category) { + $calculation + .element('selectLeaseObjectCategory') + .setValue(evo_leasingobject_type?.evo_category); + } else { + $calculation.element('selectLeaseObjectCategory').resetValue(); + } + } + ); } diff --git a/apps/web/process/leasing-object/reactions/index.ts b/apps/web/process/leasing-object/reactions/index.ts new file mode 100644 index 0000000..cc8d68a --- /dev/null +++ b/apps/web/process/leasing-object/reactions/index.ts @@ -0,0 +1,2 @@ +export { default as common } from './common'; +export { default as validation } from './validation'; diff --git a/apps/web/process/leasing-object/reactions/validation.ts b/apps/web/process/leasing-object/reactions/validation.ts index 1178640..a981034 100644 --- a/apps/web/process/leasing-object/reactions/validation.ts +++ b/apps/web/process/leasing-object/reactions/validation.ts @@ -1,7 +1,10 @@ -import type { ReactionsContext } from '@/process/types'; -import { autorun } from 'mobx'; +/* eslint-disable @typescript-eslint/naming-convention */ +import * as CRMTypes from '@/graphql/crm.types'; +import type { ProcessContext } from '@/process/types'; +import ValidationHelper from '@/stores/validation/helper'; +import { autorun, reaction } from 'mobx'; -export default function validationReactions({ store }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation } = store; /** @@ -20,4 +23,142 @@ export default function validationReactions({ store }: ReactionsContext) { delay: 10, } ); + + reaction( + () => + $calculation.$values.getValues([ + 'leaseObjectType', + 'engineVolume', + 'engineType', + 'leaseObjectMotorPower', + ]), + async ({ + engineType, + engineVolume, + leaseObjectType: leaseObjectTypeId, + leaseObjectMotorPower, + }) => { + if (!leaseObjectTypeId) { + $calculation.element('selectEngineType').unblock(); + $calculation.element('tbxEngineVolume').unblock(); + $calculation.element('tbxLeaseObjectMotorPower').unblock(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { + leaseObjectTypeId, + }, + }); + + if (evo_leasingobject_type?.evo_id === '8') { + $calculation.element('selectEngineType').resetValue().block(); + $calculation.element('tbxEngineVolume').resetValue().block(); + $calculation.element('tbxLeaseObjectMotorPower').resetValue().block(); + } else { + $calculation.element('selectEngineType').unblock(); + $calculation.element('tbxEngineVolume').unblock(); + $calculation.element('tbxLeaseObjectMotorPower').unblock(); + } + + const isNotTrailer = + evo_leasingobject_type?.evo_id !== null && evo_leasingobject_type?.evo_id !== '8'; + + $calculation.element('tbxEngineVolume').validate({ + invalid: isNotTrailer && engineVolume <= 0, + message: 'Не заполнено поле', + }); + $calculation.element('selectEngineType').validate({ + invalid: isNotTrailer && !engineType, + message: 'Не заполнено поле', + }); + $calculation.element('tbxLeaseObjectMotorPower').validate({ + invalid: isNotTrailer && leaseObjectMotorPower <= 0, + message: 'Не заполнено поле', + }); + } + ); + + { + const validationHelper = new ValidationHelper(); + + reaction( + () => $calculation.$values.getValues(['leaseObjectType', 'countSeats', 'maxMass']), + async ({ countSeats, leaseObjectType: leaseObjectTypeId, maxMass }) => { + if (!leaseObjectTypeId) { + validationHelper.removeErrors(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { + leaseObjectTypeId, + }, + }); + + $calculation.element('tbxCountSeats').validate({ + helper: validationHelper, + invalid: evo_leasingobject_type?.evo_id === '1' && countSeats >= 9, + message: 'Количество мест должно быть меньше 9', + }); + + $calculation.element('tbxCountSeats').validate({ + helper: validationHelper, + invalid: + (evo_leasingobject_type?.evo_id === '4' || evo_leasingobject_type?.evo_id === '5') && + countSeats <= 8, + message: 'Количество мест должно быть больше 8', + }); + + $calculation.element('tbxMaxMass').validate({ + helper: validationHelper, + invalid: evo_leasingobject_type?.evo_id === '2' && maxMass <= 0, + message: 'Не заполнено поле', + }); + } + ); + } + + { + const validationHelper = new ValidationHelper(); + + reaction( + () => $calculation.$values.getValues(['leaseObjectType', 'leaseObjectCategory']), + async ({ leaseObjectCategory, leaseObjectType: leaseObjectTypeId }) => { + if (!leaseObjectTypeId) { + validationHelper.removeErrors(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { + leaseObjectTypeId, + }, + }); + + $calculation.element('selectLeaseObjectCategory').validate({ + helper: validationHelper, + invalid: + !leaseObjectCategory && + Boolean( + evo_leasingobject_type?.evo_id && + !['6', '9', '10'].includes(evo_leasingobject_type?.evo_id) + ), + message: 'Не заполнено поле', + }); + } + ); + } } diff --git a/apps/web/process/leasing-without-kasko/index.ts b/apps/web/process/leasing-without-kasko/index.ts new file mode 100644 index 0000000..88c740a --- /dev/null +++ b/apps/web/process/leasing-without-kasko/index.ts @@ -0,0 +1 @@ +export * as reactions from './reactions'; diff --git a/apps/web/process/leasing-without-kasko/reactions/common.ts b/apps/web/process/leasing-without-kasko/reactions.ts similarity index 53% rename from apps/web/process/leasing-without-kasko/reactions/common.ts rename to apps/web/process/leasing-without-kasko/reactions.ts index c81842d..a7d6177 100644 --- a/apps/web/process/leasing-without-kasko/reactions/common.ts +++ b/apps/web/process/leasing-without-kasko/reactions.ts @@ -1,11 +1,11 @@ /* 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'; -import { autorun, reaction } from 'mobx'; +import { reaction } from 'mobx'; import { uid } from 'radash'; import { normalizeOptions } from 'tools'; import notification from 'ui/elements/notification'; @@ -42,7 +42,7 @@ const QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS = gql` } `; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ProcessContext) { const { $calculation, $tables } = store; reaction( @@ -73,22 +73,19 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex } ); - autorun(async () => { - const currentDate = dayjs().utc(false).toISOString(); - - const { - data: { evo_addproduct_types }, - } = await apolloClient.query< - CRMTypes.GetLeasingWithoutKaskoOptionsQuery, - CRMTypes.GetLeasingWithoutKaskoOptionsQueryVariables - >({ - query: QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS, - variables: { - currentDate, - }, - }); - - const { + reaction( + () => + $calculation.$values.getValues([ + 'plPriceRub', + 'discountRub', + 'importProgramSum', + 'leasingPeriod', + 'addEquipmentPrice', + 'leaseObjectType', + 'firstPaymentPerc', + 'model', + ]), + async ({ plPriceRub, discountRub, importProgramSum, @@ -97,30 +94,46 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex leaseObjectType, firstPaymentPerc, model: modelId, - } = $calculation.$values.values; + }) => { + const currentDate = dayjs().utc(false).toISOString(); - const options = evo_addproduct_types?.filter( - (x) => - x?.evo_max_period && - x.evo_max_period >= leasingPeriod && - x?.evo_min_period && - x.evo_min_period <= leasingPeriod && - x?.evo_max_price && - x.evo_max_price >= plPriceRub - discountRub - importProgramSum + addEquipmentPrice && - x?.evo_min_price && - x.evo_min_price <= plPriceRub - discountRub - importProgramSum + addEquipmentPrice && - x.evo_leasingobject_types?.find( - (evo_leasingobject_type) => - evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType - ) && - x.evo_visible_calc && - x.evo_min_first_payment_perc && - x.evo_min_first_payment_perc <= firstPaymentPerc && - x.evo_max_first_payment_perc && - x.evo_max_first_payment_perc >= firstPaymentPerc && - !x.evo_models?.map((evo_model) => evo_model?.evo_modelid).includes(modelId) - ); + const { + data: { evo_addproduct_types }, + } = await apolloClient.query< + CRMTypes.GetLeasingWithoutKaskoOptionsQuery, + CRMTypes.GetLeasingWithoutKaskoOptionsQueryVariables + >({ + query: QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS, + variables: { + currentDate, + }, + }); - $calculation.element('selectLeasingWithoutKasko').setOptions(normalizeOptions(options)); - }); + const price = plPriceRub - discountRub - importProgramSum + addEquipmentPrice; + const options = evo_addproduct_types?.filter( + (x) => + x && + Boolean(x.evo_max_period !== null && x.evo_max_period >= leasingPeriod) && + Boolean(x.evo_min_period !== null && x.evo_min_period <= leasingPeriod) && + Boolean(x.evo_max_price !== null && x.evo_max_price >= price) && + Boolean(x.evo_min_price !== null && x.evo_min_price <= price) && + x.evo_leasingobject_types?.find( + (evo_leasingobject_type) => + evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType + ) && + x.evo_visible_calc && + Boolean( + x.evo_min_first_payment_perc !== null && + x.evo_min_first_payment_perc <= firstPaymentPerc + ) && + Boolean( + x.evo_max_first_payment_perc !== null && + x.evo_max_first_payment_perc >= firstPaymentPerc + ) && + !x.evo_models?.map((evo_model) => evo_model?.evo_modelid).includes(modelId) + ); + + $calculation.element('selectLeasingWithoutKasko').setOptions(normalizeOptions(options)); + } + ); } diff --git a/apps/web/process/leasing-without-kasko/reactions/index.js b/apps/web/process/leasing-without-kasko/reactions/index.js deleted file mode 100644 index c8077ba..0000000 --- a/apps/web/process/leasing-without-kasko/reactions/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default as common } from './common'; diff --git a/apps/web/process/load-kp/index.ts b/apps/web/process/load-kp/index.ts new file mode 100644 index 0000000..0857fca --- /dev/null +++ b/apps/web/process/load-kp/index.ts @@ -0,0 +1,2 @@ +export * as reactions from './reactions'; +export * from './types'; diff --git a/apps/web/process/load-kp/reactions.ts b/apps/web/process/load-kp/reactions.ts index 0ba3630..60b89e9 100644 --- a/apps/web/process/load-kp/reactions.ts +++ b/apps/web/process/load-kp/reactions.ts @@ -1,18 +1,16 @@ -import type { ReactionsContext } from '@/process/types'; -import extend from '@/stores/tables/insurance/tools'; +import type { ProcessContext } from '@/process/types'; import { reaction } from 'mobx'; -import { pick } from 'radash'; import message from 'ui/elements/message'; const key = 'KP_LOADING_INFO'; -export default function loadKpReactions({ store, trpcClient }: ReactionsContext) { +export function common({ store, trpcClient }: ProcessContext) { const { $calculation, $process, $tables } = store; reaction( () => $calculation.element('selectQuote').getValue(), (quoteId) => { - if (!quoteId) return; + if (!quoteId || $process.has('LoadKP')) return; $process.add('LoadKP'); @@ -23,42 +21,39 @@ export default function loadKpReactions({ store, trpcClient }: ReactionsContext) key, }); - const { recalcWithRevision } = $calculation.$values.values; - trpcClient.quote.getData .query({ values: { quote: quoteId, - recalcWithRevision, + ...$calculation.$values.getValues(['recalcWithRevision', 'lead', 'opportunity']), }, }) .then(({ values, payments, insurance, fingap }) => { - const savedValues = pick($calculation.$values.values, [ + const savedValues = $calculation.$values.getValues([ 'lead', 'opportunity', 'quote', 'leadUrl', 'opportunityUrl', 'quoteUrl', + 'recalcWithRevision', ]); $calculation.$values.setValues({ - values: { - ...values, - ...savedValues, - }, + ...values, + ...savedValues, }); $tables.payments.setValues(payments.values); if (insurance.values.osago) { - extend($tables.insurance).setRowValues(insurance.values.osago); + $tables.insurance.row('osago').setValues(insurance.values.osago); } if (insurance.values.kasko) { - extend($tables.insurance).setRowValues(insurance.values.kasko); + $tables.insurance.row('kasko').setValues(insurance.values.kasko); } if (insurance.values.fingap) { - extend($tables.insurance).setRowValues(insurance.values.fingap); + $tables.insurance.row('fingap').setValues(insurance.values.fingap); } if (fingap) $tables.fingap.setSelectedKeys(fingap.keys); @@ -73,6 +68,7 @@ export default function loadKpReactions({ store, trpcClient }: ReactionsContext) content: `Ошибка во время загрузки КП ${quoteName}`, key, }); + $calculation.element('selectQuote').resetValue(); }) .finally(() => { $process.delete('LoadKP'); diff --git a/apps/web/process/load-kp/types.ts b/apps/web/process/load-kp/types.ts index 747d75f..c892dc2 100644 --- a/apps/web/process/load-kp/types.ts +++ b/apps/web/process/load-kp/types.ts @@ -5,30 +5,48 @@ import PaymentsSchema from '@/config/schema/payments'; import ValuesSchema from '@/config/schema/values'; import { z } from 'zod'; -const { quote, recalcWithRevision } = ValuesSchema.shape; -const InputValuesSchema = z.object({ - quote: quote.unwrap(), - recalcWithRevision, -}); -export const GetQuoteDataInputSchema = z +const { quote, recalcWithRevision, lead, opportunity } = ValuesSchema.shape; + +export const GetQuoteInputDataSchema = z .object({ - values: InputValuesSchema.required(), + values: z + .object({ + lead, + opportunity, + quote: quote.unwrap(), + recalcWithRevision, + }) + .required(), }) .strict(); -export type GetQuoteDataInput = z.infer; + +export type GetQuoteInputData = z.infer; const FinGAPSchema = z.object({ keys: z.array(RiskSchema.shape.key), }); + const InsuranceSchema = z.object({ values: z.record(KeysSchema, RowSchema), }); -export const GetQuoteDataOutputSchema = z + +export const GetQuoteOutputDataSchema = z .object({ - fingap: FinGAPSchema.optional(), - insurance: InsuranceSchema.required(), + fingap: FinGAPSchema, + insurance: InsuranceSchema, payments: PaymentsSchema, values: ValuesSchema, }) .strict(); -export type GetQuoteDataOutput = z.infer; + +export type GetQuoteOutputData = z.infer; + +export const GetQuoteProcessDataSchema = GetQuoteOutputDataSchema.omit({ + values: true, +}) + .extend({ + values: ValuesSchema.partial(), + }) + .partial(); + +export type GetQuoteProcessData = z.infer; diff --git a/apps/web/process/payments/get-kp-data.ts b/apps/web/process/payments/get-kp-data.ts index fe630f2..5124901 100644 --- a/apps/web/process/payments/get-kp-data.ts +++ b/apps/web/process/payments/get-kp-data.ts @@ -1,11 +1,12 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; import { sort } from 'radash'; -const QUERY_GET_PAYMENTS_DATA_FROM_QUOTE = gql` - query GetPaymentsDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_PAYMENTS_DATA = gql` + query GetQuotePaymentsData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_period evo_accept_period @@ -26,23 +27,15 @@ const QUERY_GET_PAYMENTS_DATA_FROM_QUOTE = gql` } `; -type QuotePaymentsProcessData = { - payments: GetQuoteDataOutput['payments']; - values: Partial; -}; - -export default async function getPaymentsDataFromKP({ +export async function getKPData({ values: { quote: quoteId, recalcWithRevision }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetPaymentsDataFromQuoteQuery, - CRMTypes.GetPaymentsDataFromQuoteQueryVariables - >({ - query: QUERY_GET_PAYMENTS_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuotePaymentsDataDocument, variables: { quoteId, }, @@ -65,18 +58,19 @@ export default async function getPaymentsDataFromKP({ return { payments: { values: [ - quote?.evo_first_payment_perc || 0, + quote?.evo_first_payment_perc ?? 0, ...paymentsValues, - quote?.evo_last_payment_perc || 0, + quote?.evo_last_payment_perc ?? 0, ], }, values: { - firstPaymentPerc: quote?.evo_first_payment_perc || 0, - graphType: quote?.evo_graph_type ?? undefined, + firstPaymentPerc: quote?.evo_first_payment_perc ?? defaultValues.firstPaymentPerc, + graphType: quote?.evo_graph_type, highSeasonStart: quote?.evo_high_season, - lastPaymentPerc: quote?.evo_last_payment_perc || 0, + lastPaymentPerc: quote?.evo_last_payment_perc ?? defaultValues.lastPaymentPerc, leasingPeriod, - parmentsDecreasePercent: quote?.evo_payments_decrease_perc || 0, + parmentsDecreasePercent: + quote?.evo_payments_decrease_perc ?? defaultValues.parmentsDecreasePercent, seasonType: quote?.evo_seasons_type, }, }; diff --git a/apps/web/process/payments/index.ts b/apps/web/process/payments/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/payments/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/payments/validation.ts b/apps/web/process/payments/lib/validation.ts similarity index 87% rename from apps/web/process/payments/validation.ts rename to apps/web/process/payments/lib/validation.ts index fd0cb9c..ae38795 100644 --- a/apps/web/process/payments/validation.ts +++ b/apps/web/process/payments/lib/validation.ts @@ -1,29 +1,30 @@ -import { SEASONS_PERIOD_NUMBER, SEASONS_PERIODS } from './lib/seasons-constants'; +import { SEASONS_PERIOD_NUMBER, SEASONS_PERIODS } from './seasons-constants'; +import { MIN_PAYMENT } from '@/constants/values'; import type RootStore from '@/stores/root'; import { counting, max, min, shift, sort } from 'radash'; import { areEqual, isSorted } from 'tools/array'; // eslint-disable-next-line sonarjs/cognitive-complexity export default function validatePaymentsTable({ $calculation, $tables }: RootStore) { + /** + * в таблице платежей в столбце Соотношение платежей + * для строк с 2 до "Срок лизинга-1" минимальное значение должно быть равно 3 + */ + { + const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); + const targetPayments = $tables.payments.values.slice(1, leasingPeriod - 1); + + if (!targetPayments.every((payment) => payment >= MIN_PAYMENT)) { + return `Минимальное значение платежа должно быть равно ${MIN_PAYMENT}`; + } + } + switch ($calculation.element('radioGraphType').getValue()) { // Дегрессия case 100_000_001: { if (!$calculation.element('selectSeasonType').getValue()) { return 'Не выбран тип дегрессии'; } - /** - * в таблице платежей в столбце Соотношение платежей - * для строк с 2 до "Срок лизинга-1" минимальное значение должно быть равно 3 - */ - { - const MIN_PAYMENT = 3; - const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); - const targetPayments = $tables.payments.values.slice(1, leasingPeriod - 1); - - if (!targetPayments.every((payment) => payment >= MIN_PAYMENT)) { - return `Минимальное значение платежа должно быть равно ${MIN_PAYMENT}`; - } - } /** * при Дегрессии все значения не должны быть равны друг другу @@ -62,7 +63,7 @@ export default function validatePaymentsTable({ $calculation, $tables }: RootSto const targetPayments = $tables.payments.values.slice(1, 4); if ((max(targetPayments) || 0) - (min(targetPayments) || 0) > 10) { - return 'Указана очень жесткая дегрессия'; + return 'Указана очень жесткая дегрессия. На 2-4 платежах Соотношение платежа должен отличаться не более чем на 10%'; } } diff --git a/apps/web/process/payments/reactions.ts b/apps/web/process/payments/reactions/common.ts similarity index 88% rename from apps/web/process/payments/reactions.ts rename to apps/web/process/payments/reactions/common.ts index da009ca..d58a3bf 100644 --- a/apps/web/process/payments/reactions.ts +++ b/apps/web/process/payments/reactions/common.ts @@ -1,10 +1,9 @@ -import * as seasonsConstants from './lib/seasons-constants'; -import * as seasonsTools from './lib/seasons-tools'; -import validatePaymentsTable from './validation'; +import * as seasonsConstants from '../lib/seasons-constants'; +import * as seasonsTools from '../lib/seasons-tools'; import { selectHighSeasonStart } from '@/config/default-options'; -import type { ReactionsContext } from '@/process/types'; +import { MIN_PAYMENT } from '@/constants/values'; +import type { ProcessContext } from '@/process/types'; import type { Row } from '@/stores/tables/payments/types'; -import ValidationHelper from '@/stores/validation/helper'; import { comparer, reaction, toJS } from 'mobx'; import { shift } from 'radash'; import { difference } from 'tools/array'; @@ -21,7 +20,7 @@ const { const { DEFAULT_SEASONS_VALUES, FORBIDDEN_HIGH_SEASON_START, SEASONS_PERIOD_NUMBER } = seasonsConstants; -export default function paymentsReactions({ store }: ReactionsContext) { +export default function reactions({ store }: ProcessContext) { const { $calculation, $tables, $process } = store; reaction( @@ -114,7 +113,8 @@ export default function paymentsReactions({ store }: ReactionsContext) { length: leasingPeriod - 2, }, (_, k) => { - const payment = 100 * (parmentsDecreasePercent / 100) ** k; + let payment = 100 * (parmentsDecreasePercent / 100) ** k; + if (payment < MIN_PAYMENT) payment = MIN_PAYMENT; return { status: 'Disabled', @@ -351,26 +351,19 @@ export default function paymentsReactions({ store }: ReactionsContext) { makeDisposable( () => reaction( - () => { + () => toJS($tables.payments.values), + (nextPayments, prevPayments) => { const graphType = $calculation.element('radioGraphType').getValue(); - const payments = toJS($tables.payments.values); const degressionType = $calculation.element('selectSeasonType').getValue(); - return { - degressionType, - graphType, - payments, - }; - }, - (nextParams, prevParams) => { - if (nextParams.graphType === 100_000_001 && nextParams.degressionType === 100_000_007) { - const changes = difference(nextParams.payments, prevParams.payments); + if (graphType === 100_000_001 && degressionType === 100_000_007) { + const changes = difference(nextPayments, prevPayments); - if (changes === null || changes.length > 1) return; + if (!changes?.length || changes.length > 1) return; const [changeIndex] = changes; - const value = nextParams.payments[changeIndex]; - const payments = nextParams.payments.slice(1, -1).map((payment, i) => { + const value = nextPayments[changeIndex]; + const payments = nextPayments.slice(1, -1).map((payment, i) => { if (i <= changeIndex - 2) return payment; return value; @@ -539,39 +532,11 @@ export default function paymentsReactions({ store }: ReactionsContext) { () => $process.has('LoadKP') ); - /** - * Валидация - */ - const validationHelper = new ValidationHelper(); - reaction( + () => $calculation.element('radioGraphType').getValue(), () => { - const payments = toJS($tables.payments.values); - const graphType = $calculation.element('radioGraphType').getValue(); - const seasonType = $calculation.element('selectSeasonType').getValue(); - const highSeasonStart = $calculation.element('selectHighSeasonStart').getValue(); - const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); - - return { - graphType, - highSeasonStart, - leasingPeriod, - payments, - seasonType, - }; - }, - () => { - validationHelper.removeErrors(); - const errorText = validatePaymentsTable(store); - - if (errorText) { - const removeError = $tables.payments.validation.addError(errorText); - validationHelper.add(removeError); - } - }, - { - delay: 50, - equals: comparer.structural, + $calculation.element('selectSeasonType').resetValue(); + $calculation.element('selectHighSeasonStart').resetValue(); } ); } diff --git a/apps/web/process/payments/reactions/index.ts b/apps/web/process/payments/reactions/index.ts new file mode 100644 index 0000000..cc8d68a --- /dev/null +++ b/apps/web/process/payments/reactions/index.ts @@ -0,0 +1,2 @@ +export { default as common } from './common'; +export { default as validation } from './validation'; diff --git a/apps/web/process/payments/reactions/validation.ts b/apps/web/process/payments/reactions/validation.ts new file mode 100644 index 0000000..7d6eefb --- /dev/null +++ b/apps/web/process/payments/reactions/validation.ts @@ -0,0 +1,64 @@ +import validatePaymentsTable from '../lib/validation'; +import { MIN_LASTPAYMENT_NSIB } from '@/constants/values'; +import type { ProcessContext } from '@/process/types'; +import ValidationHelper from '@/stores/validation/helper'; +import { comparer, reaction, toJS } from 'mobx'; + +export default function reactions({ store }: ProcessContext) { + const { $calculation, $tables } = store; + + const validationHelper = new ValidationHelper(); + + reaction( + () => { + const payments = toJS($tables.payments.values); + const graphType = $calculation.element('radioGraphType').getValue(); + const seasonType = $calculation.element('selectSeasonType').getValue(); + const highSeasonStart = $calculation.element('selectHighSeasonStart').getValue(); + const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); + + return { + graphType, + highSeasonStart, + leasingPeriod, + payments, + seasonType, + }; + }, + () => { + validationHelper.removeErrors(); + + const errorText = validatePaymentsTable(store); + + if (errorText) { + $tables.payments.validate({ + helper: validationHelper, + invalid: errorText !== null, + message: errorText, + }); + } + }, + { + delay: 50, + equals: comparer.structural, + } + ); + + reaction( + () => { + const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue(); + const insNSIB = $calculation.element('selectInsNSIB').getValue(); + + return { + insNSIB, + lastPaymentRub, + }; + }, + ({ lastPaymentRub, insNSIB }) => { + $calculation.element('tbxLastPaymentRub').validate({ + invalid: Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB, + message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`, + }); + } + ); +} diff --git a/apps/web/process/price/get-kp-data.ts b/apps/web/process/price/get-kp-data.ts index b2725dd..14c3f8e 100644 --- a/apps/web/process/price/get-kp-data.ts +++ b/apps/web/process/price/get-kp-data.ts @@ -1,42 +1,37 @@ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_PRICE_DATA_FROM_QUOTE = gql` - query GetPriceDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_PRICE_DATA = gql` + query GetQuotePriceData($quoteId: Uuid!) { quote(quoteId: $quoteId) { - evo_supplier_currency_price - evo_price_without_nds_supplier_currency - evo_nds_in_price_supplier_currency - evo_last_payment_rub - evo_last_payment_calc - evo_transactioncurrencyid - evo_discount_supplier_currency - evo_discount_perc - evo_comission_perc evo_comission_rub - evo_sale_bonus + evo_comission_perc + evo_discount_perc + evo_discount_supplier_currency + evo_first_payment_perc + evo_last_payment_calc + evo_last_payment_perc + evo_last_payment_rub + evo_nds_in_price_supplier_currency + evo_price_without_nds_supplier_currency + evo_supplier_currency_price + evo_transactioncurrencyid } } `; -type QuotePaymentsProcessData = { - values: Partial; -}; - -export default async function getPriceDataFromKP({ +export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetPriceDataFromQuoteQuery, - CRMTypes.GetPriceDataFromQuoteQueryVariables - >({ - query: QUERY_GET_PRICE_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuotePriceDataDocument, variables: { quoteId, }, @@ -44,17 +39,19 @@ export default async function getPriceDataFromKP({ return { values: { - VATInLeaseObjectPrice: quote?.evo_nds_in_price_supplier_currency || 0, - comissionPerc: quote?.evo_comission_perc || 0, - comissionRub: quote?.evo_comission_rub || 0, - lastPaymentRub: quote?.evo_last_payment_rub || 0, + VATInLeaseObjectPrice: + quote?.evo_nds_in_price_supplier_currency ?? defaultValues.VATInLeaseObjectPrice, + comissionPerc: quote?.evo_comission_perc ?? defaultValues.comissionPerc, + // comissionRub: quote?.evo_comission_rub , + firstPaymentPerc: quote?.evo_first_payment_perc ?? defaultValues.firstPaymentPerc, + // lastPaymentRub: quote?.evo_last_payment_rub , + lastPaymentPerc: quote?.evo_last_payment_perc ?? defaultValues.lastPaymentPerc, lastPaymentRule: quote?.evo_last_payment_calc, - leaseObjectPrice: quote?.evo_supplier_currency_price || 0, - leaseObjectPriceWthtVAT: quote?.evo_price_without_nds_supplier_currency || 0, - saleBonus: quote?.evo_sale_bonus || 0, + leaseObjectPrice: quote?.evo_supplier_currency_price ?? defaultValues.leaseObjectPrice, + // leaseObjectPriceWthtVAT: quote?.evo_price_without_nds_supplier_currency , supplierCurrency: quote?.evo_transactioncurrencyid, - supplierDiscountPerc: quote?.evo_discount_perc || 0, - supplierDiscountRub: quote?.evo_discount_supplier_currency || 0, + supplierDiscountPerc: quote?.evo_discount_perc ?? defaultValues.supplierDiscountPerc, + // supplierDiscountRub: quote?.evo_discount_supplier_currency , }, }; } diff --git a/apps/web/process/price/index.ts b/apps/web/process/price/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/price/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/price/reactions/common.ts b/apps/web/process/price/reactions/common.ts index 8be398f..a227432 100644 --- a/apps/web/process/price/reactions/common.ts +++ b/apps/web/process/price/reactions/common.ts @@ -1,9 +1,12 @@ -import { MIN_LASTPAYMENT_NSIB } from '@/constants/values'; -import type { ReactionsContext } from '@/process/types'; +/* eslint-disable @typescript-eslint/naming-convention */ +import { VAT } from '@/constants/values'; +import * as CRMTypes from '@/graphql/crm.types'; +import type { ProcessContext } from '@/process/types'; import { reaction } from 'mobx'; +import { makeDisposable } from 'tools'; -export default function commonReactions({ store }: ReactionsContext) { - const { $calculation } = store; +export default function reactions({ store, apolloClient }: ProcessContext) { + const { $calculation, $process } = store; reaction( () => $calculation.element('radioLastPaymentRule').getValue(), @@ -30,21 +33,151 @@ export default function commonReactions({ store }: ReactionsContext) { } ); - reaction( - () => { - const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue(); - const insNSIB = $calculation.element('selectInsNSIB').getValue(); + /** + * Расчет размера скидки поставщика в валюте + */ + makeDisposable( + () => + reaction( + () => $calculation.$values.getValues(['leaseObjectPrice', 'supplierDiscountRub']), + ({ leaseObjectPrice, supplierDiscountRub }) => { + $calculation + .element('tbxSupplierDiscountPerc') + .setValue((supplierDiscountRub / leaseObjectPrice) * 100); + }, + { + fireImmediately: true, + } + ), + () => $process.has('LoadKP') + ); - return { - insNSIB, - lastPaymentRub, - }; + /** + * Расчет суммы скидки поставщика в валюте + */ + reaction( + () => $calculation.$values.getValues(['leaseObjectPrice', 'supplierDiscountPerc']), + ({ leaseObjectPrice, supplierDiscountPerc }) => { + $calculation + .element('tbxSupplierDiscountRub') + .setValue((supplierDiscountPerc * leaseObjectPrice) / 100); }, - ({ lastPaymentRub, insNSIB }) => { - $calculation.element('tbxLastPaymentRub').validate({ - invalid: Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB, - message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`, - }); + { + fireImmediately: true, } ); + + reaction( + () => $calculation.$values.getValues(['product', 'leaseObjectPrice', 'VATInLeaseObjectPrice']), + async ({ product: productId, leaseObjectPrice, VATInLeaseObjectPrice }) => { + let evo_sale_without_nds = false; + + if (productId) { + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + if (evo_baseproduct?.evo_sale_without_nds) { + evo_sale_without_nds = evo_baseproduct.evo_sale_without_nds; + } + } + + if (evo_sale_without_nds) { + $calculation + .element('tbxLeaseObjectPriceWthtVAT') + .setValue(leaseObjectPrice - VATInLeaseObjectPrice); + } else { + const priceWithVAT = leaseObjectPrice / (1 + VAT); + const priceVAT = leaseObjectPrice - priceWithVAT; + $calculation.element('tbxLeaseObjectPriceWthtVAT').setValue(priceWithVAT); + $calculation.element('tbxVATInLeaseObjectPrice').setValue(priceVAT); + } + } + ); + + reaction( + () => + $calculation.$values.getValues([ + 'firstPaymentPerc', + 'addEquipmentPrice', + 'importProgramSum', + 'plPriceRub', + ]), + ({ firstPaymentPerc, addEquipmentPrice, importProgramSum, plPriceRub }) => { + const rub = (firstPaymentPerc * (plPriceRub + addEquipmentPrice - importProgramSum)) / 100; + $calculation.element('tbxFirstPaymentRub').setValue(rub); + } + ); + + makeDisposable( + () => + reaction( + () => $calculation.element('tbxFirstPaymentRub').getValue(), + (firstPaymentRub) => { + const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.values; + const perc = + (firstPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; + $calculation.element('tbxFirstPaymentPerc').setValue(perc); + } + ), + () => $process.has('LoadKP') + ); + + reaction( + () => $calculation.$values.getValues(['comissionPerc', 'plPriceRub']), + ({ plPriceRub, comissionPerc }) => { + const rub = (comissionPerc * plPriceRub) / 100; + $calculation.element('tbxComissionRub').setValue(rub); + } + ); + + makeDisposable( + () => + reaction( + () => $calculation.element('tbxComissionRub').getValue(), + (comissionRub) => { + const { plPriceRub } = $calculation.$values.values; + const perc = (comissionRub / plPriceRub) * 100; + $calculation.element('tbxComissionPerc').setValue(perc); + } + ), + () => $process.has('LoadKP') + ); + + makeDisposable( + () => + reaction( + () => + $calculation.$values.getValues([ + 'plPriceRub', + 'lastPaymentPerc', + 'addEquipmentPrice', + 'importProgramSum', + ]), + ({ addEquipmentPrice, lastPaymentPerc, plPriceRub, importProgramSum }) => { + const rub = (lastPaymentPerc * (plPriceRub + addEquipmentPrice - importProgramSum)) / 100; + $calculation.element('tbxLastPaymentRub').setValue(rub); + } + ), + () => $calculation.element('radioLastPaymentRule').getValue() === 100_000_000 + ); + + makeDisposable( + () => + reaction( + () => $calculation.element('tbxLastPaymentRub').getValue(), + (lastPaymentRub) => { + const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.values; + const perc = (lastPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; + $calculation.element('tbxLastPaymentPerc').setValue(perc); + } + ), + () => + $process.has('LoadKP') || + $calculation.element('radioLastPaymentRule').getValue() === 100_000_001 + ); } diff --git a/apps/web/process/price/reactions/computed.ts b/apps/web/process/price/reactions/computed.ts index 6c3cf10..af76d14 100644 --- a/apps/web/process/price/reactions/computed.ts +++ b/apps/web/process/price/reactions/computed.ts @@ -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 computedReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation } = store; autorun( diff --git a/apps/web/process/price/reactions/index.js b/apps/web/process/price/reactions/index.ts similarity index 64% rename from apps/web/process/price/reactions/index.js rename to apps/web/process/price/reactions/index.ts index ddb1f56..04e67d6 100644 --- a/apps/web/process/price/reactions/index.js +++ b/apps/web/process/price/reactions/index.ts @@ -1,2 +1,3 @@ export { default as common } from './common'; export { default as computed } from './computed'; +export { default as validation } from './validation'; diff --git a/apps/web/process/price/reactions/validation.ts b/apps/web/process/price/reactions/validation.ts new file mode 100644 index 0000000..8860c17 --- /dev/null +++ b/apps/web/process/price/reactions/validation.ts @@ -0,0 +1,74 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import { VAT } from '@/constants/values'; +import * as CRMTypes from '@/graphql/crm.types'; +import type { ProcessContext } from '@/process/types'; +import { reaction } from 'mobx'; +import { round } from 'tools'; + +export default function reactions({ store, apolloClient }: ProcessContext) { + const { $calculation } = store; + + reaction( + () => + $calculation.$values.getValues([ + 'VATInLeaseObjectPrice', + 'leaseObjectPriceWthtVAT', + 'product', + ]), + async ({ VATInLeaseObjectPrice, leaseObjectPriceWthtVAT, product: productId }) => { + let evo_sale_without_nds = false; + + if (productId) { + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + if (evo_baseproduct?.evo_sale_without_nds) { + evo_sale_without_nds = evo_baseproduct.evo_sale_without_nds; + } + } + + $calculation.element('tbxVATInLeaseObjectPrice').validate({ + invalid: + evo_sale_without_nds && round(VATInLeaseObjectPrice / leaseObjectPriceWthtVAT, 2) >= VAT, + message: + 'При продаже ПЛ после ФЛ размер НДС в стоимости ПЛ не может составлять 20% и более от стоимости с НДС. Проверьте корректность НДС, либо измените Продукт', + }); + } + ); + + reaction( + () => $calculation.$values.getValues(['supplierDiscountRub', 'plPriceRub']), + ({ supplierDiscountRub, plPriceRub }) => { + $calculation.element('tbxSupplierDiscountRub').validate({ + invalid: supplierDiscountRub >= plPriceRub, + message: 'Скидка от поставщика не может быть больше или равна стоимости ПЛ', + }); + } + ); + + reaction( + () => $calculation.$values.getValues(['firstPaymentRub', 'plPriceRub']), + ({ firstPaymentRub, plPriceRub }) => { + $calculation.element('tbxFirstPaymentRub').validate({ + invalid: firstPaymentRub >= plPriceRub, + message: 'Первый платеж не может быть больше или равен стоимости ПЛ', + }); + } + ); + + reaction( + () => $calculation.$values.getValues(['firstPaymentRub', 'subsidySum']), + ({ firstPaymentRub, subsidySum }) => { + $calculation.element('tbxFirstPaymentRub').validate({ + invalid: firstPaymentRub - subsidySum < 0, + message: + 'Первый платеж с учетом субсидии получается отрицательный, увеличьте первый платеж', + }); + } + ); +} diff --git a/apps/web/process/subsidy-import-program/index.ts b/apps/web/process/subsidy-import-program/index.ts new file mode 100644 index 0000000..88c740a --- /dev/null +++ b/apps/web/process/subsidy-import-program/index.ts @@ -0,0 +1 @@ +export * as reactions from './reactions'; diff --git a/apps/web/process/subsidy-import-program/reactions.ts b/apps/web/process/subsidy-import-program/reactions.ts new file mode 100644 index 0000000..40af966 --- /dev/null +++ b/apps/web/process/subsidy-import-program/reactions.ts @@ -0,0 +1,97 @@ +/* eslint-disable no-negated-condition */ +/* eslint-disable @typescript-eslint/naming-convention */ +import type { ProcessContext } from '../types'; +import * as CRMTypes from '@/graphql/crm.types'; +import { reaction } from 'mobx'; + +export function common({ store, apolloClient }: ProcessContext) { + const { $calculation } = store; + + /** + * на изменение selectProduct, selectSubsidy или selectImportProgram или selectDealer + * если selectSusidy или selectItProgram содержит данные или в поле selectDealer указан account, у которого evo_return_leasing_dealer = true, то selectSupplierCurrency закрыта для редактирования, + * иначе + * если selectProduct не содержит данные, то selectSupplierCurrency закрыта для редактирования, иначе + * если (в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds = True), то selectSupplierCurrency закрыта для редактирования + * иначе selectSupplierCurrency открыто для редактирования + */ + reaction( + () => $calculation.$values.getValues(['product', 'subsidy', 'importProgram', 'dealer']), + async ({ + product: productId, + subsidy: subsidyId, + importProgram: importProgramId, + dealer: dealerId, + }) => { + const { + data: { transactioncurrencies }, + } = await apolloClient.query({ + query: CRMTypes.GetTransactionCurrenciesDocument, + }); + + const transactioncurrency_rub = transactioncurrencies?.find( + (x) => x?.isocurrencycode === 'RUB' + ); + + const transactioncurrency_rub_id = transactioncurrency_rub?.transactioncurrencyid || null; + + if (!productId) { + $calculation.element('selectSupplierCurrency').setValue(transactioncurrency_rub_id).block(); + + return; + } + + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + + if (subsidyId || importProgramId || evo_baseproduct?.evo_sale_without_nds) { + $calculation.element('selectSupplierCurrency').setValue(transactioncurrency_rub_id).block(); + } else if (dealerId) { + const { + data: { dealer }, + } = await apolloClient.query({ + query: CRMTypes.GetDealerDocument, + variables: { + dealerId, + }, + }); + if (dealer?.evo_return_leasing_dealer === true) { + $calculation + .element('selectSupplierCurrency') + .setValue(transactioncurrency_rub_id) + .block(); + } else { + $calculation.element('selectSupplierCurrency').unblock(); + } + } else { + $calculation.element('selectSupplierCurrency').unblock(); + } + }, + { + fireImmediately: true, + } + ); + + /** + * При изменении "Программа от производителя" selectImportProgram (работает при загрузке КП) + * Если поле "Программа от производителя" selectImportProgram не содержит данные, + * то поле "Стоимость доп.оборудования" tbxAddEquipmentPrice закрыть для редактирования и значение равно 0, + * иначе оставлять открытым для редактирования + */ + reaction( + () => $calculation.element('selectImportProgram').getValue(), + (importProgramId) => { + if (!importProgramId) { + $calculation.element('tbxAddEquipmentPrice').resetValue().block(); + } else { + $calculation.element('tbxAddEquipmentPrice').unblock(); + } + } + ); +} diff --git a/apps/web/process/subsidy/get-kp-data.ts b/apps/web/process/subsidy/get-kp-data.ts new file mode 100644 index 0000000..11e616f --- /dev/null +++ b/apps/web/process/subsidy/get-kp-data.ts @@ -0,0 +1,36 @@ +import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; +import initializeApollo from '@/apollo/client'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; +import { gql } from '@apollo/client'; + +const QUERY_GET_QUOTE_SUBSIDY_DATA = gql` + query GetQuoteSubsidyData($quoteId: Uuid!) { + quote(quoteId: $quoteId) { + evo_subsidyid + evo_program_import_subsidyid + } + } +`; + +export async function getKPData({ + values: { quote: quoteId }, +}: GetQuoteInputData): Promise { + const apolloClient = initializeApollo(); + + const { + data: { quote }, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteSubsidyDataDocument, + variables: { + quoteId, + }, + }); + + return { + values: { + importProgram: quote?.evo_program_import_subsidyid ?? defaultValues.importProgram, + subsidy: quote?.evo_subsidyid ?? defaultValues.subsidy, + }, + }; +} diff --git a/apps/web/process/subsidy/index.ts b/apps/web/process/subsidy/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/subsidy/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/subsidy/reactions.ts b/apps/web/process/subsidy/reactions.ts index dc46979..e5209ff 100644 --- a/apps/web/process/subsidy/reactions.ts +++ b/apps/web/process/subsidy/reactions.ts @@ -1,6 +1,6 @@ import * as CRMTypes from '@/graphql/crm.types'; -import type { ReactionsContext } from '@/process/types'; -import { autorun } from 'mobx'; +import type { ProcessContext } from '@/process/types'; +import { reaction } from 'mobx'; /** * При изменении "Программа от производителя" selectImportProgram , Стоимости ПЛ tbxLeaseObjectPrice, Валюты selectSupplierCurrency, Скидка от поставщика, в валюте поставщика (tbxSupplierDiscountRub) @@ -19,39 +19,82 @@ import { autorun } from 'mobx'; */ /* eslint-enable */ -export function computedReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ProcessContext) { const { $calculation } = store; - autorun(async () => { - const importProgramId = $calculation.element('selectImportProgram').getValue(); - const plPriceRub = $calculation.$values.getValue('plPriceRub'); - const supplierDiscountRub = $calculation.element('tbxSupplierDiscountRub').getValue(); + reaction( + () => $calculation.$values.getValues(['importProgram', 'plPriceRub', 'supplierDiscountRub']), + async ({ importProgram: importProgramId, plPriceRub, supplierDiscountRub }) => { + if (importProgramId) { + const { + data: { evo_subsidy: importProgram }, + } = await apolloClient.query({ + query: CRMTypes.GetSubsidyDocument, + variables: { + subsidyId: importProgramId, + }, + }); + + if (importProgram?.evo_subsidy_summ && importProgram?.evo_subsidy_summ > 0) { + $calculation.element('tbxImportProgramSum').setValue(importProgram?.evo_subsidy_summ); + } else { + const subsidyPercent = (importProgram?.evo_percent_subsidy || 0) / 100; + + const sum = (plPriceRub - supplierDiscountRub) * subsidyPercent; + const maxSum = importProgram?.evo_max_subsidy_summ || 0; + + $calculation.element('tbxImportProgramSum').setValue(Math.min(sum, maxSum)); + } + } else { + $calculation.element('tbxImportProgramSum').setValue(0); + } + } + ); + + reaction( + () => + $calculation.$values.getValues([ + 'subsidy', + 'plPriceRub', + 'discountRub', + 'addEquipmentPrice', + 'importProgramSum', + ]), + async ({ + subsidy: subsidyId, + plPriceRub, + discountRub, + addEquipmentPrice, + importProgramSum, + }) => { + if (!subsidyId) { + $calculation.element('tbxSubsidySum').resetValue(); + + return; + } - if (importProgramId) { const { - data: { evo_subsidy: importProgram }, + data: { evo_subsidy: subsidy }, } = await apolloClient.query({ query: CRMTypes.GetSubsidyDocument, variables: { - subsidyId: importProgramId, + subsidyId, }, }); - if (importProgram?.evo_subsidy_summ && importProgram?.evo_subsidy_summ > 0) { - $calculation.element('tbxImportProgramSum').setValue(importProgram?.evo_subsidy_summ); - } else { - const subsidyPercent = (importProgram?.evo_percent_subsidy || 0) / 100; + if (subsidy?.evo_subsidy_summ) { + $calculation.element('tbxSubsidySum').setValue(subsidy?.evo_subsidy_summ); - const sum = (plPriceRub - supplierDiscountRub) * subsidyPercent; - const maxSum = importProgram?.evo_max_subsidy_summ || 0; - - $calculation.element('tbxImportProgramSum').setValue(Math.min(sum, maxSum)); + return; } - } else { - $calculation.element('tbxImportProgramSum').setValue(0); - } - }); -} -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function commonReactions({ store }: ReactionsContext) {} + const price = plPriceRub - discountRub - importProgramSum + addEquipmentPrice; + + let sum = (price * (subsidy?.evo_percent_subsidy ?? 0)) / 100; + const maxSum = subsidy?.evo_max_subsidy_summ ?? 0; + if (sum > maxSum) sum = maxSum; + + $calculation.element('tbxSubsidySum').setValue(sum); + } + ); +} diff --git a/apps/web/process/supplier-agent/get-kp-values/get-sums.ts b/apps/web/process/supplier-agent/get-kp-data/get-sums.ts similarity index 86% rename from apps/web/process/supplier-agent/get-kp-values/get-sums.ts rename to apps/web/process/supplier-agent/get-kp-data/get-sums.ts index 59af825..d12138e 100644 --- a/apps/web/process/supplier-agent/get-kp-values/get-sums.ts +++ b/apps/web/process/supplier-agent/get-kp-data/get-sums.ts @@ -1,9 +1,10 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type { Quote } from './index'; import initializeApollo from '@/apollo/client'; import type * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; +type Quote = NonNullable; + const QUERY_GET_REWARD_RULES = gql` query GetRewardRules($conditionId: Uuid!) { evo_reward_condition(evo_reward_conditionid: $conditionId) { @@ -55,7 +56,11 @@ async function getRewardSum( return quote[quoteRewardTotalField]; } -export default async function getSums(quote: Quote) { +export default async function getSums(quote: Quote | null) { + if (!quote) { + return null; + } + const [ dealerRewardSumm, dealerBrokerRewardSumm, @@ -103,11 +108,11 @@ export default async function getSums(quote: Quote) { ]); return { - calcBrokerRewardSum: calcBrokerRewardSum ?? 0, - calcDoubleAgentRewardSumm: calcDoubleAgentRewardSumm ?? 0, - dealerBrokerRewardSumm: dealerBrokerRewardSumm ?? 0, - dealerRewardSumm: dealerRewardSumm ?? 0, - finDepartmentRewardSumm: finDepartmentRewardSumm ?? 0, - indAgentRewardSumm: indAgentRewardSumm ?? 0, + calcBrokerRewardSum, + calcDoubleAgentRewardSumm, + dealerBrokerRewardSumm, + dealerRewardSumm, + finDepartmentRewardSumm, + indAgentRewardSumm, }; } diff --git a/apps/web/process/supplier-agent/get-kp-values/index.ts b/apps/web/process/supplier-agent/get-kp-data/index.ts similarity index 64% rename from apps/web/process/supplier-agent/get-kp-values/index.ts rename to apps/web/process/supplier-agent/get-kp-data/index.ts index 8f6a80e..2845b9a 100644 --- a/apps/web/process/supplier-agent/get-kp-values/index.ts +++ b/apps/web/process/supplier-agent/get-kp-data/index.ts @@ -1,12 +1,13 @@ /* eslint-disable canonical/sort-keys */ -import type { GetQuoteDataInput, GetQuoteDataOutput } from '../../load-kp/types'; +import type { GetQuoteInputData, GetQuoteProcessData } from '../../load-kp/types'; import getSums from './get-sums'; import initializeApollo from '@/apollo/client'; -import type * as CRMTypes from '@/graphql/crm.types'; +import defaultValues from '@/config/default-values'; +import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; -const QUERY_GET_AGENTS_DATA_FROM_QUOTE = gql` - query GetAgentsDataFromQuote($quoteId: Uuid!) { +const QUERY_GET_QUOTE_AGENTS_DATA = gql` + query GetQuoteAgentsData($quoteId: Uuid!) { quote(quoteId: $quoteId) { evo_supplier_accountid evo_dealer_person_accountid @@ -37,64 +38,46 @@ const QUERY_GET_AGENTS_DATA_FROM_QUOTE = gql` } `; -export type Quote = NonNullable; - -type QuoteSupplierAgentProcessData = { - values: Partial; -}; - -export default async function getSupplierAgentsDataFromKP({ +export async function getKPData({ values: { quote: quoteId }, -}: GetQuoteDataInput): Promise { +}: GetQuoteInputData): Promise { const apolloClient = initializeApollo(); const { data: { quote }, - } = await apolloClient.query< - CRMTypes.GetAgentsDataFromQuoteQuery, - CRMTypes.GetAgentsDataFromQuoteQueryVariables - >({ - query: QUERY_GET_AGENTS_DATA_FROM_QUOTE, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteAgentsDataDocument, variables: { quoteId, }, }); - if (!quote) { - throw new Error('Quote is empty'); - } - - const { - dealerRewardSumm, - dealerBrokerRewardSumm, - indAgentRewardSumm, - calcDoubleAgentRewardSumm, - calcBrokerRewardSum, - finDepartmentRewardSumm, - } = await getSums(quote); + const sums = await getSums(quote); return { values: { dealer: quote?.evo_supplier_accountid, dealerBroker: quote?.evo_dealer_broker_accountid, dealerBrokerRewardCondition: quote?.evo_dealer_broker_reward_conditionid, - dealerBrokerRewardSumm, + dealerBrokerRewardSumm: sums?.dealerBrokerRewardSumm ?? defaultValues.dealerBrokerRewardSumm, dealerPerson: quote?.evo_dealer_person_accountid, dealerRewardCondition: quote?.evo_dealer_reward_conditionid, - dealerRewardSumm, + dealerRewardSumm: sums?.dealerRewardSumm ?? defaultValues.dealerRewardSumm, calcBroker: quote?.evo_broker_accountid, calcBrokerRewardCondition: quote?.evo_broker_reward_conditionid, - calcBrokerRewardSum, + calcBrokerRewardSum: sums?.calcBrokerRewardSum ?? defaultValues.calcBrokerRewardSum, calcDoubleAgent: quote?.evo_double_agent_accountid, calcDoubleAgentRewardCondition: quote?.evo_double_agent_reward_conditionid, - calcDoubleAgentRewardSumm, + calcDoubleAgentRewardSumm: + sums?.calcDoubleAgentRewardSumm ?? defaultValues.calcDoubleAgentRewardSumm, calcFinDepartment: quote?.evo_fin_department_accountid, finDepartmentRewardCondtion: quote?.evo_fin_department_reward_conditionid, - finDepartmentRewardSumm, + finDepartmentRewardSumm: + sums?.finDepartmentRewardSumm ?? defaultValues.finDepartmentRewardSumm, indAgent: quote?.evo_agent_accountid, indAgentRewardCondition: quote?.evo_agent_reward_conditionid, - indAgentRewardSumm, + indAgentRewardSumm: sums?.indAgentRewardSumm ?? defaultValues.indAgentRewardSumm, }, }; } diff --git a/apps/web/process/supplier-agent/index.ts b/apps/web/process/supplier-agent/index.ts new file mode 100644 index 0000000..e05ea2d --- /dev/null +++ b/apps/web/process/supplier-agent/index.ts @@ -0,0 +1,2 @@ +export * from './get-kp-data'; +export * as reactions from './reactions'; diff --git a/apps/web/process/supplier-agent/lib/create-reactions.ts b/apps/web/process/supplier-agent/lib/create-reactions.ts index b0a119b..dfd54c0 100644 --- a/apps/web/process/supplier-agent/lib/create-reactions.ts +++ b/apps/web/process/supplier-agent/lib/create-reactions.ts @@ -147,44 +147,32 @@ export function validateAgentRewardSumm( } if (evo_reward_condition.evo_reward_summ) { - $calculation - .element(rewardSummField) - .validate({ - invalid: rewardSumm > evo_reward_condition?.evo_reward_summ, - message: 'Вознаграждение указано больше условия по агентскому договору!', - }) - .err((removeError) => { - validationHelper.add(removeError); - }); + $calculation.element(rewardSummField).validate({ + helper: validationHelper, + invalid: rewardSumm > evo_reward_condition?.evo_reward_summ, + message: 'Вознаграждение указано больше условия по агентскому договору!', + }); } if ( evo_reward_condition?.evo_reduce_reward !== null && evo_reward_condition.evo_reward_summ ) { - $calculation - .element(rewardSummField) - .validate({ - invalid: - evo_reward_condition.evo_reduce_reward === false && - rewardSumm < evo_reward_condition.evo_reward_summ, - message: 'Вознаграждение указано меньше условия по агентскому договору!', - }) - .err((removeError) => { - validationHelper.add(removeError); - }); + $calculation.element(rewardSummField).validate({ + helper: validationHelper, + invalid: + evo_reward_condition.evo_reduce_reward === false && + rewardSumm < evo_reward_condition.evo_reward_summ, + message: 'Вознаграждение указано меньше условия по агентскому договору!', + }); } if (evo_reward_condition?.evo_min_reward_summ !== null) { - $calculation - .element(rewardSummField) - .validate({ - invalid: rewardSumm < evo_reward_condition?.evo_min_reward_summ, - message: 'Вознаграждение указано меньше условия по агентскому договору!', - }) - .err((removeError) => { - validationHelper.add(removeError); - }); + $calculation.element(rewardSummField).validate({ + helper: validationHelper, + invalid: rewardSumm < evo_reward_condition?.evo_min_reward_summ, + message: 'Вознаграждение указано меньше условия по агентскому договору!', + }); } } ); diff --git a/apps/web/process/supplier-agent/reactions/agents.ts b/apps/web/process/supplier-agent/reactions/agents.ts index f50d5df..000750d 100644 --- a/apps/web/process/supplier-agent/reactions/agents.ts +++ b/apps/web/process/supplier-agent/reactions/agents.ts @@ -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'; @@ -15,7 +15,21 @@ const { fillAgentRewardReaction, fillAgentRewardSummReaction, validateAgentRewar dayjs.extend(utc); -export function fillReactions({ store, apolloClient }: ReactionsContext) { +class Helper { + public enabled: boolean; + /** + * + */ + constructor() { + this.enabled = false; + } + + public set = (value: boolean) => { + this.enabled = value; + }; +} + +export function common({ store, apolloClient }: ProcessContext) { const { $calculation, $process } = store; /** @@ -94,24 +108,6 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) { rewardConditionField: 'selectFinDepartmentRewardCondtion', rewardSummField: 'tbxFinDepartmentRewardSumm', }); -} - -class Helper { - public enabled: boolean; - /** - * - */ - constructor() { - this.enabled = false; - } - - public set = (value: boolean) => { - this.enabled = value; - }; -} - -export function commonReactions({ store, apolloClient }: ReactionsContext) { - const { $calculation } = store; /** * Добавить реакцию на изменение списка в поле selectDealerRewardCondition : @@ -526,7 +522,7 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) { } } -export function validationReactions({ store, apolloClient }: ReactionsContext) { +export function validation({ store, apolloClient }: ProcessContext) { const { $calculation } = store; validateAgentRewardSumm(store, apolloClient, { diff --git a/apps/web/process/supplier-agent/reactions/index.ts b/apps/web/process/supplier-agent/reactions/index.ts new file mode 100644 index 0000000..52e9725 --- /dev/null +++ b/apps/web/process/supplier-agent/reactions/index.ts @@ -0,0 +1,17 @@ +import * as agents from './agents'; +import * as leaseback from './leaseback'; +import * as supplier from './supplier'; +import type { ProcessContext } from '@/process/types'; + +function common(context: ProcessContext) { + agents.common(context); + leaseback.common(context); + supplier.common(context); +} + +function validation(context: ProcessContext) { + agents.validation(context); + supplier.validation(context); +} + +export { common, validation }; diff --git a/apps/web/process/supplier-agent/reactions/leaseback.ts b/apps/web/process/supplier-agent/reactions/leaseback.ts index a5a9bcc..ce8ff98 100644 --- a/apps/web/process/supplier-agent/reactions/leaseback.ts +++ b/apps/web/process/supplier-agent/reactions/leaseback.ts @@ -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 default function leasebackReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ProcessContext) { const { $calculation, $tables } = store; /** * Дополнить реакцию на изменение поля Салон приобретения selectDealer: diff --git a/apps/web/process/supplier-agent/reactions/supplier.ts b/apps/web/process/supplier-agent/reactions/supplier.ts index ac8cdf5..bbb50f7 100644 --- a/apps/web/process/supplier-agent/reactions/supplier.ts +++ b/apps/web/process/supplier-agent/reactions/supplier.ts @@ -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 commonReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ProcessContext) { const { $calculation, $process } = store; /** @@ -158,7 +158,7 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) { ); } -export function validationReactions({ store, apolloClient }: ReactionsContext) { +export function validation({ store, apolloClient }: ProcessContext) { createReactions.validateAgentRewardSumm(store, apolloClient, { rewardConditionField: 'selectDealerRewardCondition', rewardSummField: 'tbxDealerRewardSumm', diff --git a/apps/web/process/types.ts b/apps/web/process/types.ts index bc301bf..6ec8db7 100644 --- a/apps/web/process/types.ts +++ b/apps/web/process/types.ts @@ -3,9 +3,13 @@ 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; queryClient: QueryClient; store: RootStore; trpcClient: TRPCPureClient; }; + +export type Process = { + reactions: Record void>; +}; diff --git a/apps/web/process/used-pl/index.ts b/apps/web/process/used-pl/index.ts new file mode 100644 index 0000000..88c740a --- /dev/null +++ b/apps/web/process/used-pl/index.ts @@ -0,0 +1 @@ +export * as reactions from './reactions'; diff --git a/apps/web/process/used-pl/reactions.ts b/apps/web/process/used-pl/reactions.ts new file mode 100644 index 0000000..50c88da --- /dev/null +++ b/apps/web/process/used-pl/reactions.ts @@ -0,0 +1,318 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +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 }: ProcessContext) { + const { $calculation } = store; + + /** + * Создаем реакцию на выбор Продукта selectProduct: + * + * Если в поле Продукт selectProduct значение не выбрано, то + * поле Валюта поставщика selectSupplierCurrency закрыть для редактирования и сделать равным RUB + * поле Скидка от поставщика tbxSupplierDiscountRub закрыть для редактирования и сделать равным 0 + * поле Скидка от поставщика, % tbxSupplierDiscountPerc закрыть для редактирования и сделать равным 0 + * поле Стоимость предмета лизинга с НДС tbxLeaseObjectPrice закрыть для редактирования + * поле Стоимость предмета лизинга без НДС xxx закрыть для редактирования + * поле НДС в стоимости предмета лизинга xxx закрыть для редактирования + * + * Если в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds = True, то: + * поле ПЛ БУ cbxLeaseObjectUsed =True и закрыто для редактирования + * поле Валюта поставщика selectSupplierCurrency закрыть для редактирования и сделать равным RUB + * поле Скидка от поставщика tbxSupplierDiscountRub закрыть для редактирования и сделать равным 0 + * поле Скидка от поставщика, % tbxSupplierDiscountPerc закрыть для редактирования и сделать равным 0 + * поле Стоимость предмета лизинга с НДС tbxLeaseObjectPrice закрыть для редактирования + * поле Стоимость предмета лизинга без НДС xxx открыть для редактирования + * поле НДС в стоимости предмета лизинга xxx открыть для редактирования + * + * Если в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds != True, то: + * поле ПЛ БУ cbxLeaseObjectUsed открыто для редактирования (проверить на другие реакции открывающие/закрывающие это поле) + * поле Валюта поставщика selectSupplierCurrency открыто для редактирования + * поле Скидка от поставщика tbxSupplierDiscountRub открыто для редактирования + * поле Скидка от поставщика, % tbxSupplierDiscountPerc открыто для редактирования + * поле Стоимость предмета лизинга с НДС tbxLeaseObjectPrice открыто для редактирования + * поле Стоимость предмета лизинга без НДС xxx закрыть для редактирования + * поле НДС в стоимости предмета лизинга xxx закрыть для редактирования + */ + reaction( + () => $calculation.$values.getValues(['product', 'recalcWithRevision']), + async ({ product: productId }) => { + if (!productId) { + $calculation.element('tbxSupplierDiscountRub').block().resetValue(); + $calculation.element('tbxSupplierDiscountPerc').block().resetValue(); + $calculation.element('tbxLeaseObjectPrice').block().resetValue(); + $calculation.element('tbxVATInLeaseObjectPrice').block().resetValue(); + $calculation.element('selectImportProgram').unblock().resetValue(); + + return; + } + + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + + if (evo_baseproduct?.evo_sale_without_nds) { + $calculation.element('tbxSupplierDiscountRub').block().resetValue(); + $calculation.element('tbxSupplierDiscountPerc').block().resetValue(); + $calculation.element('tbxLeaseObjectPrice').unblock(); + $calculation.element('tbxVATInLeaseObjectPrice').unblock(); + $calculation.element('selectImportProgram').block().resetValue(); + $calculation.element('cbxLeaseObjectUsed').setValue(true); + } else { + $calculation.element('tbxSupplierDiscountRub').unblock(); + $calculation.element('tbxSupplierDiscountPerc').unblock(); + $calculation.element('tbxLeaseObjectPrice').unblock(); + $calculation.element('tbxVATInLeaseObjectPrice').block(); + $calculation.element('selectImportProgram').unblock(); + } + }, + { + fireImmediately: true, + } + ); + + /** + * Добавить реакцию на изменение поля Пересчет без пересмотра cbxRecalcWithRevision и загрузку КП: + * ЕСЛИ в поле Продукт selectProduct выбрана запись и поле БУбезНДС evo_sale_without_nds = True + * и Пересчет без пересмотра cbxRecalcWithRevision = True, + * + * то поля "Первый платеж, руб." tbxFirstPaymentRub + * и "Первый платеж %" tbxFirstPaymentPerc закрыты для редактирования, + * иначе открыты для редактирования + */ + reaction( + () => $calculation.$values.getValues(['recalcWithRevision', 'quote']), + async ({ recalcWithRevision }) => { + const productId = $calculation.element('selectProduct').getValue(); + + if (!productId) { + $calculation.element('tbxFirstPaymentPerc').unblock(); + $calculation.element('tbxFirstPaymentRub').unblock(); + + return; + } + + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + + if (evo_baseproduct?.evo_sale_without_nds && recalcWithRevision) { + $calculation.element('tbxFirstPaymentPerc').block(); + $calculation.element('tbxFirstPaymentRub').block(); + } else { + $calculation.element('tbxFirstPaymentPerc').unblock(); + $calculation.element('tbxFirstPaymentRub').unblock(); + } + } + ); + + /** + * Реакция на изменение ПЛ БУ cbxLeaseObjectUsed и Тип ПЛ selectLeaseObjectType + * Если ПЛ БУ cbxLeaseObjectUsed = True и Тип ПЛ selectLeaseObjectType = Спецтехника (id=9) , + * то поле Моточасы tbxEngineHours открыто для редактирования, иначе закрыто и равно 0. + */ + reaction( + () => $calculation.$values.getValues(['leaseObjectUsed', 'leaseObjectType']), + async ({ leaseObjectUsed, leaseObjectType: leaseObjectTypeId }) => { + if (!leaseObjectTypeId) { + $calculation.element('tbxEngineHours').resetValue().unblock(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + if (leaseObjectUsed && evo_leasingobject_type?.evo_id === '9') { + $calculation.element('tbxEngineHours').unblock(); + } else { + $calculation.element('tbxEngineHours').resetValue().block(); + } + }, + { + fireImmediately: true, + } + ); + + /** + * Добавить реакцию на изменение Типа ПЛ selectLeaseObjectType , ПЛ БУ cbxLeaseObjectUsed и Моточасы tbxEngineHours: + * Если ПЛ БУ cbxLeaseObjectUsed = True и Тип ПЛ selectLeaseObjectType = Спецтехника (id=9) и Моточасы = 0, + * то поле Моточасы tbxEngineHours должно обводиться красной рамкой и выводиться сообщение + * "Укажите Моточасы, иначе красная рамка снимается. + * При красной рамке в данном поле нельзя осуществить расчет графика. + */ + { + const validationHelper = new ValidationHelper(); + + reaction( + () => $calculation.$values.getValues(['leaseObjectUsed', 'engineHours', 'leaseObjectType']), + async ({ leaseObjectType: leaseObjectTypeId, leaseObjectUsed, engineHours }) => { + if (!leaseObjectTypeId) { + validationHelper.removeErrors(); + + return; + } + + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + $calculation.element('tbxEngineHours').validate({ + helper: validationHelper, + invalid: leaseObjectUsed && evo_leasingobject_type?.evo_id === '9' && !engineHours, + message: 'Не заполнено поле', + }); + } + ); + } + + reaction( + () => $calculation.element('cbxLeaseObjectUsed').getValue(), + (leaseObjectUsed) => { + if (leaseObjectUsed) { + $calculation.element('tbxMileage').unblock(); + } else { + $calculation.element('tbxMileage').resetValue().block(); + } + } + ); + + reaction( + () => $calculation.$values.getValues(['mileage', 'leaseObjectUsed']), + ({ mileage, leaseObjectUsed }) => { + $calculation.element('tbxMileage').validate({ + invalid: leaseObjectUsed && !mileage, + message: 'Не заполнено поле', + }); + } + ); + + reaction( + () => $calculation.element('cbxLeaseObjectUsed').getValue(), + (leaseObjectUsed) => { + if (leaseObjectUsed === true) { + $calculation.element('selectSubsidy').resetValue().block(); + } else { + $calculation.element('selectSubsidy').unblock(); + } + } + ); + + /** + * реакция на ПЛ БУ, Субсидию и Продукт и Салон + * если ПЛ БУ = Да или Субсидия содержит данные + * или в Продукте БУбезНДС = Да, + * или в selectDealer указан account, у которого evo_return_leasing_dealer === true + * то поле Срок поставки = 100 000 000 и закрыто для редактирования, иначе открыто для редактирования + */ + reaction( + () => $calculation.$values.getValues(['leaseObjectUsed', 'subsidy', 'product', 'dealer']), + async ({ leaseObjectUsed, subsidy, product: productId, dealer: dealerId }) => { + if (!productId || !dealerId) { + $calculation.element('radioDeliveryTime').unblock(); + + return; + } + + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { productId }, + }); + + const { + data: { dealer }, + } = await apolloClient.query({ + query: CRMTypes.GetDealerDocument, + variables: { dealerId }, + }); + + if ( + leaseObjectUsed || + subsidy || + evo_baseproduct?.evo_sale_without_nds || + dealer?.evo_return_leasing_dealer + ) { + $calculation.element('radioDeliveryTime').setValue(100_000_000).block(); + } else { + $calculation.element('radioDeliveryTime').unblock(); + } + } + ); + + reaction( + () => $calculation.element('selectSubsidy').getValue(), + (subsidyId) => { + if (subsidyId) { + $calculation.element('tbxLeaseObjectCount').setValue(1).block(); + $calculation.element('cbxLeaseObjectUsed').setValue(false).block(); + } else { + $calculation.element('tbxLeaseObjectCount').unblock(); + $calculation.element('cbxLeaseObjectUsed').unblock(); + } + } + ); + + /** + * Если "Категория" содержит данные, то должны быть доступными для набора только арабские цифры и буквы латинского алфавита за исключением I, O, Q, так как они сходны по начертанию с цифрами 1, 0, 9. Можно использовать регулярное выражение: "^[A-HJ-NPR-Za-hj-npr-z0-9]{17}$". + * Иначе (если Категория = пусто) то требуется аналогичная первому условию маска, но без проверки 17ти символов (допускать и больше и меньше символов, мб так: "^[A-HJ-NPR-Za-hj-npr-z0-9]{99}$". + * Вот так: /^[A-HJ-NPR-Za-hj-npr-z0-9]+$/ + */ + { + const vinRegex = /^[\dA-HJ-NPR-Za-hj-npr-z]+$/u; + const validationHelper = new ValidationHelper(); + + reaction( + () => $calculation.$values.getValues(['vin', 'leaseObjectCategory', 'leaseObjectUsed']), + ({ vin, leaseObjectCategory }) => { + if (!vin) { + validationHelper.removeErrors(); + + return; + } + + let invalid = vinRegex.test(vin) === false; + if (leaseObjectCategory && vin?.length !== 17) { + invalid = true; + } + + $calculation.element('tbxVIN').validate({ + helper: validationHelper, + invalid, + message: 'Неверно заполнено поле', + }); + } + ); + } + + reaction( + () => $calculation.element('cbxLeaseObjectUsed').getValue(), + (leaseObjectUsed) => { + if (leaseObjectUsed) { + $calculation.element('tbxVIN').unblock(); + } else { + $calculation.element('tbxVIN').resetValue().block(); + } + } + ); +} diff --git a/apps/web/scripts/graphql-codegen.js b/apps/web/scripts/graphql-codegen.js new file mode 100644 index 0000000..1fe65ec --- /dev/null +++ b/apps/web/scripts/graphql-codegen.js @@ -0,0 +1,3 @@ +const { generateTypescript } = require('./lib/graphql'); + +generateTypescript(); diff --git a/apps/web/scripts/graphql-update.js b/apps/web/scripts/graphql-update.js index 3a3b438..1525d63 100644 --- a/apps/web/scripts/graphql-update.js +++ b/apps/web/scripts/graphql-update.js @@ -1,10 +1,4 @@ -const run = require('tools/scripts'); +const { downloadSchema, generateTypescript } = require('./lib/graphql'); -const { URL_CRM_GRAPHQL_DIRECT } = process.env; -const PATH_CRM_GRAPHQL_SCHEMA = './graphql/crm.schema.graphql'; - -const command1 = ['gql-sdl', URL_CRM_GRAPHQL_DIRECT, '-o', PATH_CRM_GRAPHQL_SCHEMA].join(' '); -run(command1, 'Download GraphQL Schema...'); - -const command2 = ['graphql-codegen,', '--config', '.graphqlrc.yml'].join(' '); -run(command2, 'Generating TypeScript code...'); +downloadSchema(); +generateTypescript(); diff --git a/apps/web/scripts/lib/graphql.js b/apps/web/scripts/lib/graphql.js new file mode 100644 index 0000000..693a9d8 --- /dev/null +++ b/apps/web/scripts/lib/graphql.js @@ -0,0 +1,18 @@ +const run = require('tools/scripts'); + +function downloadSchema() { + const { URL_CRM_GRAPHQL_DIRECT } = process.env; + const PATH_CRM_GRAPHQL_SCHEMA = './graphql/crm.schema.graphql'; + const command1 = ['gql-sdl', URL_CRM_GRAPHQL_DIRECT, '-o', PATH_CRM_GRAPHQL_SCHEMA].join(' '); + run(command1, 'Download GraphQL Schema...'); +} + +function generateTypescript() { + const command2 = ['graphql-codegen,', '--config', '.graphqlrc.yml'].join(' '); + run(command2, 'Generating TypeScript code...'); +} + +module.exports = { + downloadSchema, + generateTypescript, +}; diff --git a/apps/web/stores/calculation/index.ts b/apps/web/stores/calculation/index.ts index f8048a2..42816cb 100644 --- a/apps/web/stores/calculation/index.ts +++ b/apps/web/stores/calculation/index.ts @@ -99,21 +99,19 @@ export default class CalculationStore { return this.element(elementName); }, - validate: ({ invalid, message, silent }: ValidationParams) => { + validate: ({ invalid, message, silent, helper }: ValidationParams) => { if (!this.$validation[elementName]) this.createElementValidation(elementName); let removeError: RemoveError | undefined; + if (invalid) { removeError = this.$validation[elementName]?.addError(message, silent); + if (helper && removeError) helper.add(removeError); } else { this.$validation[elementName]?.removeError(message); } - return { - err(callback: (removeError: RemoveError) => void) { - if (removeError) callback(removeError); - }, - }; + return removeError; }, }); } diff --git a/apps/web/stores/calculation/values/index.ts b/apps/web/stores/calculation/values/index.ts index 42ac3d1..038427d 100644 --- a/apps/web/stores/calculation/values/index.ts +++ b/apps/web/stores/calculation/values/index.ts @@ -2,10 +2,11 @@ import type RootStore from '../../root'; import type { CalculationValues, Values } from './types'; import defaultValues from '@/config/default-values'; import { makeAutoObservable } from 'mobx'; +import { pick } from 'radash'; export default class ValuesStore { private root: RootStore; - public values: CalculationValues = defaultValues; + public values = defaultValues; constructor(rootStore: RootStore) { makeAutoObservable(this); @@ -13,12 +14,12 @@ export default class ValuesStore { } public hydrate = (initialValues: CalculationValues) => { - this.values = initialValues; + this.values = { ...defaultValues, ...initialValues }; }; - public setValues = (params: { values: CalculationValues }) => { - const { values } = params; + public getValues = (keys: K[]) => pick(this.values, keys); + public setValues = (values: CalculationValues) => { this.values = values; }; diff --git a/apps/web/stores/tables/fingap/index.ts b/apps/web/stores/tables/fingap/index.ts index f2aefd5..9df4da9 100644 --- a/apps/web/stores/tables/fingap/index.ts +++ b/apps/web/stores/tables/fingap/index.ts @@ -1,5 +1,5 @@ import Validation from '../../validation'; -import type { ValidationParams } from '../../validation/types'; +import type { RemoveError, ValidationParams } from '../../validation/types'; import type * as FinGAP from '@/Components/Calculation/Form/Insurance/FinGAPTable/types'; import type RootStore from '@/stores/root'; import type { IObservableArray } from 'mobx'; @@ -38,12 +38,17 @@ export default class FinGAPTable { .reduce((sum, risk) => sum + risk.premium, 0); } - public validate = ({ invalid, message }: ValidationParams) => { + public validate = ({ invalid, message, helper }: ValidationParams) => { + let removeError: RemoveError | undefined; + if (invalid) { - this.validation?.addError(message); + removeError = this.validation?.addError(message); + if (helper && removeError) helper.add(removeError); } else { this.validation?.removeError(message); } + + return removeError; }; public clear = () => { diff --git a/apps/web/stores/tables/insurance/index.ts b/apps/web/stores/tables/insurance/index.ts index 15084c4..b79a33c 100644 --- a/apps/web/stores/tables/insurance/index.ts +++ b/apps/web/stores/tables/insurance/index.ts @@ -1,5 +1,5 @@ import Validation from '../../validation'; -import type { ValidationParams } from '../../validation/types'; +import type { RemoveError, ValidationParams } from '../../validation/types'; import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types'; import * as insuranceTableConfig from '@/config/tables/insurance-table'; import type RootStore from '@/stores/root'; @@ -40,12 +40,17 @@ export default class InsuranceTable { if (initialStatuses) this.statuses = initialStatuses; }; - public validate = ({ invalid, message }: ValidationParams) => { + public validate = ({ invalid, message, helper }: ValidationParams) => { + let removeError: RemoveError | undefined; + if (invalid) { - this.validation?.addError(message); + removeError = this.validation?.addError(message); + if (helper && removeError) helper.add(removeError); } else { this.validation?.removeError(message); } + + return removeError; }; public reset = () => { @@ -113,6 +118,12 @@ export default class InsuranceTable { return this.row(key); }, + setValues: (row: Insurance.RowValues) => { + (Object.keys(row) as Insurance.Values[]).forEach((valueName) => { + this.row(row.key).setValue(valueName, row[valueName]); + }); + }, + unblock: (valueName: Insurance.Values) => { this.statuses[key][valueName] = 'Default'; diff --git a/apps/web/stores/tables/insurance/tools.ts b/apps/web/stores/tables/insurance/tools.ts deleted file mode 100644 index d873e37..0000000 --- a/apps/web/stores/tables/insurance/tools.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type InsuranceTable from '.'; -import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types'; - -export default function extend(insuranceTable: InsuranceTable) { - return { - setRowValues(row: Insurance.RowValues) { - (Object.keys(row) as Insurance.Values[]).forEach((valueName) => { - insuranceTable.row(row.key).setValue(valueName, row[valueName]); - }); - }, - }; -} diff --git a/apps/web/stores/tables/payments/index.ts b/apps/web/stores/tables/payments/index.ts index 5a8f4b6..cbe63eb 100644 --- a/apps/web/stores/tables/payments/index.ts +++ b/apps/web/stores/tables/payments/index.ts @@ -1,5 +1,5 @@ import Validation from '../../validation'; -import type { ValidationParams } from '../../validation/types'; +import type { RemoveError, ValidationParams } from '../../validation/types'; import type { Row } from './types'; import type RootStore from '@/stores/root'; import type { IObservableArray } from 'mobx'; @@ -72,12 +72,17 @@ export default class PaymentsTable { this.setStatuses(statuses); }; - public validate = ({ invalid, message }: ValidationParams) => { + public validate = ({ invalid, message, helper }: ValidationParams) => { + let removeError: RemoveError | undefined; + if (invalid) { - this.validation?.addError(message); + removeError = this.validation?.addError(message); + if (helper && removeError) helper.add(removeError); } else { this.validation?.removeError(message); } + + return removeError; }; public reset = () => { diff --git a/apps/web/stores/validation/index.ts b/apps/web/stores/validation/index.ts index 6c4559d..e9c86b7 100644 --- a/apps/web/stores/validation/index.ts +++ b/apps/web/stores/validation/index.ts @@ -1,4 +1,4 @@ -import type { ValidationConfig } from './types'; +import type { RemoveError, ValidationConfig } from './types'; import { makeAutoObservable } from 'mobx'; import notification from 'ui/elements/notification'; @@ -26,9 +26,7 @@ export default class Validation { }; public addError = (message: string, silent?: boolean) => { - this.messages.add(message); - - if (!silent) { + if (!silent && !this.messages.has(message)) { notification.error({ description: message, key: this.params.err_key, @@ -36,7 +34,9 @@ export default class Validation { }); } - return () => this.removeError(message); + this.messages.add(message); + + return (() => this.removeError(message)) as RemoveError; }; public clearErrors = () => { diff --git a/apps/web/stores/validation/types.ts b/apps/web/stores/validation/types.ts index c5ef5c9..4c27464 100644 --- a/apps/web/stores/validation/types.ts +++ b/apps/web/stores/validation/types.ts @@ -1,9 +1,12 @@ +import type ValidationHelper from './helper'; + export type ValidationConfig = { err_key: string; err_title: string; }; export type ValidationParams = { + helper?: ValidationHelper; invalid: boolean; message: string; silent?: boolean; diff --git a/apps/web/trpc/routers/quote.ts b/apps/web/trpc/routers/quote.ts index 0c40560..66e093e 100644 --- a/apps/web/trpc/routers/quote.ts +++ b/apps/web/trpc/routers/quote.ts @@ -1,47 +1,66 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable canonical/sort-keys */ import { t } from '../server'; import defaultValues from '@/config/default-values'; -import { defaultValues as defaultInsuranceValues } from '@/config/tables/insurance-table'; -import getConfiguratorDataFromKP from '@/process/configurator/get-kp-data'; -import getFingapDataFromKP from '@/process/fingap/get-kp-data'; -import getLeasingObjectDataFromKP from '@/process/leasing-object/get-kp-data'; -import { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } from '@/process/load-kp/types'; -import getPaymentsDataFromKP from '@/process/payments/get-kp-data'; -import getPriceDataFromKP from '@/process/price/get-kp-data'; -import getSupplierAgentsDataFromKP from '@/process/supplier-agent/get-kp-values'; +import * as insuranceTable from '@/config/tables/insurance-table'; +import * as bonuses from '@/process/bonuses'; +import * as configurator from '@/process/configurator'; +import * as fingapProcess from '@/process/fingap'; +import * as gibdd from '@/process/gibdd'; +import * as insuranceProcess from '@/process/insurance'; +import * as leasingObject from '@/process/leasing-object'; +import * as loadKP from '@/process/load-kp'; +import * as paymentsProcess from '@/process/payments'; +import * as price from '@/process/price'; +import * as subsidy from '@/process/subsidy'; +import * as supplierAgent from '@/process/supplier-agent'; -const DEFAULT_OSAGO_ROW = defaultInsuranceValues.find((x) => x.key === 'osago'); -const DEFAULT_KASKO_ROW = defaultInsuranceValues.find((x) => x.key === 'kasko'); +const { GetQuoteInputDataSchema, GetQuoteOutputDataSchema } = loadKP; +const { DEFAULT_FINGAP_ROW, DEFAULT_KASKO_ROW, DEFAULT_OSAGO_ROW } = insuranceTable; + +const defaultInsurance = { + values: { + fingap: DEFAULT_FINGAP_ROW, + kasko: DEFAULT_KASKO_ROW, + osago: DEFAULT_OSAGO_ROW, + }, +}; + +const defaultFingap = { keys: [] }; +const defaultPayments = { values: [] }; const quoteRouter = t.router({ getData: t.procedure - .input(GetQuoteDataInputSchema) - .output(GetQuoteDataOutputSchema) + .input(GetQuoteInputDataSchema) + .output(GetQuoteOutputDataSchema) .query(async ({ input }) => { - const { values: configuratorValues } = await getConfiguratorDataFromKP(input); - const { values: supplierAgentsValues } = await getSupplierAgentsDataFromKP(input); - const { values: paymentsValues, payments } = await getPaymentsDataFromKP(input); - const { values: priceValues } = await getPriceDataFromKP(input); - const { values: leasingObjectValues } = await getLeasingObjectDataFromKP(input); - const { fingap, insurance: fingapInsurance } = await getFingapDataFromKP(input); + const processData = await Promise.all( + [ + configurator, + supplierAgent, + paymentsProcess, + price, + bonuses, + leasingObject, + fingapProcess, + gibdd, + subsidy, + insuranceProcess, + ].map(({ getKPData }) => getKPData(input)) + ); + + const values = processData.reduce( + (obj, data) => Object.assign(obj, data.values), + defaultValues + ); + const payments = processData.find((x) => x.payments)?.payments ?? defaultPayments; + const insurance = processData.find((x) => x.insurance)?.insurance ?? defaultInsurance; + const fingap = processData.find((x) => x.fingap)?.fingap ?? defaultFingap; return { - values: { - ...defaultValues, - ...configuratorValues, - ...supplierAgentsValues, - ...paymentsValues, - ...priceValues, - ...leasingObjectValues, - }, + values, payments, - insurance: { - values: { - osago: DEFAULT_OSAGO_ROW, - kasko: DEFAULT_KASKO_ROW, - fingap: fingapInsurance.values.fingap, - }, - }, + insurance, fingap, }; }), diff --git a/package.json b/package.json index be1a566..d5a15f0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "test": "dotenv -e .env.local turbo run test", "prepare": "husky install", "precommit": "yarn format && yarn lint:fix && yarn test", - "graphql:update": "dotenv -e .env.local node ./scripts/graphql-update.js" + "graphql:update": "dotenv -e .env.local node ./scripts/graphql-update.js", + "graphql:codegen": "dotenv -e .env.local node ./scripts/graphql-codegen.js" }, "dependencies": {}, "devDependencies": { diff --git a/packages/eslint-config-custom/rules.js b/packages/eslint-config-custom/rules.js index 4d1e2d8..091a394 100644 --- a/packages/eslint-config-custom/rules.js +++ b/packages/eslint-config-custom/rules.js @@ -71,7 +71,7 @@ module.exports = { }, ], 'unicorn/numeric-separators-style': [ - 'off', + 'warn', { onlyIfContainsSeparator: false, hexadecimal: { diff --git a/packages/tools/number.ts b/packages/tools/number.ts index 7779961..1ca4eb0 100644 --- a/packages/tools/number.ts +++ b/packages/tools/number.ts @@ -18,3 +18,7 @@ export const formatterExtra = (value?: number) => maximumFractionDigits: 6, minimumFractionDigits: 2, }).format(value || 0); + +export function round(value: number, precision: number = 0) { + return Number.parseFloat(value.toFixed(precision)); +} diff --git a/packages/ui/elements/icons/DownloadOutlined.jsx b/packages/ui/elements/icons/DownloadOutlined.jsx deleted file mode 100644 index c61295b..0000000 --- a/packages/ui/elements/icons/DownloadOutlined.jsx +++ /dev/null @@ -1,3 +0,0 @@ -import DownloadOutlined from '@ant-design/icons/lib/icons/DownloadOutlined'; - -export default ; diff --git a/packages/ui/elements/icons/index.ts b/packages/ui/elements/icons/index.ts index 929b7c8..f4ca613 100644 --- a/packages/ui/elements/icons/index.ts +++ b/packages/ui/elements/icons/index.ts @@ -1 +1 @@ -export { default as DownloadOutlined } from './DownloadOutlined'; +export * from '@ant-design/icons'; diff --git a/scripts/graphql-codegen.js b/scripts/graphql-codegen.js new file mode 100644 index 0000000..1323ee0 --- /dev/null +++ b/scripts/graphql-codegen.js @@ -0,0 +1,5 @@ +const run = require('tools/scripts'); + +const command = ['yarn', 'workspace', 'web', 'graphql:codegen'].join(' '); + +run(command, '*** Update GraphQL files ***');