diff --git a/apps/api/src/proxy/lib/config.ts b/apps/api/src/proxy/lib/config.ts index bb939eb..b4b525a 100644 --- a/apps/api/src/proxy/lib/config.ts +++ b/apps/api/src/proxy/lib/config.ts @@ -14,6 +14,7 @@ export const queryTTL: Record = { GetDealerPerson: seconds().fromHours(1), GetDealerPersons: seconds().fromHours(1), GetDealers: seconds().fromMinutes(15), + GetEltInsuranceRules: seconds().fromHours(12), GetFuelCards: seconds().fromHours(12), GetGPSBrands: seconds().fromHours(24), GetGPSModels: seconds().fromHours(24), @@ -32,6 +33,7 @@ export const queryTTL: Record = { GetOpportunities: false, GetOpportunity: false, GetOpportunityUrl: seconds().fromHours(12), + GetOsagoAddproductTypes: seconds().fromHours(12), GetProduct: seconds().fromHours(12), GetProducts: seconds().fromHours(12), GetQuote: false, diff --git a/apps/web/Components/Calculation/Form/ELT/Kasko.tsx b/apps/web/Components/Calculation/Form/ELT/Kasko.tsx index 58fdab0..91858ac 100644 --- a/apps/web/Components/Calculation/Form/ELT/Kasko.tsx +++ b/apps/web/Components/Calculation/Form/ELT/Kasko.tsx @@ -1,129 +1,41 @@ /* eslint-disable sonarjs/cognitive-complexity */ import { PolicyTable, ReloadButton, Validation } from './Components'; import { columns } from './lib/config'; -import { makeEltKaskoRequest } from './lib/make-request'; +import { resetRow } from './lib/tools'; import type { Row, StoreSelector } from './types'; -import { getEltKasko } from '@/api/elt/query'; -import { MAX_FRANCHISE, MAX_INSURANCE, MIN_INSURANCE } from '@/constants/values'; -import helper from '@/process/elt/lib/helper'; import { useStore } from '@/stores/hooks'; -import { defaultRow } from '@/stores/tables/elt/default-values'; -import { useApolloClient } from '@apollo/client'; +import { trpcClient } from '@/trpc/client'; import { observer } from 'mobx-react-lite'; -import { omit, sift } from 'radash'; -import { useCallback } from 'react'; import { Flex } from 'ui/grid'; const storeSelector: StoreSelector = ({ kasko }) => kasko; -const initialData = { - ...omit(defaultRow, ['name', 'key', 'id']), - error: null, - kaskoSum: 0, - paymentPeriods: [ - { - kaskoSum: 0, - }, - ], -}; - export const Kasko = observer(() => { const store = useStore(); const { $calculation, $tables } = store; - const apolloClient = useApolloClient(); - const { init } = helper({ apolloClient, store }); - const handleOnClick = useCallback(async () => { - $tables.elt.kasko.abortController?.abort(); - $tables.elt.kasko.abortController = new AbortController(); + const calculateKasko = trpcClient.eltKasko.useMutation({ + onError() { + $tables.elt.kasko.setRows( + $tables.elt.kasko.getRows.map((row) => ({ ...row, status: 'error' })) + ); + }, + onMutate: () => { + const rows = $tables.elt.kasko.getRows; + $tables.elt.kasko.setRows(rows.map((row) => ({ ...resetRow(row), status: 'fetching' }))); + }, + onSuccess: ({ rows }) => { + $tables.elt.kasko.setRows(rows); + }, + }); - const { kasko } = await init(); - $tables.elt.kasko.setRows(kasko); - const kaskoCompanyIds = sift( - $tables.insurance - .row('kasko') - .getOptions('insuranceCompany') - .map((x) => x.value) - ); - const values = $calculation.$values.getValues(); - - kaskoCompanyIds.forEach((key) => { - const row = $tables.elt.kasko.getRow(key); - if (row) { - $tables.elt.kasko.setRow({ key, status: 'fetching' }); - makeEltKaskoRequest({ apolloClient, store }, row) - .then((payload) => - getEltKasko(payload, { signal: $tables.elt.kasko.abortController?.signal }) - ) - .then((res) => { - if (res) { - const { - kaskoSum = 0, - message, - paymentPeriods, - requestId, - skCalcId, - totalFranchise = 0, - } = res; - let { error } = res; - - const sum = - values.leasingPeriod <= 16 ? kaskoSum : paymentPeriods?.[0]?.kaskoSum || 0; - - if (totalFranchise > MAX_FRANCHISE) { - error ||= `Франшиза по страховке превышает максимально допустимое значение: ${Intl.NumberFormat( - 'ru', - { - currency: 'RUB', - style: 'currency', - } - ).format(MAX_FRANCHISE)}`; - } - - if (sum > MAX_INSURANCE) { - error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости КАСКО: ${Intl.NumberFormat( - 'ru', - { - currency: 'RUB', - style: 'currency', - } - ).format(MAX_INSURANCE)}`; - } - - if (sum < MIN_INSURANCE) { - error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости КАСКО: ${Intl.NumberFormat( - 'ru', - { - currency: 'RUB', - style: 'currency', - } - ).format(MIN_INSURANCE)}`; - } - - $tables.elt.kasko.setRow({ - key, - message: error || message, - numCalc: '0', - requestId, - skCalcId, - status: error ? 'error' : null, - sum, - totalFranchise, - }); - } - }) - .catch((error) => { - const _err = error as Error; - $tables.elt.kasko.setRow({ - ...initialData, - key, - message: _err.message || String(error), - status: 'error', - }); - }); - } + function handleOnClick() { + calculateKasko.mutate({ + calculation: { + values: store.$calculation.$values.getValues(), + }, }); - }, [$calculation.$values, $tables.elt.kasko, $tables.insurance, apolloClient, init, store]); + } function handleOnSelectRow(row: Row) { $tables.insurance.row('kasko').column('insuranceCompany').setValue(row.key); diff --git a/apps/web/Components/Calculation/Form/ELT/Osago.tsx b/apps/web/Components/Calculation/Form/ELT/Osago.tsx index 667f91f..91a03ac 100644 --- a/apps/web/Components/Calculation/Form/ELT/Osago.tsx +++ b/apps/web/Components/Calculation/Form/ELT/Osago.tsx @@ -2,125 +2,41 @@ /* eslint-disable sonarjs/cognitive-complexity */ import { PolicyTable, ReloadButton, Validation } from './Components'; import { columns } from './lib/config'; -import { makeEltOsagoRequest, makeOwnOsagoRequest } from './lib/make-request'; +import { resetRow } from './lib/tools'; import type { Row, StoreSelector } from './types'; -import { getEltOsago } from '@/api/elt/query'; -import { MAX_INSURANCE, MIN_INSURANCE } from '@/constants/values'; -import helper from '@/process/elt/lib/helper'; import { useStore } from '@/stores/hooks'; -import { defaultRow } from '@/stores/tables/elt/default-values'; -import { useApolloClient } from '@apollo/client'; +import { trpcClient } from '@/trpc/client'; import { observer } from 'mobx-react-lite'; -import { omit, sift } from 'radash'; -import { useCallback } from 'react'; import { Flex } from 'ui/grid'; const storeSelector: StoreSelector = ({ osago }) => osago; -const initialData = { - ...omit(defaultRow, ['name', 'key', 'id']), - error: null, - premiumSum: 0, -}; - export const Osago = observer(() => { const store = useStore(); const { $tables } = store; - const apolloClient = useApolloClient(); - const { init } = helper({ apolloClient, store }); - const handleOnClick = useCallback(async () => { - $tables.elt.osago.abortController?.abort(); - $tables.elt.osago.abortController = new AbortController(); + const calculateOsago = trpcClient.eltOsago.useMutation({ + onError() { + $tables.elt.osago.setRows( + $tables.elt.osago.getRows.map((row) => ({ ...row, status: 'error' })) + ); + }, + onMutate: () => { + const rows = $tables.elt.osago.getRows; + $tables.elt.osago.setRows(rows.map((row) => ({ ...resetRow(row), status: 'fetching' }))); + }, + onSuccess: ({ rows }) => { + $tables.elt.osago.setRows(rows); + }, + }); - const { osago } = await init(); - $tables.elt.osago.setRows(osago); - const osagoCompanyIds = sift( - $tables.insurance - .row('osago') - .getOptions('insuranceCompany') - .map((x) => x.value) - ); - - osagoCompanyIds.forEach((key) => { - const row = $tables.elt.osago.getRow(key); - if (row) { - row.status = 'fetching'; - $tables.elt.osago.setRow(row); - - if (row.metodCalc === 'CRM') { - makeOwnOsagoRequest({ apolloClient, store }, row).then((res) => { - if (!res) { - $tables.elt.osago.setRow({ - key, - message: - 'Для получения расчета ОСАГО следует использовать калькулятор ЭЛТ или Индивидуальный запрос', - numCalc: undefined, - skCalcId: undefined, - status: 'error', - sum: 0, - totalFranchise: 0, - }); - } else { - $tables.elt.osago.setRow({ - key, - message: null, - numCalc: res.evo_id || undefined, - status: null, - sum: res.evo_graph_price_withoutnds || undefined, - }); - } - }); - } else { - makeEltOsagoRequest({ apolloClient, store }, row) - .then((payload) => - getEltOsago(payload, { signal: $tables.elt.osago.abortController.signal }) - ) - .then((res) => { - if (res) { - const { message, numCalc, premiumSum = 0, skCalcId } = res; - let { error } = res; - if (premiumSum > MAX_INSURANCE) { - error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости ОСАГО: ${Intl.NumberFormat( - 'ru', - { - currency: 'RUB', - style: 'currency', - } - ).format(MAX_INSURANCE)}`; - } - if (premiumSum < MIN_INSURANCE) { - error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости ОСАГО: ${Intl.NumberFormat( - 'ru', - { - currency: 'RUB', - style: 'currency', - } - ).format(MIN_INSURANCE)}`; - } - $tables.elt.osago.setRow({ - key, - message: error || message, - numCalc: `${numCalc}`, - skCalcId, - status: error ? 'error' : null, - sum: premiumSum, - }); - } - }) - .catch((error) => { - const _err = error as Error; - $tables.elt.osago.setRow({ - ...initialData, - key, - message: _err.message || String(error), - status: 'error', - }); - }); - } - } + async function handleOnClick() { + calculateOsago.mutate({ + calculation: { + values: store.$calculation.$values.getValues(), + }, }); - }, [$tables.elt.osago, $tables.insurance, apolloClient, init, store]); + } function handleOnSelectRow(row: Row) { $tables.insurance.row('osago').column('insuranceCompany').setValue(row.key); diff --git a/apps/web/Components/Calculation/Form/ELT/lib/config.tsx b/apps/web/Components/Calculation/Form/ELT/lib/config.tsx index 05ee967..8e83176 100644 --- a/apps/web/Components/Calculation/Form/ELT/lib/config.tsx +++ b/apps/web/Components/Calculation/Form/ELT/lib/config.tsx @@ -1,10 +1,7 @@ -import type { RowSchema } from '@/config/schema/elt'; +import type { Row } from '../types'; import type { ColumnsType } from 'antd/lib/table'; import { CloseOutlined, LoadingOutlined } from 'ui/elements/icons'; import { Flex } from 'ui/grid'; -import type { z } from 'zod'; - -type Row = z.infer; const formatter = Intl.NumberFormat('ru', { currency: 'RUB', diff --git a/apps/web/Components/Calculation/Form/ELT/lib/make-request.ts b/apps/web/Components/Calculation/Form/ELT/lib/make-request.ts deleted file mode 100644 index d82d045..0000000 --- a/apps/web/Components/Calculation/Form/ELT/lib/make-request.ts +++ /dev/null @@ -1,761 +0,0 @@ -/* eslint-disable sonarjs/cognitive-complexity */ -/* eslint-disable complexity */ -import type { Row } from '../types'; -import type { RequestEltKasko, RequestEltOsago } from '@/api/elt/types'; -import * as CRMTypes from '@/graphql/crm.types'; -import type { ProcessContext } from '@/process/types'; -import { getCurrentDateString } from '@/utils/date'; -import dayjs from 'dayjs'; -import { first, sort } from 'radash'; - -export async function makeOwnOsagoRequest( - { store, apolloClient }: Pick, - row: Row -): Promise[number]> { - const currentDate = getCurrentDateString(); - - const { - data: { evo_addproduct_types }, - } = await apolloClient.query({ - query: CRMTypes.GetOsagoAddproductTypesDocument, - variables: { currentDate }, - }); - - if (!evo_addproduct_types) return null; - - const { leaseObjectCategory, leaseObjectMotorPower, countSeats, maxMass } = - store.$calculation.$values.getValues([ - 'leaseObjectCategory', - 'leaseObjectMotorPower', - 'countSeats', - 'maxMass', - ]); - - const filteredTypes = evo_addproduct_types.filter( - (type) => - type?.evo_accountid === row.key && - type.evo_visible_calc && - type.evo_category === leaseObjectCategory && - type.evo_min_power !== null && - type.evo_max_power !== null && - type.evo_min_power <= leaseObjectMotorPower && - type.evo_max_power >= leaseObjectMotorPower && - type.evo_min_seats_count !== null && - type.evo_max_seats_count !== null && - type.evo_min_seats_count <= countSeats && - type.evo_max_seats_count >= countSeats && - type.evo_min_mass !== null && - type.evo_max_mass !== null && - type.evo_min_mass <= maxMass && - type.evo_max_mass >= maxMass - ); - - const sortedTypes = sort(filteredTypes, (type) => dayjs(type?.createdon).date()); - - return first(sortedTypes) || null; -} - -const getSpecified = (value: unknown) => value !== null && value !== undefined; - -export async function makeEltOsagoRequest( - { store, apolloClient }: Pick, - row: Row -): Promise { - const { $calculation, $tables } = store; - - const currentDate = dayjs().toDate(); - let kladr = '7700000000000'; - if ($calculation.element('radioObjectRegistration').getValue() === 100_000_001) { - const townRegistrationId = $calculation.element('selectTownRegistration').getValue(); - - if (townRegistrationId) { - const { - data: { evo_town }, - } = await apolloClient.query({ - query: CRMTypes.GetTownDocument, - variables: { townId: townRegistrationId }, - }); - kladr = evo_town?.evo_kladr_id || kladr; - } - } else { - const { - data: { account: insuranceCompany }, - } = await apolloClient.query({ - query: CRMTypes.GetInsuranceCompanyDocument, - variables: { accountId: row.key }, - }); - if (insuranceCompany?.evo_legal_region_calc === true) { - const regionId = $calculation.element('selectLegalClientRegion').getValue(); - let evo_region: CRMTypes.GetRegionQuery['evo_region'] = null; - if (regionId) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetRegionDocument, - variables: { regionId }, - }); - ({ evo_region } = data); - } - - const townId = $calculation.element('selectLegalClientTown').getValue(); - let evo_town: CRMTypes.GetTownQuery['evo_town'] = null; - if (townId) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetTownDocument, - variables: { townId }, - }); - ({ evo_town } = data); - } - - kladr = evo_town?.evo_kladr_id || evo_region?.evo_kladr_id || kladr; - } - } - - let brandId = ''; - const brand = $calculation.element('selectBrand').getValue(); - if (brand) { - const { - data: { evo_brand }, - } = await apolloClient.query({ - query: CRMTypes.GetBrandDocument, - variables: { brandId: brand }, - }); - - if (evo_brand?.evo_id) { - brandId = evo_brand.evo_id; - } - } - - let modelId = ''; - const model = $calculation.element('selectModel').getValue(); - if (model) { - const { - data: { evo_model }, - } = await apolloClient.query({ - query: CRMTypes.GetModelDocument, - variables: { modelId: model }, - }); - - if (evo_model?.evo_id) { - modelId = evo_model.evo_id; - } - } - - let gpsMark = ''; - const gpsBrandId = $calculation.element('selectGPSBrand').getValue(); - if (gpsBrandId) { - const { - data: { evo_gps_brands }, - } = await apolloClient.query({ - query: CRMTypes.GetGpsBrandsDocument, - }); - gpsMark = evo_gps_brands?.find((x) => x?.value === gpsBrandId)?.evo_id || gpsMark; - } - - let gpsModel = ''; - const gpsModelId = $calculation.element('selectGPSModel').getValue(); - if (gpsModelId) { - const { - data: { evo_gps_models }, - } = await apolloClient.query({ - query: CRMTypes.GetGpsModelsDocument, - }); - gpsModel = evo_gps_models?.find((x) => x?.value === gpsModelId)?.evo_id || gpsModel; - } - - const vehicleYear = $calculation.element('tbxLeaseObjectYear').getValue().toString(); - const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue(); - const vehiclePower = $calculation.element('tbxLeaseObjectMotorPower').getValue() || 0; - - const mapCategory: Record = { - 100_000_000: 'A', - 100_000_001: 'B', - 100_000_002: 'C', - 100_000_003: 'D', - 100_000_004: 'ПРОЧИЕ ТС', - }; - const category = (leaseObjectCategory && mapCategory[leaseObjectCategory]) || '0'; - - const leaseObjectUseFor = $calculation.element('selectLeaseObjectUseFor').getValue(); - const maxMass = $calculation.element('tbxMaxMass').getValue(); - const countSeats = $calculation.element('tbxCountSeats').getValue(); - - let subCategory = '0'; - switch (leaseObjectCategory) { - case 100_000_001: { - if (leaseObjectUseFor === 100_000_001) { - subCategory = '11'; - } - subCategory = '10'; - break; - } - - case 100_000_002: { - if (maxMass <= 16_000) { - subCategory = '20'; - } - subCategory = '21'; - break; - } - - case 100_000_003: { - if (leaseObjectUseFor === 100_000_001) { - subCategory = '32'; - } - if (countSeats <= 20) { - subCategory = '30'; - } - - subCategory = '31'; - break; - } - - case 100_000_004: { - subCategory = '22'; - break; - } - - case 100_000_000: - default: { - subCategory = '0'; - break; - } - } - - let seatingCapacity = 0; - if (leaseObjectCategory === 100_000_003) { - seatingCapacity = countSeats; - } - const seatingCapacitySpecified = getSpecified(seatingCapacity); - - let maxAllowedMass = 0; - if (leaseObjectCategory === 100_000_002) { - maxAllowedMass = maxMass; - } - const maxAllowedMassSpecified = getSpecified(maxAllowedMass); - - const useWithTrailer = $calculation.element('cbxWithTrailer').getValue(); - const useWithTrailerSpecified = true; - - const address = { - // district: '0', - city: 'Москва', - - cityKladr: '7700000000000', - - country: 'Россия', - - house: '52', - korpus: '5', - region: 'Москва', - resident: 1, - street: 'Космодамианская наб', - }; - - const owner = { - JuridicalName: 'ООО "ЛК "ЭВОЛЮЦИЯ"', - email: 'client@evoleasing.ru', - factAddress: address, - inn: '9724016636', - kpp: '770501001', - ogrn: '1207700245037', - opf: 1, - opfSpecified: true, - phone: '8 (800) 333-75-75', - registrationAddress: address, - subjectType: 1, - subjectTypeSpecified: true, - }; - - let inn = '9724016636'; - const insured = $tables.insurance.row('osago').getValue('insured'); - const leadid = $calculation.element('selectLead').getValue(); - if (insured === 100_000_000 && leadid) { - const { - data: { lead }, - } = await apolloClient.query({ - query: CRMTypes.GetLeadDocument, - variables: { leadid }, - }); - - inn = lead?.evo_inn || inn; - } - - return { - companyId: row.id, - params: { - FullDriversInfo: [ - { - kbm: '3', - }, - ], - carInfo: { - mark: gpsMark, - model: gpsModel, - tsType: { category, subCategory }, - useWithTrailer, - useWithTrailerSpecified, - vehicle: { - maxAllowedMass, - maxAllowedMassSpecified, - seatingCapacity, - seatingCapacitySpecified, - }, - vehiclePower, - vehicleYear, - }, - contractBeginDate: currentDate, - contractOptionId: 1, - contractStatusId: 13, - driversCount: 0, - duration: 12, - insurer: { - INN: inn, - SubjectType: 1, - SubjectTypeSpecified: true, - }, - insurerType: 1, - lessee: { - SubjectType: 1, - SubjectTypeSpecified: true, - inn, - }, - owner, - ownerType: 1, - tsToRegistrationPlace: 0, - }, - preparams: { - brandId, - kladr, - modelId, - }, - }; -} - -export async function makeEltKaskoRequest( - { store, apolloClient }: Pick, - row: Row -): Promise { - const { $calculation } = store; - - const currentDate = dayjs().toDate(); - - const regionId = $calculation.element('selectLegalClientRegion').getValue(); - let evo_region: CRMTypes.GetRegionQuery['evo_region'] = null; - if (regionId) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetRegionDocument, - variables: { regionId }, - }); - ({ evo_region } = data); - } - - const townId = $calculation.element('selectLegalClientTown').getValue(); - let evo_town: CRMTypes.GetTownQuery['evo_town'] = null; - if (townId) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetTownDocument, - variables: { townId }, - }); - ({ evo_town } = data); - } - - const kladr = evo_town?.evo_kladr_id || evo_region?.evo_kladr_id || ''; - - const leaseObjectTypeId = $calculation.element('selectLeaseObjectType').getValue(); - let evo_leasingobject_type: CRMTypes.GetLeaseObjectTypeQuery['evo_leasingobject_type'] = null; - if (leaseObjectTypeId) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetLeaseObjectTypeDocument, - variables: { leaseObjectTypeId }, - }); - ({ evo_leasingobject_type } = data); - } - - const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue(); - - const brand = $calculation.element('selectBrand').getValue(); - let evo_brand: CRMTypes.GetBrandQuery['evo_brand'] = null; - if (brand) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetBrandDocument, - variables: { brandId: brand }, - }); - ({ evo_brand } = data); - } - const brandId = evo_brand?.evo_id || ''; - - const model = $calculation.element('selectModel').getValue(); - let evo_model: CRMTypes.GetModelQuery['evo_model'] = null; - if (model) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetModelDocument, - variables: { modelId: model }, - }); - ({ evo_model } = data); - } - const modelId = evo_model?.evo_id || ''; - - const leaseObjectUsed = $calculation.element('cbxLeaseObjectUsed').getValue(); - - const productId = $calculation.element('selectProduct').getValue(); - const partialVAT = $calculation.element('cbxPartialVAT').getValue(); - - const leaseObjectYear = $calculation.element('tbxLeaseObjectYear').getValue(); - let isNew = true; - if ( - leaseObjectUsed === true || - (leaseObjectUsed === false && - productId && - partialVAT && - leaseObjectYear < currentDate.getFullYear() - 1) - ) { - isNew = false; - } - - const vehicleYear = leaseObjectYear; - let vehicleDate; - if ( - leaseObjectUsed === true || - (leaseObjectUsed === false && - productId && - partialVAT && - leaseObjectYear < currentDate.getFullYear() - 1) - ) { - vehicleDate = new Date(`${vehicleYear}-01-01`); - } - const vehicleDateSpecified = getSpecified(vehicleDate); - - const power = $calculation.element('tbxLeaseObjectMotorPower').getValue(); - const powerSpecified = getSpecified(power); - - let country = 0; - let countrySpecified = false; - if ( - (leaseObjectCategory === 100_000_002 || - (evo_leasingobject_type?.evo_id && - ['6', '9', '10', '8'].includes(evo_leasingobject_type?.evo_id))) && - evo_brand?.evo_brand_owner === 100_000_001 - ) { - country = 1; - countrySpecified = true; - } - - const mapEngineType: Record = { - 100_000_000: '0', - 100_000_001: '1', - 100_000_003: '2', - 100_000_004: '3', - }; - - let engineType = '5'; - const engineTypeValue = $calculation.element('selectEngineType').getValue(); - if (engineTypeValue) { - engineType = mapEngineType[engineTypeValue] || '5'; - } - - const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); - const duration = leasingPeriod < 12 ? 12 : leasingPeriod; - - const cost = - $calculation.$values.getValue('plPriceRub') - - $calculation.$values.getValue('discountRub') - - $calculation.$values.getValue('importProgramSum') + - $calculation.$values.getValue('addEquipmentPrice'); - - let notConfirmedDamages = 0; - let notConfirmedDamagesSpecified = false; - let notConfirmedGlassesDamages = 0; - let notConfirmedGlassesDamagesSpecified = false; - let outsideRoads = false; - let outsideRoadsSpecified = false; - let selfIgnition = false; - let selfIgnitionSpecified = false; - if ( - leaseObjectCategory === 100_000_002 || - (evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)) - ) { - notConfirmedGlassesDamages = 3; - notConfirmedGlassesDamagesSpecified = true; - notConfirmedDamages = 2; - notConfirmedDamagesSpecified = true; - selfIgnition = true; - selfIgnitionSpecified = getSpecified(selfIgnition); - outsideRoads = true; - outsideRoadsSpecified = true; - } - - const franchise = $calculation.element('tbxInsFranchise').getValue(); - const franchiseSpecified = getSpecified(franchise); - - let puuMark = ''; - const gpsBrandId = $calculation.element('selectGPSBrand').getValue(); - if (gpsBrandId) { - const { - data: { evo_gps_brands }, - } = await apolloClient.query({ - query: CRMTypes.GetGpsBrandsDocument, - }); - puuMark = evo_gps_brands?.find((x) => x?.value === gpsBrandId)?.evo_id || puuMark; - } - - let puuModel = ''; - const gpsModelId = $calculation.element('selectGPSModel').getValue(); - if (gpsModelId) { - const { - data: { evo_gps_models }, - } = await apolloClient.query({ - query: CRMTypes.GetGpsModelsDocument, - }); - puuModel = evo_gps_models?.find((x) => x?.value === gpsModelId)?.evo_id || puuModel; - } - - const puuModelSpecified = getSpecified(puuModel); - - let age = $calculation.element('tbxInsAgeDrivers').getValue(); - let experience = $calculation.element('tbxInsExpDrivers').getValue(); - const sex = '0'; - let driversCount = 1; - - const risk = - evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id) - ? 3 - : 0; - - if ($calculation.element('cbxInsUnlimitDrivers').getValue()) { - age = 18; - experience = 0; - driversCount = 0; - } - const sexSpecified = getSpecified(sex); - - let maxAllowedMass = 0; - if (leaseObjectCategory === 100_000_002) { - maxAllowedMass = $calculation.element('tbxMaxMass').getValue(); - } - const maxAllowedMassSpecified = getSpecified(maxAllowedMass); - - let mileage = 0; - if (leaseObjectUsed === true) { - mileage = $calculation.element('tbxMileage').getValue(); - } - - if ( - leaseObjectUsed === false && - productId && - partialVAT && - leaseObjectYear < currentDate.getFullYear() - 1 - ) { - mileage = 0; - } - - let vin = ''; - - if (leaseObjectUsed === true) { - vin = $calculation.element('tbxVIN').getValue() || vin; - } - - const mileageSpecified = getSpecified(mileage); - - let vehicleUsage = 0; - - const mapVehicleUsage: Record = { - 100_000_000: 0, - 100_000_001: 1, - 100_000_002: 5, - 100_000_003: 5, - 100_000_004: 2, - 100_000_005: 6, - 100_000_006: 5, - 100_000_007: 4, - 100_000_008: 4, - 100_000_009: 0, - 100_000_010: 0, - 100_000_011: 3, - 100_000_012: 3, - 100_000_013: 9, - 100_000_020: 10, - }; - - const leaseObjectUseFor = $calculation.element('selectLeaseObjectUseFor').getValue(); - if (leaseObjectUseFor) { - vehicleUsage = mapVehicleUsage[leaseObjectUseFor] || 0; - } - const vehicleUsageSpecified = getSpecified(vehicleUsage); - - let seatingCapacity = 0; - if (leaseObjectCategory === 100_000_003) { - seatingCapacity = $calculation.element('tbxCountSeats').getValue(); - } - const seatingCapacitySpecified = getSpecified(seatingCapacity); - - const mapCategory: Record = { - 100_000_000: 'A', - 100_000_001: 'B', - // 100000002: 'C2', - 100_000_003: 'D', - 100_000_004: 'E1', - }; - - let category = ''; - - if (leaseObjectCategory) { - category = mapCategory[leaseObjectCategory]; - } - - if (leaseObjectCategory === 100_000_002) - switch (evo_leasingobject_type?.evo_id) { - case '7': { - category = 'C1'; - break; - } - case '3': { - category = 'C3'; - break; - } - default: { - category = 'C2'; - break; - } - } - - const classification = - leaseObjectCategory && [100_000_002, 100_000_003, 100_000_004].includes(leaseObjectCategory) - ? '11635' - : '0'; - - let INN = ''; - const leadid = $calculation.element('selectLead').getValue(); - if (leadid) { - const { - data: { lead }, - } = await apolloClient.query({ - query: CRMTypes.GetLeadDocument, - variables: { leadid }, - }); - INN = lead?.evo_inn || INN; - } - - const lesseSubjectType = (INN.length === 10 && 1) || (INN.length === 12 && 2) || 0; - - const mapLeaseObjectUseForToIndustry: Record = { - 100_000_014: 30, - 100_000_015: 15, - 100_000_016: 3, - 100_000_017: 26, - 100_000_018: 2, - 100_000_019: 6, - }; - - let specialMachineryIndustry = 0; - let specialMachineryMover = 0; - let specialMachineryType = 0; - if (evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)) { - specialMachineryType = Number(evo_model?.evo_vehicle_body_typeidData?.evo_id_elt || 0); - specialMachineryIndustry = leaseObjectUseFor - ? mapLeaseObjectUseForToIndustry[leaseObjectUseFor] - : specialMachineryIndustry; - specialMachineryMover = evo_model?.evo_running_gear === 100_000_001 ? 2 : 1; - } - - return { - companyId: row.id, - params: { - Insurer: { - SubjectType: 1, - SubjectTypeSpecified: true, - }, - Lessee: { - INN, - SubjectType: lesseSubjectType, - SubjectTypeSpecified: true, - }, - OfficialDealer: true, - OfficialDealerSpecified: true, - Owner: { - SubjectType: 1, - SubjectTypeSpecified: true, - }, - PUUs: puuMark - ? [ - { - mark: puuMark, - model: puuModel, - modelSpecified: puuModelSpecified, - }, - ] - : [], - STOA: '0', - approvedDriving: 2, - approvedDrivingSpecified: true, - bankId: '245', - cost, - currency: 'RUR', - drivers: [{ age, experience, sex, sexSpecified }], - driversCount, - duration, - franchise, - franchiseSpecified, - isNew, - modification: { - KPPTypeId: 1, - country, - countrySpecified, - engineType, - engineVolume: 0, - engineVolumeSpecified: true, - power, - powerSpecified, - }, - notConfirmedDamages, - notConfirmedDamagesSpecified, - notConfirmedGlassesDamages, - notConfirmedGlassesDamagesSpecified, - outsideRoads, - outsideRoadsSpecified, - payType: '0', - risk, - selfIgnition, - selfIgnitionSpecified, - ssType: '1', - usageStart: currentDate, - vehicle: { - category, - classification, - maxAllowedMass, - maxAllowedMassSpecified, - mileage, - mileageSpecified, - seatingCapacity, - seatingCapacitySpecified, - vehicleUsage, - vehicleUsageSpecified, - vin, - }, - vehicleDate, - vehicleDateSpecified, - vehicleYear, - // FullDriversInfo: [ - // { - // surname, - // name, - // patronymic, - // sex, - // sexSpecified, - // expertienceStart, - // }, - // ], - }, - preparams: { - brandId, - kladr, - modelId, - specialMachinery: { - industry: specialMachineryIndustry, - industrySpecified: getSpecified(specialMachineryIndustry), - mover: specialMachineryMover, - moverSpecified: getSpecified(specialMachineryMover), - type: specialMachineryType, - typeSpecified: getSpecified(specialMachineryType), - }, - }, - }; -} diff --git a/apps/web/Components/Calculation/Form/ELT/lib/tools.ts b/apps/web/Components/Calculation/Form/ELT/lib/tools.ts new file mode 100644 index 0000000..fda71ef --- /dev/null +++ b/apps/web/Components/Calculation/Form/ELT/lib/tools.ts @@ -0,0 +1,12 @@ +import type { Row } from '@/Components/Calculation/Form/ELT/types'; +import { defaultRow } from '@/stores/tables/elt/default-values'; + +export function resetRow(row: Row): Row { + return { + ...defaultRow, + id: row.id, + key: row.key, + metodCalc: row.metodCalc, + name: row.name, + }; +} diff --git a/apps/web/api/elt/query.ts b/apps/web/api/elt/query.ts index 6711811..98cfb72 100644 --- a/apps/web/api/elt/query.ts +++ b/apps/web/api/elt/query.ts @@ -6,24 +6,18 @@ import axios from 'axios'; const { URL_ELT_KASKO, URL_ELT_OSAGO } = getUrls(); -export async function getEltOsago( - payload: ELT.RequestEltOsago, - { signal }: { signal: AbortSignal } -) { +export async function getEltOsago(payload: ELT.RequestEltOsago) { return withHandleError( axios - .post(URL_ELT_OSAGO, payload, { signal, timeout: TIMEOUT }) + .post(URL_ELT_OSAGO, payload, { timeout: TIMEOUT }) .then(({ data }) => data) ); } -export async function getEltKasko( - payload: ELT.RequestEltKasko, - { signal }: { signal: AbortSignal } -) { +export async function getEltKasko(payload: ELT.RequestEltKasko) { return withHandleError( axios - .post(URL_ELT_KASKO, payload, { signal, timeout: TIMEOUT }) + .post(URL_ELT_KASKO, payload, { timeout: TIMEOUT }) .then(({ data }) => data) ); } diff --git a/apps/web/apollo/client.js b/apps/web/apollo/client.js index cb3b5fd..442f4cd 100644 --- a/apps/web/apollo/client.js +++ b/apps/web/apollo/client.js @@ -14,6 +14,10 @@ function createApolloClient(headers) { } export default function initializeApollo(initialState, headers) { + if (isServer() && !headers) { + throw new Error('initializeApollo: headers must be provided in server side'); + } + const _apolloClient = apolloClient ?? createApolloClient(headers); // If your page has Next.js data fetching methods that use Apollo Client, the initial state diff --git a/apps/web/config/schema/elt.ts b/apps/web/config/schema/elt.ts index 2d5d46f..faf3f0f 100644 --- a/apps/web/config/schema/elt.ts +++ b/apps/web/config/schema/elt.ts @@ -270,6 +270,7 @@ export const ResultEltOsagoSchema = z.object({ export const RowSchema = z.object({ id: z.string(), + insuranceCondition: z.string().nullable(), key: z.string(), message: z.string().nullable(), metodCalc: z.union([z.literal('CRM'), z.literal('ELT')]), diff --git a/apps/web/graphql/crm.query.graphql b/apps/web/graphql/crm.query.graphql index 0656e76..e6fda6c 100644 --- a/apps/web/graphql/crm.query.graphql +++ b/apps/web/graphql/crm.query.graphql @@ -310,6 +310,12 @@ query GetQuoteData($quoteId: UUID!) { evo_equip_price evo_coefficien_bonus_reducttion evo_accept_limit_quote + evo_kasko_insurance_rulesidData { + evo_id + } + evo_osago_insurance_rulesiddData { + evo_id + } } } @@ -1059,6 +1065,8 @@ query GetInsuranceCompany($accountId: UUID!) { evo_osago_with_kasko evo_legal_region_calc accountid + evo_kasko_fact_part + evo_kasko_plan_part } } @@ -1073,6 +1081,64 @@ query GetInsuranceCompanies { evo_id_elt evo_id_elt_smr evo_osago_id + evo_kasko_category + evo_osago_category + } +} + +query GetEltInsuranceRules($currentDate: DateTime) { + evo_insurance_ruleses( + filterConditionGroup: { + andFilterConditions: [ + { filterConditionInt: { fieldName: "statecode", eq: 0 } } + { filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } } + { filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } } + ] + } + ) { + evo_id + evo_datefrom + evo_dateto + evo_risk + evo_category + evo_min_period + evo_max_period + evo_object_type + evo_use_for + evo_min_price + evo_max_price + evo_min_year + evo_max_year + evo_min_power + evo_max_power + evo_enginie_type + evo_opf + evo_min_mileage + evo_max_mileage + evo_brand + evo_model + evo_region + evo_dealer + evo_rules_type + evo_message + evo_discount + evo_insurer_accountid + evo_brand + evo_model + evo_region + evo_dealer + evo_brands { + evo_brandid + } + evo_models { + evo_modelid + } + accounts { + accountid + } + evo_regions { + evo_regionid + } } } diff --git a/apps/web/graphql/crm.schema.graphql b/apps/web/graphql/crm.schema.graphql index e5c8f7d..41536a7 100644 --- a/apps/web/graphql/crm.schema.graphql +++ b/apps/web/graphql/crm.schema.graphql @@ -105,6 +105,8 @@ type Query { evo_insurance_periods(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_period] evo_insurance_policy(evo_insurance_policyid: UUID!): evo_insurance_policy evo_insurance_policies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_policy] + evo_insurance_rules(evo_insurance_rulesid: UUID!): evo_insurance_rules + evo_insurance_ruleses(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_rules] evo_job_title(evo_job_titleid: UUID!): evo_job_title evo_job_titles(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_job_title] evo_leasingobject(evo_leasingobjectid: UUID!): evo_leasingobject @@ -2174,8 +2176,8 @@ type systemuser { roles: [role] evo_edo_departmentData: [picklist_value] businessunitidData: businessunit - leads(orderby: OrderByInput): [lead] - opportunities(orderby: OrderByInput): [opportunity] + leads(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [lead] + opportunities(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [opportunity] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String @@ -2270,7 +2272,7 @@ type role { evo_documenttypes: [evo_documenttype] evo_documenttypes_letter: [evo_documenttype] evo_connection_roleData: [evo_connection_role] - systemusers: [systemuser] + systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser] picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String } @@ -2807,9 +2809,9 @@ type quote { evo_statuscodeidData: evo_statuscode evo_evokasko_insurer_accountidData: account evo_supplier_accountidData: account - evo_addproduct_types: [evo_addproduct_type] - evo_product_risks: [evo_product_risk] - evo_graphs: [evo_graph] + evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type] + evo_product_risks(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_product_risk] + evo_graphs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_graph] evo_approvallogs: [evo_approvallog] evo_lessor_bank_detailsidData: evo_bank_details evo_accept_control_addproduct_typeidData: evo_addproduct_type @@ -2819,6 +2821,8 @@ type quote { evo_req_telematicname: String evo_req_telematic_acceptname: String evo_question_credit_committees: [evo_question_credit_committee] + evo_kasko_insurance_rulesidData: evo_insurance_rules + evo_osago_insurance_rulesiddData: evo_insurance_rules ownerid_systemuserData: systemuser ownerid_teamData: team link: String @@ -4082,10 +4086,10 @@ type evo_tarif { organizationid: UUID evo_client_risks: [evo_client_risk] evo_client_types: [evo_client_type] - evo_leasingobject_types: [evo_leasingobject_type] + evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type] evo_models: [evo_model] evo_model_exceptions: [evo_model] - evo_rates: [evo_rate] + evo_rates(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_rate] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String @@ -4265,10 +4269,10 @@ type evo_subsidy { modifiedby: UUID createdby: UUID organizationid: UUID - evo_brands: [evo_brand] - evo_models: [evo_model] - accounts: [account] - evo_leasingobject_types: [evo_leasingobject_type] + evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand] + evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model] + accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account] + evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String @@ -4879,7 +4883,7 @@ type evo_region { modifiedby: UUID createdby: UUID organizationid: UUID - accounts: [account] + accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String @@ -4937,7 +4941,7 @@ type evo_rate { createdby: UUID organizationid: UUID evo_brands: [evo_brand] - evo_tarifs: [evo_tarif] + evo_tarifs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_tarif] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String @@ -5798,8 +5802,8 @@ type evo_leasingobject_type { modifiedby: UUID createdby: UUID organizationid: UUID - evo_subsidies: [evo_subsidy] - evo_vehicle_body_types: [evo_vehicle_body_type] + evo_subsidies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_subsidy] + evo_vehicle_body_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_vehicle_body_type] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String @@ -6024,6 +6028,92 @@ type evo_job_title { twoParamsName(value: Boolean, key: String): String } +type evo_insurance_rules { + toOdata(keys: [String]): [KeyValuePairOfStringAndObject!] + toOdataCreate: [KeyValuePairOfStringAndObject!] + toOdataUpdate: [KeyValuePairOfStringAndObject!] + emptyGuids: [String] + entitySetName: String + primaryId: UUID! + relativePathForUpdate: String + containerFields: [KeyValuePairOfStringAndObject!] + evo_insurance_rulesid: UUID + createdon: DateTime + modifiedon: DateTime + overriddencreatedon: DateTime + evo_dateto: DateTime + evo_datefrom: DateTime + evo_opf: Int + evo_risk: Int + evo_max_year: Int + evo_object_type: Int + evo_dealer: Int + statecode: Int + timezoneruleversionnumber: Int + evo_rules_type: Int + utcconversiontimezonecode: Int + importsequencenumber: Int + evo_brand: Int + evo_max_period: Int + evo_model: Int + evo_min_year: Int + evo_region: Int + statuscode: Int + evo_min_period: Int + evo_min_price: Decimal + evo_min_mileage: Decimal + evo_min_power: Decimal + evo_max_power: Decimal + evo_max_price: Decimal + evo_max_mileage: Decimal + evo_discount: Decimal + modifiedbyname: String + evo_insurer_accountidname: String + evo_message: String + evo_id: String + createdonbehalfbyname: String + createdbyyominame: String + evo_name: String + createdbyname: String + modifiedonbehalfbyname: String + createdonbehalfbyyominame: String + modifiedbyyominame: String + evo_insurer_accountidyominame: String + modifiedonbehalfbyyominame: String + organizationidname: String + evo_use_for: [Int!] + evo_enginie_type: [Int!] + evo_category: [Int!] + createdonbehalfby: UUID + modifiedonbehalfby: UUID + evo_insurer_accountid: UUID + createdby: UUID + modifiedby: UUID + organizationid: UUID + evo_models: [evo_model] + evo_brands: [evo_brand] + evo_regions: [evo_region] + accounts: [account] + evo_riskname: String + evo_rules_typename: String + evo_brandname: String + evo_modelname: String + evo_regionname: String + evo_dealername: String + evo_categorynames: [String] + evo_use_fornames: [String] + evo_enginie_typenames: [String] + evo_opfname: String + evo_object_typename: String + ownerid_systemuser: UUID + ownerid_team: UUID + ownerid_systemuserData: systemuser + ownerid_teamData: team + link: String + picklistName(value: Int, key: String): String + twoParamsName(value: Boolean, key: String): String +} + type evo_insurance_policy { toOdata(keys: [String]): [KeyValuePairOfStringAndObject!] toOdataCreate: [KeyValuePairOfStringAndObject!] @@ -6593,7 +6683,7 @@ type evo_graph { modifiedonbehalfby: UUID ownerid_systemuser: UUID ownerid_team: UUID - evo_planpayments: [evo_planpayment] + evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment] ownerid_systemuserData: systemuser ownerid_teamData: team link: String @@ -8344,9 +8434,9 @@ type evo_coefficient { evo_businessunitid: UUID organizationid: UUID evo_job_titleid: UUID - evo_leasingobject_types: [evo_leasingobject_type] - evo_businessunits: [evo_businessunit] - evo_baseproducts: [evo_baseproduct] + evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type] + evo_businessunits(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_businessunit] + evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct] evo_sot_coefficient_typeidData: evo_sot_coefficient_type link: String picklistName(value: Int, key: String): String @@ -8633,12 +8723,12 @@ type evo_baseproduct { modifiedby: UUID createdby: UUID organizationid: UUID - evo_leasingobject_types: [evo_leasingobject_type] - evo_brands: [evo_brand] - systemusers: [systemuser] - accounts: [account] + evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type] + evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand] + systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser] + accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account] evo_coefficients: [evo_coefficient] - evo_baseproducts: [evo_baseproduct] + evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String @@ -9226,11 +9316,11 @@ type evo_addproduct_type { modifiedonbehalfby: UUID organizationid: UUID evo_accountid: UUID - evo_leasingobject_types: [evo_leasingobject_type] - evo_planpayments: [evo_planpayment] - evo_addproduct_types: [evo_addproduct_type] - evo_models: [evo_model] - evo_brands: [evo_brand] + evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type] + evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment] + evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type] + evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model] + evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand] link: String picklistName(value: Int, key: String): String twoParamsName(value: Boolean, key: String): String diff --git a/apps/web/graphql/crm.types.ts b/apps/web/graphql/crm.types.ts index b08f824..44f33ec 100644 --- a/apps/web/graphql/crm.types.ts +++ b/apps/web/graphql/crm.types.ts @@ -1922,7 +1922,7 @@ export type GetQuoteDataQueryVariables = Exact<{ }>; -export type GetQuoteDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_accept_control_addproduct_typeid: string | null, evo_sale_bonus: number | null, evo_baseproductid: string | null, evo_client_typeid: string | null, evo_msfo_irr: number | null, evo_delivery_time: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_period: number | null, evo_accept_period: number | null, evo_rateid: string | null, evo_min_change_price: number | null, evo_max_price_change: number | null, evo_floating_rate: boolean | null, evo_sale_without_nds: boolean | null, evo_price_with_discount: boolean | null, evo_price_without_discount_quote: boolean | null, evo_cost_increace: boolean | null, evo_insurance: boolean | null, evo_registration_quote: boolean | null, evo_card_quote: boolean | null, evo_nsib_quote: boolean | null, evo_redemption_graph: boolean | null, evo_fingap_quote: boolean | null, evo_contact_name: string | null, evo_gender: number | null, evo_last_payment_redemption: boolean | null, evo_full_nds_price: boolean | null, evo_kasko_accountid: string | null, evo_kasko_price: number | null, evo_id_elt_kasko: string | null, evo_id_kasko_calc: string | null, evo_franchise: number | null, evo_osago_accountid: string | null, evo_id_elt_osago: string | null, evo_osago_price: number | null, 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_req_telematic: number | null, evo_req_telematic_accept: number | null, evo_osago_payer: number | null, evo_kasko_payer: number | null, evo_insurance_period: number | null, evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null, evo_fingap_price: number | null, evo_gps_brandid: string | null, evo_gps_modelid: string | null, evo_insurance_decentral: boolean | null, evo_unlimit_drivers: boolean | null, evo_age_drivers: number | null, evo_exp_drivers: number | null, evo_brandid: string | null, evo_category: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | 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, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_subsidyid: string | null, evo_program_import_subsidyid: string | null, 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, evo_supplier_financing: boolean | null, evo_comission_rub: number | null, evo_comission_perc: number | null, evo_discount_perc: number | null, evo_discount_supplier_currency: number | null, evo_first_payment_rub: number | null, evo_last_payment_calc: 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, evo_equip_price: number | null, evo_coefficien_bonus_reducttion: number | null, evo_accept_limit_quote: boolean | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_addproduct_typeid: string | null } | null> | 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, evo_leadidData: { __typename?: 'lead', evo_agent_accountid: string | null, evo_double_agent_accountid: string | null, evo_broker_accountid: string | null, evo_fin_department_accountid: string | null } | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null } | null }; +export type GetQuoteDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_accept_control_addproduct_typeid: string | null, evo_sale_bonus: number | null, evo_baseproductid: string | null, evo_client_typeid: string | null, evo_msfo_irr: number | null, evo_delivery_time: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_period: number | null, evo_accept_period: number | null, evo_rateid: string | null, evo_min_change_price: number | null, evo_max_price_change: number | null, evo_floating_rate: boolean | null, evo_sale_without_nds: boolean | null, evo_price_with_discount: boolean | null, evo_price_without_discount_quote: boolean | null, evo_cost_increace: boolean | null, evo_insurance: boolean | null, evo_registration_quote: boolean | null, evo_card_quote: boolean | null, evo_nsib_quote: boolean | null, evo_redemption_graph: boolean | null, evo_fingap_quote: boolean | null, evo_contact_name: string | null, evo_gender: number | null, evo_last_payment_redemption: boolean | null, evo_full_nds_price: boolean | null, evo_kasko_accountid: string | null, evo_kasko_price: number | null, evo_id_elt_kasko: string | null, evo_id_kasko_calc: string | null, evo_franchise: number | null, evo_osago_accountid: string | null, evo_id_elt_osago: string | null, evo_osago_price: number | null, 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_req_telematic: number | null, evo_req_telematic_accept: number | null, evo_osago_payer: number | null, evo_kasko_payer: number | null, evo_insurance_period: number | null, evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null, evo_fingap_price: number | null, evo_gps_brandid: string | null, evo_gps_modelid: string | null, evo_insurance_decentral: boolean | null, evo_unlimit_drivers: boolean | null, evo_age_drivers: number | null, evo_exp_drivers: number | null, evo_brandid: string | null, evo_category: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | 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, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_subsidyid: string | null, evo_program_import_subsidyid: string | null, 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, evo_supplier_financing: boolean | null, evo_comission_rub: number | null, evo_comission_perc: number | null, evo_discount_perc: number | null, evo_discount_supplier_currency: number | null, evo_first_payment_rub: number | null, evo_last_payment_calc: 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, evo_equip_price: number | null, evo_coefficien_bonus_reducttion: number | null, evo_accept_limit_quote: boolean | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_addproduct_typeid: string | null } | null> | 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, evo_leadidData: { __typename?: 'lead', evo_agent_accountid: string | null, evo_double_agent_accountid: string | null, evo_broker_accountid: string | null, evo_fin_department_accountid: string | null } | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null, evo_kasko_insurance_rulesidData: { __typename?: 'evo_insurance_rules', evo_id: string | null } | null, evo_osago_insurance_rulesiddData: { __typename?: 'evo_insurance_rules', evo_id: string | null } | null } | null }; export type GetTarifsQueryVariables = Exact<{ currentDate: InputMaybe; @@ -2223,12 +2223,19 @@ export type GetInsuranceCompanyQueryVariables = Exact<{ }>; -export type GetInsuranceCompanyQuery = { __typename?: 'Query', account: { __typename?: 'account', evo_osago_with_kasko: boolean | null, evo_legal_region_calc: boolean | null, accountid: string | null } | null }; +export type GetInsuranceCompanyQuery = { __typename?: 'Query', account: { __typename?: 'account', evo_osago_with_kasko: boolean | null, evo_legal_region_calc: boolean | null, accountid: string | null, evo_kasko_fact_part: number | null, evo_kasko_plan_part: number | null } | null }; export type GetInsuranceCompaniesQueryVariables = Exact<{ [key: string]: never; }>; -export type GetInsuranceCompaniesQuery = { __typename?: 'Query', accounts: Array<{ __typename?: 'account', evo_type_ins_policy: Array | null, evo_evokasko_access: boolean | null, evo_inn: string | null, evo_id_elt_osago: string | null, evo_id_elt: string | null, evo_id_elt_smr: string | null, evo_osago_id: string | null, value: string | null, label: string | null } | null> | null }; +export type GetInsuranceCompaniesQuery = { __typename?: 'Query', accounts: Array<{ __typename?: 'account', evo_type_ins_policy: Array | null, evo_evokasko_access: boolean | null, evo_inn: string | null, evo_id_elt_osago: string | null, evo_id_elt: string | null, evo_id_elt_smr: string | null, evo_osago_id: string | null, evo_kasko_category: Array | null, evo_osago_category: Array | null, value: string | null, label: string | null } | null> | null }; + +export type GetEltInsuranceRulesQueryVariables = Exact<{ + currentDate: InputMaybe; +}>; + + +export type GetEltInsuranceRulesQuery = { __typename?: 'Query', evo_insurance_ruleses: Array<{ __typename?: 'evo_insurance_rules', evo_id: string | null, evo_datefrom: string | null, evo_dateto: string | null, evo_risk: number | null, evo_category: Array | null, evo_min_period: number | null, evo_max_period: number | null, evo_object_type: number | null, evo_use_for: Array | null, evo_min_price: number | null, evo_max_price: number | null, evo_min_year: number | null, evo_max_year: number | null, evo_min_power: number | null, evo_max_power: number | null, evo_enginie_type: Array | null, evo_opf: number | null, evo_min_mileage: number | null, evo_max_mileage: number | null, evo_brand: number | null, evo_model: number | null, evo_region: number | null, evo_dealer: number | null, evo_rules_type: number | null, evo_message: string | null, evo_discount: number | null, evo_insurer_accountid: string | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null, accounts: Array<{ __typename?: 'account', accountid: string | null } | null> | null, evo_regions: Array<{ __typename?: 'evo_region', evo_regionid: string | null } | null> | null } | null> | null }; export type GetRolesQueryVariables = Exact<{ roleName: InputMaybe; @@ -2247,7 +2254,7 @@ export const GetOpportunityDocument = {"kind":"Document","definitions":[{"kind": 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":"systemusers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionString"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"domainname","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderby"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"createdon","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"sortingType"},"value":{"kind":"EnumValue","value":"DESC"}}]}}],"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":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionGuid"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_leadid","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"statecode","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"0"}}]}}]}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"orderby"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"createdon","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"sortingType"},"value":{"kind":"EnumValue","value":"DESC"}}]}}],"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_statuscodeidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_purchases_participation"}}]}}]}}]} 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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_one_year_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidy_sum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_approved_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_maximum_percentage_av"}},{"kind":"Field","name":{"kind":"Name","value":"evo_untype_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_percent_subsidy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_programsolution"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_promotion"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"link"}},{"kind":"Field","name":{"kind":"Name","value":"evo_committee_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_msfo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_quoteid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib"}},{"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_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasing_bonus_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_card_bonus_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib_bonus_summ"}}]}}]}}]} as unknown as DocumentNode; -export const GetQuoteDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteData"},"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_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_accept_control_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_client_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_msfo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"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_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_floating_rate"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_with_discount"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_discount_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_increace"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_card_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_redemption_graph"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_contact_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gender"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_redemption"}},{"kind":"Field","name":{"kind":"Name","value":"evo_full_nds_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_kasko"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_kasko_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_franchise"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_osago"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_price"}},{"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_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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic_accept"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gps_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance_decentral"}},{"kind":"Field","name":{"kind":"Name","value":"evo_unlimit_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_age_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_exp_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"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_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"}},{"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"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidyid"}},{"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leadidData"},"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_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"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_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_coefficien_bonus_reducttion"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_limit_quote"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteData"},"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_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_accept_control_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_client_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_msfo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"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_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_floating_rate"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_with_discount"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_discount_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_increace"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_card_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_redemption_graph"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_contact_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gender"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_redemption"}},{"kind":"Field","name":{"kind":"Name","value":"evo_full_nds_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_kasko"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_kasko_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_franchise"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_osago"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_price"}},{"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_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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic_accept"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gps_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance_decentral"}},{"kind":"Field","name":{"kind":"Name","value":"evo_unlimit_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_age_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_exp_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"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_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"}},{"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"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidyid"}},{"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leadidData"},"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_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"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_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_coefficien_bonus_reducttion"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_limit_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_insurance_rulesidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_insurance_rulesiddData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}}]}}]}}]} 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":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"statecode","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"0"}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_datefrom","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_dateto","block":false}},{"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"}},{"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_pl_use_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_rules"}},{"kind":"Field","name":{"kind":"Name","value":"evo_floating_rate"}}]}}]}}]} 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","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_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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_datefrom"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type"}},{"kind":"Field","name":{"kind":"Name","value":"statecode"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_irr_plan"}},{"kind":"Field","name":{"kind":"Name","value":"evo_margin_min"}}]}}]}}]} 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":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"statecode","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"0"}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_datefrom","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_dateto","block":false}},{"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"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}}]}}]}}]} as unknown as DocumentNode; @@ -2291,6 +2298,7 @@ export const GetTrackerTypesDocument = {"kind":"Document","definitions":[{"kind" export const GetInsNsibTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsNSIBTypes"},"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":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"statecode","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"0"}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_datefrom","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_dateto","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_product_type","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"100000002"}}]}}]}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_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":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"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"}}]}}]} as unknown as DocumentNode; export const GetLeasingWithoutKaskoTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoTypes"},"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":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"statecode","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"0"}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_datefrom","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_dateto","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_product_type","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"100000007"}}]}}]}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"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"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"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"}}]}}]} as unknown as DocumentNode; export const GetOsagoAddproductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOsagoAddproductTypes"},"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":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"statecode","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"0"}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_datefrom","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_dateto","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_product_type","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"100000008"}}]}}]}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_seats_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_seats_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}}]}}]} as unknown as DocumentNode; -export const GetInsuranceCompanyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompany"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"account"},"name":{"kind":"Name","value":"insurance"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_osago_with_kasko"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_region_calc"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]} as unknown as DocumentNode; -export const GetInsuranceCompaniesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompanies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"accounts"},"name":{"kind":"Name","value":"insurances"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_type_ins_policy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_evokasko_access"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"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","name":{"kind":"Name","value":"evo_id_elt_osago"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_smr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_id"}}]}}]}}]} as unknown as DocumentNode; +export const GetInsuranceCompanyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompany"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"account"},"name":{"kind":"Name","value":"insurance"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_osago_with_kasko"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_region_calc"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_fact_part"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_plan_part"}}]}}]}}]} as unknown as DocumentNode; +export const GetInsuranceCompaniesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompanies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"accounts"},"name":{"kind":"Name","value":"insurances"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_type_ins_policy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_evokasko_access"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"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","name":{"kind":"Name","value":"evo_id_elt_osago"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_smr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_category"}}]}}]}}]} as unknown as DocumentNode; +export const GetEltInsuranceRulesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetEltInsuranceRules"},"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_insurance_ruleses"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionInt"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"statecode","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"IntValue","value":"0"}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_datefrom","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionDateTime"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"evo_dateto","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}]}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_datefrom"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dateto"}},{"kind":"Field","name":{"kind":"Name","value":"evo_risk"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"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_object_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"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_min_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_enginie_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_opf"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brand"}},{"kind":"Field","name":{"kind":"Name","value":"evo_model"}},{"kind":"Field","name":{"kind":"Name","value":"evo_region"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rules_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_message"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurer_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brand"}},{"kind":"Field","name":{"kind":"Name","value":"evo_model"}},{"kind":"Field","name":{"kind":"Name","value":"evo_region"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer"}},{"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":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_regions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetRolesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRoles"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"roleName"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"roles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filterConditionGroup"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"andFilterConditions"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filterConditionString"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fieldName"},"value":{"kind":"StringValue","value":"name","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"roleName"}}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"systemusers"},"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":"domainname"}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/apps/web/pages/_app.jsx b/apps/web/pages/_app.jsx index 4f18e48..216d2f5 100644 --- a/apps/web/pages/_app.jsx +++ b/apps/web/pages/_app.jsx @@ -29,7 +29,10 @@ const colorPrimary = getColors().COLOR_PRIMARY; function App({ Component, pageProps }) { const { initialApolloState, initialQueryState } = pageProps; - const apolloClient = useMemo(() => initializeApollo(initialApolloState), [initialApolloState]); + const apolloClient = useMemo( + () => initializeApollo(initialApolloState, {}), + [initialApolloState] + ); const queryClient = useMemo(() => initializeQueryClient(initialQueryState), [initialQueryState]); const { loading } = usePageLoading(); diff --git a/apps/web/process/elt/get-kp-data.ts b/apps/web/process/elt/get-kp-data.ts index fe306c7..396f321 100644 --- a/apps/web/process/elt/get-kp-data.ts +++ b/apps/web/process/elt/get-kp-data.ts @@ -1,28 +1,37 @@ import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types'; +import { defaultRow } from '@/stores/tables/elt/default-values'; export async function getKPData({ quote }: GetQuoteInputData): Promise { const elt: NonNullable = { kasko: undefined, osago: undefined }; if ( quote?.evo_kasko_accountid && - quote?.evo_id_elt_kasko && - quote?.evo_id_kasko_calc && + ((quote?.evo_id_elt_kasko && quote?.evo_id_kasko_calc) || + quote.evo_kasko_insurance_rulesidData?.evo_id) && quote?.evo_kasko_price && quote?.evo_franchise !== null ) { elt.kasko = { + insuranceCondition: + quote.evo_kasko_insurance_rulesidData?.evo_id ?? defaultRow.insuranceCondition, key: quote?.evo_kasko_accountid, - requestId: quote?.evo_id_elt_kasko, - skCalcId: quote?.evo_id_kasko_calc, + requestId: quote?.evo_id_elt_kasko ?? defaultRow.requestId, + skCalcId: quote?.evo_id_kasko_calc ?? defaultRow.skCalcId, sum: quote?.evo_kasko_price, totalFranchise: quote?.evo_franchise, }; } - if (quote?.evo_osago_accountid && quote?.evo_id_elt_osago && quote?.evo_osago_price) { + if ( + quote?.evo_osago_accountid && + (quote?.evo_id_elt_osago || quote.evo_osago_insurance_rulesiddData?.evo_id) && + quote?.evo_osago_price + ) { elt.osago = { + insuranceCondition: + quote.evo_osago_insurance_rulesiddData?.evo_id ?? defaultRow.insuranceCondition, key: quote?.evo_osago_accountid, - numCalc: quote?.evo_id_elt_osago, + numCalc: quote?.evo_id_elt_osago ?? defaultRow.numCalc, sum: quote?.evo_osago_price, }; } diff --git a/apps/web/process/elt/lib/helper.ts b/apps/web/process/elt/lib/helper.ts index a9084b1..1d54bde 100644 --- a/apps/web/process/elt/lib/helper.ts +++ b/apps/web/process/elt/lib/helper.ts @@ -30,14 +30,23 @@ export default function helper({ ({ evo_leasingobject_type } = data); } + // const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue(); + return { kasko: (accounts - ?.filter((x) => - x?.evo_type_ins_policy?.includes(100_000_000) && - evo_leasingobject_type?.evo_id && - ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id) - ? Boolean(x.evo_id_elt_smr) - : Boolean(x?.evo_id_elt) + ?.filter( + (x) => + x?.evo_type_ins_policy?.includes(100_000_000) && + // leaseObjectCategory && + // x.evo_kasko_category?.includes(leaseObjectCategory) && + evo_leasingobject_type?.evo_id + ) + .filter( + (x) => + (evo_leasingobject_type?.evo_id && + ['6', '9', '10'].includes(evo_leasingobject_type.evo_id) && + x?.evo_id_elt_smr) || + x?.evo_id_elt ) .map((x) => ({ ...defaultRow, @@ -53,6 +62,8 @@ export default function helper({ ?.filter( (x) => x?.evo_type_ins_policy?.includes(100_000_001) && + // leaseObjectCategory && + // x.evo_osago_category?.includes(leaseObjectCategory) && (x?.evo_id_elt_osago || x.evo_osago_id) ) .map((x) => ({ diff --git a/apps/web/process/elt/lib/response.ts b/apps/web/process/elt/lib/response.ts new file mode 100644 index 0000000..517f252 --- /dev/null +++ b/apps/web/process/elt/lib/response.ts @@ -0,0 +1,284 @@ +/* eslint-disable sonarjs/cognitive-complexity */ +/* eslint-disable complexity */ +import type { ownOsagoRequest } from './request'; +import { getInsuranceRule } from './tools'; +import type { BaseConvertResponseInput } from './types'; +import type * as ELT from '@/api/elt/types'; +import type { Row } from '@/Components/Calculation/Form/ELT/types'; +import { MAX_FRANCHISE, MAX_INSURANCE, MIN_INSURANCE } from '@/constants/values'; +import * as CRMTypes from '@/graphql/crm.types'; +import { defaultRow } from '@/stores/tables/elt/default-values'; +import { round } from 'tools'; + +type ConvertEltOsagoResponseInput = BaseConvertResponseInput & { + response: ELT.ResponseEltOsago; +}; + +export async function convertEltOsagoResponse(input: ConvertEltOsagoResponseInput): Promise { + const { context, response, row } = input; + const { store } = context; + + const { premiumSum = 0 } = response; + let { message, numCalc, skCalcId, error } = response; + let sum = premiumSum; + + const { $calculation } = store; + + const cost = + $calculation.$values.getValue('plPriceRub') - + $calculation.$values.getValue('discountRub') - + $calculation.$values.getValue('importProgramSum') + + $calculation.$values.getValue('addEquipmentPrice'); + + const selectedRule = await getInsuranceRule(input, { cost, riskType: 'osago' }); + + const insuranceCondition = selectedRule?.evo_id ?? null; + + if (selectedRule) { + const rule_evo_discount = selectedRule.evo_discount ?? 0; + + switch (selectedRule.evo_rules_type) { + // "не выводить результат расчета" + case 100_000_000: { + sum = 0; + numCalc = Number.parseInt(defaultRow.numCalc, 2); + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + break; + } + + // "проверка на мин.тариф" + case 100_000_001: { + const newSum = round((sum / cost) * 100, 2); + if (newSum < rule_evo_discount) { + sum = 0; + numCalc = Number.parseInt(defaultRow.numCalc, 2); + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + } + break; + } + + // "скидка за счет КВ" + case 100_000_002: { + sum = (sum * (100 - rule_evo_discount)) / 100; + numCalc = Number.parseInt(defaultRow.numCalc, 2); + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + break; + } + + // "акционный тариф" + case 100_000_003: { + sum = (rule_evo_discount / 100) * cost; + numCalc = Number.parseInt(defaultRow.numCalc, 2); + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + break; + } + } + } + + if (sum > MAX_INSURANCE) { + error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости ОСАГО: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MAX_INSURANCE)}`; + } + if (sum < MIN_INSURANCE) { + error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости ОСАГО: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MIN_INSURANCE)}`; + } + + return { + ...row, + insuranceCondition, + message: error || message, + numCalc: `${numCalc}`, + skCalcId, + status: error ? 'error' : null, + sum, + }; +} + +type ResponseOwnOsago = Awaited>; + +export function convertOwnOsagoResult(result: ResponseOwnOsago | undefined, row: Row): Row { + if (!result) { + return { + ...row, + message: + 'Для получения расчета ОСАГО следует использовать калькулятор ЭЛТ или Индивидуальный запрос', + numCalc: '', + skCalcId: '', + status: 'error', + sum: 0, + totalFranchise: 0, + }; + } + + if (!result.evo_id) { + return { + ...row, + message: 'Сервер не вернул идентификатор страховки evo_id', + numCalc: '', + skCalcId: '', + status: 'error', + sum: result.evo_graph_price_withoutnds || 0, + }; + } + + return { + ...row, + message: null, + numCalc: result.evo_id, + status: null, + sum: result.evo_graph_price_withoutnds || 0, + }; +} + +type ConvertEltKaskoResponseInput = BaseConvertResponseInput & { + response: ELT.ResponseEltKasko; +}; + +export async function convertEltKaskoResponse(input: ConvertEltKaskoResponseInput): Promise { + const { context, response, row } = input; + const { apolloClient, store } = context; + + const { kaskoSum = 0, paymentPeriods } = response; + let { message, requestId, skCalcId, totalFranchise = 0, error } = response; + + const { $calculation } = store; + const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); + let sum = leasingPeriod <= 16 ? kaskoSum : paymentPeriods?.[0]?.kaskoSum || 0; + + const { + data: { account: insuranceCompany }, + } = await apolloClient.query({ + query: CRMTypes.GetInsuranceCompanyDocument, + variables: { accountId: row.key }, + }); + + if ( + insuranceCompany?.evo_kasko_fact_part !== null && + insuranceCompany?.evo_kasko_plan_part !== undefined && + insuranceCompany?.evo_kasko_plan_part !== null && + insuranceCompany?.evo_kasko_plan_part !== undefined && + insuranceCompany?.evo_kasko_fact_part > insuranceCompany?.evo_kasko_plan_part + ) { + requestId = defaultRow.requestId; + skCalcId = defaultRow.skCalcId; + sum = defaultRow.sum; + totalFranchise = defaultRow.totalFranchise; + error = 'Расчет возможен только через отдел страхования ЛК'; + } + + const cost = + $calculation.$values.getValue('plPriceRub') - + $calculation.$values.getValue('discountRub') - + $calculation.$values.getValue('importProgramSum') + + $calculation.$values.getValue('addEquipmentPrice'); + + const selectedRule = await getInsuranceRule(input, { cost, riskType: 'kasko' }); + + const insuranceCondition = selectedRule?.evo_id ?? null; + + if (selectedRule) { + const rule_evo_discount = selectedRule.evo_discount ?? 0; + + switch (selectedRule.evo_rules_type) { + // "не выводить результат расчета" + case 100_000_000: { + sum = 0; + requestId = defaultRow.requestId; + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + totalFranchise = 0; + break; + } + + // "проверка на мин.тариф" + case 100_000_001: { + const newSum = round((sum / cost) * 100, 2); + if (newSum < rule_evo_discount) { + sum = 0; + requestId = defaultRow.requestId; + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + totalFranchise = 0; + } + break; + } + + // "скидка за счет КВ" + case 100_000_002: { + sum = (sum * (100 - rule_evo_discount)) / 100; + requestId = defaultRow.requestId; + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + totalFranchise = 0; + break; + } + + // "акционный тариф" + case 100_000_003: { + sum = (rule_evo_discount / 100) * cost; + requestId = defaultRow.requestId; + skCalcId = defaultRow.skCalcId; + if (selectedRule.evo_message) message = selectedRule.evo_message; + totalFranchise = 0; + break; + } + } + } + + if (totalFranchise > MAX_FRANCHISE) { + error ||= `Франшиза по страховке превышает максимально допустимое значение: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MAX_FRANCHISE)}`; + } + + if (sum > MAX_INSURANCE) { + error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости КАСКО: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MAX_INSURANCE)}`; + } + + if (sum < MIN_INSURANCE) { + error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости КАСКО: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MIN_INSURANCE)}`; + } + + return { + ...row, + insuranceCondition, + message: error || message, + numCalc: '0', + requestId, + skCalcId, + status: error ? 'error' : null, + sum, + totalFranchise, + }; +} diff --git a/apps/web/process/elt/lib/tools.ts b/apps/web/process/elt/lib/tools.ts new file mode 100644 index 0000000..e324b9c --- /dev/null +++ b/apps/web/process/elt/lib/tools.ts @@ -0,0 +1,142 @@ +/* eslint-disable sonarjs/cognitive-complexity */ +/* eslint-disable complexity */ +import type { BaseConvertResponseInput } from './types'; +import * as CRMTypes from '@/graphql/crm.types'; +import { getCurrentDateString } from '@/utils/date'; +import dayjs from 'dayjs'; +import { sort } from 'radash'; + +type GetInsuranceConditionParams = { + cost: number; + riskType: 'osago' | 'kasko'; +}; + +type Rule = + | NonNullable[number] + | undefined; + +export async function getInsuranceRule( + input: BaseConvertResponseInput, + { cost, riskType }: GetInsuranceConditionParams +) { + const { context, row } = input; + const { apolloClient, store } = context; + + const { $calculation } = store; + const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); + + const currentDate = getCurrentDateString(); + + const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue(); + const leaseObjectYear = $calculation.element('tbxLeaseObjectYear').getValue(); + const leaseObjectMotorPower = $calculation.element('tbxLeaseObjectMotorPower').getValue(); + const engineType = $calculation.element('selectEngineType').getValue(); + const tbxMileage = $calculation.element('tbxMileage').getValue(); + const brand = $calculation.element('selectBrand').getValue(); + const model = $calculation.element('selectModel').getValue(); + const selectLeaseObjectUseFor = $calculation.element('selectLeaseObjectUseFor').getValue(); + const legalClientRegion = $calculation.element('selectLegalClientRegion').getValue(); + const dealerPerson = $calculation.element('selectDealerPerson').getValue(); + const cbxLeaseObjectUsed = $calculation.element('cbxLeaseObjectUsed').getValue(); + + let lead: CRMTypes.GetLeadQuery['lead'] = null; + const leadid = $calculation.element('selectLead').getValue(); + if (leadid) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { leadid }, + }); + ({ lead } = data); + } + const insuranceOPF = lead?.evo_inn?.length === 12 ? 100_000_001 : 100_000_000; + + const { + data: { evo_insurance_ruleses }, + } = await apolloClient.query({ + query: CRMTypes.GetEltInsuranceRulesDocument, + variables: { + currentDate, + }, + }); + + const { + data: { account: insuranceCompany }, + } = await apolloClient.query({ + query: CRMTypes.GetInsuranceCompanyDocument, + variables: { accountId: row.key }, + }); + + const filteredRules = evo_insurance_ruleses?.filter( + (rule) => + rule && + rule.evo_insurer_accountid === insuranceCompany?.accountid && + (riskType === 'kasko' ? rule.evo_risk === 100_000_000 : rule.evo_risk === 100_000_003) && + leaseObjectCategory && + rule.evo_category?.includes(leaseObjectCategory) && + rule.evo_min_period !== null && + rule.evo_max_period !== null && + leasingPeriod !== null && + rule.evo_min_period <= leasingPeriod && + rule.evo_max_period >= leasingPeriod && + (rule.evo_object_type === 100_000_000 || + (rule.evo_object_type === 100_000_001 && cbxLeaseObjectUsed === false) || + (rule.evo_object_type === 100_000_002 && cbxLeaseObjectUsed === true)) && + selectLeaseObjectUseFor && + rule.evo_use_for?.includes(selectLeaseObjectUseFor) && + rule.evo_min_price !== null && + rule.evo_max_price !== null && + cost !== null && + rule.evo_min_price <= cost && + rule.evo_max_price >= cost && + rule.evo_min_year !== null && + rule.evo_max_year !== null && + leaseObjectYear !== null && + rule.evo_min_year <= leaseObjectYear && + rule.evo_max_year >= leaseObjectYear && + rule.evo_min_power !== null && + rule.evo_max_power !== null && + leaseObjectMotorPower !== null && + rule.evo_min_power <= leaseObjectMotorPower && + rule.evo_max_power >= leaseObjectMotorPower && + engineType && + rule.evo_enginie_type?.includes(engineType) && + rule.evo_opf === insuranceOPF && + rule.evo_min_mileage !== null && + rule.evo_max_mileage !== null && + tbxMileage !== null && + rule.evo_min_mileage <= tbxMileage && + rule.evo_max_mileage >= tbxMileage && + (rule.evo_brand === 100_000_000 || + (rule.evo_brand === 100_000_001 && + rule.evo_brands?.some((x) => x?.evo_brandid === brand)) || + (rule.evo_brand === 100_000_002 && + !rule.evo_brands?.some((x) => x?.evo_brandid === brand))) && + (rule.evo_model === 100_000_000 || + (rule.evo_model === 100_000_001 && + rule.evo_models?.some((x) => x?.evo_modelid === model)) || + (rule.evo_model === 100_000_002 && + !rule.evo_models?.some((x) => x?.evo_modelid === model))) && + (rule.evo_region === 100_000_000 || + (rule.evo_region === 100_000_001 && + rule.evo_regions?.some((x) => x?.evo_regionid === legalClientRegion)) || + (rule.evo_region === 100_000_002 && + !rule.evo_regions?.some((x) => x?.evo_regionid === legalClientRegion))) && + (rule.evo_dealer === 100_000_000 || + (rule.evo_dealer === 100_000_001 && + rule.accounts?.some((x) => x?.accountid === dealerPerson)) || + (rule.evo_dealer === 100_000_002 && + !rule.accounts?.some((x) => x?.accountid === dealerPerson))) + ); + + // Обработка найденных записей по приоритету + const sortedRules = filteredRules + ? sort(filteredRules, (x) => dayjs(x?.evo_datefrom).date(), true) + : []; + + const priorities = [100_000_000, 100_000_003, 100_000_001, 100_000_002]; + + return priorities.reduce( + (found, priority) => found || sortedRules.find((rule) => rule?.evo_rules_type === priority), + null as Rule + ); +} diff --git a/apps/web/process/elt/lib/types.ts b/apps/web/process/elt/lib/types.ts new file mode 100644 index 0000000..c949697 --- /dev/null +++ b/apps/web/process/elt/lib/types.ts @@ -0,0 +1,7 @@ +import type { Row } from '@/Components/Calculation/Form/ELT/types'; +import type { ProcessContext } from '@/process/types'; + +export type BaseConvertResponseInput = { + context: Pick; + row: Row; +}; diff --git a/apps/web/process/load-kp/reactions.ts b/apps/web/process/load-kp/reactions.ts index d31370a..489442c 100644 --- a/apps/web/process/load-kp/reactions.ts +++ b/apps/web/process/load-kp/reactions.ts @@ -15,7 +15,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { reaction( () => $calculation.$values.getValue('quote'), - async () => { + () => { const quote = $calculation.element('selectQuote').getOption(); if (!quote || $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP')) @@ -29,8 +29,6 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { onClick: () => message.destroy(key), }); - const eltInitialValues = await initElt(); - trpcClient.getQuote .query({ values: { @@ -38,7 +36,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { ...$calculation.$values.getValues(['lead', 'opportunity', 'recalcWithRevision']), }, }) - .then(({ values, payments, insurance, fingap, elt, options }) => { + .then(async ({ values, payments, insurance, fingap, elt, options }) => { if (options?.selectTarif) { $calculation.element('selectTarif').setOptions(normalizeOptions(options.selectTarif)); } else { @@ -76,6 +74,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { $tables.fingap.setRisks(fingap.risks); $tables.fingap.setSelectedKeys(fingap.keys); } + const eltInitialValues = await initElt(); if (eltInitialValues) { $tables.elt.kasko.setRows(eltInitialValues.kasko); diff --git a/apps/web/server/routers/_app.ts b/apps/web/server/routers/_app.ts index 160ddb4..2562d18 100644 --- a/apps/web/server/routers/_app.ts +++ b/apps/web/server/routers/_app.ts @@ -1,8 +1,9 @@ import { mergeRouters } from '../trpc'; import { calculateRouter } from './calculate'; +import { eltRouter } from './elt'; import { quoteRouter } from './quote'; import { tarifRouter } from './tarif'; -export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter); +export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter, eltRouter); export type AppRouter = typeof appRouter; diff --git a/apps/web/server/routers/elt/index.ts b/apps/web/server/routers/elt/index.ts new file mode 100644 index 0000000..2dbbec7 --- /dev/null +++ b/apps/web/server/routers/elt/index.ts @@ -0,0 +1,5 @@ +import { mergeRouters } from '../../trpc'; +import { eltKaskoRouter } from './kasko'; +import { eltOsagoRouter } from './osago'; + +export const eltRouter = mergeRouters(eltOsagoRouter, eltKaskoRouter); diff --git a/apps/web/server/routers/elt/kasko.ts b/apps/web/server/routers/elt/kasko.ts new file mode 100644 index 0000000..d255a7c --- /dev/null +++ b/apps/web/server/routers/elt/kasko.ts @@ -0,0 +1,45 @@ +import { protectedProcedure } from '../../procedure'; +import { router } from '../../trpc'; +import { EltInputSchema, EltOutputSchema } from './types'; +import { getEltKasko } from '@/api/elt/query'; +import initializeApollo from '@/apollo/client'; +import eltHelper from '@/process/elt/lib/helper'; +import { makeEltKaskoRequest } from '@/process/elt/lib/request'; +import { convertEltKaskoResponse } from '@/process/elt/lib/response'; +import RootStore from '@/stores/root'; +import { createTRPCError } from '@/utils/trpc'; + +export const eltKaskoRouter = router({ + eltKasko: protectedProcedure + .input(EltInputSchema) + .output(EltOutputSchema) + .mutation(async ({ input, ctx }) => { + try { + const apolloClient = initializeApollo(null, ctx.headers); + const store = new RootStore(); + store.$calculation.$values.hydrate(input.calculation.values); + + const context = { apolloClient, store }; + const { init: initElt } = await eltHelper(context); + const { kasko: initRows } = await initElt(); + + const requests = initRows.map((row) => + makeEltKaskoRequest(context, row) + .then((request) => getEltKasko(request)) + .then((response) => convertEltKaskoResponse({ context, response, row })) + .then((convertedRow) => convertedRow) + .catch((error) => ({ + ...row, + message: error.message, + status: 'error', + })) + ); + + return { + rows: await Promise.all(requests), + }; + } catch (error) { + throw createTRPCError(error); + } + }), +}); diff --git a/apps/web/server/routers/elt/osago.ts b/apps/web/server/routers/elt/osago.ts new file mode 100644 index 0000000..31a82e2 --- /dev/null +++ b/apps/web/server/routers/elt/osago.ts @@ -0,0 +1,47 @@ +import { protectedProcedure } from '../../procedure'; +import { router } from '../../trpc'; +import { EltInputSchema, EltOutputSchema } from './types'; +import { getEltOsago } from '@/api/elt/query'; +import initializeApollo from '@/apollo/client'; +import eltHelper from '@/process/elt/lib/helper'; +import { makeEltOsagoRequest, ownOsagoRequest } from '@/process/elt/lib/request'; +import { convertEltOsagoResponse, convertOwnOsagoResult } from '@/process/elt/lib/response'; +import RootStore from '@/stores/root'; +import { createTRPCError } from '@/utils/trpc'; + +export const eltOsagoRouter = router({ + eltOsago: protectedProcedure + .input(EltInputSchema) + .output(EltOutputSchema) + .mutation(async ({ input, ctx }) => { + try { + const apolloClient = initializeApollo(null, ctx.headers); + const store = new RootStore(); + store.$calculation.$values.hydrate(input.calculation.values); + + const context = { apolloClient, store }; + const { init: initElt } = await eltHelper({ apolloClient, store }); + const { osago: initRows } = await initElt(); + + const requests = initRows.map(async (row) => { + if (row.metodCalc === 'CRM') { + return ownOsagoRequest({ apolloClient, store }, row).then((request) => + convertOwnOsagoResult(request, row) + ); + } + + return makeEltOsagoRequest({ apolloClient, store }, row).then((request) => + getEltOsago(request) + .then((response) => convertEltOsagoResponse({ context, response, row })) + .catch((error) => ({ ...row, message: error.message, status: 'error' })) + ); + }); + + return { + rows: await Promise.all(requests), + }; + } catch (error) { + throw createTRPCError(error); + } + }), +}); diff --git a/apps/web/server/routers/elt/types.ts b/apps/web/server/routers/elt/types.ts new file mode 100644 index 0000000..da8f757 --- /dev/null +++ b/apps/web/server/routers/elt/types.ts @@ -0,0 +1,13 @@ +import { RowSchema } from '@/config/schema/elt'; +import ValuesSchema from '@/config/schema/values'; +import { z } from 'zod'; + +export const EltInputSchema = z.object({ + calculation: z.object({ + values: ValuesSchema, + }), +}); + +export const EltOutputSchema = z.object({ + rows: RowSchema.array(), +}); diff --git a/apps/web/server/routers/quote/types.ts b/apps/web/server/routers/quote/types.ts index da11b98..342d63e 100644 --- a/apps/web/server/routers/quote/types.ts +++ b/apps/web/server/routers/quote/types.ts @@ -48,6 +48,7 @@ export const GetQuoteOutputDataSchema = z elt: z .object({ kasko: EltRowSchema.pick({ + insuranceCondition: true, key: true, requestId: true, skCalcId: true, @@ -55,6 +56,7 @@ export const GetQuoteOutputDataSchema = z totalFranchise: true, }).optional(), osago: EltRowSchema.pick({ + insuranceCondition: true, key: true, numCalc: true, sum: true, diff --git a/apps/web/stores/tables/elt/default-values.ts b/apps/web/stores/tables/elt/default-values.ts index a844bc3..d0730b0 100644 --- a/apps/web/stores/tables/elt/default-values.ts +++ b/apps/web/stores/tables/elt/default-values.ts @@ -2,6 +2,7 @@ import type * as ELT from '@/Components/Calculation/Form/ELT/types'; export const defaultRow: ELT.Row = { id: '', + insuranceCondition: null, key: '', message: null, metodCalc: 'ELT', diff --git a/apps/web/utils/axios.ts b/apps/web/utils/axios.ts index d1678eb..aefb72f 100644 --- a/apps/web/utils/axios.ts +++ b/apps/web/utils/axios.ts @@ -4,12 +4,13 @@ import type { AxiosError } from 'axios'; import { isAxiosError } from 'axios'; import { pick } from 'radash'; -function getErrorMessage( - error: AxiosError -) { +function getErrorMessage< + T extends { error?: string; errors?: string[]; fullMessage?: string; message?: string } +>(error: AxiosError) { return ( error.response?.data?.error || error.response?.data?.errors?.[0] || + error.response?.data.fullMessage || error.response?.data?.message || error.message ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7fc70e..7812eed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6983,7 +6983,7 @@ packages: '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.3.3) '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.3.3) eslint: 8.57.0 - jest: 29.7.0(@types/node@18.19.18)(ts-node@10.9.2) + jest: 29.7.0(@types/node@20.11.20)(ts-node@10.9.2) transitivePeerDependencies: - supports-color - typescript @@ -8227,7 +8227,7 @@ packages: '@graphql-tools/json-file-loader': 7.4.18(graphql@16.8.1) '@graphql-tools/load': 7.8.14(graphql@16.8.1) '@graphql-tools/merge': 8.4.2(graphql@16.8.1) - '@graphql-tools/url-loader': 7.17.18(@types/node@20.11.20)(graphql@16.8.1) + '@graphql-tools/url-loader': 7.17.18(@types/node@18.19.18)(graphql@16.8.1) '@graphql-tools/utils': 9.2.1(graphql@16.8.1) cosmiconfig: 8.0.0 graphql: 16.8.1 @@ -9347,7 +9347,7 @@ packages: pretty-format: 29.7.0 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.9.2(@types/node@18.19.18)(typescript@5.3.3) + ts-node: 10.9.2(@types/node@20.11.20)(typescript@5.3.3) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -13271,7 +13271,7 @@ packages: '@babel/core': 7.23.9 bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@18.19.18)(ts-node@10.9.2) + jest: 29.7.0(@types/node@20.11.20)(ts-node@10.9.2) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2