merge branch release/dyn-4497
This commit is contained in:
parent
88b7501b4d
commit
9c63cadf29
@ -14,6 +14,7 @@ export const queryTTL: Record<string, number | false> = {
|
|||||||
GetDealerPerson: seconds().fromHours(1),
|
GetDealerPerson: seconds().fromHours(1),
|
||||||
GetDealerPersons: seconds().fromHours(1),
|
GetDealerPersons: seconds().fromHours(1),
|
||||||
GetDealers: seconds().fromMinutes(15),
|
GetDealers: seconds().fromMinutes(15),
|
||||||
|
GetEltInsuranceRules: seconds().fromHours(12),
|
||||||
GetFuelCards: seconds().fromHours(12),
|
GetFuelCards: seconds().fromHours(12),
|
||||||
GetGPSBrands: seconds().fromHours(24),
|
GetGPSBrands: seconds().fromHours(24),
|
||||||
GetGPSModels: seconds().fromHours(24),
|
GetGPSModels: seconds().fromHours(24),
|
||||||
@ -32,6 +33,7 @@ export const queryTTL: Record<string, number | false> = {
|
|||||||
GetOpportunities: false,
|
GetOpportunities: false,
|
||||||
GetOpportunity: false,
|
GetOpportunity: false,
|
||||||
GetOpportunityUrl: seconds().fromHours(12),
|
GetOpportunityUrl: seconds().fromHours(12),
|
||||||
|
GetOsagoAddproductTypes: seconds().fromHours(12),
|
||||||
GetProduct: seconds().fromHours(12),
|
GetProduct: seconds().fromHours(12),
|
||||||
GetProducts: seconds().fromHours(12),
|
GetProducts: seconds().fromHours(12),
|
||||||
GetQuote: false,
|
GetQuote: false,
|
||||||
|
|||||||
@ -1,129 +1,41 @@
|
|||||||
/* eslint-disable sonarjs/cognitive-complexity */
|
/* eslint-disable sonarjs/cognitive-complexity */
|
||||||
import { PolicyTable, ReloadButton, Validation } from './Components';
|
import { PolicyTable, ReloadButton, Validation } from './Components';
|
||||||
import { columns } from './lib/config';
|
import { columns } from './lib/config';
|
||||||
import { makeEltKaskoRequest } from './lib/make-request';
|
import { resetRow } from './lib/tools';
|
||||||
import type { Row, StoreSelector } from './types';
|
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 { useStore } from '@/stores/hooks';
|
||||||
import { defaultRow } from '@/stores/tables/elt/default-values';
|
import { trpcClient } from '@/trpc/client';
|
||||||
import { useApolloClient } from '@apollo/client';
|
|
||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
import { omit, sift } from 'radash';
|
|
||||||
import { useCallback } from 'react';
|
|
||||||
import { Flex } from 'ui/grid';
|
import { Flex } from 'ui/grid';
|
||||||
|
|
||||||
const storeSelector: StoreSelector = ({ kasko }) => kasko;
|
const storeSelector: StoreSelector = ({ kasko }) => kasko;
|
||||||
|
|
||||||
const initialData = {
|
|
||||||
...omit(defaultRow, ['name', 'key', 'id']),
|
|
||||||
error: null,
|
|
||||||
kaskoSum: 0,
|
|
||||||
paymentPeriods: [
|
|
||||||
{
|
|
||||||
kaskoSum: 0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Kasko = observer(() => {
|
export const Kasko = observer(() => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { $calculation, $tables } = store;
|
const { $calculation, $tables } = store;
|
||||||
const apolloClient = useApolloClient();
|
|
||||||
const { init } = helper({ apolloClient, store });
|
|
||||||
|
|
||||||
const handleOnClick = useCallback(async () => {
|
const calculateKasko = trpcClient.eltKasko.useMutation({
|
||||||
$tables.elt.kasko.abortController?.abort();
|
onError() {
|
||||||
$tables.elt.kasko.abortController = new AbortController();
|
$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();
|
function handleOnClick() {
|
||||||
$tables.elt.kasko.setRows(kasko);
|
calculateKasko.mutate({
|
||||||
const kaskoCompanyIds = sift(
|
calculation: {
|
||||||
$tables.insurance
|
values: store.$calculation.$values.getValues(),
|
||||||
.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',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, [$calculation.$values, $tables.elt.kasko, $tables.insurance, apolloClient, init, store]);
|
}
|
||||||
|
|
||||||
function handleOnSelectRow(row: Row) {
|
function handleOnSelectRow(row: Row) {
|
||||||
$tables.insurance.row('kasko').column('insuranceCompany').setValue(row.key);
|
$tables.insurance.row('kasko').column('insuranceCompany').setValue(row.key);
|
||||||
|
|||||||
@ -2,125 +2,41 @@
|
|||||||
/* eslint-disable sonarjs/cognitive-complexity */
|
/* eslint-disable sonarjs/cognitive-complexity */
|
||||||
import { PolicyTable, ReloadButton, Validation } from './Components';
|
import { PolicyTable, ReloadButton, Validation } from './Components';
|
||||||
import { columns } from './lib/config';
|
import { columns } from './lib/config';
|
||||||
import { makeEltOsagoRequest, makeOwnOsagoRequest } from './lib/make-request';
|
import { resetRow } from './lib/tools';
|
||||||
import type { Row, StoreSelector } from './types';
|
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 { useStore } from '@/stores/hooks';
|
||||||
import { defaultRow } from '@/stores/tables/elt/default-values';
|
import { trpcClient } from '@/trpc/client';
|
||||||
import { useApolloClient } from '@apollo/client';
|
|
||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
import { omit, sift } from 'radash';
|
|
||||||
import { useCallback } from 'react';
|
|
||||||
import { Flex } from 'ui/grid';
|
import { Flex } from 'ui/grid';
|
||||||
|
|
||||||
const storeSelector: StoreSelector = ({ osago }) => osago;
|
const storeSelector: StoreSelector = ({ osago }) => osago;
|
||||||
|
|
||||||
const initialData = {
|
|
||||||
...omit(defaultRow, ['name', 'key', 'id']),
|
|
||||||
error: null,
|
|
||||||
premiumSum: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Osago = observer(() => {
|
export const Osago = observer(() => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { $tables } = store;
|
const { $tables } = store;
|
||||||
const apolloClient = useApolloClient();
|
|
||||||
const { init } = helper({ apolloClient, store });
|
|
||||||
|
|
||||||
const handleOnClick = useCallback(async () => {
|
const calculateOsago = trpcClient.eltOsago.useMutation({
|
||||||
$tables.elt.osago.abortController?.abort();
|
onError() {
|
||||||
$tables.elt.osago.abortController = new AbortController();
|
$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();
|
async function handleOnClick() {
|
||||||
$tables.elt.osago.setRows(osago);
|
calculateOsago.mutate({
|
||||||
const osagoCompanyIds = sift(
|
calculation: {
|
||||||
$tables.insurance
|
values: store.$calculation.$values.getValues(),
|
||||||
.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',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, [$tables.elt.osago, $tables.insurance, apolloClient, init, store]);
|
}
|
||||||
|
|
||||||
function handleOnSelectRow(row: Row) {
|
function handleOnSelectRow(row: Row) {
|
||||||
$tables.insurance.row('osago').column('insuranceCompany').setValue(row.key);
|
$tables.insurance.row('osago').column('insuranceCompany').setValue(row.key);
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
import type { RowSchema } from '@/config/schema/elt';
|
import type { Row } from '../types';
|
||||||
import type { ColumnsType } from 'antd/lib/table';
|
import type { ColumnsType } from 'antd/lib/table';
|
||||||
import { CloseOutlined, LoadingOutlined } from 'ui/elements/icons';
|
import { CloseOutlined, LoadingOutlined } from 'ui/elements/icons';
|
||||||
import { Flex } from 'ui/grid';
|
import { Flex } from 'ui/grid';
|
||||||
import type { z } from 'zod';
|
|
||||||
|
|
||||||
type Row = z.infer<typeof RowSchema>;
|
|
||||||
|
|
||||||
const formatter = Intl.NumberFormat('ru', {
|
const formatter = Intl.NumberFormat('ru', {
|
||||||
currency: 'RUB',
|
currency: 'RUB',
|
||||||
|
|||||||
@ -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<ProcessContext, 'apolloClient' | 'store'>,
|
|
||||||
row: Row
|
|
||||||
): Promise<NonNullable<CRMTypes.GetOsagoAddproductTypesQuery['evo_addproduct_types']>[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<ProcessContext, 'apolloClient' | 'store'>,
|
|
||||||
row: Row
|
|
||||||
): Promise<RequestEltOsago> {
|
|
||||||
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<number, string> = {
|
|
||||||
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<ProcessContext, 'apolloClient' | 'store'>,
|
|
||||||
row: Row
|
|
||||||
): Promise<RequestEltKasko> {
|
|
||||||
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<number, string> = {
|
|
||||||
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<number, number> = {
|
|
||||||
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<number, string> = {
|
|
||||||
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<number, number> = {
|
|
||||||
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),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
12
apps/web/Components/Calculation/Form/ELT/lib/tools.ts
Normal file
12
apps/web/Components/Calculation/Form/ELT/lib/tools.ts
Normal file
@ -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,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -6,24 +6,18 @@ import axios from 'axios';
|
|||||||
|
|
||||||
const { URL_ELT_KASKO, URL_ELT_OSAGO } = getUrls();
|
const { URL_ELT_KASKO, URL_ELT_OSAGO } = getUrls();
|
||||||
|
|
||||||
export async function getEltOsago(
|
export async function getEltOsago(payload: ELT.RequestEltOsago) {
|
||||||
payload: ELT.RequestEltOsago,
|
|
||||||
{ signal }: { signal: AbortSignal }
|
|
||||||
) {
|
|
||||||
return withHandleError(
|
return withHandleError(
|
||||||
axios
|
axios
|
||||||
.post<ELT.ResponseEltOsago>(URL_ELT_OSAGO, payload, { signal, timeout: TIMEOUT })
|
.post<ELT.ResponseEltOsago>(URL_ELT_OSAGO, payload, { timeout: TIMEOUT })
|
||||||
.then(({ data }) => data)
|
.then(({ data }) => data)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getEltKasko(
|
export async function getEltKasko(payload: ELT.RequestEltKasko) {
|
||||||
payload: ELT.RequestEltKasko,
|
|
||||||
{ signal }: { signal: AbortSignal }
|
|
||||||
) {
|
|
||||||
return withHandleError(
|
return withHandleError(
|
||||||
axios
|
axios
|
||||||
.post<ELT.ResponseEltKasko>(URL_ELT_KASKO, payload, { signal, timeout: TIMEOUT })
|
.post<ELT.ResponseEltKasko>(URL_ELT_KASKO, payload, { timeout: TIMEOUT })
|
||||||
.then(({ data }) => data)
|
.then(({ data }) => data)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,10 @@ function createApolloClient(headers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function initializeApollo(initialState, 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);
|
const _apolloClient = apolloClient ?? createApolloClient(headers);
|
||||||
|
|
||||||
// If your page has Next.js data fetching methods that use Apollo Client, the initial state
|
// If your page has Next.js data fetching methods that use Apollo Client, the initial state
|
||||||
|
|||||||
@ -270,6 +270,7 @@ export const ResultEltOsagoSchema = z.object({
|
|||||||
|
|
||||||
export const RowSchema = z.object({
|
export const RowSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
insuranceCondition: z.string().nullable(),
|
||||||
key: z.string(),
|
key: z.string(),
|
||||||
message: z.string().nullable(),
|
message: z.string().nullable(),
|
||||||
metodCalc: z.union([z.literal('CRM'), z.literal('ELT')]),
|
metodCalc: z.union([z.literal('CRM'), z.literal('ELT')]),
|
||||||
|
|||||||
@ -310,6 +310,12 @@ query GetQuoteData($quoteId: UUID!) {
|
|||||||
evo_equip_price
|
evo_equip_price
|
||||||
evo_coefficien_bonus_reducttion
|
evo_coefficien_bonus_reducttion
|
||||||
evo_accept_limit_quote
|
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_osago_with_kasko
|
||||||
evo_legal_region_calc
|
evo_legal_region_calc
|
||||||
accountid
|
accountid
|
||||||
|
evo_kasko_fact_part
|
||||||
|
evo_kasko_plan_part
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,6 +1081,64 @@ query GetInsuranceCompanies {
|
|||||||
evo_id_elt
|
evo_id_elt
|
||||||
evo_id_elt_smr
|
evo_id_elt_smr
|
||||||
evo_osago_id
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,6 +105,8 @@ type Query {
|
|||||||
evo_insurance_periods(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_period]
|
evo_insurance_periods(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_period]
|
||||||
evo_insurance_policy(evo_insurance_policyid: UUID!): evo_insurance_policy
|
evo_insurance_policy(evo_insurance_policyid: UUID!): evo_insurance_policy
|
||||||
evo_insurance_policies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [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_title(evo_job_titleid: UUID!): evo_job_title
|
||||||
evo_job_titles(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_job_title]
|
evo_job_titles(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_job_title]
|
||||||
evo_leasingobject(evo_leasingobjectid: UUID!): evo_leasingobject
|
evo_leasingobject(evo_leasingobjectid: UUID!): evo_leasingobject
|
||||||
@ -2174,8 +2176,8 @@ type systemuser {
|
|||||||
roles: [role]
|
roles: [role]
|
||||||
evo_edo_departmentData: [picklist_value]
|
evo_edo_departmentData: [picklist_value]
|
||||||
businessunitidData: businessunit
|
businessunitidData: businessunit
|
||||||
leads(orderby: OrderByInput): [lead]
|
leads(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [lead]
|
||||||
opportunities(orderby: OrderByInput): [opportunity]
|
opportunities(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [opportunity]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
@ -2270,7 +2272,7 @@ type role {
|
|||||||
evo_documenttypes: [evo_documenttype]
|
evo_documenttypes: [evo_documenttype]
|
||||||
evo_documenttypes_letter: [evo_documenttype]
|
evo_documenttypes_letter: [evo_documenttype]
|
||||||
evo_connection_roleData: [evo_connection_role]
|
evo_connection_roleData: [evo_connection_role]
|
||||||
systemusers: [systemuser]
|
systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser]
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
}
|
}
|
||||||
@ -2807,9 +2809,9 @@ type quote {
|
|||||||
evo_statuscodeidData: evo_statuscode
|
evo_statuscodeidData: evo_statuscode
|
||||||
evo_evokasko_insurer_accountidData: account
|
evo_evokasko_insurer_accountidData: account
|
||||||
evo_supplier_accountidData: account
|
evo_supplier_accountidData: account
|
||||||
evo_addproduct_types: [evo_addproduct_type]
|
evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type]
|
||||||
evo_product_risks: [evo_product_risk]
|
evo_product_risks(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_product_risk]
|
||||||
evo_graphs: [evo_graph]
|
evo_graphs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_graph]
|
||||||
evo_approvallogs: [evo_approvallog]
|
evo_approvallogs: [evo_approvallog]
|
||||||
evo_lessor_bank_detailsidData: evo_bank_details
|
evo_lessor_bank_detailsidData: evo_bank_details
|
||||||
evo_accept_control_addproduct_typeidData: evo_addproduct_type
|
evo_accept_control_addproduct_typeidData: evo_addproduct_type
|
||||||
@ -2819,6 +2821,8 @@ type quote {
|
|||||||
evo_req_telematicname: String
|
evo_req_telematicname: String
|
||||||
evo_req_telematic_acceptname: String
|
evo_req_telematic_acceptname: String
|
||||||
evo_question_credit_committees: [evo_question_credit_committee]
|
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_systemuserData: systemuser
|
||||||
ownerid_teamData: team
|
ownerid_teamData: team
|
||||||
link: String
|
link: String
|
||||||
@ -4082,10 +4086,10 @@ type evo_tarif {
|
|||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
evo_client_risks: [evo_client_risk]
|
evo_client_risks: [evo_client_risk]
|
||||||
evo_client_types: [evo_client_type]
|
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_models: [evo_model]
|
||||||
evo_model_exceptions: [evo_model]
|
evo_model_exceptions: [evo_model]
|
||||||
evo_rates: [evo_rate]
|
evo_rates(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_rate]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
@ -4265,10 +4269,10 @@ type evo_subsidy {
|
|||||||
modifiedby: UUID
|
modifiedby: UUID
|
||||||
createdby: UUID
|
createdby: UUID
|
||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
evo_brands: [evo_brand]
|
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
|
||||||
evo_models: [evo_model]
|
evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model]
|
||||||
accounts: [account]
|
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
|
||||||
evo_leasingobject_types: [evo_leasingobject_type]
|
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
@ -4879,7 +4883,7 @@ type evo_region {
|
|||||||
modifiedby: UUID
|
modifiedby: UUID
|
||||||
createdby: UUID
|
createdby: UUID
|
||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
accounts: [account]
|
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
@ -4937,7 +4941,7 @@ type evo_rate {
|
|||||||
createdby: UUID
|
createdby: UUID
|
||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
evo_brands: [evo_brand]
|
evo_brands: [evo_brand]
|
||||||
evo_tarifs: [evo_tarif]
|
evo_tarifs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_tarif]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
@ -5798,8 +5802,8 @@ type evo_leasingobject_type {
|
|||||||
modifiedby: UUID
|
modifiedby: UUID
|
||||||
createdby: UUID
|
createdby: UUID
|
||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
evo_subsidies: [evo_subsidy]
|
evo_subsidies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_subsidy]
|
||||||
evo_vehicle_body_types: [evo_vehicle_body_type]
|
evo_vehicle_body_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_vehicle_body_type]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
@ -6024,6 +6028,92 @@ type evo_job_title {
|
|||||||
twoParamsName(value: Boolean, key: String): String
|
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 {
|
type evo_insurance_policy {
|
||||||
toOdata(keys: [String]): [KeyValuePairOfStringAndObject!]
|
toOdata(keys: [String]): [KeyValuePairOfStringAndObject!]
|
||||||
toOdataCreate: [KeyValuePairOfStringAndObject!]
|
toOdataCreate: [KeyValuePairOfStringAndObject!]
|
||||||
@ -6593,7 +6683,7 @@ type evo_graph {
|
|||||||
modifiedonbehalfby: UUID
|
modifiedonbehalfby: UUID
|
||||||
ownerid_systemuser: UUID
|
ownerid_systemuser: UUID
|
||||||
ownerid_team: UUID
|
ownerid_team: UUID
|
||||||
evo_planpayments: [evo_planpayment]
|
evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment]
|
||||||
ownerid_systemuserData: systemuser
|
ownerid_systemuserData: systemuser
|
||||||
ownerid_teamData: team
|
ownerid_teamData: team
|
||||||
link: String
|
link: String
|
||||||
@ -8344,9 +8434,9 @@ type evo_coefficient {
|
|||||||
evo_businessunitid: UUID
|
evo_businessunitid: UUID
|
||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
evo_job_titleid: UUID
|
evo_job_titleid: UUID
|
||||||
evo_leasingobject_types: [evo_leasingobject_type]
|
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||||
evo_businessunits: [evo_businessunit]
|
evo_businessunits(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_businessunit]
|
||||||
evo_baseproducts: [evo_baseproduct]
|
evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct]
|
||||||
evo_sot_coefficient_typeidData: evo_sot_coefficient_type
|
evo_sot_coefficient_typeidData: evo_sot_coefficient_type
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
@ -8633,12 +8723,12 @@ type evo_baseproduct {
|
|||||||
modifiedby: UUID
|
modifiedby: UUID
|
||||||
createdby: UUID
|
createdby: UUID
|
||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
evo_leasingobject_types: [evo_leasingobject_type]
|
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||||
evo_brands: [evo_brand]
|
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
|
||||||
systemusers: [systemuser]
|
systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser]
|
||||||
accounts: [account]
|
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
|
||||||
evo_coefficients: [evo_coefficient]
|
evo_coefficients: [evo_coefficient]
|
||||||
evo_baseproducts: [evo_baseproduct]
|
evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
@ -9226,11 +9316,11 @@ type evo_addproduct_type {
|
|||||||
modifiedonbehalfby: UUID
|
modifiedonbehalfby: UUID
|
||||||
organizationid: UUID
|
organizationid: UUID
|
||||||
evo_accountid: UUID
|
evo_accountid: UUID
|
||||||
evo_leasingobject_types: [evo_leasingobject_type]
|
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
|
||||||
evo_planpayments: [evo_planpayment]
|
evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment]
|
||||||
evo_addproduct_types: [evo_addproduct_type]
|
evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type]
|
||||||
evo_models: [evo_model]
|
evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model]
|
||||||
evo_brands: [evo_brand]
|
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
|
||||||
link: String
|
link: String
|
||||||
picklistName(value: Int, key: String): String
|
picklistName(value: Int, key: String): String
|
||||||
twoParamsName(value: Boolean, key: String): String
|
twoParamsName(value: Boolean, key: String): String
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -29,7 +29,10 @@ const colorPrimary = getColors().COLOR_PRIMARY;
|
|||||||
|
|
||||||
function App({ Component, pageProps }) {
|
function App({ Component, pageProps }) {
|
||||||
const { initialApolloState, initialQueryState } = pageProps;
|
const { initialApolloState, initialQueryState } = pageProps;
|
||||||
const apolloClient = useMemo(() => initializeApollo(initialApolloState), [initialApolloState]);
|
const apolloClient = useMemo(
|
||||||
|
() => initializeApollo(initialApolloState, {}),
|
||||||
|
[initialApolloState]
|
||||||
|
);
|
||||||
const queryClient = useMemo(() => initializeQueryClient(initialQueryState), [initialQueryState]);
|
const queryClient = useMemo(() => initializeQueryClient(initialQueryState), [initialQueryState]);
|
||||||
|
|
||||||
const { loading } = usePageLoading();
|
const { loading } = usePageLoading();
|
||||||
|
|||||||
@ -1,28 +1,37 @@
|
|||||||
import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types';
|
import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types';
|
||||||
|
import { defaultRow } from '@/stores/tables/elt/default-values';
|
||||||
|
|
||||||
export async function getKPData({ quote }: GetQuoteInputData): Promise<GetQuoteProcessData> {
|
export async function getKPData({ quote }: GetQuoteInputData): Promise<GetQuoteProcessData> {
|
||||||
const elt: NonNullable<GetQuoteProcessData['elt']> = { kasko: undefined, osago: undefined };
|
const elt: NonNullable<GetQuoteProcessData['elt']> = { kasko: undefined, osago: undefined };
|
||||||
|
|
||||||
if (
|
if (
|
||||||
quote?.evo_kasko_accountid &&
|
quote?.evo_kasko_accountid &&
|
||||||
quote?.evo_id_elt_kasko &&
|
((quote?.evo_id_elt_kasko && quote?.evo_id_kasko_calc) ||
|
||||||
quote?.evo_id_kasko_calc &&
|
quote.evo_kasko_insurance_rulesidData?.evo_id) &&
|
||||||
quote?.evo_kasko_price &&
|
quote?.evo_kasko_price &&
|
||||||
quote?.evo_franchise !== null
|
quote?.evo_franchise !== null
|
||||||
) {
|
) {
|
||||||
elt.kasko = {
|
elt.kasko = {
|
||||||
|
insuranceCondition:
|
||||||
|
quote.evo_kasko_insurance_rulesidData?.evo_id ?? defaultRow.insuranceCondition,
|
||||||
key: quote?.evo_kasko_accountid,
|
key: quote?.evo_kasko_accountid,
|
||||||
requestId: quote?.evo_id_elt_kasko,
|
requestId: quote?.evo_id_elt_kasko ?? defaultRow.requestId,
|
||||||
skCalcId: quote?.evo_id_kasko_calc,
|
skCalcId: quote?.evo_id_kasko_calc ?? defaultRow.skCalcId,
|
||||||
sum: quote?.evo_kasko_price,
|
sum: quote?.evo_kasko_price,
|
||||||
totalFranchise: quote?.evo_franchise,
|
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 = {
|
elt.osago = {
|
||||||
|
insuranceCondition:
|
||||||
|
quote.evo_osago_insurance_rulesiddData?.evo_id ?? defaultRow.insuranceCondition,
|
||||||
key: quote?.evo_osago_accountid,
|
key: quote?.evo_osago_accountid,
|
||||||
numCalc: quote?.evo_id_elt_osago,
|
numCalc: quote?.evo_id_elt_osago ?? defaultRow.numCalc,
|
||||||
sum: quote?.evo_osago_price,
|
sum: quote?.evo_osago_price,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,14 +30,23 @@ export default function helper({
|
|||||||
({ evo_leasingobject_type } = data);
|
({ evo_leasingobject_type } = data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
kasko: (accounts
|
kasko: (accounts
|
||||||
?.filter((x) =>
|
?.filter(
|
||||||
x?.evo_type_ins_policy?.includes(100_000_000) &&
|
(x) =>
|
||||||
evo_leasingobject_type?.evo_id &&
|
x?.evo_type_ins_policy?.includes(100_000_000) &&
|
||||||
['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)
|
// leaseObjectCategory &&
|
||||||
? Boolean(x.evo_id_elt_smr)
|
// x.evo_kasko_category?.includes(leaseObjectCategory) &&
|
||||||
: Boolean(x?.evo_id_elt)
|
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) => ({
|
.map((x) => ({
|
||||||
...defaultRow,
|
...defaultRow,
|
||||||
@ -53,6 +62,8 @@ export default function helper({
|
|||||||
?.filter(
|
?.filter(
|
||||||
(x) =>
|
(x) =>
|
||||||
x?.evo_type_ins_policy?.includes(100_000_001) &&
|
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)
|
(x?.evo_id_elt_osago || x.evo_osago_id)
|
||||||
)
|
)
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
|
|||||||
284
apps/web/process/elt/lib/response.ts
Normal file
284
apps/web/process/elt/lib/response.ts
Normal file
@ -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<Row> {
|
||||||
|
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<ReturnType<typeof ownOsagoRequest>>;
|
||||||
|
|
||||||
|
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<Row> {
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
142
apps/web/process/elt/lib/tools.ts
Normal file
142
apps/web/process/elt/lib/tools.ts
Normal file
@ -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<CRMTypes.GetEltInsuranceRulesQuery['evo_insurance_ruleses']>[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
|
||||||
|
);
|
||||||
|
}
|
||||||
7
apps/web/process/elt/lib/types.ts
Normal file
7
apps/web/process/elt/lib/types.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import type { Row } from '@/Components/Calculation/Form/ELT/types';
|
||||||
|
import type { ProcessContext } from '@/process/types';
|
||||||
|
|
||||||
|
export type BaseConvertResponseInput = {
|
||||||
|
context: Pick<ProcessContext, 'apolloClient' | 'store'>;
|
||||||
|
row: Row;
|
||||||
|
};
|
||||||
@ -15,7 +15,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
|
|||||||
|
|
||||||
reaction(
|
reaction(
|
||||||
() => $calculation.$values.getValue('quote'),
|
() => $calculation.$values.getValue('quote'),
|
||||||
async () => {
|
() => {
|
||||||
const quote = $calculation.element('selectQuote').getOption();
|
const quote = $calculation.element('selectQuote').getOption();
|
||||||
|
|
||||||
if (!quote || $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP'))
|
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),
|
onClick: () => message.destroy(key),
|
||||||
});
|
});
|
||||||
|
|
||||||
const eltInitialValues = await initElt();
|
|
||||||
|
|
||||||
trpcClient.getQuote
|
trpcClient.getQuote
|
||||||
.query({
|
.query({
|
||||||
values: {
|
values: {
|
||||||
@ -38,7 +36,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
|
|||||||
...$calculation.$values.getValues(['lead', 'opportunity', 'recalcWithRevision']),
|
...$calculation.$values.getValues(['lead', 'opportunity', 'recalcWithRevision']),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(({ values, payments, insurance, fingap, elt, options }) => {
|
.then(async ({ values, payments, insurance, fingap, elt, options }) => {
|
||||||
if (options?.selectTarif) {
|
if (options?.selectTarif) {
|
||||||
$calculation.element('selectTarif').setOptions(normalizeOptions(options.selectTarif));
|
$calculation.element('selectTarif').setOptions(normalizeOptions(options.selectTarif));
|
||||||
} else {
|
} else {
|
||||||
@ -76,6 +74,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
|
|||||||
$tables.fingap.setRisks(fingap.risks);
|
$tables.fingap.setRisks(fingap.risks);
|
||||||
$tables.fingap.setSelectedKeys(fingap.keys);
|
$tables.fingap.setSelectedKeys(fingap.keys);
|
||||||
}
|
}
|
||||||
|
const eltInitialValues = await initElt();
|
||||||
|
|
||||||
if (eltInitialValues) {
|
if (eltInitialValues) {
|
||||||
$tables.elt.kasko.setRows(eltInitialValues.kasko);
|
$tables.elt.kasko.setRows(eltInitialValues.kasko);
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { mergeRouters } from '../trpc';
|
import { mergeRouters } from '../trpc';
|
||||||
import { calculateRouter } from './calculate';
|
import { calculateRouter } from './calculate';
|
||||||
|
import { eltRouter } from './elt';
|
||||||
import { quoteRouter } from './quote';
|
import { quoteRouter } from './quote';
|
||||||
import { tarifRouter } from './tarif';
|
import { tarifRouter } from './tarif';
|
||||||
|
|
||||||
export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter);
|
export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter, eltRouter);
|
||||||
|
|
||||||
export type AppRouter = typeof appRouter;
|
export type AppRouter = typeof appRouter;
|
||||||
|
|||||||
5
apps/web/server/routers/elt/index.ts
Normal file
5
apps/web/server/routers/elt/index.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { mergeRouters } from '../../trpc';
|
||||||
|
import { eltKaskoRouter } from './kasko';
|
||||||
|
import { eltOsagoRouter } from './osago';
|
||||||
|
|
||||||
|
export const eltRouter = mergeRouters(eltOsagoRouter, eltKaskoRouter);
|
||||||
45
apps/web/server/routers/elt/kasko.ts
Normal file
45
apps/web/server/routers/elt/kasko.ts
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
47
apps/web/server/routers/elt/osago.ts
Normal file
47
apps/web/server/routers/elt/osago.ts
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
13
apps/web/server/routers/elt/types.ts
Normal file
13
apps/web/server/routers/elt/types.ts
Normal file
@ -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(),
|
||||||
|
});
|
||||||
@ -48,6 +48,7 @@ export const GetQuoteOutputDataSchema = z
|
|||||||
elt: z
|
elt: z
|
||||||
.object({
|
.object({
|
||||||
kasko: EltRowSchema.pick({
|
kasko: EltRowSchema.pick({
|
||||||
|
insuranceCondition: true,
|
||||||
key: true,
|
key: true,
|
||||||
requestId: true,
|
requestId: true,
|
||||||
skCalcId: true,
|
skCalcId: true,
|
||||||
@ -55,6 +56,7 @@ export const GetQuoteOutputDataSchema = z
|
|||||||
totalFranchise: true,
|
totalFranchise: true,
|
||||||
}).optional(),
|
}).optional(),
|
||||||
osago: EltRowSchema.pick({
|
osago: EltRowSchema.pick({
|
||||||
|
insuranceCondition: true,
|
||||||
key: true,
|
key: true,
|
||||||
numCalc: true,
|
numCalc: true,
|
||||||
sum: true,
|
sum: true,
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import type * as ELT from '@/Components/Calculation/Form/ELT/types';
|
|||||||
|
|
||||||
export const defaultRow: ELT.Row = {
|
export const defaultRow: ELT.Row = {
|
||||||
id: '',
|
id: '',
|
||||||
|
insuranceCondition: null,
|
||||||
key: '',
|
key: '',
|
||||||
message: null,
|
message: null,
|
||||||
metodCalc: 'ELT',
|
metodCalc: 'ELT',
|
||||||
|
|||||||
@ -4,12 +4,13 @@ import type { AxiosError } from 'axios';
|
|||||||
import { isAxiosError } from 'axios';
|
import { isAxiosError } from 'axios';
|
||||||
import { pick } from 'radash';
|
import { pick } from 'radash';
|
||||||
|
|
||||||
function getErrorMessage<T extends { error?: string; errors?: string[]; message?: string }>(
|
function getErrorMessage<
|
||||||
error: AxiosError<T>
|
T extends { error?: string; errors?: string[]; fullMessage?: string; message?: string }
|
||||||
) {
|
>(error: AxiosError<T>) {
|
||||||
return (
|
return (
|
||||||
error.response?.data?.error ||
|
error.response?.data?.error ||
|
||||||
error.response?.data?.errors?.[0] ||
|
error.response?.data?.errors?.[0] ||
|
||||||
|
error.response?.data.fullMessage ||
|
||||||
error.response?.data?.message ||
|
error.response?.data?.message ||
|
||||||
error.message
|
error.message
|
||||||
);
|
);
|
||||||
|
|||||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -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/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)
|
'@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.3.3)
|
||||||
eslint: 8.57.0
|
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:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
- typescript
|
- typescript
|
||||||
@ -8227,7 +8227,7 @@ packages:
|
|||||||
'@graphql-tools/json-file-loader': 7.4.18(graphql@16.8.1)
|
'@graphql-tools/json-file-loader': 7.4.18(graphql@16.8.1)
|
||||||
'@graphql-tools/load': 7.8.14(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/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)
|
'@graphql-tools/utils': 9.2.1(graphql@16.8.1)
|
||||||
cosmiconfig: 8.0.0
|
cosmiconfig: 8.0.0
|
||||||
graphql: 16.8.1
|
graphql: 16.8.1
|
||||||
@ -9347,7 +9347,7 @@ packages:
|
|||||||
pretty-format: 29.7.0
|
pretty-format: 29.7.0
|
||||||
slash: 3.0.0
|
slash: 3.0.0
|
||||||
strip-json-comments: 3.1.1
|
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:
|
transitivePeerDependencies:
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
- supports-color
|
- supports-color
|
||||||
@ -13271,7 +13271,7 @@ packages:
|
|||||||
'@babel/core': 7.23.9
|
'@babel/core': 7.23.9
|
||||||
bs-logger: 0.2.6
|
bs-logger: 0.2.6
|
||||||
fast-json-stable-stringify: 2.1.0
|
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
|
jest-util: 29.7.0
|
||||||
json5: 2.2.3
|
json5: 2.2.3
|
||||||
lodash.memoize: 4.1.2
|
lodash.memoize: 4.1.2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user