Compare commits

..

55 Commits

Author SHA1 Message Date
vchikalkin
5d2fddade4 Revert "docker-compose.yml: expose client port (variable PORT_CLIENT_EXPOSE)"
This reverts commit c2e383256fc8be76b12ab5194f13410154f1753a.
2024-07-14 20:51:55 +03:00
vchikalkin
c2e383256f docker-compose.yml: expose client port (variable PORT_CLIENT_EXPOSE) 2024-07-14 20:41:02 +03:00
vchikalkin
5eb0639fbe use message on mobile & notification on desktop 2024-07-10 17:13:01 +03:00
vchikalkin
6e9dfb547e graphql: fix sort GetOpportunities & GetLeads 2024-07-10 13:39:16 +03:00
vchikalkin
ac76f7dcdb add success badge for result tab 2024-07-09 12:08:23 +03:00
vchikalkin
192bb089a0 fix navbar show error dot for validation tab 2024-07-09 11:53:22 +03:00
vchikalkin
dcf93644c8 navigation: show badge for validation tab 2024-07-02 18:46:20 +03:00
vchikalkin
2ea1b1bd69 disable errors tab in output for mobile 2024-07-02 18:12:29 +03:00
vchikalkin
e9ca1cc752 add background to validation tab 2024-07-02 18:03:10 +03:00
vchikalkin
3661b468d5 fix main components on desktop 2024-07-02 17:47:23 +03:00
vchikalkin
29fdb70509 add Errors tab
move calculation content to file
2024-07-02 17:38:19 +03:00
vchikalkin
65b4c95779 increase UserText font-size 2024-07-02 17:07:54 +03:00
vchikalkin
42beeb4a84 navigation tabs: z-index 999999 2024-07-02 16:53:13 +03:00
vchikalkin
6818adf1bd navigation: add tabs icons 2024-07-02 16:51:30 +03:00
vchikalkin
b96cc16be3 fix btnCreateKP & linkDownloadKp layout on mobile 2024-07-02 16:41:54 +03:00
vchikalkin
decabd6157 Form/Insurance: change elements order 2024-07-02 11:36:47 +03:00
vchikalkin
d8c3bcdd17 fix render rows order (Insurance tab) 2024-07-01 20:45:23 +03:00
vchikalkin
7664e71506 fix render rows order on mobile 2024-07-01 20:33:57 +03:00
vchikalkin
f5890c94b2 pages/index: change settings tab title 2024-07-01 19:57:13 +03:00
vchikalkin
b99cad781e disable notification for mobile & non calculation pages 2024-07-01 18:35:44 +03:00
vchikalkin
d0856f95af apps\web\styles\media: rename ExampleAppMedia -> AppMedia 2024-07-01 18:25:25 +03:00
vchikalkin
7349478fe9 fix tabs rerender 2024-07-01 18:10:42 +03:00
vchikalkin
359a9d4921 move NavigationBar to page
export Content function from root page -> use in /unlimited
2024-06-20 16:17:13 +03:00
vchikalkin
e3961af777 pages: remove prune={['unlimited']} for Calculation.Form 2024-06-20 15:57:27 +03:00
vchikalkin
89ee797fc7 oplimize tabs render 2024-06-20 15:37:24 +03:00
vchikalkin
9940bf8bbb fix build: specify turbo version 2024-06-19 15:36:46 +03:00
vchikalkin
34153fa21a add primary color for active tab 2024-06-19 15:24:06 +03:00
vchikalkin
67749c1ed5 export tabs list from / 2024-06-19 15:01:56 +03:00
vchikalkin
e5e4ca5857 packages: replace react-responsive -> @artsy/fresnel 2024-06-19 15:00:07 +03:00
vchikalkin
5aad257058 filter form tabs in Form component 2024-06-19 14:29:44 +03:00
vchikalkin
b87c22b6ed apps/web: add mobile tabs 2024-06-19 14:15:59 +03:00
vchikalkin
07ca9a5b2a Layout: add NavigationBar 2024-06-19 13:35:45 +03:00
vchikalkin
b1cacc06a1 rename AppNavigation -> AppMenu 2024-06-19 13:05:45 +03:00
vchikalkin
854ea375bd graphql: sort leads & opportunities 2024-06-11 11:59:50 +03:00
vchikalkin
ca96097bf9 fix GetDealerPerson query 2024-05-22 13:06:31 +03:00
vchikalkin
f57c38264c get-main-data: fix selectOpportunity 2024-05-21 20:33:30 +03:00
vchikalkin
95b6dec872 passthrough apolloClient & queryClient to get-kp-data's 2024-05-21 19:46:02 +03:00
vchikalkin
f63a6ac96b passthrough authorization header to trpc user middleware 2024-05-21 19:20:41 +03:00
vchikalkin
c18875f369 passthrough authorization header to trpc/get-tarif 2024-05-21 18:57:06 +03:00
vchikalkin
16b7188773 pass headers to initializeApollo (nginx injects Authorization header to any request) 2024-05-21 14:50:28 +03:00
vchikalkin
13cd93338f apps/web: pass token to GraphQL query (SSR) 2024-05-21 13:51:57 +03:00
vchikalkin
7d5be83e4c apps/web: pass DEV_AUTH_TOKEN to GQL request 2024-05-20 20:44:48 +03:00
vchikalkin
ef4f7b2547 scripts: remove token from code 2024-05-20 17:45:56 +03:00
vchikalkin
747fe1fa3f graphql: update some queries 2024-05-20 17:39:30 +03:00
vchikalkin
dd1bab5ffc scripts: add token to gql-sdl args 2024-05-20 17:33:26 +03:00
vchikalkin
2ae4d87b4d Revert "next.config.js: add csp header"
This reverts commit 1797c13718e88ce7c30f3b85eb79a6c3d12552db.
2024-04-27 13:48:32 +03:00
vchikalkin
1797c13718 next.config.js: add csp header 2024-04-27 11:22:26 +03:00
vchikalkin
7578460878 build: fix antd generate css for production 2024-04-24 15:24:29 +03:00
vchikalkin
9f80956145 graphql: fix GetRewardConditions query 2024-04-23 14:40:07 +03:00
vchikalkin
83031218ea apps/web: add getCurrentDateString 2024-04-23 14:13:53 +03:00
vchikalkin
9c3f2bbd78 crm.query.graphql: fix arrays sorting 2024-04-23 10:58:18 +03:00
vchikalkin
01111a6f0b fix GetProducts query 2024-04-17 11:32:46 +03:00
vchikalkin
030a630681 crm.types: fix any -> string for UUID 2024-04-16 17:41:36 +03:00
vchikalkin
5ee420dde6 fix using queries in code 2024-04-16 17:38:34 +03:00
vchikalkin
8f80ed5446 update graphql queries & generate new types 2024-04-16 17:05:24 +03:00
83 changed files with 794 additions and 2074 deletions

View File

@ -2,7 +2,7 @@
# Make sure you update both files!
FROM node:alpine AS builder
RUN corepack enable && corepack prepare pnpm@8.9.0 --activate
RUN corepack enable && corepack prepare pnpm@latest --activate
ENV PNPM_HOME=/usr/local/bin
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat

View File

@ -14,7 +14,6 @@ export const queryTTL: Record<string, number | false> = {
GetDealerPerson: seconds().fromHours(1),
GetDealerPersons: seconds().fromHours(1),
GetDealers: seconds().fromMinutes(15),
GetEltInsuranceRules: seconds().fromHours(12),
GetFuelCards: seconds().fromHours(12),
GetGPSBrands: seconds().fromHours(24),
GetGPSModels: seconds().fromHours(24),
@ -33,7 +32,6 @@ export const queryTTL: Record<string, number | false> = {
GetOpportunities: false,
GetOpportunity: false,
GetOpportunityUrl: seconds().fromHours(12),
GetOsagoAddproductTypes: seconds().fromHours(12),
GetProduct: seconds().fromHours(12),
GetProducts: seconds().fromHours(12),
GetQuote: false,

View File

@ -1,10 +1,9 @@
import Background from '../../Layout/Background';
import { useFilteredQueries } from './lib/hooks';
import { QueryList } from './QueryList';
import { reset } from '@/api/cache/query';
import { min } from '@/styles/mq';
import styled from 'styled-components';
import { Button, Collapse, Divider, Input } from 'ui/elements';
import { Collapse, Divider, Input } from 'ui/elements';
const Wrapper = styled(Background)`
padding: 4px 6px;
@ -22,21 +21,13 @@ const Wrapper = styled(Background)`
const Flex = styled.div`
display: flex;
flex-direction: column;
margin-bottom: 16px;
justify-content: space-between;
gap: 10px;
`;
const ButtonWrapper = styled.div`
display: flex;
justify-content: flex-end;
`;
export function Cache() {
const { filteredQueries, refetch, setFilterString } = useFilteredQueries();
function handleDeleteQuery() {
return reset().then(() => refetch());
}
const { filteredQueries, setFilterString } = useFilteredQueries();
if (!filteredQueries) {
return <div>Загрузка...</div>;
@ -51,20 +42,15 @@ export function Cache() {
allowClear
onChange={(e) => setFilterString(e.target.value)}
/>
<Collapse
accordion
items={Object.keys(filteredQueries).map((queryGroupName) => ({
children: <QueryList {...filteredQueries[queryGroupName]} />,
key: queryGroupName,
label: queryGroupName,
}))}
/>
<ButtonWrapper>
<Button type="primary" danger disabled={false} onClick={() => handleDeleteQuery()}>
Очистить кэш
</Button>
</ButtonWrapper>
</Flex>
<Collapse
accordion
items={Object.keys(filteredQueries).map((queryGroupName) => ({
children: <QueryList {...filteredQueries[queryGroupName]} />,
key: queryGroupName,
label: queryGroupName,
}))}
/>
</Wrapper>
);
}

View File

@ -12,6 +12,5 @@ export const rows: FormTabRows = [
[['cbxInsurance', 'cbxRegistrationQuote'], { gridTemplateColumns: ['1fr', '1fr 1fr'] }],
[['cbxTechnicalCardQuote', 'cbxNSIB'], { gridTemplateColumns: ['1fr', '1fr 1fr'] }],
[['cbxQuoteRedemptionGraph', 'cbxShowFinGAP'], { gridTemplateColumns: ['1fr', '1fr 1fr'] }],
[['cbxQuoteShowAcceptLimit'], { gridTemplateColumns: ['1fr', '1fr 1fr'] }],
[['tbxQuoteName', 'radioQuoteContactGender'], { gridTemplateColumns: ['1fr', '2fr 1fr'] }],
];

View File

@ -1,41 +1,129 @@
/* eslint-disable sonarjs/cognitive-complexity */
import { PolicyTable, ReloadButton, Validation } from './Components';
import { columns } from './lib/config';
import { resetRow } from './lib/tools';
import { makeEltKaskoRequest } from './lib/make-request';
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 { trpcClient } from '@/trpc/client';
import { defaultRow } from '@/stores/tables/elt/default-values';
import { useApolloClient } from '@apollo/client';
import { observer } from 'mobx-react-lite';
import { omit, sift } from 'radash';
import { useCallback } from 'react';
import { Flex } from 'ui/grid';
const storeSelector: StoreSelector = ({ kasko }) => kasko;
const initialData = {
...omit(defaultRow, ['name', 'key', 'id']),
error: null,
kaskoSum: 0,
paymentPeriods: [
{
kaskoSum: 0,
},
],
};
export const Kasko = observer(() => {
const store = useStore();
const { $calculation, $tables } = store;
const apolloClient = useApolloClient();
const { init } = helper({ apolloClient, store });
const calculateKasko = trpcClient.eltKasko.useMutation({
onError() {
$tables.elt.kasko.setRows(
$tables.elt.kasko.getRows.map((row) => ({ ...row, status: 'error' }))
);
},
onMutate: () => {
const rows = $tables.elt.kasko.getRows;
$tables.elt.kasko.setRows(rows.map((row) => ({ ...resetRow(row), status: 'fetching' })));
},
onSuccess: ({ rows }) => {
$tables.elt.kasko.setRows(rows);
},
});
const handleOnClick = useCallback(async () => {
$tables.elt.kasko.abortController?.abort();
$tables.elt.kasko.abortController = new AbortController();
function handleOnClick() {
calculateKasko.mutate({
calculation: {
values: store.$calculation.$values.getValues(),
},
const { kasko } = await init();
$tables.elt.kasko.setRows(kasko);
const kaskoCompanyIds = sift(
$tables.insurance
.row('kasko')
.getOptions('insuranceCompany')
.map((x) => x.value)
);
const values = $calculation.$values.getValues();
kaskoCompanyIds.forEach((key) => {
const row = $tables.elt.kasko.getRow(key);
if (row) {
$tables.elt.kasko.setRow({ key, status: 'fetching' });
makeEltKaskoRequest({ apolloClient, store }, row)
.then((payload) =>
getEltKasko(payload, { signal: $tables.elt.kasko.abortController?.signal })
)
.then((res) => {
if (res) {
const {
kaskoSum = 0,
message,
paymentPeriods,
requestId,
skCalcId,
totalFranchise = 0,
} = res;
let { error } = res;
const sum =
values.leasingPeriod <= 16 ? kaskoSum : paymentPeriods?.[0]?.kaskoSum || 0;
if (totalFranchise > MAX_FRANCHISE) {
error ||= `Франшиза по страховке превышает максимально допустимое значение: ${Intl.NumberFormat(
'ru',
{
currency: 'RUB',
style: 'currency',
}
).format(MAX_FRANCHISE)}`;
}
if (sum > MAX_INSURANCE) {
error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости КАСКО: ${Intl.NumberFormat(
'ru',
{
currency: 'RUB',
style: 'currency',
}
).format(MAX_INSURANCE)}`;
}
if (sum < MIN_INSURANCE) {
error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости КАСКО: ${Intl.NumberFormat(
'ru',
{
currency: 'RUB',
style: 'currency',
}
).format(MIN_INSURANCE)}`;
}
$tables.elt.kasko.setRow({
key,
message: error || message,
numCalc: '0',
requestId,
skCalcId,
status: error ? 'error' : null,
sum,
totalFranchise,
});
}
})
.catch((error) => {
const _err = error as Error;
$tables.elt.kasko.setRow({
...initialData,
key,
message: _err.message || String(error),
status: 'error',
});
});
}
});
}
}, [$calculation.$values, $tables.elt.kasko, $tables.insurance, apolloClient, init, store]);
function handleOnSelectRow(row: Row) {
$tables.insurance.row('kasko').column('insuranceCompany').setValue(row.key);

View File

@ -2,41 +2,125 @@
/* eslint-disable sonarjs/cognitive-complexity */
import { PolicyTable, ReloadButton, Validation } from './Components';
import { columns } from './lib/config';
import { resetRow } from './lib/tools';
import { makeEltOsagoRequest, makeOwnOsagoRequest } from './lib/make-request';
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 { trpcClient } from '@/trpc/client';
import { defaultRow } from '@/stores/tables/elt/default-values';
import { useApolloClient } from '@apollo/client';
import { observer } from 'mobx-react-lite';
import { omit, sift } from 'radash';
import { useCallback } from 'react';
import { Flex } from 'ui/grid';
const storeSelector: StoreSelector = ({ osago }) => osago;
const initialData = {
...omit(defaultRow, ['name', 'key', 'id']),
error: null,
premiumSum: 0,
};
export const Osago = observer(() => {
const store = useStore();
const { $tables } = store;
const apolloClient = useApolloClient();
const { init } = helper({ apolloClient, store });
const calculateOsago = trpcClient.eltOsago.useMutation({
onError() {
$tables.elt.osago.setRows(
$tables.elt.osago.getRows.map((row) => ({ ...row, status: 'error' }))
);
},
onMutate: () => {
const rows = $tables.elt.osago.getRows;
$tables.elt.osago.setRows(rows.map((row) => ({ ...resetRow(row), status: 'fetching' })));
},
onSuccess: ({ rows }) => {
$tables.elt.osago.setRows(rows);
},
});
const handleOnClick = useCallback(async () => {
$tables.elt.osago.abortController?.abort();
$tables.elt.osago.abortController = new AbortController();
async function handleOnClick() {
calculateOsago.mutate({
calculation: {
values: store.$calculation.$values.getValues(),
},
const { osago } = await init();
$tables.elt.osago.setRows(osago);
const osagoCompanyIds = sift(
$tables.insurance
.row('osago')
.getOptions('insuranceCompany')
.map((x) => x.value)
);
osagoCompanyIds.forEach((key) => {
const row = $tables.elt.osago.getRow(key);
if (row) {
row.status = 'fetching';
$tables.elt.osago.setRow(row);
if (row.metodCalc === 'CRM') {
makeOwnOsagoRequest({ apolloClient, store }, row).then((res) => {
if (!res) {
$tables.elt.osago.setRow({
key,
message:
'Для получения расчета ОСАГО следует использовать калькулятор ЭЛТ или Индивидуальный запрос',
numCalc: undefined,
skCalcId: undefined,
status: 'error',
sum: 0,
totalFranchise: 0,
});
} else {
$tables.elt.osago.setRow({
key,
message: null,
numCalc: res.evo_id || undefined,
status: null,
sum: res.evo_graph_price_withoutnds || undefined,
});
}
});
} else {
makeEltOsagoRequest({ apolloClient, store }, row)
.then((payload) =>
getEltOsago(payload, { signal: $tables.elt.osago.abortController.signal })
)
.then((res) => {
if (res) {
const { message, numCalc, premiumSum = 0, skCalcId } = res;
let { error } = res;
if (premiumSum > MAX_INSURANCE) {
error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости ОСАГО: ${Intl.NumberFormat(
'ru',
{
currency: 'RUB',
style: 'currency',
}
).format(MAX_INSURANCE)}`;
}
if (premiumSum < MIN_INSURANCE) {
error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости ОСАГО: ${Intl.NumberFormat(
'ru',
{
currency: 'RUB',
style: 'currency',
}
).format(MIN_INSURANCE)}`;
}
$tables.elt.osago.setRow({
key,
message: error || message,
numCalc: `${numCalc}`,
skCalcId,
status: error ? 'error' : null,
sum: premiumSum,
});
}
})
.catch((error) => {
const _err = error as Error;
$tables.elt.osago.setRow({
...initialData,
key,
message: _err.message || String(error),
status: 'error',
});
});
}
}
});
}
}, [$tables.elt.osago, $tables.insurance, apolloClient, init, store]);
function handleOnSelectRow(row: Row) {
$tables.insurance.row('osago').column('insuranceCompany').setValue(row.key);

View File

@ -1,7 +1,10 @@
import type { Row } from '../types';
import type { RowSchema } from '@/config/schema/elt';
import type { ColumnsType } from 'antd/lib/table';
import { CloseOutlined, LoadingOutlined } from 'ui/elements/icons';
import { Flex } from 'ui/grid';
import type { z } from 'zod';
type Row = z.infer<typeof RowSchema>;
const formatter = Intl.NumberFormat('ru', {
currency: 'RUB',

View File

@ -1,14 +1,14 @@
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable complexity */
import type { Row } from '../types';
import type { RequestEltKasko, RequestEltOsago } from '@/api/elt/types';
import type { Row } from '@/Components/Calculation/Form/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 ownOsagoRequest(
export async function makeOwnOsagoRequest(
{ store, apolloClient }: Pick<ProcessContext, 'apolloClient' | 'store'>,
row: Row
): Promise<NonNullable<CRMTypes.GetOsagoAddproductTypesQuery['evo_addproduct_types']>[number]> {
@ -471,8 +471,7 @@ export async function makeEltKaskoRequest(
let selfIgnitionSpecified = false;
if (
leaseObjectCategory === 100_000_002 ||
(evo_leasingobject_type?.evo_id &&
['6', '8', '9', '10'].includes(evo_leasingobject_type?.evo_id))
(evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id))
) {
notConfirmedGlassesDamages = 3;
notConfirmedGlassesDamagesSpecified = true;
@ -618,26 +617,10 @@ export async function makeEltKaskoRequest(
}
}
let classification = '11606';
switch (evo_leasingobject_type?.evo_id) {
case '7': {
classification = '11611';
break;
}
case '3': {
classification = '11607';
break;
}
case '8': {
classification = '11650';
break;
}
default: {
classification = '11606';
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();

View File

@ -1,12 +0,0 @@
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,
};
}

View File

@ -23,7 +23,29 @@ const AlertWrapper = styled(Box)`
margin: 0 0 5px 0;
`;
function getAlerts(errors, title, $process) {
function getElementsErrors({ $calculation, $process }) {
return Object.values($calculation.$validation).map((validation) => {
const elementErrors = validation.getErrors();
const elementTitle = validation.params.err_title;
return elementErrors.map(({ key, message }) => (
<AlertWrapper>
<Alert
key={key}
type={$process.has('Unlimited') ? 'warning' : 'error'}
showIcon
message={Message(elementTitle, message)}
/>
</AlertWrapper>
));
});
}
function getPaymentsTableErrors({ $process, $tables }) {
const { payments } = $tables;
const errors = payments.validation.getErrors();
const title = payments.validation.params.err_title;
return errors.map(({ key, message }) => (
<AlertWrapper>
<Alert
@ -36,21 +58,38 @@ function getAlerts(errors, title, $process) {
));
}
function getElementsErrors({ $calculation, $process }) {
return Object.values($calculation.$validation).map((validation) => {
const elementErrors = validation.getErrors();
const elementTitle = validation.params.err_title;
function getInsuranceTableErrors({ $process, $tables }) {
const { insurance } = $tables;
const errors = insurance.validation.getErrors();
const title = insurance.validation.params.err_title;
return getAlerts(elementErrors, elementTitle, $process);
});
return errors.map(({ key, message }) => (
<AlertWrapper>
<Alert
key={key}
type={$process.has('Unlimited') ? 'warning' : 'error'}
showIcon
message={Message(title, message)}
/>
</AlertWrapper>
));
}
function getTableErrors(tableName, { $process, $tables }) {
const table = $tables[tableName];
const errors = table.validation.getErrors();
const title = table.validation.params.err_title;
function getFingapTableErrors({ $process, $tables }) {
const { fingap } = $tables;
const errors = fingap.validation.getErrors();
const title = fingap.validation.params.err_title;
return getAlerts(errors, title, $process);
return errors.map(({ key, message }) => (
<AlertWrapper>
<Alert
key={key}
type={$process.has('Unlimited') ? 'warning' : 'error'}
showIcon
message={Message(title, message)}
/>
</AlertWrapper>
));
}
const Errors = observer(() => {
@ -62,16 +101,15 @@ const Errors = observer(() => {
);
const hasPaymentsErrors = $tables.payments.validation.hasErrors;
const hasInsuranceErrors = $tables.insurance.validation.hasErrors;
const hasFingapErrors = $tables.fingap.validation.hasErrors;
if (!hasElementsErrors && !hasPaymentsErrors && !hasInsuranceErrors && !hasFingapErrors) {
if (!hasElementsErrors && !hasPaymentsErrors && !hasInsuranceErrors) {
return <Alert type="success" showIcon message="Ошибок нет 🙂" />;
}
const elementsErrors = getElementsErrors(store);
const paymentsErrors = getTableErrors('payments', store);
const insuranceErrors = getTableErrors('insurance', store);
const fingapErrors = getTableErrors('fingap', store);
const paymentsErrors = getPaymentsTableErrors(store);
const insuranceErrors = getInsuranceTableErrors(store);
const fingapErrors = getFingapTableErrors(store);
const errors = [...elementsErrors, ...paymentsErrors, ...insuranceErrors, ...fingapErrors];

View File

@ -136,7 +136,6 @@ const components = wrapComponentsMap({
cbxPartialVAT: e.Switch,
cbxFloatingRate: e.Switch,
cbxQuotePriceWithFullVAT: e.Switch,
cbxQuoteShowAcceptLimit: e.Switch,
/** Readonly Elements */
labelLeaseObjectRisk: e.Text,

View File

@ -130,7 +130,6 @@ const titles: Record<ActionElements | ValuesElements, string> = {
cbxPartialVAT: 'Частичный НДС',
cbxFloatingRate: 'Плавающая ставка',
cbxQuotePriceWithFullVAT: 'Отображать Стоимость ПЛ с полным НДС',
cbxQuoteShowAcceptLimit: 'Отображать одобренный лимит',
/** Link Elements */
linkDownloadKp: '',

View File

@ -195,7 +195,6 @@ const types = wrapElementsTypes({
cbxPartialVAT: t.Switch,
cbxFloatingRate: t.Switch,
cbxQuotePriceWithFullVAT: t.Switch,
cbxQuoteShowAcceptLimit: t.Switch,
labelLeaseObjectRisk: t.Readonly,
tbxInsKaskoPriceLeasePeriod: t.Readonly,

View File

@ -133,7 +133,6 @@ const elementsToValues = wrapElementsMap({
cbxPartialVAT: 'partialVAT',
cbxFloatingRate: 'floatingRate',
cbxQuotePriceWithFullVAT: 'quotePriceWithFullVAT',
cbxQuoteShowAcceptLimit: 'quoteShowAcceptLimit',
/** Readonly Elements */
labelLeaseObjectRisk: 'leaseObjectRiskName',

View File

@ -2,7 +2,7 @@
# Make sure you update both files!
FROM node:alpine AS builder
RUN corepack enable && corepack prepare pnpm@8.9.0 --activate
RUN corepack enable && corepack prepare pnpm@latest --activate
ENV PNPM_HOME=/usr/local/bin
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
@ -47,8 +47,6 @@ ARG URL_CORE_CALCULATE_DIRECT
ARG URL_1C_TRANSTAX_DIRECT
ARG URL_ELT_OSAGO_DIRECT
ARG URL_ELT_KASKO_DIRECT
ARG USERNAME_1C_TRANSTAX
ARG PASSWORD_1C_TRANSTAX
RUN pnpm dotenv -v NODE_ENV=production -e .env turbo run prebuild --filter=web...
RUN pnpm dotenv -e .env turbo run build --filter=web...

View File

@ -1,12 +1,11 @@
export type RequestTransTax = {
CalcDate: string;
CarCategory: string;
OKTMO: string;
Power: number;
Year: number;
calcDate: Date;
carCategory: string;
power: number;
year: number;
};
export type ResponseTransTax = {
Error: string;
Tax: number;
TaxRate: number;
error: string;
tax: number;
};

View File

@ -6,7 +6,6 @@ import ValuesSchema from '@/config/schema/values';
import { z } from 'zod';
export const RequestCreateKPSchema = z.object({
__info: z.record(z.any()).optional(),
calculation: z
.object({
calculationValues: ValuesSchema,

View File

@ -6,18 +6,24 @@ import axios from 'axios';
const { URL_ELT_KASKO, URL_ELT_OSAGO } = getUrls();
export async function getEltOsago(payload: ELT.RequestEltOsago) {
export async function getEltOsago(
payload: ELT.RequestEltOsago,
{ signal }: { signal: AbortSignal }
) {
return withHandleError(
axios
.post<ELT.ResponseEltOsago>(URL_ELT_OSAGO, payload, { timeout: TIMEOUT })
.post<ELT.ResponseEltOsago>(URL_ELT_OSAGO, payload, { signal, timeout: TIMEOUT })
.then(({ data }) => data)
);
}
export async function getEltKasko(payload: ELT.RequestEltKasko) {
export async function getEltKasko(
payload: ELT.RequestEltKasko,
{ signal }: { signal: AbortSignal }
) {
return withHandleError(
axios
.post<ELT.ResponseEltKasko>(URL_ELT_KASKO, payload, { timeout: TIMEOUT })
.post<ELT.ResponseEltKasko>(URL_ELT_KASKO, payload, { signal, timeout: TIMEOUT })
.then(({ data }) => data)
);
}

View File

@ -14,10 +14,6 @@ function createApolloClient(headers) {
}
export default function initializeApollo(initialState, headers) {
if (isServer() && !headers) {
throw new Error('initializeApollo: headers must be provided in server side');
}
const _apolloClient = apolloClient ?? createApolloClient(headers);
// If your page has Next.js data fetching methods that use Apollo Client, the initial state

View File

@ -9,10 +9,6 @@ import { getCurrentScope } from '@sentry/nextjs';
import getConfig from 'next/config';
import { isServer } from 'tools';
function isSovkom(account) {
return account.label.toLowerCase().includes('совком');
}
export function createLink(headers) {
const { URL_CRM_GRAPHQL } = getUrls();
@ -48,24 +44,16 @@ export function createLink(headers) {
}
if (operation.operationName === 'GetInsuranceCompanies') {
response.data.accounts = response.data.accounts
.sort((a, b) => {
if (isSovkom(a)) return -1;
response.data.accounts = response.data.accounts.map((account) => {
const substring = account.label.match(/"(.+)"/u);
if (substring)
return {
...account,
label: substring ? substring[1].replaceAll('"', '').trim() : account.label,
};
if (isSovkom(b)) return 1;
return 0;
})
.map((account) => {
const substring = account.label.match(/"(.+)"/u);
if (substring)
return {
...account,
label: substring ? substring[1].replaceAll('"', '').trim() : account.label,
};
return account;
});
return account;
});
}
}

View File

@ -104,7 +104,7 @@ export const selectObjectCategoryTax = [
export const selectLeaseObjectUseFor = alphabetical(
[
{
label: 'Для представительских целей / перевозки сотрудников ЛП',
label: 'Для представительских целей',
value: 100_000_000,
},
{
@ -151,10 +151,10 @@ export const selectLeaseObjectUseFor = alphabetical(
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
value: 100_000_011,
},
// {
// label: 'Для перевозки сотрудников ЛП',
// value: 100_000_012,
// },
{
label: 'Для перевозки сотрудников ЛП',
value: 100_000_012,
},
{
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
value: 100_000_013,
@ -511,7 +511,6 @@ const defaultOptions: CalculationOptions = {
cbxPartialVAT: [],
cbxFloatingRate: [],
cbxQuotePriceWithFullVAT: [],
cbxQuoteShowAcceptLimit: [],
};
export default defaultOptions;

View File

@ -18,7 +18,6 @@ const defaultStatuses: CalculationStatuses = {
cbxPriceWithDiscount: 'Default',
cbxQuotePriceWithFullVAT: 'Default',
cbxQuoteRedemptionGraph: 'Default',
cbxQuoteShowAcceptLimit: 'Default',
cbxRecalcWithRevision: 'Default',
cbxRegistrationQuote: 'Default',
cbxShowFinGAP: 'Default',

View File

@ -22,7 +22,7 @@ const defaultValues: CalculationValues = {
comissionRub: 0,
configuration: null,
costIncrease: true,
countSeats: 4,
countSeats: 0,
creditRate: RATE,
dealer: null,
dealerBroker: null,
@ -144,7 +144,6 @@ const defaultValues: CalculationValues = {
partialVAT: false,
floatingRate: false,
quotePriceWithFullVAT: false,
quoteShowAcceptLimit: true,
};
export default defaultValues;

View File

@ -2,7 +2,6 @@ import { withBasePath } from '@/config/urls';
export const metaFavicon = (
<>
<link rel="icon" type="image/x-icon" href={withBasePath('/favicon.ico')} sizes="32x32" />
<link rel="apple-touch-icon" sizes="180x180" href={withBasePath('/apple-touch-icon.png')} />
<link rel="icon" type="image/png" sizes="32x32" href={withBasePath('/favicon-32x32.png')} />
<link rel="icon" type="image/png" sizes="16x16" href={withBasePath('/favicon-16x16.png')} />

View File

@ -270,7 +270,6 @@ export const ResultEltOsagoSchema = z.object({
export const RowSchema = z.object({
id: z.string(),
insuranceCondition: z.string().nullable(),
key: z.string(),
message: z.string().nullable(),
metodCalc: z.union([z.literal('CRM'), z.literal('ELT')]),

View File

@ -2,8 +2,6 @@ const { z } = require('zod');
const envSchema = z.object({
BASE_PATH: z.string().optional().default(''),
DEV_AUTH_TOKEN: z.string().optional(),
PASSWORD_1C_TRANSTAX: z.string(),
PORT: z.string().optional(),
SENTRY_AUTH_TOKEN: z.string(),
SENTRY_DSN: z.string(),
@ -13,6 +11,7 @@ const envSchema = z.object({
URL_CACHE_GET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/get-queries'),
URL_CACHE_GET_QUERY_DIRECT: z.string().default('http://api:3001/proxy/get-query'),
URL_CACHE_RESET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/reset'),
DEV_AUTH_TOKEN: z.string().optional(),
URL_CORE_CALCULATE_DIRECT: z.string(),
URL_CORE_FINGAP_DIRECT: z.string(),
URL_CRM_CREATEKP_DIRECT: z.string(),
@ -23,7 +22,6 @@ const envSchema = z.object({
URL_ELT_OSAGO_DIRECT: z.string(),
URL_GET_USER_DIRECT: z.string(),
USE_DEV_COLORS: z.unknown().optional().transform(Boolean),
USERNAME_1C_TRANSTAX: z.string(),
});
module.exports = envSchema;

View File

@ -11,7 +11,6 @@ const publicRuntimeConfigSchema = envSchema.pick({
const serverRuntimeConfigSchema = envSchema.pick({
BASE_PATH: true,
DEV_AUTH_TOKEN: true,
PASSWORD_1C_TRANSTAX: true,
PORT: true,
SENTRY_DSN: true,
SENTRY_ENVIRONMENT: true,
@ -28,7 +27,6 @@ const serverRuntimeConfigSchema = envSchema.pick({
URL_ELT_KASKO_DIRECT: true,
URL_ELT_OSAGO_DIRECT: true,
URL_GET_USER_DIRECT: true,
USERNAME_1C_TRANSTAX: true,
});
module.exports = {

View File

@ -129,7 +129,6 @@ const ValuesSchema = z.object({
withTrailer: z.boolean(),
partialVAT: z.boolean(),
floatingRate: z.boolean(),
quoteShowAcceptLimit: z.boolean(),
/**
* Link Values

View File

@ -12,5 +12,3 @@ export const VEHICLE_SEATS = 20;
export const ESN = 1.3;
export const NSIB_MAX = 5_000_000;
export const NDFL = 0.13;
export const IRR_THRESHOLD = 0.001;

View File

@ -137,25 +137,6 @@ query GetQuote($quoteId: UUID!) {
evo_promotion
evo_sale_without_nds
link
evo_committee_quote
evo_msfo_irr
evo_accept_quoteid
evo_power
evo_engine_volume
evo_nsib
evo_addproduct_types {
evo_product_type
}
evo_db_accept_registration
evo_product_risks {
evo_addproduct_typeid
}
evo_fingap_payer
evo_osago_payer
evo_kasko_payer
evo_leasing_bonus_summ
evo_card_bonus_summ
evo_nsib_bonus_summ
}
}
@ -255,7 +236,7 @@ query GetQuoteData($quoteId: UUID!) {
evo_graphs {
createdon
evo_sumpay_withnds
evo_planpayments(orderby: { fieldName: "evo_plandate", sortingType: ASC }) {
evo_planpayments {
evo_payment_ratio
}
}
@ -309,13 +290,6 @@ query GetQuoteData($quoteId: UUID!) {
evo_transactioncurrencyid
evo_equip_price
evo_coefficien_bonus_reducttion
evo_accept_limit_quote
evo_kasko_insurance_rulesidData {
evo_id
}
evo_osago_insurance_rulesiddData {
evo_id
}
}
}
@ -365,7 +339,6 @@ query GetTarif($tarifId: UUID!) {
evo_datefrom
evo_rateid
evo_type
statecode
}
evo_irr_plan
evo_margin_min
@ -718,8 +691,6 @@ query GetDealerPerson($dealerPersonId: UUID!) {
evo_return_leasing_dealer
evo_broker_accountid
evo_supplier_financing_accept
evo_legal_form
evo_inn
}
}
@ -727,7 +698,6 @@ query GetAgent($agentid: UUID!) {
agent(accountid: $agentid) {
label: name
value: accountid
evo_inn
}
}
@ -1068,8 +1038,6 @@ query GetInsuranceCompany($accountId: UUID!) {
evo_osago_with_kasko
evo_legal_region_calc
accountid
evo_kasko_fact_part
evo_kasko_plan_part
}
}
@ -1084,64 +1052,6 @@ query GetInsuranceCompanies {
evo_id_elt
evo_id_elt_smr
evo_osago_id
evo_kasko_category
evo_osago_category
}
}
query GetEltInsuranceRules($currentDate: DateTime) {
evo_insurance_ruleses(
filterConditionGroup: {
andFilterConditions: [
{ filterConditionInt: { fieldName: "statecode", eq: 0 } }
{ filterConditionDateTime: { fieldName: "evo_datefrom", lte: $currentDate } }
{ filterConditionDateTime: { fieldName: "evo_dateto", gte: $currentDate } }
]
}
) {
evo_id
evo_datefrom
evo_dateto
evo_risk
evo_category
evo_min_period
evo_max_period
evo_object_type
evo_use_for
evo_min_price
evo_max_price
evo_min_year
evo_max_year
evo_min_power
evo_max_power
evo_enginie_type
evo_opf
evo_min_mileage
evo_max_mileage
evo_brand
evo_model
evo_region
evo_dealer
evo_rules_type
evo_message
evo_discount
evo_insurer_accountid
evo_brand
evo_model
evo_region
evo_dealer
evo_brands {
evo_brandid
}
evo_models {
evo_modelid
}
accounts {
accountid
}
evo_regions {
evo_regionid
}
}
}

View File

@ -105,8 +105,6 @@ type Query {
evo_insurance_periods(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_period]
evo_insurance_policy(evo_insurance_policyid: UUID!): evo_insurance_policy
evo_insurance_policies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_policy]
evo_insurance_rules(evo_insurance_rulesid: UUID!): evo_insurance_rules
evo_insurance_ruleses(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_insurance_rules]
evo_job_title(evo_job_titleid: UUID!): evo_job_title
evo_job_titles(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_job_title]
evo_leasingobject(evo_leasingobjectid: UUID!): evo_leasingobject
@ -2176,8 +2174,8 @@ type systemuser {
roles: [role]
evo_edo_departmentData: [picklist_value]
businessunitidData: businessunit
leads(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [lead]
opportunities(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [opportunity]
leads(orderby: OrderByInput): [lead]
opportunities(orderby: OrderByInput): [opportunity]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
@ -2272,7 +2270,7 @@ type role {
evo_documenttypes: [evo_documenttype]
evo_documenttypes_letter: [evo_documenttype]
evo_connection_roleData: [evo_connection_role]
systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser]
systemusers: [systemuser]
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
}
@ -2809,9 +2807,9 @@ type quote {
evo_statuscodeidData: evo_statuscode
evo_evokasko_insurer_accountidData: account
evo_supplier_accountidData: account
evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type]
evo_product_risks(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_product_risk]
evo_graphs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_graph]
evo_addproduct_types: [evo_addproduct_type]
evo_product_risks: [evo_product_risk]
evo_graphs: [evo_graph]
evo_approvallogs: [evo_approvallog]
evo_lessor_bank_detailsidData: evo_bank_details
evo_accept_control_addproduct_typeidData: evo_addproduct_type
@ -2821,8 +2819,6 @@ type quote {
evo_req_telematicname: String
evo_req_telematic_acceptname: String
evo_question_credit_committees: [evo_question_credit_committee]
evo_kasko_insurance_rulesidData: evo_insurance_rules
evo_osago_insurance_rulesiddData: evo_insurance_rules
ownerid_systemuserData: systemuser
ownerid_teamData: team
link: String
@ -4086,10 +4082,10 @@ type evo_tarif {
organizationid: UUID
evo_client_risks: [evo_client_risk]
evo_client_types: [evo_client_type]
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
evo_leasingobject_types: [evo_leasingobject_type]
evo_models: [evo_model]
evo_model_exceptions: [evo_model]
evo_rates(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_rate]
evo_rates: [evo_rate]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
@ -4269,10 +4265,10 @@ type evo_subsidy {
modifiedby: UUID
createdby: UUID
organizationid: UUID
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model]
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
evo_brands: [evo_brand]
evo_models: [evo_model]
accounts: [account]
evo_leasingobject_types: [evo_leasingobject_type]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
@ -4883,7 +4879,7 @@ type evo_region {
modifiedby: UUID
createdby: UUID
organizationid: UUID
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
accounts: [account]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
@ -4941,7 +4937,7 @@ type evo_rate {
createdby: UUID
organizationid: UUID
evo_brands: [evo_brand]
evo_tarifs(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_tarif]
evo_tarifs: [evo_tarif]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
@ -5802,8 +5798,8 @@ type evo_leasingobject_type {
modifiedby: UUID
createdby: UUID
organizationid: UUID
evo_subsidies(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_subsidy]
evo_vehicle_body_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_vehicle_body_type]
evo_subsidies: [evo_subsidy]
evo_vehicle_body_types: [evo_vehicle_body_type]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
@ -6028,92 +6024,6 @@ type evo_job_title {
twoParamsName(value: Boolean, key: String): String
}
type evo_insurance_rules {
toOdata(keys: [String]): [KeyValuePairOfStringAndObject!]
toOdataCreate: [KeyValuePairOfStringAndObject!]
toOdataUpdate: [KeyValuePairOfStringAndObject!]
emptyGuids: [String]
entitySetName: String
primaryId: UUID!
relativePathForUpdate: String
containerFields: [KeyValuePairOfStringAndObject!]
evo_insurance_rulesid: UUID
createdon: DateTime
modifiedon: DateTime
overriddencreatedon: DateTime
evo_dateto: DateTime
evo_datefrom: DateTime
evo_opf: Int
evo_risk: Int
evo_max_year: Int
evo_object_type: Int
evo_dealer: Int
statecode: Int
timezoneruleversionnumber: Int
evo_rules_type: Int
utcconversiontimezonecode: Int
importsequencenumber: Int
evo_brand: Int
evo_max_period: Int
evo_model: Int
evo_min_year: Int
evo_region: Int
statuscode: Int
evo_min_period: Int
evo_min_price: Decimal
evo_min_mileage: Decimal
evo_min_power: Decimal
evo_max_power: Decimal
evo_max_price: Decimal
evo_max_mileage: Decimal
evo_discount: Decimal
modifiedbyname: String
evo_insurer_accountidname: String
evo_message: String
evo_id: String
createdonbehalfbyname: String
createdbyyominame: String
evo_name: String
createdbyname: String
modifiedonbehalfbyname: String
createdonbehalfbyyominame: String
modifiedbyyominame: String
evo_insurer_accountidyominame: String
modifiedonbehalfbyyominame: String
organizationidname: String
evo_use_for: [Int!]
evo_enginie_type: [Int!]
evo_category: [Int!]
createdonbehalfby: UUID
modifiedonbehalfby: UUID
evo_insurer_accountid: UUID
createdby: UUID
modifiedby: UUID
organizationid: UUID
evo_models: [evo_model]
evo_brands: [evo_brand]
evo_regions: [evo_region]
accounts: [account]
evo_riskname: String
evo_rules_typename: String
evo_brandname: String
evo_modelname: String
evo_regionname: String
evo_dealername: String
evo_categorynames: [String]
evo_use_fornames: [String]
evo_enginie_typenames: [String]
evo_opfname: String
evo_object_typename: String
ownerid_systemuser: UUID
ownerid_team: UUID
ownerid_systemuserData: systemuser
ownerid_teamData: team
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
}
type evo_insurance_policy {
toOdata(keys: [String]): [KeyValuePairOfStringAndObject!]
toOdataCreate: [KeyValuePairOfStringAndObject!]
@ -6683,7 +6593,7 @@ type evo_graph {
modifiedonbehalfby: UUID
ownerid_systemuser: UUID
ownerid_team: UUID
evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment]
evo_planpayments: [evo_planpayment]
ownerid_systemuserData: systemuser
ownerid_teamData: team
link: String
@ -8434,9 +8344,9 @@ type evo_coefficient {
evo_businessunitid: UUID
organizationid: UUID
evo_job_titleid: UUID
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
evo_businessunits(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_businessunit]
evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct]
evo_leasingobject_types: [evo_leasingobject_type]
evo_businessunits: [evo_businessunit]
evo_baseproducts: [evo_baseproduct]
evo_sot_coefficient_typeidData: evo_sot_coefficient_type
link: String
picklistName(value: Int, key: String): String
@ -8723,12 +8633,12 @@ type evo_baseproduct {
modifiedby: UUID
createdby: UUID
organizationid: UUID
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
systemusers(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [systemuser]
accounts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [account]
evo_leasingobject_types: [evo_leasingobject_type]
evo_brands: [evo_brand]
systemusers: [systemuser]
accounts: [account]
evo_coefficients: [evo_coefficient]
evo_baseproducts(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_baseproduct]
evo_baseproducts: [evo_baseproduct]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String
@ -9316,11 +9226,11 @@ type evo_addproduct_type {
modifiedonbehalfby: UUID
organizationid: UUID
evo_accountid: UUID
evo_leasingobject_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_leasingobject_type]
evo_planpayments(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_planpayment]
evo_addproduct_types(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_addproduct_type]
evo_models(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_model]
evo_brands(filterConditionGroup: FilterConditionGroupInput, orderby: OrderByInput): [evo_brand]
evo_leasingobject_types: [evo_leasingobject_type]
evo_planpayments: [evo_planpayment]
evo_addproduct_types: [evo_addproduct_type]
evo_models: [evo_model]
evo_brands: [evo_brand]
link: String
picklistName(value: Int, key: String): String
twoParamsName(value: Boolean, key: String): String

File diff suppressed because one or more lines are too long

View File

@ -1,17 +0,0 @@
/* eslint-disable no-console */
import { useEffect } from 'react';
export function useServiceWorker() {
useEffect(() => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/sw.js')
.then((registration) => {
console.log('Service Worker registered with scope:', registration.scope);
})
.catch((error) => {
console.log('Service Worker registration failed:', error);
});
}
}, []);
}

View File

@ -39,23 +39,20 @@ export const handlers = [
rest.post(URL_1C_TRANSTAX, (req, res, ctx) =>
res(
ctx.json({
Error: null,
Tax: _.random(100000, 200000),
error: null,
tax: _.random(100000, 200000),
})
)
),
rest.post(URL_ELT_OSAGO, async (req, res, ctx) =>
res(
rest.post(URL_ELT_OSAGO, async (req, res, ctx) => res(
ctx.json({
numCalc: _.random(1000000, 3000000),
skCalcId: _.random(50000000, 60000000).toString(),
premiumSum: _.random(10000, 20000),
message: 'OSAGO Message',
})
)
),
rest.post(URL_ELT_KASKO, async (req, res, ctx) =>
res(
)),
rest.post(URL_ELT_KASKO, async (req, res, ctx) => res(
ctx.json({
requestId: _.random(3000000, 4000000).toString(),
skCalcId: _.random(50000000, 60000000).toString(),
@ -70,8 +67,7 @@ export const handlers = [
],
totalFranchise: _.random(20000, 40000),
})
)
),
)),
// rest.post(URL_CRM_GRAPHQL, (req, res, ctx) => {
// return res(ctx.status(503));

View File

@ -29,7 +29,6 @@ module.exports = withSentryConfig(
},
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../'),
proxyTimeout: 1000 * 90,
},
images: {
deviceSizes: devices,
@ -66,10 +65,10 @@ module.exports = withSentryConfig(
destination: env.URL_CORE_FINGAP_DIRECT,
source: urls.URL_CORE_FINGAP_PROXY,
},
// {
// destination: env.URL_1C_TRANSTAX_DIRECT,
// source: urls.URL_1C_TRANSTAX_PROXY,
// },
{
destination: env.URL_1C_TRANSTAX_DIRECT,
source: urls.URL_1C_TRANSTAX_PROXY,
},
{
destination: env.URL_ELT_KASKO_DIRECT,
source: urls.URL_ELT_KASKO_PROXY,

View File

@ -30,14 +30,13 @@
"mobx": "^6.12.0",
"mobx-react-lite": "^4.0.5",
"modern-normalize": "^2.0.0",
"next": "^14.2.5",
"next": "^14.1.0",
"radash": "^11.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.11",
"superjson": "^2.2.1",
"tools": "workspace:*",
"ua-parser-js": "^1.0.38",
"ui": "workspace:*",
"use-debounce": "^9.0.4",
"zod": "^3.22.4"
@ -55,7 +54,6 @@
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/styled-components": "^5.1.26",
"@types/ua-parser-js": "^0.7.39",
"@vchikalkin/eslint-config-awesome": "^1.1.6",
"antd": "^5.14.2",
"eslint": "^8.52.0",

View File

@ -8,7 +8,6 @@ import { Loading } from '@/Components/Common';
import Layout from '@/Components/Layout';
import { theme } from '@/config/ui';
import { usePageLoading } from '@/hooks';
import { useServiceWorker } from '@/hooks/worker';
import StoreProvider from '@/stores/Provider';
import getColors from '@/styles/colors';
import { GlobalStyle } from '@/styles/global-style';
@ -29,14 +28,10 @@ const colorPrimary = getColors().COLOR_PRIMARY;
function App({ Component, pageProps }) {
const { initialApolloState, initialQueryState } = pageProps;
const apolloClient = useMemo(
() => initializeApollo(initialApolloState, {}),
[initialApolloState]
);
const apolloClient = useMemo(() => initializeApollo(initialApolloState), [initialApolloState]);
const queryClient = useMemo(() => initializeQueryClient(initialQueryState), [initialQueryState]);
const { loading } = usePageLoading();
useServiceWorker();
return (
<ThemeProvider theme={theme}>

View File

@ -1,38 +0,0 @@
import type { ResponseTransTax } from '@/api/1c/types';
import { serverRuntimeConfigSchema } from '@/config/schema/runtime-config';
import { withHandleError } from '@/utils/axios';
import type { HttpError } from '@/utils/error';
import axios from 'axios';
import type { NextApiRequest, NextApiResponse } from 'next';
import getConfig from 'next/config';
const { serverRuntimeConfig } = getConfig();
const { USERNAME_1C_TRANSTAX, PASSWORD_1C_TRANSTAX, URL_1C_TRANSTAX_DIRECT } =
serverRuntimeConfigSchema.parse(serverRuntimeConfig);
export default function handler(req: NextApiRequest, res: NextApiResponse) {
const abortController = new AbortController();
req.on('close', () => {
abortController.abort();
});
const params = req.body as ResponseTransTax;
withHandleError(
axios.get<ResponseTransTax>(URL_1C_TRANSTAX_DIRECT, {
auth: {
password: PASSWORD_1C_TRANSTAX,
username: USERNAME_1C_TRANSTAX,
},
params,
signal: abortController.signal,
})
)
.then(({ data }) => res.json(data))
.catch((error) => {
const _err = error as HttpError;
return res.json({ message: _err.message });
});
}

View File

@ -7,11 +7,10 @@ import * as CRMTypes from '@/graphql/crm.types';
import { getCurrentDateString } from '@/utils/date';
import { normalizeOptions } from '@/utils/entity';
import { debouncedReaction } from '@/utils/mobx';
import { reaction } from 'mobx';
import { max } from 'radash';
import { reaction, toJS } from 'mobx';
export default function reactions({ store, apolloClient }: ProcessContext) {
const { $calculation, $process } = store;
const { $calculation, $tables } = store;
reaction(
() => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType', 'maxMass']),
@ -48,9 +47,9 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
)
);
const currentTechnicalCardId = $calculation.element('selectTechnicalCard').getValue();
$calculation.element('selectTechnicalCard').setOptions(normalizeOptions(options));
const currentTechnicalCardId = $calculation.element('selectTechnicalCard').getValue();
if (currentTechnicalCardId) {
const {
data: { evo_addproduct_type },
@ -75,54 +74,6 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
}
);
/**
* Устанавливаем самую дорогую техническую карточку по умолчанию первый раз при формировании списка карт
*/
{
const dispose = reaction(
() => {
const technicalCards = $calculation.element('selectTechnicalCard').getOptions();
const isLoadKP = $process.has('LoadKP');
return { isLoadKP, technicalCards };
},
async ({ technicalCards, isLoadKP }) => {
if (isLoadKP) {
dispose();
return;
}
const currentTechnicalCard = $calculation.element('selectTechnicalCard').getValue();
if (technicalCards.length && !currentTechnicalCard) {
const evo_addproduct_types = await Promise.all(
technicalCards.map(async (x) => {
const {
data: { evo_addproduct_type },
} = await apolloClient.query({
query: CRMTypes.GetAddProductTypeDocument,
variables: { addproductTypeId: x.value },
});
return evo_addproduct_type;
})
);
const maxPriceTechnicalCard = max(evo_addproduct_types, (x) => x?.evo_graph_price ?? 0);
if (maxPriceTechnicalCard) {
$calculation
.element('selectTechnicalCard')
.setValue(maxPriceTechnicalCard?.evo_addproduct_typeid);
}
dispose();
}
}
);
}
reaction(
() => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType']),
async ({ leasingPeriod, leaseObjectType }) => {
@ -160,35 +111,35 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
}
);
// reaction(
// () => {
// const values = $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']);
// const kaskoInsured = toJS($tables.insurance.row('kasko').getValue('insured'));
// const fingapInsured = toJS($tables.insurance.row('fingap').getValue('insured'));
reaction(
() => {
const values = $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']);
const kaskoInsured = toJS($tables.insurance.row('kasko').getValue('insured'));
const fingapInsured = toJS($tables.insurance.row('fingap').getValue('insured'));
// return {
// ...values,
// fingapInsured,
// kaskoInsured,
// };
// },
// ({ leasingPeriod, fingapInsured, kaskoInsured, leasingWithoutKasko }) => {
// if (
// leasingPeriod < 12 ||
// leasingWithoutKasko ||
// kaskoInsured === 100_000_001 ||
// (fingapInsured === 100_000_001 && leasingPeriod < 36)
// ) {
// $calculation.element('selectInsNSIB').resetValue().block();
// } else {
// $calculation.element('selectInsNSIB').unblock();
// }
// },
// {
// delay: 10,
// fireImmediately: true,
// }
// );
return {
...values,
fingapInsured,
kaskoInsured,
};
},
({ leasingPeriod, fingapInsured, kaskoInsured, leasingWithoutKasko }) => {
if (
leasingPeriod < 12 ||
leasingWithoutKasko ||
kaskoInsured === 100_000_001 ||
(fingapInsured === 100_000_001 && leasingPeriod < 36)
) {
$calculation.element('selectInsNSIB').resetValue().block();
} else {
$calculation.element('selectInsNSIB').unblock();
}
},
{
delay: 10,
fireImmediately: true,
}
);
debouncedReaction(
() =>

View File

@ -10,17 +10,8 @@ export function createValidationSchema(context: ValidationContext) {
return ValuesSchema.pick({ product: true, saleBonus: true }).superRefine(
async ({ product, saleBonus }, ctx) => {
const coefficient = await getCoefficient(product);
const minBonus = (coefficient?.evo_correction_coefficient || 0) * 100;
const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100;
if (round(saleBonus, 2) < round(minBonus, 2)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Бонус не может быть ниже установленного по СОТ',
path: ['tbxSaleBonus'],
});
}
if (round(saleBonus, 2) > round(maxBonus, 2)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,

View File

@ -1,5 +1,4 @@
import helper from '../lib/helper';
import { IRR_THRESHOLD } from '@/constants/values';
import type { ProcessContext } from '@/process/types';
import { disposableReaction } from '@/utils/mobx';
import { comparer, reaction } from 'mobx';
@ -32,8 +31,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
const { getIrr } = helper({ apolloClient });
disposableReaction(
() => $process.has('LoadKP'),
reaction(
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
async (values) => {
const { min, max } = await getIrr(values);
@ -42,19 +40,6 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
}
);
// костыль
disposableReaction(
() =>
$process.has('LoadKP') ||
$calculation.element('radioLastPaymentRule').getValue() === 100_000_002,
() => $calculation.element('labelIrrInfo').getValue(),
({ min }) => {
if ($calculation.element('radioLastPaymentRule').getValue() === 100_000_002) return;
$calculation.element('tbxIRR_Perc').setValue(min + IRR_THRESHOLD);
}
);
disposableReaction(
() => $process.has('Calculate') || $process.has('CreateKP'),
() => {

View File

@ -21,7 +21,7 @@ export async function getKPData({
? Math.min(quote?.evo_period ?? 0, quote?.evo_accept_period ?? 0)
: quote?.evo_period ?? 0;
const { getTarifs, getRates, getPriceChange, getCreditRate } = helper({ apolloClient });
const { getTarifs, getRates, getPriceChange } = helper({ apolloClient });
let tarif = defaultValues.tarif;
let evo_tarif: unknown = null;
@ -106,8 +106,6 @@ export async function getKPData({
tarif,
});
const creditRate = await getCreditRate({ rate: evo_rate?.evo_rateid ?? null });
return {
options: {
selectTarif: evo_tarif ? normalizeOptions([evo_tarif]) : [],
@ -115,7 +113,6 @@ export async function getKPData({
values: {
IRR_Perc: quote?.evo_msfo_irr ?? defaultValues.IRR_Perc,
clientType: quote?.evo_client_typeid,
creditRate,
floatingRate: quote?.evo_floating_rate ?? false,
irrInfo,
maxPriceChange,

View File

@ -1,6 +1,5 @@
/* eslint-disable sonarjs/cognitive-complexity */
import defaultValues from '@/config/default-values';
import { RATE } from '@/constants/values';
import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import type { CalculationValues } from '@/stores/calculation/values/types';
@ -23,8 +22,6 @@ type GetTarifInputValues = Pick<
type GetRatesInputValues = Pick<CalculationValues, 'tarif'>;
type GetCreditRateInputValues = Pick<CalculationValues, 'rate'>;
type GetPriceChangeInputValues = Pick<
CalculationValues,
| 'addEquipmentPrice'
@ -37,22 +34,6 @@ type GetPriceChangeInputValues = Pick<
export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloClient'>) {
return {
async getCreditRate({ rate: rateId }: GetCreditRateInputValues) {
if (!rateId) return RATE;
const {
data: { evo_rate },
} = await apolloClient.query({
fetchPolicy: 'network-only',
query: CRMTypes.GetRateDocument,
variables: {
rateId,
},
});
return evo_rate?.evo_base_rate ?? RATE;
},
async getPriceChange({
discountRub,
importProgramSum,
@ -125,7 +106,7 @@ export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloCli
});
const filtered_evo_tarif_evo_rates =
evo_tarif?.evo_rates?.filter((x) => x?.evo_type === 100_000_000 && x.statecode === 0) || [];
evo_tarif?.evo_rates?.filter((x) => x?.evo_type === 100_000_000) || [];
const evo_tarif_evo_rate =
evo_tarif?.evo_rates &&

View File

@ -10,7 +10,7 @@ export default function valuesReactions({ store, apolloClient, trpcClient }: Pro
let abortController = new AbortController();
const { $calculation, $process } = store;
const { getRates, getPriceChange, getCreditRate } = helper({ apolloClient });
const { getRates, getPriceChange } = helper({ apolloClient });
disposableDebouncedReaction(
() => $process.has('LoadKP'),
@ -123,13 +123,32 @@ export default function valuesReactions({ store, apolloClient, trpcClient }: Pro
}
);
disposableReaction(
() => $process.has('LoadKP'),
reaction(
() => $calculation.element('selectRate').getValue(),
async (rate) => {
const creditRate = await getCreditRate({ rate });
async (rateId) => {
if (!rateId) {
$calculation.element('tbxCreditRate').resetValue();
$calculation.element('tbxCreditRate').setValue(creditRate);
return;
}
const {
data: { evo_rate },
} = await apolloClient.query({
fetchPolicy: 'network-only',
query: CRMTypes.GetRateDocument,
variables: {
rateId,
},
});
if (evo_rate?.evo_base_rate === null || evo_rate?.evo_base_rate === undefined) {
$calculation.element('tbxCreditRate').resetValue();
return;
}
$calculation.element('tbxCreditRate').setValue(evo_rate?.evo_base_rate);
}
);

View File

@ -16,7 +16,6 @@ export async function getKPData({ quote }: GetQuoteInputData): Promise<GetQuoteP
quoteName: quote?.evo_contact_name ?? defaultValues.quoteName,
quotePriceWithFullVAT: quote?.evo_full_nds_price ?? defaultValues.quotePriceWithFullVAT,
quoteRedemptionGraph: quote?.evo_redemption_graph ?? defaultValues.quoteRedemptionGraph,
quoteShowAcceptLimit: quote?.evo_accept_limit_quote ?? defaultValues.quoteShowAcceptLimit,
registrationQuote: quote?.evo_registration_quote ?? defaultValues.registrationQuote,
showFinGAP: quote?.evo_fingap_quote ?? defaultValues.showFinGAP,
technicalCardQuote: quote?.evo_card_quote ?? defaultValues.technicalCardQuote,

View File

@ -1,37 +1,28 @@
import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types';
import { defaultRow } from '@/stores/tables/elt/default-values';
export async function getKPData({ quote }: GetQuoteInputData): Promise<GetQuoteProcessData> {
const elt: NonNullable<GetQuoteProcessData['elt']> = { kasko: undefined, osago: undefined };
if (
quote?.evo_kasko_accountid &&
((quote?.evo_id_elt_kasko && quote?.evo_id_kasko_calc) ||
quote.evo_kasko_insurance_rulesidData?.evo_id) &&
quote?.evo_id_elt_kasko &&
quote?.evo_id_kasko_calc &&
quote?.evo_kasko_price &&
quote?.evo_franchise !== null
) {
elt.kasko = {
insuranceCondition:
quote.evo_kasko_insurance_rulesidData?.evo_id ?? defaultRow.insuranceCondition,
key: quote?.evo_kasko_accountid,
requestId: quote?.evo_id_elt_kasko ?? defaultRow.requestId,
skCalcId: quote?.evo_id_kasko_calc ?? defaultRow.skCalcId,
requestId: quote?.evo_id_elt_kasko,
skCalcId: quote?.evo_id_kasko_calc,
sum: quote?.evo_kasko_price,
totalFranchise: quote?.evo_franchise,
};
}
if (
quote?.evo_osago_accountid &&
(quote?.evo_id_elt_osago || quote.evo_osago_insurance_rulesiddData?.evo_id) &&
quote?.evo_osago_price
) {
if (quote?.evo_osago_accountid && quote?.evo_id_elt_osago && quote?.evo_osago_price) {
elt.osago = {
insuranceCondition:
quote.evo_osago_insurance_rulesiddData?.evo_id ?? defaultRow.insuranceCondition,
key: quote?.evo_osago_accountid,
numCalc: quote?.evo_id_elt_osago ?? defaultRow.numCalc,
numCalc: quote?.evo_id_elt_osago,
sum: quote?.evo_osago_price,
};
}

View File

@ -30,19 +30,14 @@ export default function helper({
({ evo_leasingobject_type } = data);
}
// const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue();
return {
kasko: (accounts
?.filter(
(x) =>
x?.evo_type_ins_policy?.includes(100_000_000) &&
// leaseObjectCategory &&
// x.evo_kasko_category?.includes(leaseObjectCategory) &&
(evo_leasingobject_type?.evo_id &&
['6', '9', '10'].includes(evo_leasingobject_type.evo_id)
? x?.evo_id_elt_smr
: x?.evo_id_elt)
?.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_000) &&
evo_leasingobject_type?.evo_id &&
['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)
? Boolean(x.evo_id_elt_smr)
: Boolean(x?.evo_id_elt)
)
.map((x) => ({
...defaultRow,
@ -58,8 +53,6 @@ export default function helper({
?.filter(
(x) =>
x?.evo_type_ins_policy?.includes(100_000_001) &&
// leaseObjectCategory &&
// x.evo_osago_category?.includes(leaseObjectCategory) &&
(x?.evo_id_elt_osago || x.evo_osago_id)
)
.map((x) => ({

View File

@ -1,284 +0,0 @@
/* 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,
};
}

View File

@ -1,142 +0,0 @@
/* 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
);
}

View File

@ -1,7 +0,0 @@
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;
};

View File

@ -259,8 +259,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
}
let okved: string | null | undefined;
let evo_inn: string | null | undefined;
if (leadid) {
const {
data: { lead },
@ -270,7 +268,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
});
okved = lead?.accountidData?.evo_okved;
evo_inn = lead?.evo_inn;
}
if (!okved && opportunityid) {
@ -305,14 +302,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
path: ['eltKasko', 'eltOsago'],
});
}
if (!evo_inn) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'ИНН в интересе не заполнен',
path: ['eltKasko', 'eltOsago'],
});
}
}
);
}

View File

@ -1,2 +1 @@
export { default as common } from './common';
export { default as init } from './init';

View File

@ -1,34 +0,0 @@
import type { ProcessContext } from '@/process/types';
import { when } from 'mobx';
export default function reactions({ store }: ProcessContext) {
const { $tables } = store;
/**
* Устанавливаем СК фингап по умолчанию при загрузке страницы
*/
when(() => {
const finGAPInsuranceCompanies = $tables.insurance.row('fingap').getOptions('insuranceCompany');
if (finGAPInsuranceCompanies.length) {
$tables.insurance
.row('fingap')
.setValue('insuranceCompany', finGAPInsuranceCompanies[0]?.value)
.setValue('insured', 100_000_001);
}
return Boolean(finGAPInsuranceCompanies.length);
});
/**
* Устанавливаем все риски ФинГАП по умолчанию при загрузке страницы
*/
when(() => {
const { risks } = $tables.fingap;
if (risks.length) {
$tables.fingap.setSelectedKeys(risks.map((x) => x.key));
}
return Boolean(risks.length);
});
}

View File

@ -9,6 +9,7 @@ import * as CRMTypes from '@/graphql/crm.types';
import { getCurrentDateString } from '@/utils/date';
import { normalizeOptions } from '@/utils/entity';
import { disposableReaction } from '@/utils/mobx';
import dayjs from 'dayjs';
import { reaction } from 'mobx';
export function common({ store, apolloClient, queryClient }: ProcessContext) {
@ -185,16 +186,18 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
const carCategory = getCarCategory(objectTypeTax);
if (OKTMO) {
const currentDate = dayjs().utc(false).toDate();
const response = await queryClient.fetchQuery(
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear, OKTMO],
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear],
(context) =>
getTransTax(
{
CalcDate: getCurrentDateString(),
CarCategory: carCategory,
OKTMO,
Power: leaseObjectMotorPower,
Year: leaseObjectYear,
calcDate: currentDate,
carCategory,
power: leaseObjectMotorPower,
year: leaseObjectYear,
},
context
),
@ -203,8 +206,8 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
}
);
if (response?.Tax) {
$calculation.element('tbxVehicleTaxInYear').setValue(response.Tax);
if (response?.tax) {
$calculation.element('tbxVehicleTaxInYear').setValue(response.tax);
} else {
$calculation.element('tbxVehicleTaxInYear').resetValue();
}

View File

@ -207,7 +207,6 @@ export function common({ store, apolloClient }: ProcessContext) {
}
);
// объединить со строчкой 308
debouncedReaction(
() => $calculation.$values.getValues(['leaseObjectCategory', 'leasingWithoutKasko']),
async ({ leaseObjectCategory, leasingWithoutKasko }) => {
@ -304,70 +303,6 @@ export function common({ store, apolloClient }: ProcessContext) {
}
}
);
// объединить со строчкой 210
reaction(
() => $calculation.$values.getValues(['leaseObjectType', 'maxSpeed']),
async ({ leaseObjectType: leaseObjectTypeId, maxSpeed }) => {
if (!leaseObjectTypeId) {
$tables.insurance.row('osago').column('insuranceCompany').unblock();
$tables.insurance.row('osago').column('insured').unblock();
$tables.insurance.row('osago').column('insCost').unblock();
return;
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
const {
data: { accounts },
} = await apolloClient.query({
query: CRMTypes.GetInsuranceCompaniesDocument,
});
if (
evo_leasingobject_type?.evo_id &&
['9', '6', '10'].includes(evo_leasingobject_type.evo_id) &&
maxSpeed < 20
) {
const otherInsuranceCompany = accounts?.find(
(x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ')
);
if (otherInsuranceCompany) {
$tables.insurance
.row('osago')
.column('insuranceCompany')
.setOptions(normalizeOptions([otherInsuranceCompany]))
.setValue(otherInsuranceCompany.value)
.block();
}
$tables.insurance.row('osago').column('insured').setValue(100_000_000).block();
$tables.insurance.row('osago').column('insCost').setValue(0).block();
} else {
const defaultOsagoOptions = accounts?.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_001)
);
$tables.insurance
.row('osago')
.column('insuranceCompany')
.setOptions(normalizeOptions(defaultOsagoOptions))
.unblock();
$tables.insurance.row('osago').column('insured').unblock();
$tables.insurance.row('osago').column('insCost').unblock();
}
}
);
}
export const validation = createValidationReaction(createValidationSchema);

View File

@ -16,7 +16,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
leaseObjectType: true,
leasingPeriod: true,
leasingWithoutKasko: true,
maxSpeed: true,
partialVAT: true,
plPriceRub: true,
product: true,
@ -43,7 +42,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
leaseObjectType: leaseObjectTypeId,
firstPaymentPerc,
plPriceRub,
maxSpeed,
},
ctx
) => {
@ -253,19 +251,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
path: ['tbxLeaseObjectPrice'],
});
}
if (
evo_leasingobject_type?.evo_id &&
['9', '6', '10'].includes(evo_leasingobject_type?.evo_id) &&
maxSpeed < 20 &&
insurance.values.osago.insured === 100_000_001
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя включать в график ОСАГО по Спецтехнике, т.к. полис не требуется',
path: ['insurance'],
});
}
}
);
}

View File

@ -17,7 +17,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
leaseObjectType: true,
leaseObjectUseFor: true,
maxMass: true,
maxSpeed: true,
model: true,
}).superRefine(
async (
@ -33,7 +32,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
model: modelId,
leaseObjectUseFor,
configuration,
maxSpeed,
},
ctx
) => {
@ -136,21 +134,21 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
}
}
if (evo_leasingobject_type?.evo_id === '1' && (countSeats <= 0 || countSeats > 9)) {
if (evo_leasingobject_type?.evo_id === '1' && countSeats >= 9) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Количество мест должно быть от 0 до 9',
message: 'Количество мест должно быть меньше 9',
path: ['tbxCountSeats'],
});
}
if (
(evo_leasingobject_type?.evo_id === '4' || evo_leasingobject_type?.evo_id === '5') &&
countSeats <= 9
countSeats <= 8
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Количество мест должно быть не меньше 9',
message: 'Количество мест должно быть больше 8',
path: ['tbxCountSeats'],
});
}
@ -176,18 +174,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
path: ['selectLeaseObjectCategory'],
});
}
if (
evo_leasingobject_type?.evo_id &&
['6', '9', '10'].includes(evo_leasingobject_type?.evo_id) &&
!maxSpeed
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['tbxMaxSpeed'],
});
}
}
}
);

View File

@ -15,7 +15,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
reaction(
() => $calculation.$values.getValue('quote'),
() => {
async () => {
const quote = $calculation.element('selectQuote').getOption();
if (!quote || $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP'))
@ -29,6 +29,8 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
onClick: () => message.destroy(key),
});
const eltInitialValues = await initElt();
trpcClient.getQuote
.query({
values: {
@ -36,7 +38,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
...$calculation.$values.getValues(['lead', 'opportunity', 'recalcWithRevision']),
},
})
.then(async ({ values, payments, insurance, fingap, elt, options }) => {
.then(({ values, payments, insurance, fingap, elt, options }) => {
if (options?.selectTarif) {
$calculation.element('selectTarif').setOptions(normalizeOptions(options.selectTarif));
} else {
@ -74,7 +76,6 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
$tables.fingap.setRisks(fingap.risks);
$tables.fingap.setSelectedKeys(fingap.keys);
}
const eltInitialValues = await initElt();
if (eltInitialValues) {
$tables.elt.kasko.setRows(eltInitialValues.kasko);

View File

@ -1,11 +1,10 @@
import type { ProcessContext } from '../types';
import { createValidationSchema } from './validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import * as CRMTypes from '@/graphql/crm.types';
import { createValidationReaction } from '@/process/tools';
import { reaction } from 'mobx';
export function common({ store, apolloClient }: ProcessContext) {
export function common({ store }: ProcessContext) {
const { $calculation, $tables } = store;
reaction(
@ -66,7 +65,6 @@ export function common({ store, apolloClient }: ProcessContext) {
// 'tbxLastPaymentRub',
'cbxPartialVAT',
];
reaction(
() => $calculation.element('cbxRecalcWithRevision').getValue(),
(recalcWithRevision) => {
@ -81,53 +79,7 @@ export function common({ store, apolloClient }: ProcessContext) {
}
}
);
}
{
/**
* Закрыть на редактирование поля при Пересчете без пересмотра recalcWithRevision = True и если в Предложении selectQuote в поле "КП по итогам КК" = Да
* Срок поставки* radioDeliveryTime
* Цель использования* selectLeaseObjectUseFor
* Тип двигателя selectEngineType
* Децентрализованное страхование cbxInsDecentral
*/
const elements: Elements[] = [
'radioDeliveryTime',
'selectLeaseObjectUseFor',
'selectEngineType',
'cbxInsDecentral',
];
reaction(
() => $calculation.$values.getValues(['recalcWithRevision', 'quote']),
async ({ recalcWithRevision, quote: quoteId }) => {
if (!recalcWithRevision || !quoteId) {
elements.forEach((elementName) => $calculation.$status.clearOverridedStatus(elementName));
return;
}
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: {
quoteId,
},
});
if (quote?.evo_committee_quote === 100_000_000) {
elements.forEach((elementName) =>
$calculation.$status.overrideStatus(elementName, 'Disabled')
);
} else {
elements.forEach((elementName) => $calculation.$status.clearOverridedStatus(elementName));
}
}
);
}
{
const agents: Elements[] = [
'selectCalcBrokerRewardCondition',
'selectCalcDoubleAgentRewardCondition',

View File

@ -1,9 +1,6 @@
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable complexity */
import type { ValidationContext } from '../types';
import type { Elements } from '@/Components/Calculation/config/map/values';
import { FinGAPSchema } from '@/config/schema/fingap';
import { InsuranceSchema } from '@/config/schema/insurance';
import ValuesSchema from '@/config/schema/values';
import { MAX_MASS, VEHICLE_SEATS } from '@/constants/values';
import * as CRMTypes from '@/graphql/crm.types';
@ -11,367 +8,221 @@ import { z } from 'zod';
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({
IRR_Perc: true,
addEquipmentPrice: true,
countSeats: true,
dealerPerson: true,
discountRub: true,
engineVolume: true,
firstPaymentPerc: true,
importProgramSum: true,
insNSIB: true,
lastPaymentPerc: true,
leaseObjectCategory: true,
leaseObjectCount: true,
leaseObjectMotorPower: true,
leaseObjectPriceWthtVAT: true,
leaseObjectUsed: true,
leaseObjectYear: true,
maxMass: true,
objectRegistration: true,
partialVAT: true,
plPriceRub: true,
product: true,
quote: true,
recalcWithRevision: true,
technicalCard: true,
})
.extend({
fingap: FinGAPSchema,
insurance: InsuranceSchema,
})
.superRefine(
async (
{
addEquipmentPrice,
dealerPerson: dealerPersonId,
importProgramSum,
leaseObjectPriceWthtVAT,
leaseObjectUsed,
product: productId,
quote: quoteId,
recalcWithRevision,
discountRub,
plPriceRub,
firstPaymentPerc,
leaseObjectCount,
maxMass,
countSeats,
leaseObjectYear,
lastPaymentPerc,
leaseObjectCategory,
partialVAT,
IRR_Perc,
leaseObjectMotorPower,
engineVolume,
insNSIB,
technicalCard,
objectRegistration,
fingap: fingapRisks,
insurance,
},
ctx
) => {
if (!recalcWithRevision) {
return;
}
}).superRefine(
async (
{
addEquipmentPrice,
dealerPerson: dealerPersonId,
importProgramSum,
leaseObjectPriceWthtVAT,
leaseObjectUsed,
product: productId,
quote: quoteId,
recalcWithRevision,
discountRub,
plPriceRub,
firstPaymentPerc,
leaseObjectCount,
maxMass,
countSeats,
leaseObjectYear,
lastPaymentPerc,
leaseObjectCategory,
partialVAT,
},
ctx
) => {
if (!recalcWithRevision) {
return;
}
if (!quoteId) {
if (!quoteId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не указано предложение, по которому осуществляется Пересчет без пересмотра',
path: ['selectQuote'],
});
}
if (dealerPersonId && quoteId && productId) {
const {
data: { dealer_person },
} = await apolloClient.query({
query: CRMTypes.GetDealerPersonDocument,
variables: { dealerPersonId },
});
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: { quoteId },
});
const maxCondition1 =
leaseObjectUsed === false &&
dealer_person?.evo_supplier_type !== 100_000_001 &&
quote?.evo_max_price_change &&
!partialVAT &&
plPriceRub - discountRub + addEquipmentPrice - importProgramSum >
quote.evo_max_price_change;
const maxCondition2 =
leaseObjectUsed === false &&
dealer_person?.evo_supplier_type !== 100_000_001 &&
quote?.evo_max_price_change &&
partialVAT &&
leaseObjectPriceWthtVAT >
quote.evo_max_price_change - (quote.evo_nds_in_price_supplier_currency || 0);
const maxCondition3 =
(leaseObjectUsed === true || dealer_person?.evo_supplier_type === 100_000_001) &&
quote?.evo_supplier_currency_price &&
plPriceRub - discountRub + addEquipmentPrice - importProgramSum >
quote.evo_supplier_currency_price -
(quote.evo_discount_supplier_currency || 0) +
(quote.evo_equip_price || 0) -
(quote.evo_program_import_subsidy_sum || 0);
const minCondition1 =
!partialVAT &&
quote?.evo_min_change_price &&
plPriceRub - discountRub + addEquipmentPrice - importProgramSum <
quote.evo_min_change_price;
const minCondition2 =
partialVAT &&
quote?.evo_min_change_price &&
leaseObjectPriceWthtVAT <
quote.evo_min_change_price - (quote.evo_nds_in_price_supplier_currency || 0);
if (maxCondition1 || maxCondition2) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не указано предложение, по которому осуществляется Пересчет без пересмотра',
path: ['selectQuote'],
message:
'Указанная стоимость предмета лизинга больше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' +
'Уменьшите стоимость предмета лизинга',
path: ['tbxLeaseObjectPrice'],
});
}
if (dealerPersonId && quoteId && productId) {
const {
data: { dealer_person },
} = await apolloClient.query({
query: CRMTypes.GetDealerPersonDocument,
variables: { dealerPersonId },
} else if (maxCondition3) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'При пересчете без пересмотра КП с ПЛ БУ или с непрофессиональным поставщиком недопустимо увеличение стоимости. Создайте новое КП и отправьте его на рассмотрение андеррайтингу для повторной проверки оценщиком.',
path: ['tbxLeaseObjectPrice'],
});
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: { quoteId },
} else if (minCondition1 || minCondition2) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указанная стоимость предмета лизинга меньше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' +
'Увеличьте стоимость предмета лизинга',
path: ['tbxLeaseObjectPrice'],
});
const maxCondition1 =
leaseObjectUsed === false &&
dealer_person?.evo_supplier_type !== 100_000_001 &&
quote?.evo_max_price_change &&
!partialVAT &&
plPriceRub - discountRub + addEquipmentPrice - importProgramSum >
quote.evo_max_price_change;
const maxCondition2 =
leaseObjectUsed === false &&
dealer_person?.evo_supplier_type !== 100_000_001 &&
quote?.evo_max_price_change &&
partialVAT &&
leaseObjectPriceWthtVAT >
quote.evo_max_price_change - (quote.evo_nds_in_price_supplier_currency || 0);
const maxCondition3 =
(leaseObjectUsed === true || dealer_person?.evo_supplier_type === 100_000_001) &&
quote?.evo_supplier_currency_price &&
plPriceRub - discountRub + addEquipmentPrice - importProgramSum >
quote.evo_supplier_currency_price -
(quote.evo_discount_supplier_currency || 0) +
(quote.evo_equip_price || 0) -
(quote.evo_program_import_subsidy_sum || 0);
const minCondition1 =
!partialVAT &&
quote?.evo_min_change_price &&
plPriceRub - discountRub + addEquipmentPrice - importProgramSum <
quote.evo_min_change_price;
const minCondition2 =
partialVAT &&
quote?.evo_min_change_price &&
leaseObjectPriceWthtVAT <
quote.evo_min_change_price - (quote.evo_nds_in_price_supplier_currency || 0);
if (maxCondition1 || maxCondition2) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указанная стоимость предмета лизинга больше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' +
'Уменьшите стоимость предмета лизинга',
path: ['tbxLeaseObjectPrice'],
});
} else if (maxCondition3) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'При пересчете без пересмотра КП с ПЛ БУ или с непрофессиональным поставщиком недопустимо увеличение стоимости. Создайте новое КП и отправьте его на рассмотрение андеррайтингу для повторной проверки оценщиком.',
path: ['tbxLeaseObjectPrice'],
});
} else if (minCondition1 || minCondition2) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указанная стоимость предмета лизинга меньше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' +
'Увеличьте стоимость предмета лизинга',
path: ['tbxLeaseObjectPrice'],
});
}
}
if (quoteId) {
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: { quoteId },
});
if (
firstPaymentPerc <
(quote?.evo_approved_first_payment || 0) + (quote?.evo_percent_subsidy || 0)
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Указанный первый платеж меньше одобренного ${quote?.evo_approved_first_payment}. При пересчете без пересмотра изменение первого платежа возможно только в большую сторону от одобренного значения`,
path: ['tbxFirstPaymentPerc'],
});
}
if (quote?.evo_recalc_limit && leaseObjectCount > quote.evo_recalc_limit) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Количество ПЛ превышает лимит пересчета без пересмотра',
path: ['tbxLeaseObjectCount'],
});
}
if (
quote?.evo_max_mass &&
((quote.evo_max_mass < MAX_MASS && maxMass >= MAX_MASS) ||
(quote?.evo_max_mass >= MAX_MASS && maxMass < MAX_MASS))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указанная разрешенная макс. масса выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки',
path: ['tbxMaxMass'],
});
}
if (
leaseObjectCategory === 100_000_003 &&
quote?.evo_seats &&
((quote.evo_seats < VEHICLE_SEATS && countSeats >= VEHICLE_SEATS) ||
(quote.evo_seats >= VEHICLE_SEATS && countSeats < VEHICLE_SEATS))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указанное кол-во мест выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки',
path: ['tbxCountSeats'],
});
}
if (quote?.evo_year && leaseObjectYear < quote.evo_year) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'При пересчете без пересмотра год выпуска нельзя уменьшать',
path: ['tbxLeaseObjectYear'],
});
}
if (
quote?.evo_last_payment_perc &&
lastPaymentPerc > 1 &&
lastPaymentPerc > quote.evo_last_payment_perc
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'При пересчете без пересмотра последний платеж можно уменьшать или увеличивать до 1%',
path: ['tbxLastPaymentPerc'],
});
}
if (partialVAT !== quote?.evo_sale_without_nds) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя менять частичный НДС при пересчете без пересмотра',
path: ['selectProduct'],
});
}
if (quote?.evo_committee_quote === 100_000_000 && quote.evo_accept_quoteid) {
const {
data: { quote: accept_quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: { quoteId: quote.evo_accept_quoteid },
});
if (accept_quote?.evo_msfo_irr && IRR_Perc - accept_quote?.evo_msfo_irr > 0.1)
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя увеличивать IRR после рассмотрения предложения на КК',
path: ['tbxIRR_Perc'] as Elements[],
});
if (
accept_quote?.evo_power &&
Math.abs(leaseObjectMotorPower - accept_quote.evo_power) > 10
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Нельзя корректировать мощность более чем на 10 л.с. после рассмотрения предложения на КК',
path: ['tbxLeaseObjectMotorPower'] as Elements[],
});
}
if (
accept_quote?.evo_engine_volume &&
Math.abs(engineVolume - accept_quote.evo_engine_volume) > 0.1
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Нельзя корректировать объем двигателя более чем на 0.1 л после рассмотрения предложения на КК',
path: ['tbxEngineVolume'] as Elements[],
});
}
if (insNSIB && !accept_quote?.evo_nsib) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя включать в график НСИБ после рассмотрения предложения на КК',
path: ['selectInsNSIB'] as Elements[],
});
}
if (
technicalCard &&
!accept_quote?.evo_addproduct_types?.some((x) => x?.evo_product_type === 100_000_000)
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Нельзя включать в график карту тех.помощи после рассмотрения предложения на КК',
path: ['selectTechnicalCard'] as Elements[],
});
}
if (
objectRegistration &&
objectRegistration !== accept_quote?.evo_db_accept_registration
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя менять регистрацию после рассмотрения предложения на КК',
path: ['radioObjectRegistration'] as Elements[],
});
}
if (
insurance.values.fingap.insured === 100_000_001 &&
fingapRisks?.length > 0 &&
fingapRisks.some(
(fingapRisk) =>
!accept_quote?.evo_product_risks?.some(
(evo_product_risk) =>
fingapRisk.riskId === evo_product_risk?.evo_addproduct_typeid
)
)
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Нельзя включать новые риски Safe Finance после рассмотрения предложения на КК',
path: ['fingap'],
});
}
if (
insurance.values.fingap.insured === 100_000_001 &&
accept_quote?.evo_fingap_payer &&
insurance.values.fingap.insured !== accept_quote?.evo_fingap_payer
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Нельзя включать в график SafeFinance после рассмотрения предложения на КК',
path: ['insurance'],
});
}
if (
insurance.values.osago.insured === 100_000_001 &&
accept_quote?.evo_osago_payer &&
insurance.values.osago.insured !== accept_quote?.evo_osago_payer
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя включать в график ОСАГО после рассмотрения предложения на КК',
path: ['insurance'],
});
}
if (
insurance.values.kasko.insured === 100_000_001 &&
accept_quote?.evo_kasko_payer &&
insurance.values.kasko.insured !== accept_quote?.evo_kasko_payer
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя включать в график КАСКО после рассмотрения предложения на КК',
path: ['insurance'],
});
}
}
}
}
);
if (quoteId) {
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: { quoteId },
});
if (
firstPaymentPerc <
(quote?.evo_approved_first_payment || 0) + (quote?.evo_percent_subsidy || 0)
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Указанный первый платеж меньше одобренного ${quote?.evo_approved_first_payment}. При пересчете без пересмотра изменение первого платежа возможно только в большую сторону от одобренного значения`,
path: ['tbxFirstPaymentPerc'],
});
}
if (quote?.evo_recalc_limit && leaseObjectCount > quote.evo_recalc_limit) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Количество ПЛ превышает лимит пересчета без пересмотра',
path: ['tbxLeaseObjectCount'],
});
}
if (
quote?.evo_max_mass &&
((quote.evo_max_mass < MAX_MASS && maxMass >= MAX_MASS) ||
(quote?.evo_max_mass >= MAX_MASS && maxMass < MAX_MASS))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указанная разрешенная макс. масса выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки',
path: ['tbxMaxMass'],
});
}
if (
leaseObjectCategory === 100_000_003 &&
quote?.evo_seats &&
((quote.evo_seats < VEHICLE_SEATS && countSeats >= VEHICLE_SEATS) ||
(quote.evo_seats >= VEHICLE_SEATS && countSeats < VEHICLE_SEATS))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указанное кол-во мест выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки',
path: ['tbxCountSeats'],
});
}
if (quote?.evo_year && leaseObjectYear < quote.evo_year) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'При пересчете без пересмотра год выпуска нельзя уменьшать',
path: ['tbxLeaseObjectYear'],
});
}
if (
quote?.evo_last_payment_perc &&
lastPaymentPerc > 1 &&
lastPaymentPerc > quote.evo_last_payment_perc
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'При пересчете без пересмотра последний платеж можно уменьшать или увеличивать до 1%',
path: ['tbxLastPaymentPerc'],
});
}
if (partialVAT !== quote?.evo_sale_without_nds) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя менять частичный НДС при пересчете без пересмотра',
path: ['selectProduct'],
});
}
}
}
);
}

View File

@ -167,53 +167,4 @@ export function common({ store, apolloClient }: ProcessContext) {
.setValue(Boolean(evo_baseproduct?.evo_supplier_financing_accept));
}
);
{
// eslint-disable-next-line no-inner-declarations
function unblock() {
const cbxPartialVAT = $calculation.element('cbxPartialVAT');
cbxPartialVAT.unblock();
if (cbxPartialVAT.getValue()) $calculation.element('tbxVATInLeaseObjectPrice').unblock();
$calculation.element('cbxInsDecentral').unblock();
$calculation.element('selectDealerPerson').unblock();
$calculation.element('selectDealerRewardCondition').unblock();
$calculation.element('selectDealerBroker').unblock();
$calculation.element('selectDealerBrokerRewardCondition').unblock();
}
/**
* @see 'apps/web/process/used-pl/reactions.ts:common (40)'
*/
reaction(
() => $calculation.$values.getValues(['dealerPerson', 'partialVAT']),
async ({ dealerPerson: dealerPersonId }) => {
if (!dealerPersonId) {
unblock();
return;
}
const { data } = await apolloClient.query({
query: CRMTypes.GetDealerPersonDocument,
variables: {
dealerPersonId,
},
});
if (data?.dealer_person?.evo_legal_form === 100_000_004) {
$calculation.element('cbxPartialVAT').setValue(true).block();
$calculation.element('tbxVATInLeaseObjectPrice').resetValue().block();
$calculation.element('cbxInsDecentral').setValue(false).block();
$calculation.element('selectDealerRewardCondition').block();
$calculation.element('tbxDealerRewardSumm').resetValue().block();
$calculation.element('selectDealerBroker').resetValue().block();
$calculation.element('selectDealerBrokerRewardCondition').resetValue().block();
$calculation.element('tbxDealerBrokerRewardSumm').resetValue().block();
} else {
unblock();
}
}
);
}
}

View File

@ -190,7 +190,7 @@ export function createValidationSchema(context: ValidationContext) {
dealerBroker,
dealerBrokerRewardCondition,
dealerBrokerRewardSumm,
dealerPerson: dealerPersonId,
dealerPerson,
dealerRewardCondition,
dealerRewardSumm,
finDepartmentRewardCondtion,
@ -248,12 +248,12 @@ export function createValidationSchema(context: ValidationContext) {
if (
dealerRewardSumm > 0 &&
Boolean(dealerPersonId) &&
((dealerPersonId === dealerBroker && dealerBrokerRewardSumm > 0) ||
(dealerPersonId === indAgent && indAgentRewardSumm > 0) ||
(dealerPersonId === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(dealerPersonId === calcBroker && calcBrokerRewardSum > 0) ||
(dealerPersonId === calcFinDepartment && finDepartmentRewardSumm > 0))
Boolean(dealerPerson) &&
((dealerPerson === dealerBroker && dealerBrokerRewardSumm > 0) ||
(dealerPerson === indAgent && indAgentRewardSumm > 0) ||
(dealerPerson === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(dealerPerson === calcBroker && calcBrokerRewardSum > 0) ||
(dealerPerson === calcFinDepartment && finDepartmentRewardSumm > 0))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
@ -265,7 +265,7 @@ export function createValidationSchema(context: ValidationContext) {
if (
dealerBrokerRewardSumm > 0 &&
Boolean(dealerBroker) &&
((dealerBroker === dealerPersonId && dealerRewardSumm > 0) ||
((dealerBroker === dealerPerson && dealerRewardSumm > 0) ||
(dealerBroker === indAgent && indAgentRewardSumm > 0) ||
(dealerBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(dealerBroker === calcBroker && calcBrokerRewardSum > 0) ||
@ -281,7 +281,7 @@ export function createValidationSchema(context: ValidationContext) {
if (
indAgentRewardSumm > 0 &&
Boolean(indAgent) &&
((indAgent === dealerPersonId && dealerRewardSumm > 0) ||
((indAgent === dealerPerson && dealerRewardSumm > 0) ||
(indAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
(indAgent === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(indAgent === calcBroker && calcBrokerRewardSum > 0) ||
@ -297,7 +297,7 @@ export function createValidationSchema(context: ValidationContext) {
if (
calcDoubleAgentRewardSumm > 0 &&
Boolean(calcDoubleAgent) &&
((calcDoubleAgent === dealerPersonId && dealerRewardSumm > 0) ||
((calcDoubleAgent === dealerPerson && dealerRewardSumm > 0) ||
(calcDoubleAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcDoubleAgent === indAgent && indAgentRewardSumm > 0) ||
(calcDoubleAgent === calcBroker && calcBrokerRewardSum > 0) ||
@ -313,7 +313,7 @@ export function createValidationSchema(context: ValidationContext) {
if (
calcBrokerRewardSum > 0 &&
Boolean(calcBroker) &&
((calcBroker === dealerPersonId && dealerRewardSumm > 0) ||
((calcBroker === dealerPerson && dealerRewardSumm > 0) ||
(calcBroker === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcBroker === indAgent && indAgentRewardSumm > 0) ||
(calcBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
@ -329,7 +329,7 @@ export function createValidationSchema(context: ValidationContext) {
if (
finDepartmentRewardSumm > 0 &&
Boolean(calcFinDepartment) &&
((calcFinDepartment === dealerPersonId && dealerRewardSumm > 0) ||
((calcFinDepartment === dealerPerson && dealerRewardSumm > 0) ||
(calcFinDepartment === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcFinDepartment === indAgent && indAgentRewardSumm > 0) ||
(calcFinDepartment === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
@ -360,7 +360,7 @@ export function createValidationSchema(context: ValidationContext) {
},
});
if (!dealerPersonId && !dealer?.evo_return_leasing_dealer)
if (!dealerPerson && !dealer?.evo_return_leasing_dealer)
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
@ -377,29 +377,14 @@ export function createValidationSchema(context: ValidationContext) {
const { validateRewardSum, validateRewardWithoutOtherAgent } = helper({ ...context, ctx });
await validateRewardSum({
agentid: dealerPersonId,
agentid: dealerPerson,
conditionId: dealerRewardCondition,
sum: dealerRewardSumm,
sumFieldName: 'tbxDealerRewardSumm',
});
let evo_broker_accountid: string | null = null;
if (dealerPersonId) {
const {
data: { dealer_person },
} = await apolloClient.query({
query: CRMTypes.GetDealerPersonDocument,
variables: {
dealerPersonId,
},
});
evo_broker_accountid = dealer_person?.evo_broker_accountid || null;
}
await validateRewardSum({
agentid: dealerBroker || evo_broker_accountid,
agentid: dealerBroker,
conditionId: dealerBrokerRewardCondition,
sum: dealerBrokerRewardSumm,
sumFieldName: 'tbxDealerBrokerRewardSumm',
@ -482,46 +467,6 @@ export function createValidationSchema(context: ValidationContext) {
});
}
if (dealerPersonId) {
const {
data: { dealer_person },
} = await apolloClient.query({
query: CRMTypes.GetDealerPersonDocument,
variables: {
dealerPersonId,
},
});
// eslint-disable-next-line no-inner-declarations
async function isAgentEqualsToDealerPerson(agentid: string | null) {
if (!agentid) return false;
if (agentid === dealerPersonId) return true;
const { data } = await apolloClient.query({
query: CRMTypes.GetAgentDocument,
variables: {
agentid,
},
});
return data?.agent?.evo_inn === dealer_person?.evo_inn;
}
if (
dealer_person?.evo_legal_form === 100_000_004 &&
((await isAgentEqualsToDealerPerson(indAgent)) ||
(await isAgentEqualsToDealerPerson(calcDoubleAgent)) ||
(await isAgentEqualsToDealerPerson(calcBroker)) ||
(await isAgentEqualsToDealerPerson(calcFinDepartment)))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Нельзя закладывать АВ поставщику-ФЛ',
path: ['selectDealerPerson'],
});
}
}
if (brandId) {
const {
data: { evo_brand },

View File

@ -90,13 +90,13 @@ export function common({ store, apolloClient }: ProcessContext) {
$calculation.element('selectImportProgram').resetValue();
}
// if (
// productId &&
// partialVAT &&
// $calculation.element('cbxRecalcWithRevision').getValue() === false
// ) {
// $calculation.element('cbxLeaseObjectUsed').setValue(true);
// }
if (
productId &&
partialVAT &&
$calculation.element('cbxRecalcWithRevision').getValue() === false
) {
$calculation.element('cbxLeaseObjectUsed').setValue(true);
}
}
);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,48 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="789.000000pt" height="789.000000pt" viewBox="0 0 789.000000 789.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,789.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M3157 7885 c-1 -2 -54 -5 -117 -9 -100 -6 -205 -17 -290 -31 -14 -3
-43 -7 -65 -10 -68 -10 -209 -37 -290 -56 -369 -85 -762 -240 -1094 -431 -46
-26 -85 -48 -87 -48 -8 0 -234 -154 -330 -225 -111 -82 -295 -238 -346 -291
l-27 -29 66 -70 c124 -131 388 -409 478 -504 50 -52 101 -106 115 -121 155
-166 325 -340 330 -338 7 3 127 108 155 134 27 27 241 176 317 222 238 141
499 245 763 306 108 24 128 28 230 41 28 4 61 9 75 11 36 6 225 17 295 17 127
0 313 -14 427 -34 32 -6 70 -12 85 -15 16 -2 84 -18 152 -35 514 -127 1007
-429 1334 -819 40 -47 75 -87 78 -90 3 -3 37 -50 76 -105 131 -188 227 -370
304 -579 32 -88 85 -272 94 -326 3 -19 8 -42 10 -50 2 -8 7 -33 10 -55 3 -23
8 -52 11 -65 18 -90 25 -418 11 -565 -55 -572 -304 -1093 -722 -1510 -213
-213 -420 -361 -690 -494 -234 -115 -497 -201 -725 -236 -19 -3 -46 -7 -60
-10 -22 -4 -60 -8 -195 -21 -55 -5 -353 -5 -390 0 -16 2 -61 7 -100 10 -98 9
-327 50 -345 61 -3 2 -19 6 -34 9 -64 12 -243 70 -351 114 -83 35 -360 176
-375 192 -3 3 -30 21 -60 40 -65 41 -51 31 -176 129 -56 43 -123 99 -150 125
-27 25 -52 46 -55 46 -6 0 -50 -46 -329 -340 -85 -90 -175 -184 -200 -211 -25
-26 -106 -111 -180 -190 -74 -79 -148 -157 -165 -174 -106 -110 -119 -126
-109 -133 6 -4 47 -39 90 -79 303 -275 708 -535 1084 -697 36 -15 66 -27 68
-27 1 1 17 -6 35 -15 33 -18 321 -120 359 -128 13 -3 72 -19 132 -35 129 -36
282 -69 401 -86 22 -4 47 -8 55 -10 8 -2 43 -7 78 -10 35 -4 71 -8 80 -10 129
-24 730 -24 882 0 14 3 50 7 80 10 61 6 79 9 195 30 44 8 91 16 105 19 14 2
66 14 115 26 50 12 97 23 105 25 87 18 389 118 516 170 908 375 1640 1047
2070 1905 120 239 217 490 270 695 1 6 12 46 23 90 12 44 23 90 26 103 2 12 6
30 9 40 3 9 7 28 10 42 2 14 9 52 15 85 6 33 13 76 15 95 2 19 7 55 10 80 4
25 8 61 11 80 26 207 26 621 -1 860 -13 126 -61 394 -83 468 -5 18 -10 33 -10
35 1 7 -17 75 -43 162 -200 674 -573 1272 -1099 1760 -101 94 -130 118 -261
220 -68 52 -128 99 -133 103 -29 23 -195 132 -201 132 -4 0 -15 6 -23 14 -9 8
-32 23 -51 34 -19 11 -69 39 -110 62 -208 119 -540 261 -783 334 -126 38 -290
81 -347 91 -19 3 -51 10 -70 15 -38 9 -66 14 -175 30 -121 18 -212 28 -315 36
-71 6 -487 13 -493 9z"/>
<path d="M3348 4996 c-1 -2 -41 -6 -88 -10 -110 -7 -139 -13 -235 -43 -293
-92 -534 -309 -651 -585 -57 -135 -76 -223 -80 -378 -5 -192 21 -324 93 -476
28 -58 82 -154 93 -164 3 -3 17 -21 32 -41 139 -186 385 -334 638 -384 108
-21 340 -14 442 13 318 86 554 278 696 567 30 62 67 168 77 220 27 154 31 290
10 420 -11 67 -64 214 -105 294 -164 312 -484 527 -830 557 -36 3 -70 7 -77 9
-6 2 -13 2 -15 1z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,19 +1,8 @@
{
"$schema": "https://json.schemastore.org/web-manifest",
"name": "Лизинговый калькулятор - Эволюция",
"short_name": "Калькулятор",
"start_url": "/",
"icons": [
{
"src": "/favicon-16x16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "/favicon-32x32.png",
"sizes": "32x32",
"type": "image/png"
},
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
@ -27,6 +16,5 @@
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone",
"scope": "/"
"display": "standalone"
}

View File

@ -1,4 +0,0 @@
self.addEventListener('install', () => {
self.skipWaiting();
});
self.addEventListener('fetch', () => {});

View File

@ -4,7 +4,7 @@ import type { inferAsyncReturnType } from '@trpc/server';
import type { CreateNextContextOptions } from '@trpc/server/adapters/next';
export async function createContext({ req }: CreateNextContextOptions) {
const { cookie = '', authorization, 'user-agent': userAgent } = req.headers;
const { cookie = '', authorization } = req.headers;
const user = await getUser({
headers: {
@ -18,7 +18,6 @@ export async function createContext({ req }: CreateNextContextOptions) {
return {
headers: { authorization },
user,
userAgent,
};
}

View File

@ -1,9 +1,8 @@
import { mergeRouters } from '../trpc';
import { calculateRouter } from './calculate';
import { eltRouter } from './elt';
import { quoteRouter } from './quote';
import { tarifRouter } from './tarif';
export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter, eltRouter);
export const appRouter = mergeRouters(quoteRouter, calculateRouter, tarifRouter);
export type AppRouter = typeof appRouter;

View File

@ -1,5 +1,4 @@
import { router } from '../../trpc';
import { validateResults } from './lib/post-validation';
import { createRequestData } from './lib/request';
import { transformCalculateResults } from './lib/transform';
import { validate } from './lib/validation';
@ -53,20 +52,6 @@ export const calculateRouter = router({
const calculateResult = await calculate(requestData);
const postValidationResult = await validateResults({
calculateResult,
context: {
apolloClient,
queryClient,
user: ctx.user,
},
input,
});
if (postValidationResult.success === false) {
throw new HttpError(postValidationResult.message, 400);
}
const result = transformCalculateResults({
calculateInput: input,
requestCalculate: requestData,

View File

@ -1,55 +0,0 @@
import type { CalculateInput, Context } from '../types';
import type { ResponseCalculate } from '@/api/core/types';
import * as CRMTypes from '@/graphql/crm.types';
export async function validateResults({
input,
context,
calculateResult,
}: {
calculateResult: ResponseCalculate;
context: Context;
input: CalculateInput;
}) {
const { recalcWithRevision, quote: quoteId } = input.values;
if (recalcWithRevision && quoteId) {
const { apolloClient } = context;
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: {
quoteId,
},
});
if (quote?.evo_committee_quote === 100_000_000 && quote.evo_accept_quoteid) {
const { preparedValues } = calculateResult;
const { npvBonusExpensesColumn } = calculateResult.columns;
const {
data: { quote: accept_quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: { quoteId: quote.evo_accept_quoteid },
});
if (
Math.abs(npvBonusExpensesColumn.values.at(2) || 0) / (1 + preparedValues.salaryRate) -
(accept_quote?.evo_leasing_bonus_summ || 0) >
100
) {
return {
message: 'Нельзя увеличивать бонус МПЛ после рассмотрения предложения на КК',
success: false,
};
}
}
}
return {
message: '',
success: true,
};
}

View File

@ -1,5 +0,0 @@
import { mergeRouters } from '../../trpc';
import { eltKaskoRouter } from './kasko';
import { eltOsagoRouter } from './osago';
export const eltRouter = mergeRouters(eltOsagoRouter, eltKaskoRouter);

View File

@ -1,45 +0,0 @@
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);
}
}),
});

View File

@ -1,47 +0,0 @@
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);
}
}),
});

View File

@ -1,13 +0,0 @@
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(),
});

View File

@ -1,7 +1,6 @@
/* eslint-disable canonical/sort-keys */
import { protectedProcedure } from '../../procedure';
import { router } from '../../trpc';
import { validateResults } from '../calculate/lib/post-validation';
import { createRequestData } from '../calculate/lib/request';
import { transformCalculateResults } from '../calculate/lib/transform';
import { validate } from '../calculate/lib/validation';
@ -42,7 +41,6 @@ import type { CalculationValues } from '@/stores/calculation/values/types';
import { HttpError } from '@/utils/error';
import { createTRPCError } from '@/utils/trpc';
import { QueryClient } from '@tanstack/react-query';
import { UAParser } from 'ua-parser-js';
const defaultInsurance = {
values: {
@ -160,20 +158,6 @@ export const quoteRouter = router({
const calculateResult = await calculate(requestData);
const postValidationResult = await validateResults({
calculateResult,
context: {
apolloClient,
queryClient,
user: ctx.user,
},
input,
});
if (postValidationResult.success === false) {
throw new HttpError(postValidationResult.message, 400);
}
const requestCreateKP = compatRequestCreateKP({
domainName: user.domainName,
finGAP: input.fingap,
@ -185,7 +169,6 @@ export const quoteRouter = router({
additionalData: requestData.additionalData,
},
elt: input.elt,
__info: new UAParser(ctx.userAgent).getResult(),
});
const createKPResult = await createKP(requestCreateKP);

View File

@ -48,7 +48,6 @@ export const GetQuoteOutputDataSchema = z
elt: z
.object({
kasko: EltRowSchema.pick({
insuranceCondition: true,
key: true,
requestId: true,
skCalcId: true,
@ -56,7 +55,6 @@ export const GetQuoteOutputDataSchema = z
totalFranchise: true,
}).optional(),
osago: EltRowSchema.pick({
insuranceCondition: true,
key: true,
numCalc: true,
sum: true,

View File

@ -2,7 +2,6 @@ import type * as ELT from '@/Components/Calculation/Form/ELT/types';
export const defaultRow: ELT.Row = {
id: '',
insuranceCondition: null,
key: '',
message: null,
metodCalc: 'ELT',

View File

@ -4,20 +4,12 @@ import type { AxiosError } from 'axios';
import { isAxiosError } from 'axios';
import { pick } from 'radash';
type ResponseError = {
Error?: string;
error?: string;
errors?: string[];
fullMessage?: string;
message?: string;
};
function getErrorMessage<T extends ResponseError>(error: AxiosError<T>) {
function getErrorMessage<T extends { error?: string; errors?: string[]; message?: string }>(
error: AxiosError<T>
) {
return (
error.response?.data?.Error ||
error.response?.data?.error ||
error.response?.data?.errors?.[0] ||
error.response?.data.fullMessage ||
error.response?.data?.message ||
error.message
);

View File

@ -16,8 +16,6 @@ services:
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
- USERNAME_1C_TRANSTAX=${USERNAME_1C_TRANSTAX}
- PASSWORD_1C_TRANSTAX=${PASSWORD_1C_TRANSTAX}
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
build:
@ -36,8 +34,6 @@ services:
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
- USERNAME_1C_TRANSTAX=${USERNAME_1C_TRANSTAX}
- PASSWORD_1C_TRANSTAX=${PASSWORD_1C_TRANSTAX}
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
context: .

119
pnpm-lock.yaml generated
View File

@ -134,7 +134,7 @@ importers:
version: 4.5.14
'@sentry/nextjs':
specifier: ^7.102.0
version: 7.102.1(next@14.2.5)(react@18.2.0)
version: 7.102.1(next@14.1.0)(react@18.2.0)
'@sentry/node':
specifier: ^7.102.0
version: 7.102.1
@ -146,7 +146,7 @@ importers:
version: 10.45.1(@trpc/server@10.45.1)
'@trpc/next':
specifier: ^10.45.1
version: 10.45.1(@tanstack/react-query@4.36.1)(@trpc/client@10.45.1)(@trpc/react-query@10.45.1)(@trpc/server@10.45.1)(next@14.2.5)(react-dom@18.2.0)(react@18.2.0)
version: 10.45.1(@tanstack/react-query@4.36.1)(@trpc/client@10.45.1)(@trpc/react-query@10.45.1)(@trpc/server@10.45.1)(next@14.1.0)(react-dom@18.2.0)(react@18.2.0)
'@trpc/react-query':
specifier: ^10.45.1
version: 10.45.1(@tanstack/react-query@4.36.1)(@trpc/client@10.45.1)(@trpc/server@10.45.1)(react-dom@18.2.0)(react@18.2.0)
@ -169,8 +169,8 @@ importers:
specifier: ^2.0.0
version: 2.0.0
next:
specifier: ^14.2.5
version: 14.2.5(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0)
specifier: ^14.1.0
version: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0)
radash:
specifier: ^11.0.0
version: 11.0.0
@ -189,9 +189,6 @@ importers:
tools:
specifier: workspace:*
version: link:../../packages/tools
ua-parser-js:
specifier: ^1.0.38
version: 1.0.38
ui:
specifier: workspace:*
version: link:../../packages/ui
@ -238,9 +235,6 @@ importers:
'@types/styled-components':
specifier: ^5.1.26
version: 5.1.34
'@types/ua-parser-js':
specifier: ^0.7.39
version: 0.7.39
'@vchikalkin/eslint-config-awesome':
specifier: ^1.1.6
version: 1.1.6(@babel/eslint-plugin@7.23.5)(@babel/plugin-syntax-flow@7.23.3)(@babel/plugin-transform-react-jsx@7.23.4)(@types/node@18.19.18)(eslint-plugin-import@2.29.1)(eslint@8.57.0)(graphql@16.8.1)(jest@29.7.0)(prettier@3.2.5)(typescript@5.3.3)
@ -2993,8 +2987,8 @@ packages:
tslib: 2.6.2
dev: true
/@next/env@14.2.5:
resolution: {integrity: sha512-/zZGkrTOsraVfYjGP8uM0p6r0BDT6xWpkjdVbcz66PJVSpwXX3yNiRycxAuDfBKGWBrZBXRuK/YVlkNgxHGwmA==}
/@next/env@14.1.0:
resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==}
dev: false
/@next/eslint-plugin-next@13.5.6:
@ -3003,8 +2997,8 @@ packages:
glob: 7.1.7
dev: true
/@next/swc-darwin-arm64@14.2.5:
resolution: {integrity: sha512-/9zVxJ+K9lrzSGli1///ujyRfon/ZneeZ+v4ptpiPoOU+GKZnm8Wj8ELWU1Pm7GHltYRBklmXMTUqM/DqQ99FQ==}
/@next/swc-darwin-arm64@14.1.0:
resolution: {integrity: sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
@ -3012,8 +3006,8 @@ packages:
dev: false
optional: true
/@next/swc-darwin-x64@14.2.5:
resolution: {integrity: sha512-vXHOPCwfDe9qLDuq7U1OYM2wUY+KQ4Ex6ozwsKxp26BlJ6XXbHleOUldenM67JRyBfVjv371oneEvYd3H2gNSA==}
/@next/swc-darwin-x64@14.1.0:
resolution: {integrity: sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
@ -3021,8 +3015,8 @@ packages:
dev: false
optional: true
/@next/swc-linux-arm64-gnu@14.2.5:
resolution: {integrity: sha512-vlhB8wI+lj8q1ExFW8lbWutA4M2ZazQNvMWuEDqZcuJJc78iUnLdPPunBPX8rC4IgT6lIx/adB+Cwrl99MzNaA==}
/@next/swc-linux-arm64-gnu@14.1.0:
resolution: {integrity: sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@ -3030,8 +3024,8 @@ packages:
dev: false
optional: true
/@next/swc-linux-arm64-musl@14.2.5:
resolution: {integrity: sha512-NpDB9NUR2t0hXzJJwQSGu1IAOYybsfeB+LxpGsXrRIb7QOrYmidJz3shzY8cM6+rO4Aojuef0N/PEaX18pi9OA==}
/@next/swc-linux-arm64-musl@14.1.0:
resolution: {integrity: sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@ -3039,8 +3033,8 @@ packages:
dev: false
optional: true
/@next/swc-linux-x64-gnu@14.2.5:
resolution: {integrity: sha512-8XFikMSxWleYNryWIjiCX+gU201YS+erTUidKdyOVYi5qUQo/gRxv/3N1oZFCgqpesN6FPeqGM72Zve+nReVXQ==}
/@next/swc-linux-x64-gnu@14.1.0:
resolution: {integrity: sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@ -3048,8 +3042,8 @@ packages:
dev: false
optional: true
/@next/swc-linux-x64-musl@14.2.5:
resolution: {integrity: sha512-6QLwi7RaYiQDcRDSU/os40r5o06b5ue7Jsk5JgdRBGGp8l37RZEh9JsLSM8QF0YDsgcosSeHjglgqi25+m04IQ==}
/@next/swc-linux-x64-musl@14.1.0:
resolution: {integrity: sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@ -3057,8 +3051,8 @@ packages:
dev: false
optional: true
/@next/swc-win32-arm64-msvc@14.2.5:
resolution: {integrity: sha512-1GpG2VhbspO+aYoMOQPQiqc/tG3LzmsdBH0LhnDS3JrtDx2QmzXe0B6mSZZiN3Bq7IOMXxv1nlsjzoS1+9mzZw==}
/@next/swc-win32-arm64-msvc@14.1.0:
resolution: {integrity: sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
@ -3066,8 +3060,8 @@ packages:
dev: false
optional: true
/@next/swc-win32-ia32-msvc@14.2.5:
resolution: {integrity: sha512-Igh9ZlxwvCDsu6438FXlQTHlRno4gFpJzqPjSIBZooD22tKeI4fE/YMRoHVJHmrQ2P5YL1DoZ0qaOKkbeFWeMg==}
/@next/swc-win32-ia32-msvc@14.1.0:
resolution: {integrity: sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
@ -3075,8 +3069,8 @@ packages:
dev: false
optional: true
/@next/swc-win32-x64-msvc@14.2.5:
resolution: {integrity: sha512-tEQ7oinq1/CjSG9uSTerca3v4AZ+dFa+4Yu6ihaG8Ud8ddqLQgFGcnwYls13H5X5CPDPZJdYxyeMui6muOLd4g==}
/@next/swc-win32-x64-msvc@14.1.0:
resolution: {integrity: sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
@ -3372,7 +3366,7 @@ packages:
localforage: 1.10.0
dev: false
/@sentry/nextjs@7.102.1(next@14.2.5)(react@18.2.0):
/@sentry/nextjs@7.102.1(next@14.1.0)(react@18.2.0):
resolution: {integrity: sha512-gOI/GD7DWhc3WucyYnepl8Nu5jmpa1YfR6jWDzTkPE2CV9zKK9zulTdqk+Aig9ch62SAmJOGkgejm5k9PE2XzQ==}
engines: {node: '>=8'}
peerDependencies:
@ -3393,7 +3387,7 @@ packages:
'@sentry/vercel-edge': 7.102.1
'@sentry/webpack-plugin': 1.21.0
chalk: 3.0.0
next: 14.2.5(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0)
next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0
resolve: 1.22.8
rollup: 2.78.0
@ -3571,14 +3565,9 @@ packages:
'@styled-system/css': 5.1.5
dev: false
/@swc/counter@0.1.3:
resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==}
dev: false
/@swc/helpers@0.5.5:
resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==}
/@swc/helpers@0.5.2:
resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==}
dependencies:
'@swc/counter': 0.1.3
tslib: 2.6.2
dev: false
@ -3660,7 +3649,7 @@ packages:
'@trpc/server': 10.45.1
dev: false
/@trpc/next@10.45.1(@tanstack/react-query@4.36.1)(@trpc/client@10.45.1)(@trpc/react-query@10.45.1)(@trpc/server@10.45.1)(next@14.2.5)(react-dom@18.2.0)(react@18.2.0):
/@trpc/next@10.45.1(@tanstack/react-query@4.36.1)(@trpc/client@10.45.1)(@trpc/react-query@10.45.1)(@trpc/server@10.45.1)(next@14.1.0)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-HSuQ0OcKUtt8mcQ4Mz4GQpy5PkNYJNvC9EEHkqTkEGa71BLEPKviyVWaE7biOlxjA0tM0aDOM21id+cRkEpfXA==}
peerDependencies:
'@tanstack/react-query': ^4.18.0
@ -3675,7 +3664,7 @@ packages:
'@trpc/client': 10.45.1(@trpc/server@10.45.1)
'@trpc/react-query': 10.45.1(@tanstack/react-query@4.36.1)(@trpc/client@10.45.1)(@trpc/server@10.45.1)(react-dom@18.2.0)(react@18.2.0)
'@trpc/server': 10.45.1
next: 14.2.5(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0)
next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
dev: false
@ -3959,10 +3948,6 @@ packages:
resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}
dev: true
/@types/ua-parser-js@0.7.39:
resolution: {integrity: sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==}
dev: true
/@types/ws@8.5.10:
resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==}
dependencies:
@ -6983,7 +6968,7 @@ packages:
'@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.3.3)
'@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.3.3)
eslint: 8.57.0
jest: 29.7.0(@types/node@20.11.20)(ts-node@10.9.2)
jest: 29.7.0(@types/node@18.19.18)(ts-node@10.9.2)
transitivePeerDependencies:
- supports-color
- typescript
@ -7725,7 +7710,7 @@ packages:
object-assign: 4.1.1
promise: 7.3.1
setimmediate: 1.0.5
ua-parser-js: 1.0.38
ua-parser-js: 1.0.37
transitivePeerDependencies:
- encoding
dev: true
@ -8227,7 +8212,7 @@ packages:
'@graphql-tools/json-file-loader': 7.4.18(graphql@16.8.1)
'@graphql-tools/load': 7.8.14(graphql@16.8.1)
'@graphql-tools/merge': 8.4.2(graphql@16.8.1)
'@graphql-tools/url-loader': 7.17.18(@types/node@18.19.18)(graphql@16.8.1)
'@graphql-tools/url-loader': 7.17.18(@types/node@20.11.20)(graphql@16.8.1)
'@graphql-tools/utils': 9.2.1(graphql@16.8.1)
cosmiconfig: 8.0.0
graphql: 16.8.1
@ -9347,7 +9332,7 @@ packages:
pretty-format: 29.7.0
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.9.2(@types/node@20.11.20)(typescript@5.3.3)
ts-node: 10.9.2(@types/node@18.19.18)(typescript@5.3.3)
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@ -10572,26 +10557,23 @@ packages:
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
dev: true
/next@14.2.5(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-0f8aRfBVL+mpzfBjYfQuLWh2WyAwtJXCRfkPF4UJ5qd2YwrHczsrSzXU4tRMV0OAxR8ZJZWPFn6uhSC56UTsLA==}
/next@14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==}
engines: {node: '>=18.17.0'}
hasBin: true
peerDependencies:
'@opentelemetry/api': ^1.1.0
'@playwright/test': ^1.41.2
react: ^18.2.0
react-dom: ^18.2.0
sass: ^1.3.0
peerDependenciesMeta:
'@opentelemetry/api':
optional: true
'@playwright/test':
optional: true
sass:
optional: true
dependencies:
'@next/env': 14.2.5
'@swc/helpers': 0.5.5
'@next/env': 14.1.0
'@swc/helpers': 0.5.2
busboy: 1.6.0
caniuse-lite: 1.0.30001589
graceful-fs: 4.2.11
@ -10600,15 +10582,15 @@ packages:
react-dom: 18.2.0(react@18.2.0)
styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0)
optionalDependencies:
'@next/swc-darwin-arm64': 14.2.5
'@next/swc-darwin-x64': 14.2.5
'@next/swc-linux-arm64-gnu': 14.2.5
'@next/swc-linux-arm64-musl': 14.2.5
'@next/swc-linux-x64-gnu': 14.2.5
'@next/swc-linux-x64-musl': 14.2.5
'@next/swc-win32-arm64-msvc': 14.2.5
'@next/swc-win32-ia32-msvc': 14.2.5
'@next/swc-win32-x64-msvc': 14.2.5
'@next/swc-darwin-arm64': 14.1.0
'@next/swc-darwin-x64': 14.1.0
'@next/swc-linux-arm64-gnu': 14.1.0
'@next/swc-linux-arm64-musl': 14.1.0
'@next/swc-linux-x64-gnu': 14.1.0
'@next/swc-linux-x64-musl': 14.1.0
'@next/swc-win32-arm64-msvc': 14.1.0
'@next/swc-win32-ia32-msvc': 14.1.0
'@next/swc-win32-x64-msvc': 14.1.0
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
@ -13271,7 +13253,7 @@ packages:
'@babel/core': 7.23.9
bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0
jest: 29.7.0(@types/node@20.11.20)(ts-node@10.9.2)
jest: 29.7.0(@types/node@18.19.18)(ts-node@10.9.2)
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
@ -13580,8 +13562,9 @@ packages:
hasBin: true
dev: true
/ua-parser-js@1.0.38:
resolution: {integrity: sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ==}
/ua-parser-js@1.0.37:
resolution: {integrity: sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==}
dev: true
/uid@2.0.2:
resolution: {integrity: sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==}