Compare commits

...

21 Commits

Author SHA1 Message Date
vchikalkin
357bb1e3a3 use ssg 2023-03-12 11:37:12 +03:00
vchikalkin
2defb4f79b for 3b55956 2023-03-10 16:31:04 +03:00
vchikalkin
f86744de70 fix radioCalcType 2023-03-10 16:03:15 +03:00
vchikalkin
3b559561d7 fix selectRate 2023-03-10 15:51:29 +03:00
vchikalkin
6c5edfefae fix selectTarif 2023-03-10 15:04:22 +03:00
vchikalkin
7a91f870fa apollo: fix caching 2023-03-10 14:39:31 +03:00
vchikalkin
5a73a9c8a3 remove field radioInsKaskoType 2023-03-10 13:53:41 +03:00
vchikalkin
0d2682cc27 перенесены все реакции insurance 2023-03-10 13:41:42 +03:00
vchikalkin
75aa3217b3 process/insurance: validation 2023-03-10 11:17:40 +03:00
vchikalkin
7fe8de83c8 merge experimental/zod-validation 2023-03-10 09:37:37 +03:00
vchikalkin
5748bb9ffd fix build 2023-03-02 16:57:10 +03:00
vchikalkin
9ae996b1ba process/insurance: insurance-table pt.1 2023-03-02 16:52:34 +03:00
vchikalkin
fc3610079d process/configurator: auto set value for specific fields 2023-03-02 15:26:03 +03:00
vchikalkin
86c9bdb113 process: add insurance reactions 2023-03-02 15:16:10 +03:00
vchikalkin
f93426767c use dayjs().utc(false).format('YYYY-MM-DD') 2023-03-02 13:45:04 +03:00
vchikalkin
581410138c move apollo config to /config/apollo.js 2023-03-02 13:08:00 +03:00
vchikalkin
f3c4c33a54 apollo: replace InMemoryCache modify settings to ApolloLink 2023-03-02 12:46:11 +03:00
vchikalkin
0ccc0e376c fix load-kp 2023-03-01 19:10:27 +03:00
vchikalkin
52784fb910 process: add-product 2023-03-01 18:44:57 +03:00
vchikalkin
b36f9772ec apollo: modify evo_equipment.evo_name 2023-03-01 16:23:02 +03:00
vchikalkin
7b401c2365 apollo: modify evo_addproduct_type.evo_name 2023-03-01 16:14:19 +03:00
75 changed files with 2757 additions and 1526 deletions

View File

@ -14,10 +14,10 @@ const Grid = styled(Flex)`
const Validation = observer(() => {
const store = useStore();
const messages = store.$tables.fingap.validation.getMessages();
const errors = store.$tables.fingap.validation.getErrors();
if (messages?.length) {
return <Alert type="error" banner message={messages[0]} />;
if (errors?.length) {
return <Alert type="error" banner message={errors[0].message} />;
}
return null;

View File

@ -19,10 +19,10 @@ const TableWrapper = styled.div`
const Validation = observer(() => {
const store = useStore();
const messages = store.$tables.insurance.validation.getMessages();
const errors = store.$tables.insurance.validation.getErrors();
if (messages?.length) {
return <Alert type="error" banner message={messages[0]} />;
if (errors?.length) {
return <Alert type="error" banner message={errors[0].message} />;
}
return null;

View File

@ -6,7 +6,7 @@ export const title = 'Страхование';
export const rows: FormTabRows = [
[['tbxLeaseObjectYear', 'selectLeaseObjectUseFor', 'selectLegalClientRegion']],
[['selectEngineType', 'tbxInsFranchise', 'selectLegalClientTown']],
[['selectLeaseObjectCategory', 'tbxMileage', 'tbxINNForCalc']],
[['selectLeaseObjectCategory', 'tbxMileage']],
[['tbxLeaseObjectMotorPower', 'cbxWithTrailer', 'selectGPSBrand']],
[['tbxEngineVolume', 'cbxInsDecentral', 'selectGPSModel']],
[['selectLeasingWithoutKasko', 'selectInsNSIB']],

View File

@ -33,10 +33,10 @@ const Validation = observer(() => {
const store = useStore();
const { payments } = store.$tables;
const messages = payments.validation.getMessages();
const errors = payments.validation.getErrors();
if (messages?.length) {
return <Alert type="error" banner message={messages[0]} />;
if (errors?.length) {
return <Alert type="error" banner message={errors[0].message} />;
}
return null;

View File

@ -74,17 +74,14 @@ const components = wrapComponentsMap({
selectFinDepartmentRewardCondtion: e.Select,
tbxFinDepartmentRewardSumm: e.InputNumber,
cbxInsDecentral: e.Switch,
radioInsKaskoType: e.Radio,
tbxInsFranchise: e.InputNumber,
cbxInsUnlimitDrivers: e.Switch,
tbxInsAgeDrivers: e.InputNumber,
tbxInsExpDrivers: e.InputNumber,
tbxINNForCalc: e.InputNumber,
selectGPSBrand: e.Select,
selectGPSModel: e.Select,
selectRegionRegistration: e.Select,
selectTownRegistration: e.Select,
radioInfuranceOPF: e.Radio,
selectRegistration: e.Select,
selectInsNSIB: e.Select,
selectRequirementTelematic: e.Select,

View File

@ -267,10 +267,6 @@ const props: Partial<ElementsProps> = {
step: 0.1,
precision: 2,
},
radioInsKaskoType: {
optionType: 'button',
buttonStyle: 'solid',
},
tbxInsFranchise: {
min: 0,
max: MAX_FRANCHISE,
@ -425,10 +421,6 @@ const props: Partial<ElementsProps> = {
showSearch: true,
optionFilterProp: 'label',
},
radioInfuranceOPF: {
optionType: 'button',
buttonStyle: 'solid',
},
radioGraphType: {
spaceProps: {
direction: 'vertical',

View File

@ -74,8 +74,6 @@ const titles: Record<ActionElements | ValuesElements, string> = {
selectGPSModel: 'Модель GPS',
selectRegionRegistration: 'Регион регистрации',
selectTownRegistration: 'Город регистрации',
radioInfuranceOPF: 'ОПФ для расчета страховки',
radioInsKaskoType: 'Тип страхования КАСКО',
cbxInsDecentral: 'Децентрализованное страхование',
tbxInsFranchise: 'Франшиза',
cbxInsUnlimitDrivers: 'Неограниченное число водителей',
@ -116,7 +114,6 @@ const titles: Record<ActionElements | ValuesElements, string> = {
selectObjectCategoryTax: 'Кат. по ТР ТС 018/2011',
selectObjectTypeTax: 'Тип ТС для ТН',
radioTypePTS: 'Тип ПТС',
tbxINNForCalc: 'ИНН контрагента',
selectLegalClientRegion: 'Регион по юр.адресу клиента',
selectLegalClientTown: 'Город по юр.адресу клиента',
selectSubsidy: 'Субсидия',

View File

@ -81,7 +81,6 @@ const types = wrapElementsTypes({
cbxInsUnlimitDrivers: t.Value,
tbxInsAgeDrivers: t.Value,
tbxInsExpDrivers: t.Value,
tbxINNForCalc: t.Value,
cbxLastPaymentRedemption: t.Value,
cbxPriceWithDiscount: t.Value,
cbxFullPriceWithDiscount: t.Value,
@ -155,8 +154,6 @@ const types = wrapElementsTypes({
radioLastPaymentRule: t.Options,
radioGraphType: t.Options,
radioDeliveryTime: t.Options,
radioInsKaskoType: t.Options,
radioInfuranceOPF: t.Options,
selectRequirementTelematic: t.Options,
radioQuoteContactGender: t.Options,
radioCalcType: t.Options,

View File

@ -80,14 +80,11 @@ const elementsToValues = wrapElementsMap({
selectGPSModel: 'GPSModel',
selectRegionRegistration: 'regionRegistration',
selectTownRegistration: 'townRegistration',
radioInfuranceOPF: 'infuranceOPF',
radioInsKaskoType: 'insKaskoType',
cbxInsDecentral: 'insDecentral',
tbxInsFranchise: 'insFranchise',
cbxInsUnlimitDrivers: 'insUnlimitDrivers',
tbxInsAgeDrivers: 'insAgeDrivers',
tbxInsExpDrivers: 'insExpDrivers',
tbxINNForCalc: 'INNForCalc',
cbxLastPaymentRedemption: 'lastPaymentRedemption',
cbxPriceWithDiscount: 'priceWithDiscount',
cbxFullPriceWithDiscount: 'fullPriceWithDiscount',

View File

@ -1,4 +1,5 @@
import { getUser } from '@/api/user/query';
import { STALE_TIME } from '@/constants/request';
import { min } from '@/styles/mq';
import { useQuery } from '@tanstack/react-query';
import styled from 'styled-components';
@ -19,8 +20,8 @@ const UserText = styled.span`
`;
function User() {
const { data: user } = useQuery(['user'], () => getUser(), {
enabled: false,
const { data: user } = useQuery(['user'], getUser, {
staleTime: STALE_TIME,
});
return <UserText>{user?.displayName}</UserText>;

View File

@ -25,12 +25,12 @@ const AlertWrapper = styled(Box)`
function getElementsErrors($calculation) {
return Object.values($calculation.$validation).map((validation) => {
const elementErrors = validation.getMessages();
const elementErrors = validation.getErrors();
const elementTitle = validation.params.err_title;
return elementErrors.map((error) => (
return elementErrors.map(({ key, message }) => (
<AlertWrapper>
<Alert type="error" showIcon message={Message(elementTitle, error)} />
<Alert key={key} type="error" showIcon message={Message(elementTitle, message)} />
</AlertWrapper>
));
});
@ -38,18 +38,22 @@ function getElementsErrors($calculation) {
function getPaymentsTableErrors($tables) {
const { payments } = $tables;
const messages = payments.validation.getMessages();
const errors = payments.validation.getErrors();
const title = payments.validation.params.err_title;
return messages.map((text) => <Alert type="error" showIcon message={Message(title, text)} />);
return errors.map(({ key, message }) => (
<Alert key={key} type="error" showIcon message={Message(title, message)} />
));
}
function getInsuranceTableErrors($tables) {
const { insurance } = $tables;
const messages = insurance.validation.getMessages();
const errors = insurance.validation.getErrors();
const title = insurance.validation.params.err_title;
return messages.map((text) => <Alert type="error" showIcon message={Message(title, text)} />);
return errors.map(({ key, message }) => (
<Alert key={key} type="error" showIcon message={Message(title, message)} />
));
}
const Errors = observer(() => {

View File

@ -1,17 +1,15 @@
import getUrls from '@/config/urls';
import { link } from '@/config/apollo';
import { ApolloClient, InMemoryCache } from '@apollo/client';
import { isServer } from 'tools/common';
/** @type {import('@apollo/client').ApolloClient<import('@apollo/client').NormalizedCacheObject>} */
let apolloClient;
const { URL_CRM_GRAPHQL } = getUrls();
function createApolloClient() {
return new ApolloClient({
cache: new InMemoryCache(),
link,
ssrMode: isServer(),
uri: URL_CRM_GRAPHQL,
});
}

34
apps/web/config/apollo.js Normal file
View File

@ -0,0 +1,34 @@
import getUrls from './urls';
import { ApolloLink, HttpLink } from '@apollo/client';
const { URL_CRM_GRAPHQL } = getUrls();
const modifyDataLink = new ApolloLink((operation, forward) => {
const context = operation?.getContext();
return forward(operation).map((response) => {
if (!context?.disableModify) {
if (Object.keys(response?.data).includes('evo_addproduct_types')) {
response.data.evo_addproduct_types = response.data.evo_addproduct_types.map((x) => ({
...x,
label: `${x.label} (${x.evo_graph_price} руб.)`,
}));
}
if (Object.keys(response?.data).includes('evo_equipments')) {
response.data.evo_equipments = response.data.evo_equipments.map((x) => ({
...x,
label: `${x.label} (${x.evo_start_production_year})`,
}));
}
}
return response;
});
});
const httpLink = new HttpLink({
uri: URL_CRM_GRAPHQL,
});
export const link = modifyDataLink.concat(httpLink);

View File

@ -97,6 +97,104 @@ export const selectObjectCategoryTax = [
value: 100_000_000 + i,
}));
export const selectLeaseObjectUseFor = alphabetical(
[
{
label: 'Для представительских целей',
value: 100_000_000,
},
{
label: 'Для использования в качестве «такси»',
value: 100_000_001,
},
{
label: 'Для передачи третьим лицам (прокат; аренда)',
value: 100_000_002,
},
{
label: 'Каршеринг',
value: 100_000_003,
},
{
label: 'Тест-драйв',
value: 100_000_004,
},
{
label: 'Для доставки продуктов конечному потребителю',
value: 100_000_005,
},
{
label: 'Для обучения вождению',
value: 100_000_006,
},
{
label: 'Маршрутные такси / Рейсовые автобусы',
value: 100_000_007,
},
{
label: 'Междугородние перевозки',
value: 100_000_008,
},
{
label: 'Для перевозки крупногабаритных грузов',
value: 100_000_009,
},
{
label: 'Для перевозки малогабаритных грузов',
value: 100_000_010,
},
{
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
value: 100_000_011,
},
{
label: 'Для перевозки сотрудников ЛП',
value: 100_000_012,
},
{
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
value: 100_000_013,
},
{
label: 'Дорожно-строительная техника',
value: 100_000_014,
},
{
label: 'Жилищно-коммунальное хозяйство',
value: 100_000_015,
},
{
label: 'Лесное хозяйство',
value: 100_000_016,
},
{
label: 'Подъёмно-транспортная отрасль',
value: 100_000_017,
},
{
label: 'Сельское хозяйство',
value: 100_000_018,
},
{
label: 'Строительство',
value: 100_000_019,
},
],
(objectUseFor) => objectUseFor.label.toLowerCase(),
'asc'
);
export const radioCalcType = [
{
label: 'IRR',
value: 100_000_000,
},
{
label: 'Суммы',
value: 100_000_001,
},
];
const defaultOptions: CalculationOptions = {
radioLastPaymentRule: [
{
@ -187,114 +285,7 @@ const defaultOptions: CalculationOptions = {
},
],
selectLeaseObjectUseFor: alphabetical(
[
{
label: 'Для представительских целей',
value: 100_000_000,
},
{
label: 'Для использования в качестве «такси»',
value: 100_000_001,
},
{
label: 'Для передачи третьим лицам (прокат; аренда)',
value: 100_000_002,
},
{
label: 'Каршеринг',
value: 100_000_003,
},
{
label: 'Тест-драйв',
value: 100_000_004,
},
{
label: 'Для доставки продуктов конечному потребителю',
value: 100_000_005,
},
{
label: 'Для обучения вождению',
value: 100_000_006,
},
{
label: 'Маршрутные такси / Рейсовые автобусы',
value: 100_000_007,
},
{
label: 'Междугородние перевозки',
value: 100_000_008,
},
{
label: 'Для перевозки крупногабаритных грузов',
value: 100_000_009,
},
{
label: 'Для перевозки малогабаритных грузов',
value: 100_000_010,
},
{
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
value: 100_000_011,
},
{
label: 'Для перевозки сотрудников ЛП',
value: 100_000_012,
},
{
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
value: 100_000_013,
},
{
label: 'Дорожно-строительная техника',
value: 100_000_014,
},
{
label: 'Жилищно-коммунальное хозяйство',
value: 100_000_015,
},
{
label: 'Лесное хозяйство',
value: 100_000_016,
},
{
label: 'Подъёмно-транспортная отрасль',
value: 100_000_017,
},
{
label: 'Сельское хозяйство',
value: 100_000_018,
},
{
label: 'Строительство',
value: 100_000_019,
},
],
(objectUseFor) => objectUseFor.label.toLowerCase(),
'asc'
),
radioInfuranceOPF: [
{
label: 'ЮЛ',
value: 100_000_000,
},
{
label: 'ИП',
value: 100_000_001,
},
],
radioInsKaskoType: [
{
label: 'Полное',
value: 100_000_000,
},
{
label: 'Усеченное',
value: 100_000_001,
},
],
selectLeaseObjectUseFor,
radioQuoteContactGender: [
{
@ -341,16 +332,7 @@ const defaultOptions: CalculationOptions = {
value: 100_000_007,
},
],
radioCalcType: [
{
label: 'IRR',
value: 100_000_000,
},
{
label: 'Суммы',
value: 100_000_001,
},
],
radioCalcType,
radioObjectRegistration: [
{
label: 'Лизингополучатель',
@ -461,7 +443,6 @@ const defaultOptions: CalculationOptions = {
cbxInsUnlimitDrivers: [],
tbxInsAgeDrivers: [],
tbxInsExpDrivers: [],
tbxINNForCalc: [],
cbxLastPaymentRedemption: [],
cbxPriceWithDiscount: [],
cbxFullPriceWithDiscount: [],

View File

@ -31,8 +31,6 @@ const defaultStatuses: CalculationStatuses = {
radioCalcType: 'Default',
radioDeliveryTime: 'Default',
radioGraphType: 'Default',
radioInfuranceOPF: 'Disabled',
radioInsKaskoType: 'Default',
radioLastPaymentRule: 'Default',
radioObjectRegistration: 'Default',
radioQuoteContactGender: 'Default',
@ -102,7 +100,6 @@ const defaultStatuses: CalculationStatuses = {
tbxFinDepartmentRewardSumm: 'Disabled',
tbxFirstPaymentPerc: 'Default',
tbxFirstPaymentRub: 'Default',
tbxINNForCalc: 'Disabled',
tbxIRR_Perc: 'Default',
tbxImportProgramSum: 'Default',
tbxImporterRewardPerc: 'Disabled',

View File

@ -55,14 +55,11 @@ const defaultValues: CalculationValues = {
indAgent: null,
indAgentRewardCondition: null,
indAgentRewardSumm: 0,
infuranceOPF: null,
INNForCalc: 0,
insAgeDrivers: 0,
insDecentral: false,
insExpDrivers: 0,
insFranchise: 0,
insKaskoPriceLeasePeriod: 0,
insKaskoType: 100_000_000,
insNSIB: null,
insUnlimitDrivers: true,
insurance: true,

View File

@ -1,3 +1,4 @@
import * as addProduct from '@/process/add-product';
import * as bonuses from '@/process/bonuses';
import * as calculate from '@/process/calculate';
import * as configurator from '@/process/configurator';
@ -5,6 +6,7 @@ import * as createKP from '@/process/create-kp';
import * as fingap from '@/process/fingap';
import * as gibdd from '@/process/gibdd';
import { useProcess } from '@/process/hooks';
import * as insurance from '@/process/insurance';
import * as leadOpportunity from '@/process/lead-opportunity';
import * as leasingObject from '@/process/leasing-object';
import * as leasingWithoutKasko from '@/process/leasing-without-kasko';
@ -23,7 +25,6 @@ export default function useReactions() {
useProcess(supplierAgent);
useProcess(price);
useProcess(fingap);
useProcess(loadKP);
useProcess(leasingWithoutKasko);
useProcess(subsidy);
useProcess(leasingObject);
@ -34,4 +35,6 @@ export default function useReactions() {
useProcess(subsidyImportProgram);
useProcess(payments);
useProcess(gibdd);
useProcess(addProduct);
useProcess(insurance);
}

View File

@ -52,13 +52,10 @@ const ValuesSchema = z
indAgent: z.string().nullable(),
indAgentRewardCondition: z.string().nullable(),
indAgentRewardSumm: z.number(),
infuranceOPF: z.number().nullable(),
INNForCalc: z.number(),
insAgeDrivers: z.number(),
insDecentral: z.boolean(),
insExpDrivers: z.number(),
insFranchise: z.number(),
insKaskoType: z.number().nullable(),
insNSIB: z.string().nullable(),
insUnlimitDrivers: z.boolean(),
insurance: z.boolean(),

View File

@ -1 +1,10 @@
export const STALE_TIME = Number.POSITIVE_INFINITY;
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
dayjs.extend(duration);
export const STALE_TIME = dayjs
.duration({
days: 1,
})
.as('milliseconds');

View File

@ -7,3 +7,4 @@ export const MAX_LEASING_PERIOD = 60;
export const MIN_LASTPAYMENT_NSIB = 3500;
export const MIN_PAYMENT = 3;
export const VAT = 0.2;
export const MAX_MASS = 3500;

View File

@ -78,6 +78,7 @@ query GetQuotes($leadid: Uuid!) {
query GetQuote($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_baseproductid
evo_one_year_insurance
}
}
@ -111,6 +112,10 @@ query GetTarif($tarifId: Uuid!) {
evo_min_irr
evo_cut_irr_with_bonus_coefficient
evo_max_irr
evo_rates {
evo_datefrom
evo_rateid
}
}
}
@ -249,6 +254,13 @@ query GetGPSBrands {
}
}
query GetGPSModels($gpsBrandId: Uuid!) {
evo_gps_models(evo_gps_brandid: $gpsBrandId) {
label: evo_name
value: evo_gps_modelid
}
}
query GetLeaseObjectTypes {
evo_leasingobject_types(statecode: 0) {
label: evo_name
@ -278,6 +290,7 @@ query GetBrands {
query GetBrand($brandId: Uuid!) {
evo_brand(evo_brandid: $brandId) {
evo_id
evo_importer_reward_perc
evo_importer_reward_rub
}
@ -306,6 +319,7 @@ query GetConfigurations($modelId: Uuid!) {
evo_equipments(statecode: 0, evo_modelid: $modelId) {
label: evo_name
value: evo_equipmentid
evo_start_production_year
}
}
@ -402,19 +416,30 @@ query GetSystemUser($domainname: String) {
}
}
fragment CoreAddProductTypesFields on evo_addproduct_type {
evo_graph_price
label: evo_name
value: evo_addproduct_typeid
}
query GetAddproductTypes($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_addproduct_typeid
evo_graph_price
...CoreAddProductTypesFields
evo_product_type
}
}
query GetAddProductType($addproductTypeId: Uuid!) {
evo_addproduct_type(evo_addproduct_typeid: $addproductTypeId) {
evo_description
evo_helpcard_type
}
}
query GetRegistrationTypes($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
@ -422,9 +447,7 @@ query GetRegistrationTypes($currentDate: DateTime) {
evo_dateto_param: { gte: $currentDate }
evo_product_type: 100000001
) {
label: evo_name
value: evo_addproduct_typeid
evo_graph_price
...CoreAddProductTypesFields
evo_leasingobject_types {
evo_leasingobject_typeid
}
@ -436,8 +459,109 @@ query GetRegistrationTypes($currentDate: DateTime) {
}
}
query GetAddProductType($addproductTypeId: Uuid!) {
evo_addproduct_type(evo_addproduct_typeid: $addproductTypeId) {
evo_description
query GetTechnicalCards($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
evo_product_type: 100000000
) {
...CoreAddProductTypesFields
evo_min_period
evo_max_period
evo_leasingobject_types {
evo_leasingobject_typeid
}
evo_helpcard_type
}
}
query GetFuelCards($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
evo_product_type: 100000005
) {
...CoreAddProductTypesFields
evo_min_period
evo_max_period
evo_leasingobject_types {
evo_leasingobject_typeid
}
}
}
query GetTelematicTypes($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
evo_product_type: 100000004
) {
...CoreAddProductTypesFields
}
}
query GetTrackerTypes($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
evo_product_type: 100000003
) {
...CoreAddProductTypesFields
}
}
query GetInsNSIBTypes($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
evo_product_type: 100000002
) {
...CoreAddProductTypesFields
}
}
query GetLeasingWithoutKaskoTypes($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_product_type: 100000007
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
...CoreAddProductTypesFields
evo_product_type
evo_min_period
evo_max_period
evo_min_price
evo_max_price
evo_leasingobject_types {
evo_leasingobject_typeid
}
evo_visible_calc
evo_min_first_payment_perc
evo_max_first_payment_perc
evo_models {
evo_modelid
}
}
}
query GetInsuranceCompany($accountId: Uuid!) {
account(accountid: $accountId) {
evo_osago_with_kasko
}
}
query GetInsuranceCompanies {
accounts(evo_account_type: [100000002], statecode: 0) {
evo_type_ins_policy
evo_evokasko_access
evo_inn
value: accountid
label: name
}
}

View File

@ -175,7 +175,7 @@ export type GetQuoteQueryVariables = Exact<{
}>;
export type GetQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null } | null };
export type GetQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null, evo_one_year_insurance: boolean | null } | null };
export type GetTarifsQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
@ -189,7 +189,7 @@ export type GetTarifQueryVariables = Exact<{
}>;
export type GetTarifQuery = { __typename?: 'Query', evo_tarif: { __typename?: 'evo_tarif', evo_irr: number | null, evo_graphtype_exception: Array<number> | null, evo_seasons_type_exception: Array<number> | null, evo_min_decreasing_perc: number | null, evo_min_irr: number | null, evo_cut_irr_with_bonus_coefficient: number | null, evo_max_irr: number | null } | null };
export type GetTarifQuery = { __typename?: 'Query', evo_tarif: { __typename?: 'evo_tarif', evo_irr: number | null, evo_graphtype_exception: Array<number> | null, evo_seasons_type_exception: Array<number> | null, evo_min_decreasing_perc: number | null, evo_min_irr: number | null, evo_cut_irr_with_bonus_coefficient: number | null, evo_max_irr: number | null, evo_rates: Array<{ __typename?: 'evo_rate', evo_datefrom: string | null, evo_rateid: string | null } | null> | null } | null };
export type GetRatesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
@ -264,6 +264,13 @@ export type GetGpsBrandsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetGpsBrandsQuery = { __typename?: 'Query', evo_gps_brands: Array<{ __typename?: 'evo_gps_brand', label: string | null, value: string | null } | null> | null };
export type GetGpsModelsQueryVariables = Exact<{
gpsBrandId: Scalars['Uuid'];
}>;
export type GetGpsModelsQuery = { __typename?: 'Query', evo_gps_models: Array<{ __typename?: 'evo_gps_model', label: string | null, value: string | null } | null> | null };
export type GetLeaseObjectTypesQueryVariables = Exact<{ [key: string]: never; }>;
@ -286,7 +293,7 @@ export type GetBrandQueryVariables = Exact<{
}>;
export type GetBrandQuery = { __typename?: 'Query', evo_brand: { __typename?: 'evo_brand', evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null } | null };
export type GetBrandQuery = { __typename?: 'Query', evo_brand: { __typename?: 'evo_brand', evo_id: string | null, evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null } | null };
export type GetModelsQueryVariables = Exact<{
brandId: Scalars['Uuid'];
@ -307,7 +314,7 @@ export type GetConfigurationsQueryVariables = Exact<{
}>;
export type GetConfigurationsQuery = { __typename?: 'Query', evo_equipments: Array<{ __typename?: 'evo_equipment', label: string | null, value: string | null } | null> | null };
export type GetConfigurationsQuery = { __typename?: 'Query', evo_equipments: Array<{ __typename?: 'evo_equipment', evo_start_production_year: number | null, label: string | null, value: string | null } | null> | null };
export type GetConfigurationQueryVariables = Exact<{
configurationId: Scalars['Uuid'];
@ -379,26 +386,89 @@ export type GetSystemUserQueryVariables = Exact<{
export type GetSystemUserQuery = { __typename?: 'Query', systemuser: { __typename?: 'systemuser', evo_job_titleid: string | null } | null };
export type CoreAddProductTypesFieldsFragment = { __typename?: 'evo_addproduct_type', evo_graph_price: number | null, label: string | null, value: string | null };
export type GetAddproductTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetAddproductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, evo_product_type: number | null, label: string | null, value: string | null } | null> | null };
export type GetRegistrationTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetRegistrationTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, evo_whom_register: number | null, evo_gibdd_region: boolean | null, evo_pts_type: Array<number> | null, evo_accountid: string | null, evo_towtruck: boolean | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null> | null };
export type GetAddproductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_graph_price: number | null, label: string | null, value: string | null } | null> | null };
export type GetAddProductTypeQueryVariables = Exact<{
addproductTypeId: Scalars['Uuid'];
}>;
export type GetAddProductTypeQuery = { __typename?: 'Query', evo_addproduct_type: { __typename?: 'evo_addproduct_type', evo_description: string | null } | null };
export type GetAddProductTypeQuery = { __typename?: 'Query', evo_addproduct_type: { __typename?: 'evo_addproduct_type', evo_description: string | null, evo_helpcard_type: number | null } | null };
export type GetRegistrationTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetRegistrationTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_whom_register: number | null, evo_gibdd_region: boolean | null, evo_pts_type: Array<number> | null, evo_accountid: string | null, evo_towtruck: boolean | null, evo_graph_price: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null> | null };
export type GetTechnicalCardsQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetTechnicalCardsQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_min_period: number | null, evo_max_period: number | null, evo_helpcard_type: number | null, evo_graph_price: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null> | null };
export type GetFuelCardsQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetFuelCardsQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_min_period: number | null, evo_max_period: number | null, evo_graph_price: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null> | null };
export type GetTelematicTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetTelematicTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, label: string | null, value: string | null } | null> | null };
export type GetTrackerTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetTrackerTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, label: string | null, value: string | null } | null> | null };
export type GetInsNsibTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetInsNsibTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, label: string | null, value: string | null } | null> | null };
export type GetLeasingWithoutKaskoTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetLeasingWithoutKaskoTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_min_period: number | null, evo_max_period: number | null, evo_min_price: number | null, evo_max_price: number | null, evo_visible_calc: boolean | null, evo_min_first_payment_perc: number | null, evo_max_first_payment_perc: number | null, evo_graph_price: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null } | null> | null };
export type GetInsuranceCompanyQueryVariables = Exact<{
accountId: Scalars['Uuid'];
}>;
export type GetInsuranceCompanyQuery = { __typename?: 'Query', account: { __typename?: 'account', evo_osago_with_kasko: boolean | null } | null };
export type GetInsuranceCompaniesQueryVariables = Exact<{ [key: string]: never; }>;
export type GetInsuranceCompaniesQuery = { __typename?: 'Query', accounts: Array<{ __typename?: 'account', evo_type_ins_policy: Array<number> | null, evo_evokasko_access: boolean | null, evo_inn: string | null, value: string | null, label: string | null } | null> | null };
export type GetQuoteAddProductDataQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetQuoteAddProductDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_addproduct_typeid: string | null } | null> | null } | null };
export type GetQuoteBonusDataQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
@ -433,7 +503,7 @@ export type GetQuoteGibddDataQueryVariables = Exact<{
}>;
export type GetQuoteGibddDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_db_accept_registration: number | null, evo_object_registration: number | null, evo_pts_type: number | null, evo_vehicle_tax_year: number | null, evo_vehicle_tax_approved: number | null, evo_category_tr: number | null, evo_vehicle_type_tax: number | null, evo_regionid: string | null, evo_townid: string | null, evo_legal_regionid: string | null, evo_legal_townid: string | null, evo_registration_regionid: string | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_addproduct_typeid: string | null } | null> | null } | null };
export type GetQuoteGibddDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_db_accept_registration: number | null, evo_object_registration: number | null, evo_pts_type: number | null, evo_vehicle_tax_year: number | null, evo_vehicle_tax_approved: number | null, evo_category_tr: number | null, evo_vehicle_type_tax: number | null, evo_regionid: string | null, evo_townid: string | null, evo_legal_regionid: string | null, evo_legal_townid: string | null, evo_registration_regionid: string | null } | null };
export type GetQuoteRegionTownQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
@ -442,13 +512,6 @@ export type GetQuoteRegionTownQueryVariables = Exact<{
export type GetQuoteRegionTownQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_regionid: string | null, evo_townid: string | null, evo_legal_regionid: string | null, evo_legal_townid: string | null } | null };
export type GetInsuranceDataQueryVariables = Exact<{
evo_account_type: InputMaybe<Array<Scalars['Int']> | Scalars['Int']>;
}>;
export type GetInsuranceDataQuery = { __typename?: 'Query', osago: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, kasko: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, fingap: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null };
export type GetQuoteInsuranceDataQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
@ -484,13 +547,6 @@ export type GetQuoteLeasingObjectDataQueryVariables = Exact<{
export type GetQuoteLeasingObjectDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_category: number | null, evo_delivery_time: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_max_mass: number | null, evo_max_speed: number | null, evo_mileage: number | null, evo_modelid: string | null, evo_object_count: number | null, evo_power: number | null, evo_recalc_limit: number | null, evo_seats: number | null, evo_trailer: boolean | null, evo_use_for: number | null, evo_vin: string | null, evo_year: number | null } | null };
export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetLeasingWithoutKaskoOptionsQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null, evo_min_period: number | null, evo_max_period: number | null, evo_min_price: number | null, evo_max_price: number | null, evo_visible_calc: boolean | null, evo_min_first_payment_perc: number | null, evo_max_first_payment_perc: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null } | null> | null };
export type GetQuotePaymentsDataQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
@ -526,7 +582,7 @@ export type GetQuoteAgentsDataQueryVariables = Exact<{
export type GetQuoteAgentsDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_supplier_accountid: string | null, evo_dealer_person_accountid: string | null, evo_dealer_reward_conditionid: string | null, evo_dealer_reward_total: number | null, evo_dealer_reward_summ: number | null, evo_dealer_broker_accountid: string | null, evo_dealer_broker_reward_conditionid: string | null, evo_dealer_broker_reward_total: number | null, evo_dealer_broker_reward_summ: number | null, evo_agent_accountid: string | null, evo_agent_reward_conditionid: string | null, evo_agent_reward_total: number | null, evo_agent_reward_summ: number | null, evo_double_agent_accountid: string | null, evo_double_agent_reward_conditionid: string | null, evo_double_agent_reward_total: number | null, evo_double_agent_reward_summ: number | null, evo_broker_accountid: string | null, evo_broker_reward_conditionid: string | null, evo_broker_reward_total: number | null, evo_broker_reward_summ: number | null, evo_fin_department_accountid: string | null, evo_fin_department_reward_conditionid: string | null, evo_fin_department_reward_total: number | null, evo_fin_department_reward_summ: number | null } | null };
export const CoreAddProductTypesFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<CoreAddProductTypesFieldsFragment, unknown>;
export const GetTransactionCurrenciesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransactionCurrencies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactioncurrencies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"currencyname"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"isocurrencycode"}},{"kind":"Field","name":{"kind":"Name","value":"currencysymbol"}}]}}]}}]} as unknown as DocumentNode<GetTransactionCurrenciesQuery, GetTransactionCurrenciesQueryVariables>;
export const GetTransactionCurrencyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransactionCurrency"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currencyid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactioncurrency"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"transactioncurrencyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currencyid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencysymbol"}},{"kind":"Field","name":{"kind":"Name","value":"isocurrencycode"}}]}}]}}]} as unknown as DocumentNode<GetTransactionCurrencyQuery, GetTransactionCurrencyQueryVariables>;
export const GetCurrencyChangesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrencyChanges"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_currencychanges"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_coursedate_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_currencychange"}},{"kind":"Field","name":{"kind":"Name","value":"evo_ref_transactioncurrency"}}]}}]}}]} as unknown as DocumentNode<GetCurrencyChangesQuery, GetCurrencyChangesQueryVariables>;
@ -535,9 +591,9 @@ export const GetLeadDocument = {"kind":"Document","definitions":[{"kind":"Operat
export const GetOpportunityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leadid"}},{"kind":"Field","name":{"kind":"Name","value":"accountidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_address_legalidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_city_fias_id"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOpportunityQuery, GetOpportunityQueryVariables>;
export const GetOpportunitiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunities"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"owner_domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"opportunityid"}}]}}]}}]} as unknown as DocumentNode<GetOpportunitiesQuery, GetOpportunitiesQueryVariables>;
export const GetQuotesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quotes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_quotename"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"quoteid"}}]}}]}}]} as unknown as DocumentNode<GetQuotesQuery, GetQuotesQueryVariables>;
export const GetQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode<GetQuoteQuery, GetQuoteQueryVariables>;
export const GetQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_one_year_insurance"}}]}}]}}]} as unknown as DocumentNode<GetQuoteQuery, GetQuoteQueryVariables>;
export const GetTarifsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarifs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_used"}}]}}]}}]} as unknown as DocumentNode<GetTarifsQuery, GetTarifsQueryVariables>;
export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarif"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarif"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_tarifid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphtype_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_decreasing_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus_coefficient"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_irr"}}]}}]}}]} as unknown as DocumentNode<GetTarifQuery, GetTarifQueryVariables>;
export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarif"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarif"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_tarifid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphtype_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_decreasing_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus_coefficient"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_datefrom"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}}]}}]}}]}}]} as unknown as DocumentNode<GetTarifQuery, GetTarifQueryVariables>;
export const GetRatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRates"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}}]}}]}}]}}]} as unknown as DocumentNode<GetRatesQuery, GetRatesQueryVariables>;
export const GetRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_rateid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_base_rate"}}]}}]}}]} as unknown as DocumentNode<GetRateQuery, GetRateQueryVariables>;
export const GetProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProducts"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_relation"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode<GetProductsQuery, GetProductsQueryVariables>;
@ -549,13 +605,14 @@ export const GetRegionsDocument = {"kind":"Document","definitions":[{"kind":"Ope
export const GetRegionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_oktmo"}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]}}]} as unknown as DocumentNode<GetRegionQuery, GetRegionQueryVariables>;
export const GetTownsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTowns"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_towns"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunit_evolution"}}]}}]}}]} as unknown as DocumentNode<GetTownsQuery, GetTownsQueryVariables>;
export const GetGpsBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_brandid"}}]}}]}}]} as unknown as DocumentNode<GetGpsBrandsQuery, GetGpsBrandsQueryVariables>;
export const GetGpsModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSModels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"gpsBrandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_models"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_gps_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"gpsBrandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_modelid"}}]}}]}}]} as unknown as DocumentNode<GetGpsModelsQuery, GetGpsModelsQueryVariables>;
export const GetLeaseObjectTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypesQuery, GetLeaseObjectTypesQueryVariables>;
export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypeQuery, GetLeaseObjectTypeQueryVariables>;
export const GetBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode<GetBrandsQuery, GetBrandsQueryVariables>;
export const GetBrandDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrand"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brand"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}}]}}]}}]} as unknown as DocumentNode<GetBrandQuery, GetBrandQueryVariables>;
export const GetBrandDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrand"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brand"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}}]}}]}}]} as unknown as DocumentNode<GetBrandQuery, GetBrandQueryVariables>;
export const GetModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode<GetModelsQuery, GetModelsQueryVariables>;
export const GetModelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_model"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}}]}}]}}]} as unknown as DocumentNode<GetModelQuery, GetModelQueryVariables>;
export const GetConfigurationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfigurations"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_equipmentid"}}]}}]}}]} as unknown as DocumentNode<GetConfigurationsQuery, GetConfigurationsQueryVariables>;
export const GetConfigurationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfigurations"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_start_production_year"}}]}}]}}]} as unknown as DocumentNode<GetConfigurationsQuery, GetConfigurationsQueryVariables>;
export const GetConfigurationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguration"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_equipmentid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}}]}}]}}]} as unknown as DocumentNode<GetConfigurationQuery, GetConfigurationQueryVariables>;
export const GetDealersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealers"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_legal_form"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]} as unknown as DocumentNode<GetDealersQuery, GetDealersQueryVariables>;
export const GetDealerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealer"},"name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_return_leasing_dealer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}}]}}]}}]} as unknown as DocumentNode<GetDealerQuery, GetDealerQueryVariables>;
@ -566,22 +623,29 @@ export const GetRewardConditionDocument = {"kind":"Document","definitions":[{"ki
export const GetSotCoefficientTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSotCoefficientType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evo_id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}}]}}]}}]} as unknown as DocumentNode<GetSotCoefficientTypeQuery, GetSotCoefficientTypeQueryVariables>;
export const GetCoefficientsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoefficients"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_coefficients"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_job_titleid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient"}}]}}]}}]} as unknown as DocumentNode<GetCoefficientsQuery, GetCoefficientsQueryVariables>;
export const GetSystemUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSystemUser"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"systemuser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}}]}}]}}]} as unknown as DocumentNode<GetSystemUserQuery, GetSystemUserQueryVariables>;
export const GetAddproductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddproductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}}]}}]}}]} as unknown as DocumentNode<GetAddproductTypesQuery, GetAddproductTypesQueryVariables>;
export const GetRegistrationTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegistrationTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_whom_register"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gibdd_region"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_towtruck"}}]}}]}}]} as unknown as DocumentNode<GetRegistrationTypesQuery, GetRegistrationTypesQueryVariables>;
export const GetAddProductTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddProductType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_addproduct_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_description"}}]}}]}}]} as unknown as DocumentNode<GetAddProductTypeQuery, GetAddProductTypeQueryVariables>;
export const GetAddproductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddproductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetAddproductTypesQuery, GetAddproductTypesQueryVariables>;
export const GetAddProductTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddProductType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_addproduct_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_description"}},{"kind":"Field","name":{"kind":"Name","value":"evo_helpcard_type"}}]}}]}}]} as unknown as DocumentNode<GetAddProductTypeQuery, GetAddProductTypeQueryVariables>;
export const GetRegistrationTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegistrationTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_whom_register"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gibdd_region"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_towtruck"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetRegistrationTypesQuery, GetRegistrationTypesQueryVariables>;
export const GetTechnicalCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTechnicalCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000000"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_helpcard_type"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetTechnicalCardsQuery, GetTechnicalCardsQueryVariables>;
export const GetFuelCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFuelCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000005"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetFuelCardsQuery, GetFuelCardsQueryVariables>;
export const GetTelematicTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTelematicTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000004"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetTelematicTypesQuery, GetTelematicTypesQueryVariables>;
export const GetTrackerTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTrackerTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000003"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetTrackerTypesQuery, GetTrackerTypesQueryVariables>;
export const GetInsNsibTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsNSIBTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000002"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetInsNsibTypesQuery, GetInsNsibTypesQueryVariables>;
export const GetLeasingWithoutKaskoTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000007"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetLeasingWithoutKaskoTypesQuery, GetLeasingWithoutKaskoTypesQueryVariables>;
export const GetInsuranceCompanyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompany"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_osago_with_kasko"}}]}}]}}]} as unknown as DocumentNode<GetInsuranceCompanyQuery, GetInsuranceCompanyQueryVariables>;
export const GetInsuranceCompaniesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompanies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000002"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_type_ins_policy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_evokasko_access"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetInsuranceCompaniesQuery, GetInsuranceCompaniesQueryVariables>;
export const GetQuoteAddProductDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteAddProductData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode<GetQuoteAddProductDataQuery, GetQuoteAddProductDataQueryVariables>;
export const GetQuoteBonusDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteBonusData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}}]}}]}}]} as unknown as DocumentNode<GetQuoteBonusDataQuery, GetQuoteBonusDataQueryVariables>;
export const GetQuoteConfiguratorDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteConfiguratorData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode<GetQuoteConfiguratorDataQuery, GetQuoteConfiguratorDataQueryVariables>;
export const GetQuoteFingapDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteFingapData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode<GetQuoteFingapDataQuery, GetQuoteFingapDataQueryVariables>;
export const GetFinGapAddProductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFinGAPAddProductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000006"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type_calc_cerebellum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode<GetFinGapAddProductTypesQuery, GetFinGapAddProductTypesQueryVariables>;
export const GetQuoteGibddDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteGibddData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_approved"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_regionid"}}]}}]}}]} as unknown as DocumentNode<GetQuoteGibddDataQuery, GetQuoteGibddDataQueryVariables>;
export const GetQuoteGibddDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteGibddData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_approved"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_regionid"}}]}}]}}]} as unknown as DocumentNode<GetQuoteGibddDataQuery, GetQuoteGibddDataQueryVariables>;
export const GetQuoteRegionTownDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteRegionTown"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}}]}}]}}]} as unknown as DocumentNode<GetQuoteRegionTownQuery, GetQuoteRegionTownQueryVariables>;
export const GetInsuranceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"osago"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"kasko"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"fingap"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_account_type"}}},{"kind":"Argument","name":{"kind":"Name","value":"evo_type_ins_policy"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000002"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetInsuranceDataQuery, GetInsuranceDataQueryVariables>;
export const GetQuoteInsuranceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteInsuranceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_osago_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_period"}}]}}]}}]} as unknown as DocumentNode<GetQuoteInsuranceDataQuery, GetQuoteInsuranceDataQueryVariables>;
export const GetLeadUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeadUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetLeadUrlQuery, GetLeadUrlQueryVariables>;
export const GetOpportunityUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunityUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetOpportunityUrlQuery, GetOpportunityUrlQueryVariables>;
export const GetQuoteUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetQuoteUrlQuery, GetQuoteUrlQueryVariables>;
export const GetQuoteLeasingObjectDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteLeasingObjectData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vin"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}}]}}]}}]} as unknown as DocumentNode<GetQuoteLeasingObjectDataQuery, GetQuoteLeasingObjectDataQueryVariables>;
export const GetLeasingWithoutKaskoOptionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoOptions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000007"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode<GetLeasingWithoutKaskoOptionsQuery, GetLeasingWithoutKaskoOptionsQueryVariables>;
export const GetQuotePaymentsDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePaymentsData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetQuotePaymentsDataQuery, GetQuotePaymentsDataQueryVariables>;
export const GetQuotePriceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePriceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_comission_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_nds_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}}]}}]}}]} as unknown as DocumentNode<GetQuotePriceDataQuery, GetQuotePriceDataQueryVariables>;
export const GetQuoteSubsidyDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteSubsidyData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidyid"}}]}}]}}]} as unknown as DocumentNode<GetQuoteSubsidyDataQuery, GetQuoteSubsidyDataQueryVariables>;

View File

@ -1,12 +1,9 @@
import { getUser } from '@/api/user/query';
import initializeApollo from '@/apollo/client';
import * as Calculation from '@/Components/Calculation';
import { CRMError } from '@/Components/Common/Error';
import Output from '@/Components/Output';
import { useDefaultReactions } from '@/config/process';
import * as init from '@/process/init';
import { min } from '@/styles/mq';
import { dehydrate, QueryClient } from '@tanstack/react-query';
import Head from 'next/head';
import styled from 'styled-components';
import { Box } from 'ui/grid';
@ -38,6 +35,7 @@ const Grid = styled(Box)`
function Home({ error }) {
init.useMainData();
init.useInsuranceData();
init.useInitialData();
useDefaultReactions();
if (error) return <CRMError error={error} />;
@ -53,41 +51,9 @@ function Home({ error }) {
</Grid>
);
}
/** @type {import('next').GetServerSideProps} */
export const getServerSideProps = async ({ req }) => {
const { cookie = '' } = req.headers;
const queryGetUser = () =>
getUser({
headers: {
cookie,
},
});
const queryClient = new QueryClient();
const user = await queryClient.fetchQuery(['user'], queryGetUser);
const apolloClient = initializeApollo();
try {
const { values, options } = await init.getInitialData(apolloClient, user);
return {
props: {
calculation: {
options,
values,
},
initialApolloState: apolloClient.cache.extract(),
initialQueryState: dehydrate(queryClient),
},
};
} catch (error) {
return {
props: {
error: JSON.stringify(error),
},
};
}
};
/** @type {import('next').GetStaticProps} */
export const getStaticProps = async () => ({
props: {},
});
export default Home;

View File

@ -0,0 +1,71 @@
import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types';
import initializeApollo from '@/apollo/client';
import defaultValues from '@/config/default-values';
import * as CRMTypes from '@/graphql/crm.types';
import { gql } from '@apollo/client';
const QUERY_GET_QUOTE_ADD_PRODUCT_DATA = gql`
query GetQuoteAddProductData($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_addproduct_types {
evo_product_type
evo_addproduct_typeid
}
}
}
`;
export async function getKPData({
values: { quote: quoteId },
}: GetQuoteInputData): Promise<GetQuoteProcessData> {
const apolloClient = initializeApollo();
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteAddProductDataDocument,
variables: {
quoteId,
},
});
const registration =
quote?.evo_addproduct_types?.find((x) => x?.evo_product_type === 100_000_001)
?.evo_addproduct_typeid ?? defaultValues.registration;
const technicalCard =
quote?.evo_addproduct_types?.find((x) => x?.evo_product_type === 100_000_000)
?.evo_addproduct_typeid ?? defaultValues.technicalCard;
const insNSIB =
quote?.evo_addproduct_types?.find((x) => x?.evo_product_type === 100_000_002)
?.evo_addproduct_typeid ?? defaultValues.insNSIB;
const tracker =
quote?.evo_addproduct_types?.find((x) => x?.evo_product_type === 100_000_003)
?.evo_addproduct_typeid ?? defaultValues.tracker;
const telematic =
quote?.evo_addproduct_types?.find((x) => x?.evo_product_type === 100_000_004)
?.evo_addproduct_typeid ?? defaultValues.telematic;
const fuelCard =
quote?.evo_addproduct_types?.find((x) => x?.evo_product_type === 100_000_005)
?.evo_addproduct_typeid ?? defaultValues.fuelCard;
const leasingWithoutKasko =
quote?.evo_addproduct_types?.find((x) => x?.evo_product_type === 100_000_007)
?.evo_addproduct_typeid ?? defaultValues.leasingWithoutKasko;
return {
values: {
fuelCard,
insNSIB,
leasingWithoutKasko,
registration,
technicalCard,
telematic,
tracker,
},
};
}

View File

@ -0,0 +1,2 @@
export * from './get-kp-data';
export * as reactions from './reactions';

View File

@ -0,0 +1,121 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ProcessContext } from '../types';
import * as CRMTypes from '@/graphql/crm.types';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { reaction } from 'mobx';
import { normalizeOptions } from 'tools';
dayjs.extend(utc);
export default function reactions({ store, apolloClient }: ProcessContext) {
const { $calculation } = store;
reaction(
() => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType']),
async ({ leasingPeriod, leaseObjectType }) => {
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
const {
data: { evo_addproduct_types },
} = await apolloClient.query({
query: CRMTypes.GetTechnicalCardsDocument,
variables: { currentDate },
});
const options = evo_addproduct_types?.filter(
(evo_addproduct_type) =>
Boolean(
evo_addproduct_type?.evo_min_period &&
evo_addproduct_type.evo_min_period <= leasingPeriod
) &&
Boolean(
evo_addproduct_type?.evo_max_period &&
evo_addproduct_type.evo_max_period >= leasingPeriod
) &&
Boolean(
leaseObjectType &&
evo_addproduct_type?.evo_leasingobject_types?.find(
(x) => x?.evo_leasingobject_typeid === leaseObjectType
)
)
);
$calculation.element('selectTechnicalCard').setOptions(normalizeOptions(options));
const currentTechnicalCardId = $calculation.element('selectTechnicalCard').getValue();
if (currentTechnicalCardId) {
const {
data: { evo_addproduct_type },
} = await apolloClient.query({
query: CRMTypes.GetAddProductTypeDocument,
variables: { addproductTypeId: currentTechnicalCardId },
});
const nextTechnicalCard = options?.find(
(x) => x?.evo_helpcard_type === evo_addproduct_type?.evo_helpcard_type
);
if (nextTechnicalCard) {
$calculation.element('selectTechnicalCard').setValue(nextTechnicalCard?.value);
} else {
$calculation.element('selectTechnicalCard').resetValue();
}
}
},
{
fireImmediately: true,
}
);
reaction(
() => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType']),
async ({ leasingPeriod, leaseObjectType }) => {
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
const {
data: { evo_addproduct_types },
} = await apolloClient.query({
query: CRMTypes.GetFuelCardsDocument,
variables: { currentDate },
});
const options = evo_addproduct_types?.filter(
(evo_addproduct_type) =>
Boolean(
evo_addproduct_type?.evo_min_period &&
evo_addproduct_type.evo_min_period <= leasingPeriod
) &&
Boolean(
evo_addproduct_type?.evo_max_period &&
evo_addproduct_type.evo_max_period >= leasingPeriod
) &&
Boolean(
leaseObjectType &&
evo_addproduct_type?.evo_leasingobject_types?.find(
(x) => x?.evo_leasingobject_typeid === leaseObjectType
)
)
);
$calculation.element('selectFuelCard').setOptions(normalizeOptions(options));
},
{
fireImmediately: true,
}
);
reaction(
() => $calculation.element('tbxLeasingPeriod').getValue(),
(leasingPeriod) => {
if (leasingPeriod < 12) {
$calculation.element('selectInsNSIB').resetValue().block();
} else {
$calculation.element('selectInsNSIB').unblock();
}
},
{
fireImmediately: true,
}
);
}

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ProcessContext } from '../../../types';
import type { ValidationContext } from '../../types';
import { getUser } from '@/api/user/query';
import type { ElementsTypes } from '@/Components/Calculation/config/map/values';
import { STALE_TIME } from '@/constants/request';
@ -8,7 +8,7 @@ import dayjs from 'dayjs';
export type ProductId = ElementsTypes['selectProduct'];
export default function helper({ apolloClient, queryClient }: ProcessContext) {
export default function helper({ apolloClient, queryClient }: ValidationContext) {
return {
async getCoefficient(productId: ProductId) {
if (!productId) {
@ -32,7 +32,7 @@ export default function helper({ apolloClient, queryClient }: ProcessContext) {
return null;
}
const currentDate = dayjs().utc(false).toISOString();
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
const {
data: { evo_coefficients },

View File

@ -1,11 +1,11 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ProcessContext } from '../../types';
import helper from './lib/helper';
import { makeDisposable } from '@/../../packages/tools';
import helper from '../lib/helper';
import * as CRMTypes from '@/graphql/crm.types';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { reaction } from 'mobx';
import { makeDisposable } from 'tools';
dayjs.extend(utc);

View File

@ -1,23 +1,35 @@
import helper from './lib/helper';
import { createValidationSchema } from '../validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { reaction } from 'mobx';
import { round } from 'tools';
import { uid } from 'radash';
const key = uid(7);
export default function reactions(context: ProcessContext) {
const { store } = context;
const { $calculation } = store;
const { getCoefficient } = helper(context);
const validationSchema = createValidationSchema(context);
const helper = new ValidationHelper();
reaction(
() => $calculation.$values.getValues(['product', 'saleBonus']),
async ({ product: productId, saleBonus }) => {
const coefficient = await getCoefficient(productId);
const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100;
async (values) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
$calculation.element('tbxSaleBonus').validate({
invalid: round(saleBonus, 2) > round(maxBonus, 2),
message: 'Размер бонуса МПЛ не может быть выше установленного по СОТ',
});
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Elements[]).forEach((elementName) => {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
});
});
}
},
{
delay: 100,
}
);
}

View File

@ -0,0 +1,24 @@
import type { ValidationContext } from '../types';
import helper from './lib/helper';
import ValuesSchema from '@/config/schema/values';
import { round } from 'tools';
import { z } from 'zod';
export function createValidationSchema(context: ValidationContext) {
const { getCoefficient } = helper(context);
return ValuesSchema.pick({ product: true, saleBonus: true }).superRefine(
async ({ product, saleBonus }, ctx) => {
const coefficient = await getCoefficient(product);
const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100;
if (round(saleBonus, 2) > round(maxBonus, 2)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Размер бонуса МПЛ не может быть выше установленного по СОТ',
path: ['tbxSaleBonus'],
});
}
}
);
}

View File

@ -2,7 +2,9 @@ import types from '@/Components/Calculation/config/elements-types';
import type * as Values from '@/Components/Calculation/config/map/values';
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { reaction } from 'mobx';
import { uid } from 'radash';
import type { BaseOption } from 'ui/elements/types';
function hasInvalidValueOrOptions(value: unknown, options: Array<BaseOption<unknown>>) {
@ -21,6 +23,7 @@ export default function reactions({ store }: ProcessContext) {
const hasElementsErrors = Object.values($calculation.$validation).some(
(validation) => validation.hasErrors
);
const hasPaymentsErrors = $tables.payments.validation.hasErrors;
const hasInsuranceErrors = $tables.insurance.validation.hasErrors;
const hasFingapErrors = $tables.fingap.validation.hasErrors;
@ -44,6 +47,10 @@ export default function reactions({ store }: ProcessContext) {
/**
* Проверяем, что выбранное значение элемента есть в списке
*/
const key = uid(7);
const message = 'Выбранное значение отсутствует в списке';
function validateOptionsElement(elementName: Values.Elements) {
const type = types[elementName];
if (type().typeName !== 'Options') {
@ -52,6 +59,8 @@ export default function reactions({ store }: ProcessContext) {
const element = $calculation.element(elementName);
const validationHelper = new ValidationHelper();
reaction(
() => {
const options = element.getOptions();
@ -63,11 +72,16 @@ export default function reactions({ store }: ProcessContext) {
};
},
({ value, options }) => {
element.validate({
invalid: hasInvalidValueOrOptions(value, options),
message: 'Выбранное значение отсутствует в списке',
silent: true,
});
if (hasInvalidValueOrOptions(value, options)) {
const removeError = element.setError({
key,
message,
silent: true,
});
if (removeError) validationHelper.add(removeError);
} else {
validationHelper.removeErrors();
}
},
{
delay: 100,
@ -95,6 +109,8 @@ export default function reactions({ store }: ProcessContext) {
function validateInsuranceCompany(rowKey: Insurance.Keys) {
const row = $tables.insurance.row(rowKey);
const validationHelper = new ValidationHelper();
reaction(
() => {
const options = row.getOptions('insuranceCompany');
@ -106,11 +122,16 @@ export default function reactions({ store }: ProcessContext) {
};
},
({ value, options }) => {
$tables.insurance.validate({
invalid: hasInvalidValueOrOptions(value, options),
message: 'Выбранное значение отсутствует в списке',
silent: true,
});
if (hasInvalidValueOrOptions(value, options)) {
const removeError = $tables.insurance.setError({
key,
message,
silent: true,
});
validationHelper.add(removeError);
} else {
validationHelper.removeErrors();
}
},
{
delay: 100,

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { radioGraphType, selectSeasonType } from '@/config/default-options';
import { radioCalcType, radioGraphType, selectSeasonType } from '@/config/default-options';
import * as CRMTypes from '@/graphql/crm.types';
import { SEASON_TYPES } from '@/process/payments/lib/seasons-constants';
import type { ProcessContext } from '@/process/types';
@ -278,7 +278,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
const {
data: { evo_baseproduct },
} = await apolloClient.query<CRMTypes.GetProductQuery, CRMTypes.GetProductQueryVariables>({
} = await apolloClient.query({
query: CRMTypes.GetProductDocument,
variables: {
productId,
@ -286,10 +286,9 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
});
if (evo_baseproduct?.evo_calculation_method) {
const filteredCalcTypeOptions = $calculation
.element('radioCalcType')
.getOptions()
.filter((calcType) => evo_baseproduct.evo_calculation_method?.includes(calcType.value));
const filteredCalcTypeOptions = radioCalcType.filter((calcType) =>
evo_baseproduct.evo_calculation_method?.includes(calcType.value)
);
$calculation.element('radioCalcType').setOptions(filteredCalcTypeOptions);
} else {
$calculation.element('radioCalcType').resetOptions();
@ -306,7 +305,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
reaction(
() => $calculation.element('selectQuote').getValue(),
async (quoteId) => {
const currentDate = dayjs().utc(false).toISOString();
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
const {
data: { evo_baseproducts },

View File

@ -1,44 +1,35 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as CRMTypes from '@/graphql/crm.types';
import { createValidationSchema } from '../validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { reaction } from 'mobx';
import { uid } from 'radash';
export default function reactions({ store, apolloClient }: ProcessContext) {
const key = uid(7);
export default function reactions(context: ProcessContext) {
const { store } = context;
const { $calculation } = store;
/**
* На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку:
* Если значение поля меньше значения в поле "Минимальный % убывания платежей" evo_min_decreasing_perc из записи,
* указанной в поле ТарифselectTarif , то поле Процет убывания платежей tbxParmentsDecreasePercent должно обводиться красной рамкой
* и выводиться сообщение "Процент убывания не может быть меньше минимального значения по данному тарифу
* - <указывается значение из поля "Минимальный % убывания платежей">, иначе красная рамка снимается.
* При красной рамке в данном поле нельзя осуществить расчет графика.
*/
const validationSchema = createValidationSchema(context);
const helper = new ValidationHelper();
reaction(
() => ({
parmentsDecreasePercent: $calculation.element('tbxParmentsDecreasePercent').getValue(),
tarifId: $calculation.element('selectTarif').getValue(),
}),
async ({ parmentsDecreasePercent, tarifId }) => {
let evo_tarif: CRMTypes.GetTarifQuery['evo_tarif'] = null;
() => $calculation.$values.getValues(['parmentsDecreasePercent', 'tarif']),
async (values) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
if (tarifId) {
const { data } = await apolloClient.query({
query: CRMTypes.GetTarifDocument,
variables: {
tarifId,
},
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Elements[]).forEach((elementName) => {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
});
});
({ evo_tarif } = data);
}
$calculation.element('tbxParmentsDecreasePercent').validate({
invalid: Boolean(
evo_tarif?.evo_min_decreasing_perc &&
parmentsDecreasePercent < evo_tarif?.evo_min_decreasing_perc
),
message: `Процент убывания не может быть меньше минимального значения по данному тарифу - ${evo_tarif?.evo_min_decreasing_perc}`,
});
},
{
delay: 100,
}
);
}

View File

@ -1,9 +1,11 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { Elements } from '@/Components/Calculation/config/map/values';
import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { reaction } from 'mobx';
import { first, sort } from 'radash';
import { makeDisposable, normalizeOptions } from 'tools';
dayjs.extend(utc);
@ -29,7 +31,7 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
firstPaymentPerc,
lastPaymentPerc,
}) => {
const currentDate = dayjs().utc(false).toISOString();
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
let {
data: { evo_tarifs = [] },
@ -41,6 +43,8 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
},
});
$calculation.element('selectTarif').setOptions(normalizeOptions(evo_tarifs));
if (product && leasingPeriod && deliveryTime && evo_tarifs) {
evo_tarifs = evo_tarifs?.filter(
(tarif) =>
@ -60,11 +64,9 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
tarif.evo_max_last_payment !== null &&
tarif.evo_max_last_payment >= lastPaymentPerc
);
} else {
$calculation.element('selectTarif').resetValue();
}
if (leaseObjectUsed === true && evo_tarifs) {
$calculation.element('selectTarif').setValue(evo_tarifs?.at(0)?.evo_tarifid || null);
} else if (leaseObjectUsed === true && evo_tarifs) {
evo_tarifs = evo_tarifs?.filter((tarif) => {
if (leaseObjectUsed === true) {
return tarif?.evo_used;
@ -72,12 +74,10 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
return true;
});
$calculation.element('selectTarif').setValue(evo_tarifs?.at(0)?.evo_tarifid || null);
} else {
$calculation.element('selectTarif').resetValue();
}
$calculation
.element('selectTarif')
.setOptions(normalizeOptions(evo_tarifs))
.setValue(evo_tarifs?.at(0)?.evo_tarifid || null);
},
{
delay: 10,
@ -98,6 +98,7 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
const {
data: { evo_tarif },
} = await apolloClient.query({
fetchPolicy: 'network-only',
query: CRMTypes.GetTarifDocument,
variables: {
tarifId,
@ -124,26 +125,37 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
return;
}
const currentDate = dayjs().utc(false).toISOString();
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
const {
data: { evo_rates },
} = await apolloClient.query({
fetchPolicy: 'network-only',
query: CRMTypes.GetRatesDocument,
variables: {
currentDate,
},
});
const rates = evo_rates?.filter((rate) =>
rate?.evo_tarifs?.filter((tarif) => tarif?.evo_tarifid === tarifId)
);
const baseRate = rates?.find((x) => x?.evo_id === 'BASE');
$calculation.element('selectRate').setOptions(normalizeOptions(evo_rates));
$calculation
.element('selectRate')
.setOptions(normalizeOptions(rates))
.setValue(baseRate?.value ?? null);
const {
data: { evo_tarif },
} = await apolloClient.query({
query: CRMTypes.GetTarifDocument,
variables: { tarifId },
});
const targetRate =
evo_tarif?.evo_rates &&
first(sort(evo_tarif?.evo_rates, (x) => dayjs(x?.evo_datefrom).date()));
if (targetRate) {
$calculation.element('selectRate').setValue(targetRate?.evo_rateid);
} else {
const baseRate = evo_rates?.find((x) => x?.evo_id === 'BASE');
if (baseRate) $calculation.element('selectRate').setValue(baseRate?.value);
}
}
);
@ -159,6 +171,7 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
const {
data: { evo_rate },
} = await apolloClient.query({
fetchPolicy: 'network-only',
query: CRMTypes.GetRateDocument,
variables: {
rateId,
@ -174,4 +187,30 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
$calculation.element('tbxCreditRate').setValue(evo_rate?.evo_base_rate);
}
);
(
[
'selectProduct',
'selectLeaseObjectType',
'selectBrand',
'selectModel',
'selectConfiguration',
'selectTracker',
'selectTelematic',
'selectTechnicalCard',
'selectFuelCard',
'selectRegistration',
'selectTownRegistration',
'radioCalcType',
] as Elements[]
).forEach((elementName) => {
reaction(
() => $calculation.element(elementName).getOptions(),
(options) => {
if (options.length === 1) {
$calculation.element(elementName).setValue(options[0]?.value);
}
}
);
});
}

View File

@ -0,0 +1,41 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ValidationContext } from '../types';
import ValuesSchema from '@/config/schema/values';
import * as CRMTypes from '@/graphql/crm.types';
import { z } from 'zod';
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({ parmentsDecreasePercent: true, tarif: true }).superRefine(
async ({ parmentsDecreasePercent, tarif: tarifId }, ctx) => {
/**
* На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку:
* Если значение поля меньше значения в поле "Минимальный % убывания платежей" evo_min_decreasing_perc из записи,
* указанной в поле ТарифselectTarif , то поле Процет убывания платежей tbxParmentsDecreasePercent должно обводиться красной рамкой
* и выводиться сообщение "Процент убывания не может быть меньше минимального значения по данному тарифу
* - <указывается значение из поля "Минимальный % убывания платежей">, иначе красная рамка снимается.
* При красной рамке в данном поле нельзя осуществить расчет графика.
*/
if (tarifId) {
const {
data: { evo_tarif },
} = await apolloClient.query({
query: CRMTypes.GetTarifDocument,
variables: {
tarifId,
},
});
if (
evo_tarif?.evo_min_decreasing_perc &&
parmentsDecreasePercent < evo_tarif?.evo_min_decreasing_perc
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Процент убывания не может быть меньше минимального значения по данному тарифу - ${evo_tarif?.evo_min_decreasing_perc}`,
path: ['tbxParmentsDecreasePercent'],
});
}
}
}
);
}

View File

@ -1,9 +1,14 @@
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { reaction } from 'mobx';
import { uid } from 'radash';
const key = uid(7);
export default function reactions({ store }: ProcessContext) {
const { $tables } = store;
const helper = new ValidationHelper();
reaction(
() => {
const hasPaymentsErrors = $tables.payments.validation.hasErrors;
@ -15,10 +20,15 @@ export default function reactions({ store }: ProcessContext) {
};
},
({ hasPaymentsErrors, finGAPInsuranceCompany }) => {
$tables.fingap.validate({
invalid: finGAPInsuranceCompany !== null && hasPaymentsErrors,
message: 'Неверно заполнены платежи',
});
if (finGAPInsuranceCompany !== null && hasPaymentsErrors) {
const removeError = $tables.fingap.setError({
key,
message: 'Неверно заполнены платежи',
});
helper.add(removeError);
} else {
helper.removeErrors();
}
if (hasPaymentsErrors) {
$tables.fingap.clear();

View File

@ -14,10 +14,6 @@ const QUERY_GET_QUOTE_GIBDD_DATA = gql`
evo_pts_type
evo_vehicle_tax_year
evo_vehicle_tax_approved
evo_addproduct_types {
evo_product_type
evo_addproduct_typeid
}
evo_category_tr
evo_vehicle_type_tax
evo_regionid
@ -73,10 +69,6 @@ export async function getKPData({ values }: GetQuoteInputData): Promise<GetQuote
regionId,
});
const registration = quote?.evo_addproduct_types?.find(
(x) => x?.evo_product_type === 100_000_001
)?.evo_addproduct_typeid;
return {
values: {
legalClientRegion: legalRegionId,
@ -88,7 +80,6 @@ export async function getKPData({ values }: GetQuoteInputData): Promise<GetQuote
: quote?.evo_object_registration,
objectTypeTax: quote?.evo_vehicle_type_tax,
regionRegistration: regionId,
registration,
townRegistration: townId,
typePTS: quote?.evo_pts_type,
vehicleTaxInYear:

View File

@ -1,7 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ProcessContext } from '../types';
import helper from './lib/helper';
import { createValidationSchema } from './validation';
import { getTransTax } from '@/api/1c/query';
import type { Elements } from '@/Components/Calculation/config/map/values';
import { selectObjectCategoryTax } from '@/config/default-options';
import { STALE_TIME } from '@/constants/request';
import * as CRMTypes from '@/graphql/crm.types';
@ -10,6 +12,7 @@ import type { QueryFunctionContext } from '@tanstack/react-query';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { reaction } from 'mobx';
import { uid } from 'radash';
import { makeDisposable, normalizeOptions } from 'tools';
dayjs.extend(utc);
@ -43,36 +46,6 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
}
);
reaction(
() => $calculation.$values.getValues(['objectRegistration', 'vehicleTaxInYear']),
({ objectRegistration, vehicleTaxInYear }) => {
if (objectRegistration === 100_000_001) {
$calculation.element('tbxVehicleTaxInYear').unblock();
} else {
$calculation.element('tbxVehicleTaxInYear').resetValue().block();
}
$calculation.element('tbxVehicleTaxInYear').validate({
invalid: objectRegistration === 100_000_001 && !(vehicleTaxInYear > 0),
message: 'Значение должно быть больше 0',
});
}
);
reaction(
() => $calculation.$values.getValues(['objectRegistration', 'typePTS']),
({ objectRegistration, typePTS }) => {
if (objectRegistration === 100_000_001) {
$calculation.element('radioTypePTS').unblock();
} else {
$calculation.element('radioTypePTS').resetValue().block();
}
$calculation.element('radioTypePTS').validate({
invalid: objectRegistration === 100_000_001 && !typePTS,
message: 'Не заполнено поле',
});
}
);
makeDisposable(
() =>
reaction(
@ -233,9 +206,13 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
},
context
);
const { tax, error } = await queryClient.fetchQuery(['1c', 'trans-tax'], request, {
staleTime: STALE_TIME,
});
const { tax, error } = await queryClient.fetchQuery(
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear],
request,
{
staleTime: STALE_TIME,
}
);
if (!error && tax) {
$calculation.element('tbxVehicleTaxInYear').setValue(tax);
@ -273,7 +250,7 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
return;
}
const currentDate = dayjs().utc(false).toISOString();
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
const {
data: { evo_region },
@ -289,32 +266,27 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
variables: { currentDate },
});
const options = evo_addproduct_types
?.filter(
(x) =>
x?.evo_leasingobject_types?.find(
(evo_leasingobject_type) =>
evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType
) &&
x.evo_whom_register === objectRegistration &&
Boolean(
leaseObjectCategory === 100_000_001
? x.evo_towtruck === true || x.evo_towtruck === false
: x.evo_towtruck === false
) &&
x.evo_gibdd_region === (objectRegionRegistrationId === regionRegistrationId) &&
Boolean(typePTS && x.evo_pts_type?.includes(typePTS)) &&
Boolean(
x.evo_accountid &&
evo_region?.accounts?.some(
(evo_region_account) => evo_region_account?.accountid === x.evo_accountid
)
)
)
.map((x) => ({
...x,
label: `${x?.label} (${x?.evo_graph_price} руб.)`,
}));
const options = evo_addproduct_types?.filter(
(x) =>
x?.evo_leasingobject_types?.find(
(evo_leasingobject_type) =>
evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType
) &&
x.evo_whom_register === objectRegistration &&
Boolean(
leaseObjectCategory === 100_000_001
? x.evo_towtruck === true || x.evo_towtruck === false
: x.evo_towtruck === false
) &&
x.evo_gibdd_region === (objectRegionRegistrationId === regionRegistrationId) &&
Boolean(typePTS && x.evo_pts_type?.includes(typePTS)) &&
Boolean(
x.evo_accountid &&
evo_region?.accounts?.some(
(evo_region_account) => evo_region_account?.accountid === x.evo_accountid
)
)
);
$calculation.element('selectRegistration').setOptions(normalizeOptions(options));
}
@ -504,89 +476,41 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
);
}
export function validation({ store, apolloClient }: ProcessContext) {
const { $calculation } = store;
const key = uid(7);
export function validation(context: ProcessContext) {
const { store } = context;
const { $calculation } = store;
const validationSchema = createValidationSchema(context);
const validationHelper = new ValidationHelper();
reaction(
() => $calculation.$values.getValues(['leaseObjectCategory', 'maxMass']),
({ leaseObjectCategory, maxMass }) => {
$calculation.element('tbxMaxMass').validate({
invalid: leaseObjectCategory === 100_000_001 && maxMass > 3500,
message: 'При категории ТС = В Разрешенная макс.масса не может быть больше 3500 кг',
});
$calculation.element('tbxMaxMass').validate({
invalid: leaseObjectCategory === 100_000_002 && maxMass <= 3500,
message: 'При категории ТС = С Разрешенная макс.масса не может быть меньше 3500 кг',
});
() =>
$calculation.$values.getValues([
'leaseObjectCategory',
'maxMass',
'leaseObjectType',
'typePTS',
'objectRegistration',
'objectCategoryTax',
'insNSIB',
'vehicleTaxInYear',
]),
async (values) => {
validationHelper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Elements[]).forEach((elementName) => {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) validationHelper.add(removeError);
});
});
}
},
{
delay: 100,
}
);
{
const validationHelper = new ValidationHelper();
reaction(
() =>
$calculation.$values.getValues([
'typePTS',
'objectRegistration',
'objectCategoryTax',
'leaseObjectType',
]),
async ({
leaseObjectType: leaseObjectTypeId,
typePTS,
objectRegistration,
objectCategoryTax,
}) => {
if (!leaseObjectTypeId) {
validationHelper.removeErrors();
return;
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: { leaseObjectTypeId },
});
$calculation.element('selectObjectCategoryTax').validate({
helper: validationHelper,
invalid:
objectRegistration === 100_000_001 &&
typePTS === 100_000_001 &&
objectCategoryTax === null &&
Boolean(evo_leasingobject_type?.evo_category_tr?.length),
message: 'Необходимо из ЭПТС указать Категорию в соответствии с ТР ТС 018/2011',
});
}
);
}
{
const validationHelper = new ValidationHelper();
reaction(
() => $calculation.$values.getValues(['leaseObjectType', 'insNSIB']),
async ({ insNSIB, leaseObjectType: leaseObjectTypeId }) => {
if (!leaseObjectTypeId) {
validationHelper.removeErrors();
return;
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: { leaseObjectTypeId },
});
$calculation.element('selectInsNSIB').validate({
helper: validationHelper,
invalid: evo_leasingobject_type?.evo_id === '11' && !insNSIB,
message: 'Страхование НСИБ обязательно для мотоциклистов',
});
}
);
}
}

View File

@ -0,0 +1,95 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ValidationContext } from '../types';
import ValuesSchema from '@/config/schema/values';
import { MAX_MASS } from '@/constants/values';
import * as CRMTypes from '@/graphql/crm.types';
import { z } from 'zod';
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({
insNSIB: true,
leaseObjectCategory: true,
leaseObjectType: true,
maxMass: true,
objectCategoryTax: true,
objectRegistration: true,
typePTS: true,
vehicleTaxInYear: true,
}).superRefine(
async (
{
leaseObjectCategory,
maxMass,
leaseObjectType: leaseObjectTypeId,
typePTS,
objectRegistration,
objectCategoryTax,
insNSIB,
vehicleTaxInYear,
},
ctx
) => {
if (leaseObjectCategory === 100_000_001 && maxMass > MAX_MASS) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `При категории ТС = В Разрешенная макс.масса не может быть больше ${MAX_MASS} кг`,
path: ['tbxMaxMass'],
});
}
if (leaseObjectCategory === 100_000_002 && maxMass <= MAX_MASS) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `При категории ТС = С Разрешенная макс.масса не может быть меньше ${MAX_MASS} кг`,
path: ['tbxMaxMass'],
});
}
if (leaseObjectTypeId) {
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: { leaseObjectTypeId },
});
if (
objectRegistration === 100_000_001 &&
typePTS === 100_000_001 &&
objectCategoryTax === null &&
Boolean(evo_leasingobject_type?.evo_category_tr?.length)
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['selectObjectCategoryTax'],
});
}
if (evo_leasingobject_type?.evo_id === '11' && !insNSIB) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Страхование НСИБ обязательно для мотоциклистов',
path: ['selectInsNSIB'],
});
}
}
if (objectRegistration === 100_000_001 && !(vehicleTaxInYear > 0)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Значение должно быть больше 0',
path: ['tbxVehicleTaxInYear'],
});
}
if (objectRegistration === 100_000_001 && !typePTS) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['radioTypePTS'],
});
}
}
);
}

View File

@ -0,0 +1,69 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { getUser } from '@/api/user/query';
import { STALE_TIME } from '@/constants/request';
import * as CRMTypes from '@/graphql/crm.types';
import { useStore } from '@/stores/hooks';
import { useApolloClient } from '@apollo/client';
import { useQuery } from '@tanstack/react-query';
import { useEffect } from 'react';
import { normalizeOptions } from 'tools';
/**
* @param {import('@apollo/client').ApolloClient} apolloClient
* @param {import('@/api/user/types').User } user
* @param {*} onCompleted
*/
export function getInitialData({ query }, user, onCompleted) {
query({ query: CRMTypes.GetLeadsDocument, variables: { domainname: user.domainName } }).then(
({ data }) => {
onCompleted({
selectLead: data?.leads,
});
}
);
query({
query: CRMTypes.GetOpportunitiesDocument,
variables: { domainname: user.domainName },
}).then(({ data }) => {
onCompleted({
selectOpportunity: data?.opportunities,
});
});
query({
query: CRMTypes.GetTransactionCurrenciesDocument,
}).then(({ data }) => {
onCompleted({
selectSupplierCurrency: data?.transactioncurrencies,
});
const transactioncurrency_rub = data?.transactioncurrencies?.find(
(x) => x?.isocurrencycode === 'RUB'
);
onCompleted(null, {
supplierCurrency: transactioncurrency_rub?.value,
});
});
}
export function useInitialData() {
const { $calculation } = useStore();
const apolloClient = useApolloClient();
const { data: user } = useQuery(['user'], getUser, { staleTime: STALE_TIME });
function handleOnCompleted(options, values) {
if (options)
Object.keys(options).forEach((elementName) => {
const elementOptions = options[elementName];
$calculation.element(elementName).setOptions(normalizeOptions(elementOptions));
});
if (values) $calculation.$values.hydrate(values);
}
useEffect(() => {
if (user) getInitialData(apolloClient, user, handleOnCompleted);
}, [user]);
}

View File

@ -1,44 +0,0 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { User } from '@/api/user/types';
import * as CRMTypes from '@/graphql/crm.types';
import type { ApolloClient } from '@apollo/client';
export async function getInitialData({ query }: ApolloClient<object>, user: User) {
const {
data: { leads },
} = await query({ query: CRMTypes.GetLeadsDocument, variables: { domainname: user.domainName } });
const {
data: { opportunities },
} = await query({
query: CRMTypes.GetOpportunitiesDocument,
variables: { domainname: user.domainName },
});
const {
data: { transactioncurrencies },
} = await query({
query: CRMTypes.GetTransactionCurrenciesDocument,
});
const transactioncurrency_rub = transactioncurrencies?.find((x) => x?.isocurrencycode === 'RUB');
if (transactioncurrency_rub?.transactioncurrencyid)
await query({
query: CRMTypes.GetTransactionCurrencyDocument,
variables: {
currencyid: transactioncurrency_rub?.transactioncurrencyid,
},
});
return {
options: {
selectLead: leads,
selectOpportunity: opportunities,
selectSupplierCurrency: transactioncurrencies,
},
values: {
supplierCurrency: transactioncurrency_rub?.transactioncurrencyid ?? null,
},
};
}

View File

@ -1,56 +1,32 @@
/* eslint-disable canonical/sort-keys */
import * as CRMTypes from '@/graphql/crm.types';
import { useStore } from '@/stores/hooks';
import { gql, useApolloClient } from '@apollo/client';
import { useApolloClient } from '@apollo/client';
import { useEffect } from 'react';
const QUERY_GET_INSURANCE_DATA = gql`
query GetInsuranceData($evo_account_type: [Int!]) {
osago: accounts(
evo_account_type: $evo_account_type
evo_type_ins_policy: [100000001]
statecode: 0
) {
value: accountid
label: name
}
kasko: accounts(
evo_account_type: $evo_account_type
evo_type_ins_policy: [100000000]
statecode: 0
) {
value: accountid
label: name
}
fingap: accounts(
evo_account_type: $evo_account_type
evo_type_ins_policy: [100000002]
statecode: 0
) {
value: accountid
label: name
}
}
`;
/**
*
* @param {import('@apollo/client').ApolloClient} apolloClient
* @param {*} onCompleted
*/
function getInsuranceData({ query }, onCompleted) {
query({
query: QUERY_GET_INSURANCE_DATA,
query: CRMTypes.GetInsuranceCompaniesDocument,
}).then(({ data }) => {
const insurance = {
osago: {
insuranceCompany: data.osago,
insuranceCompany: data.accounts.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_001)
),
},
kasko: {
insuranceCompany: data.kasko,
insuranceCompany: data.accounts.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_000)
),
},
fingap: {
insuranceCompany: data.fingap,
insuranceCompany: data.accounts.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_002)
),
},
};

View File

@ -9,7 +9,7 @@ import { normalizeOptions } from 'tools';
dayjs.extend(utc);
const currentDate = dayjs().utc(false).toISOString();
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
/**
*
@ -98,55 +98,33 @@ function getMainData({ query }, onCompleted) {
});
query({
query: CRMTypes.GetAddproductTypesDocument,
query: CRMTypes.GetTelematicTypesDocument,
variables: {
currentDate,
},
}).then(({ data }) => {
// const selectRegistration = data.evo_addproduct_types
// ?.filter((x) => x?.evo_product_type === 100_000_001)
// .map((x) => ({
// ...x,
// label: `${x?.label} (${x?.evo_graph_price} руб.)`,
// }));
onCompleted({ selectTelematic: data?.evo_addproduct_types });
});
const selectTechnicalCard = data.evo_addproduct_types
?.filter((x) => x?.evo_product_type === 100_000_000)
.map((x) => ({
...x,
label: `${x?.label} (${x?.evo_graph_price} руб.)`,
}));
query({
query: CRMTypes.GetTrackerTypesDocument,
variables: {
currentDate,
},
}).then(({ data }) => {
onCompleted({ selectTracker: data?.evo_addproduct_types });
});
const selectTelematic = data.evo_addproduct_types
?.filter((x) => x?.evo_product_type === 100_000_004)
.map((x) => ({
...x,
label: `${x?.label} (${x?.evo_graph_price} руб.)`,
}));
const selectTracker = data.evo_addproduct_types
?.filter((x) => x?.evo_product_type === 100_000_003)
.map((x) => ({
...x,
label: `${x?.label} (${x?.evo_graph_price} руб.)`,
}));
const selectInsNSIB = data.evo_addproduct_types?.filter(
(x) => x?.evo_product_type === 100_000_002
);
const selectLeasingWithoutKasko = data.evo_addproduct_types?.filter(
(x) => x?.evo_product_type === 100_000_007
);
onCompleted({
// selectRegistration,
selectTechnicalCard,
selectTelematic,
selectTracker,
selectInsNSIB,
selectLeasingWithoutKasko,
});
query({
query: CRMTypes.GetInsNsibTypesDocument,
variables: {
currentDate,
},
context: {
disableModify: true,
},
}).then(({ data }) => {
onCompleted({ selectInsNSIB: data?.evo_addproduct_types });
});
query({

View File

@ -1 +1,2 @@
export * from './get-kp-data';
export * as reactions from './reactions';

View File

@ -0,0 +1,319 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ProcessContext } from '../types';
import { createValidationSchema } from './validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import { selectLeaseObjectUseFor } from '@/config/default-options';
import * as CRMTypes from '@/graphql/crm.types';
import ValidationHelper from '@/stores/validation/helper';
import { comparer, reaction, toJS } from 'mobx';
import { uid } from 'radash';
import { normalizeOptions } from 'tools';
export function common({ store, apolloClient }: ProcessContext) {
const { $calculation, $tables } = store;
reaction(
() => $calculation.element('selectGPSBrand').getValue(),
async (gpsBrandId) => {
if (!gpsBrandId) {
$calculation.element('selectGPSModel').resetValue();
return;
}
const {
data: { evo_gps_models },
} = await apolloClient.query({
query: CRMTypes.GetGpsModelsDocument,
variables: {
gpsBrandId,
},
});
if (evo_gps_models) {
$calculation.element('selectGPSModel').setOptions(normalizeOptions(evo_gps_models));
}
}
);
reaction(
() => $calculation.element('selectLeaseObjectCategory').getValue(),
(leaseObjectCategory) => {
switch (leaseObjectCategory) {
case 100_000_000: {
$calculation
.element('selectLeaseObjectUseFor')
.setOptions(
selectLeaseObjectUseFor.filter((x) => [100_000_000, 100_000_002].includes(x.value))
);
break;
}
case 100_000_001: {
$calculation
.element('selectLeaseObjectUseFor')
.setOptions(
selectLeaseObjectUseFor.filter((x) =>
[
100_000_000, 100_000_001, 100_000_002, 100_000_003, 100_000_004, 100_000_005,
100_000_006, 100_000_007, 100_000_008, 100_000_009, 100_000_010, 100_000_011,
100_000_012, 100_000_013,
].includes(x.value)
)
);
break;
}
case 100_000_002: {
$calculation
.element('selectLeaseObjectUseFor')
.setOptions(
selectLeaseObjectUseFor.filter((x) =>
[
100_000_002, 100_000_004, 100_000_005, 100_000_006, 100_000_009, 100_000_010,
].includes(x.value)
)
);
break;
}
case 100_000_003: {
$calculation
.element('selectLeaseObjectUseFor')
.setOptions(
selectLeaseObjectUseFor.filter((x) =>
[
100_000_002, 100_000_004, 100_000_006, 100_000_007, 100_000_008, 100_000_011,
100_000_012, 100_000_013,
].includes(x.value)
)
);
break;
}
case 100_000_004: {
$calculation
.element('selectLeaseObjectUseFor')
.setOptions(
selectLeaseObjectUseFor.filter((x) => [100_000_002, 100_000_009].includes(x.value))
);
break;
}
default: {
$calculation
.element('selectLeaseObjectUseFor')
.setOptions(
selectLeaseObjectUseFor.filter((x) =>
[
100_000_014, 100_000_015, 100_000_016, 100_000_017, 100_000_018, 100_000_019,
].includes(x.value)
)
);
break;
}
}
},
{
fireImmediately: true,
}
);
reaction(
() => $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']),
async ({ leasingPeriod, leasingWithoutKasko }) => {
const {
data: { accounts },
} = await apolloClient.query({
query: CRMTypes.GetInsuranceCompaniesDocument,
});
if (leasingWithoutKasko) {
const otherInsuranceCompany = accounts?.find(
(x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ')
);
if (otherInsuranceCompany) {
$tables.insurance
.row('kasko')
.column('insuranceCompany')
.setOptions(normalizeOptions([otherInsuranceCompany]))
.setValue(otherInsuranceCompany.value)
.block();
$tables.insurance.row('kasko').column('insCost').resetValue().block();
$tables.insurance.row('kasko').column('insTerm').setValue(100_000_000).block();
$tables.insurance.row('kasko').column('insured').setValue(100_000_000).block();
}
} else {
const defaultKaskoOptions = accounts?.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_000)
);
$tables.insurance
.row('kasko')
.setOptions('insuranceCompany', normalizeOptions(defaultKaskoOptions))
.unblock('insCost');
if (leasingPeriod < 12) {
$tables.insurance.row('osago').column('insured').setValue(100_000_000).block();
$tables.insurance.row('kasko').column('insured').setValue(100_000_000).block();
$tables.insurance.row('kasko').column('insTerm').setValue(100_000_000).block();
} else if (leasingPeriod === 12 || leasingPeriod > 16) {
$tables.insurance.row('osago').column('insured').unblock();
$tables.insurance.row('kasko').column('insTerm').setValue(100_000_000).block();
$tables.insurance.row('kasko').column('insured').unblock();
} else if (leasingPeriod > 12 && leasingPeriod < 16) {
$tables.insurance.row('osago').column('insured').unblock();
$tables.insurance.row('kasko').column('insTerm').setValue(100_000_001).block();
$tables.insurance.row('kasko').column('insured').unblock();
} else {
$tables.insurance.row('osago').column('insured').unblock();
$tables.insurance.row('kasko').column('insTerm').block();
$tables.insurance.row('kasko').column('insured').unblock();
}
}
},
{
fireImmediately: true,
}
);
reaction(
() => $calculation.$values.getValues(['leaseObjectCategory', 'leasingWithoutKasko']),
async ({ leaseObjectCategory, leasingWithoutKasko }) => {
const {
data: { accounts },
} = await apolloClient.query({
query: CRMTypes.GetInsuranceCompaniesDocument,
});
const isTrailer = leaseObjectCategory === 100_000_004;
if (isTrailer) {
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('insCost').resetValue().block();
}
} else {
$tables.insurance.row('osago').column('insCost').unblock();
$tables.insurance.row('osago').column('insuranceCompany').unblock();
const defaultOsagoOptions = accounts?.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_001)
);
if (leasingWithoutKasko) {
const evoKaskoInsuranceOptions = defaultOsagoOptions?.filter(
(x) => x?.evo_evokasko_access === true
);
$tables.insurance
.row('osago')
.column('insuranceCompany')
.setOptions(normalizeOptions(evoKaskoInsuranceOptions));
} else {
$tables.insurance
.row('osago')
.column('insuranceCompany')
.setOptions(normalizeOptions(defaultOsagoOptions));
}
}
}
);
reaction(
() => $calculation.element('selectBrand').getValue(),
async (brandId) => {
if (!brandId) {
$tables.insurance.row('kasko').column('insuranceCompany').resetValue().unblock();
return;
}
const {
data: { accounts },
} = await apolloClient.query({
query: CRMTypes.GetInsuranceCompaniesDocument,
});
const defaultKaskoOptions = accounts?.filter((x) =>
x?.evo_type_ins_policy?.includes(100_000_000)
);
const {
data: { evo_brand },
} = await apolloClient.query({
query: CRMTypes.GetBrandDocument,
variables: { brandId },
});
if (evo_brand?.evo_id === 'BRAND49') {
const renessansCompany = defaultKaskoOptions?.find((x) => x?.evo_inn === '7725497022');
if (renessansCompany)
$tables.insurance
.row('kasko')
.column('insuranceCompany')
.setValue(renessansCompany?.value)
.block();
} else {
$tables.insurance.row('kasko').column('insuranceCompany').resetValue().unblock();
}
}
);
}
const key = uid(7);
export function validation(context: ProcessContext) {
const { $calculation, $tables } = context.store;
const validationSchema = createValidationSchema(context);
const helper = new ValidationHelper();
reaction(
() => {
const values = $calculation.$values.getValues([
'leasingPeriod',
'quote',
'recalcWithRevision',
'leasingWithoutKasko',
'insDecentral',
]);
return {
insurance: {
fingap: toJS($tables.insurance.row('fingap').getValues()),
kasko: toJS($tables.insurance.row('kasko').getValues()),
osago: toJS($tables.insurance.row('osago').getValues()),
},
...values,
};
},
async (values) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Array<Elements & 'insurance'>).forEach((elementName) => {
if (elementName === 'insurance') {
const removeError = $tables.insurance.setError({ key, message });
if (removeError) helper.add(removeError);
} else {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
}
});
});
}
},
{
delay: 100,
equals: comparer.structural,
}
);
}

View File

@ -0,0 +1,120 @@
/* eslint-disable zod/require-strict */
import type { ValidationContext } from '../types';
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
import { RowSchema } from '@/config/schema/insurance';
import ValuesSchema from '@/config/schema/values';
import * as CRMTypes from '@/graphql/crm.types';
import { z } from 'zod';
const InsuranceSchema = z.object({
insurance: z.object({
fingap: RowSchema,
kasko: RowSchema,
osago: RowSchema,
}),
});
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({
insDecentral: true,
leasingPeriod: true,
leasingWithoutKasko: true,
quote: true,
recalcWithRevision: true,
})
.merge(InsuranceSchema)
.superRefine(
async (
{
leasingPeriod,
recalcWithRevision,
quote: quoteId,
leasingWithoutKasko,
insDecentral,
insurance,
},
ctx
) => {
if (quoteId) {
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: { quoteId },
});
if (
recalcWithRevision &&
quote?.evo_one_year_insurance === true &&
leasingPeriod > 15 &&
insurance.kasko.insTerm === 100_000_001
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Срок страхования КАСКО должен быть 12 месяцев, т.к. оформляется Однолетний полис',
path: ['insurance'],
});
}
}
(['osago', 'kasko'] as Insurance.Keys[]).forEach((key) => {
const { insCost, insured, policyType, insuranceCompany, insTerm } = insurance[key];
if (insured === 100_000_001 && insCost < 1000) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Укажите стоимость ${policyType}, включаемую в график (>1000)`,
path: ['insurance'],
});
}
if (insCost > 0 && !insuranceCompany) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Укажите страховую компанию ${policyType}`,
path: ['insurance'],
});
}
if (insCost > 0 && !insTerm) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Укажите срок страхования ${policyType}`,
path: ['insurance'],
});
}
if (insCost > 0 && !insured) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Укажите плательщика ${policyType}`,
path: ['insurance'],
});
}
});
if (
!leasingWithoutKasko &&
!insDecentral &&
insurance.osago.insuranceCompany &&
insurance.kasko.insuranceCompany !== insurance.osago.insuranceCompany
) {
const {
data: { account },
} = await apolloClient.query({
query: CRMTypes.GetInsuranceCompanyDocument,
variables: { accountId: insurance.osago.insuranceCompany },
});
if (account?.evo_osago_with_kasko) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Невозможно страхование ОСАГО отдельно от КАСКО - страховая компания должна быть одна!',
path: ['insurance'],
});
}
}
}
);
}

View File

@ -110,28 +110,4 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
}
}
);
reaction(
() => $calculation.element('selectLead').getValue(),
async (leadid) => {
if (!leadid) {
$calculation.element('tbxINNForCalc').resetValue();
return;
}
const {
data: { lead },
} = await apolloClient.query({
query: CRMTypes.GetLeadDocument,
variables: { leadid },
});
if (lead?.evo_inn) {
$calculation.element('tbxINNForCalc').setValue(Number.parseInt(lead?.evo_inn, 10));
} else {
$calculation.element('tbxINNForCalc').resetValue();
}
}
);
}

View File

@ -405,4 +405,42 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
}
}
);
reaction(
() =>
$calculation.$values.getValues([
'leaseObjectType',
'engineVolume',
'engineType',
'leaseObjectMotorPower',
]),
async ({ leaseObjectType: leaseObjectTypeId }) => {
if (!leaseObjectTypeId) {
$calculation.element('selectEngineType').unblock();
$calculation.element('tbxEngineVolume').unblock();
$calculation.element('tbxLeaseObjectMotorPower').unblock();
return;
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
if (evo_leasingobject_type?.evo_id === '8') {
$calculation.element('selectEngineType').resetValue().block();
$calculation.element('tbxEngineVolume').resetValue().block();
$calculation.element('tbxLeaseObjectMotorPower').resetValue().block();
} else {
$calculation.element('selectEngineType').unblock();
$calculation.element('tbxEngineVolume').unblock();
$calculation.element('tbxLeaseObjectMotorPower').unblock();
}
}
);
}

View File

@ -1,11 +1,15 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as CRMTypes from '@/graphql/crm.types';
import { createValidationSchema } from '../validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { autorun, reaction } from 'mobx';
import { uid } from 'radash';
export default function reactions({ store, apolloClient }: ProcessContext) {
const { $calculation } = store;
const key = uid(7);
export default function reactions(context: ProcessContext) {
const { $calculation } = context.store;
/**
* Если model содержит данные и по связи Модель-Комплектация в CRM у данной модели есть связанные активные записи Комплектаций,
@ -14,16 +18,23 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
autorun(
() => {
const selectConfiguration = $calculation.element('selectConfiguration');
selectConfiguration.validate({
invalid: selectConfiguration.getOptions()?.length > 0 && !selectConfiguration.getValue(),
message: 'Не заполнено поле',
});
if (selectConfiguration.getOptions()?.length > 0 && !selectConfiguration.getValue()) {
selectConfiguration.setError({
key,
message: 'Не заполнено поле',
});
} else {
selectConfiguration.removeError({ key });
}
},
{
delay: 10,
}
);
const validationSchema = createValidationSchema(context);
const helper = new ValidationHelper();
reaction(
() =>
$calculation.$values.getValues([
@ -31,134 +42,25 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
'engineVolume',
'engineType',
'leaseObjectMotorPower',
'countSeats',
'maxMass',
'leaseObjectCategory',
]),
async ({
engineType,
engineVolume,
leaseObjectType: leaseObjectTypeId,
leaseObjectMotorPower,
}) => {
if (!leaseObjectTypeId) {
$calculation.element('selectEngineType').unblock();
$calculation.element('tbxEngineVolume').unblock();
$calculation.element('tbxLeaseObjectMotorPower').unblock();
async (values) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
return;
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Elements[]).forEach((elementName) => {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
});
});
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
if (evo_leasingobject_type?.evo_id === '8') {
$calculation.element('selectEngineType').resetValue().block();
$calculation.element('tbxEngineVolume').resetValue().block();
$calculation.element('tbxLeaseObjectMotorPower').resetValue().block();
} else {
$calculation.element('selectEngineType').unblock();
$calculation.element('tbxEngineVolume').unblock();
$calculation.element('tbxLeaseObjectMotorPower').unblock();
}
const isNotTrailer =
evo_leasingobject_type?.evo_id !== null && evo_leasingobject_type?.evo_id !== '8';
$calculation.element('tbxEngineVolume').validate({
invalid: isNotTrailer && engineVolume <= 0,
message: 'Не заполнено поле',
});
$calculation.element('selectEngineType').validate({
invalid: isNotTrailer && !engineType,
message: 'Не заполнено поле',
});
$calculation.element('tbxLeaseObjectMotorPower').validate({
invalid: isNotTrailer && leaseObjectMotorPower <= 0,
message: 'Не заполнено поле',
});
},
{
delay: 100,
}
);
{
const validationHelper = new ValidationHelper();
reaction(
() => $calculation.$values.getValues(['leaseObjectType', 'countSeats', 'maxMass']),
async ({ countSeats, leaseObjectType: leaseObjectTypeId, maxMass }) => {
if (!leaseObjectTypeId) {
validationHelper.removeErrors();
return;
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
$calculation.element('tbxCountSeats').validate({
helper: validationHelper,
invalid: evo_leasingobject_type?.evo_id === '1' && countSeats >= 9,
message: 'Количество мест должно быть меньше 9',
});
$calculation.element('tbxCountSeats').validate({
helper: validationHelper,
invalid:
(evo_leasingobject_type?.evo_id === '4' || evo_leasingobject_type?.evo_id === '5') &&
countSeats <= 8,
message: 'Количество мест должно быть больше 8',
});
$calculation.element('tbxMaxMass').validate({
helper: validationHelper,
invalid: evo_leasingobject_type?.evo_id === '2' && maxMass <= 0,
message: 'Не заполнено поле',
});
}
);
}
{
const validationHelper = new ValidationHelper();
reaction(
() => $calculation.$values.getValues(['leaseObjectType', 'leaseObjectCategory']),
async ({ leaseObjectCategory, leaseObjectType: leaseObjectTypeId }) => {
if (!leaseObjectTypeId) {
validationHelper.removeErrors();
return;
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
$calculation.element('selectLeaseObjectCategory').validate({
helper: validationHelper,
invalid:
!leaseObjectCategory &&
Boolean(
evo_leasingobject_type?.evo_id &&
!['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)
),
message: 'Не заполнено поле',
});
}
);
}
}

View File

@ -0,0 +1,109 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ValidationContext } from '../types';
import ValuesSchema from '@/config/schema/values';
import * as CRMTypes from '@/graphql/crm.types';
import { z } from 'zod';
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({
countSeats: true,
engineType: true,
engineVolume: true,
leaseObjectCategory: true,
leaseObjectMotorPower: true,
leaseObjectType: true,
maxMass: true,
}).superRefine(
async (
{
leaseObjectType: leaseObjectTypeId,
engineVolume,
engineType,
leaseObjectMotorPower,
countSeats,
maxMass,
leaseObjectCategory,
},
ctx
) => {
if (leaseObjectTypeId) {
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
const isNotTrailer =
evo_leasingobject_type?.evo_id !== null && evo_leasingobject_type?.evo_id !== '8';
if (isNotTrailer && engineVolume <= 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['tbxEngineVolume'],
});
}
if (isNotTrailer && !engineType) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['selectEngineType'],
});
}
if (isNotTrailer && leaseObjectMotorPower <= 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['tbxLeaseObjectMotorPower'],
});
}
if (evo_leasingobject_type?.evo_id === '1' && countSeats >= 9) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Количество мест должно быть меньше 9',
path: ['tbxCountSeats'],
});
}
if (
(evo_leasingobject_type?.evo_id === '4' || evo_leasingobject_type?.evo_id === '5') &&
countSeats <= 8
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Количество мест должно быть больше 8',
path: ['tbxCountSeats'],
});
}
if (evo_leasingobject_type?.evo_id === '2' && maxMass <= 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['tbxMaxMass'],
});
}
if (
!leaseObjectCategory &&
Boolean(
evo_leasingobject_type?.evo_id &&
!['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)
)
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['selectLeaseObjectCategory'],
});
}
}
}
);
}

View File

@ -1,8 +1,7 @@
/* eslint-disable canonical/sort-keys */
/* eslint-disable @typescript-eslint/naming-convention */
import type * as CRMTypes from '@/graphql/crm.types';
import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import { gql } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { reaction } from 'mobx';
@ -14,34 +13,6 @@ dayjs.extend(utc);
const NOTIFICATION_KEY = uid(7);
const QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS = gql`
query GetLeasingWithoutKaskoOptions($currentDate: DateTime) {
evo_addproduct_types(
statecode: 0
evo_product_type: 100000007
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_addproduct_typeid
evo_product_type
evo_min_period
evo_max_period
evo_min_price
evo_max_price
evo_leasingobject_types {
evo_leasingobject_typeid
}
evo_visible_calc
evo_min_first_payment_perc
evo_max_first_payment_perc
evo_models {
evo_modelid
}
}
}
`;
export function common({ store, apolloClient }: ProcessContext) {
const { $calculation, $tables } = store;
@ -95,18 +66,18 @@ export function common({ store, apolloClient }: ProcessContext) {
firstPaymentPerc,
model: modelId,
}) => {
const currentDate = dayjs().utc(false).toISOString();
const currentDate = dayjs().utc(false).format('YYYY-MM-DD');
const {
data: { evo_addproduct_types },
} = await apolloClient.query<
CRMTypes.GetLeasingWithoutKaskoOptionsQuery,
CRMTypes.GetLeasingWithoutKaskoOptionsQueryVariables
>({
query: QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS,
} = await apolloClient.query({
query: CRMTypes.GetLeasingWithoutKaskoTypesDocument,
variables: {
currentDate,
},
context: {
disableModify: true,
},
});
const price = plPriceRub - discountRub - importProgramSum + addEquipmentPrice;

View File

@ -1,138 +0,0 @@
import { SEASONS_PERIOD_NUMBER, SEASONS_PERIODS } from './seasons-constants';
import { MIN_PAYMENT } from '@/constants/values';
import type RootStore from '@/stores/root';
import { counting, max, min, shift, sort } from 'radash';
import { areEqual, isSorted } from 'tools/array';
// eslint-disable-next-line sonarjs/cognitive-complexity
export default function validatePaymentsTable({ $calculation, $tables }: RootStore) {
/**
* в таблице платежей в столбце Соотношение платежей
* для строк с 2 до "Срок лизинга-1" минимальное значение должно быть равно 3
*/
{
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const targetPayments = $tables.payments.values.slice(1, leasingPeriod - 1);
if (!targetPayments.every((payment) => payment >= MIN_PAYMENT)) {
return `Минимальное значение платежа должно быть равно ${MIN_PAYMENT}`;
}
}
switch ($calculation.element('radioGraphType').getValue()) {
// Дегрессия
case 100_000_001: {
if (!$calculation.element('selectSeasonType').getValue()) {
return 'Не выбран тип дегрессии';
}
/**
* при Дегрессии все значения не должны быть равны друг другу
* + что при Легком старте 2,3 и 4 платежи не должны быть равны 100
*/
{
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const targetPayments = $tables.payments.values.slice(1, leasingPeriod - 1);
if (new Set(targetPayments).size === 1) {
return 'Платежи не должны быть равны друг другу';
}
}
/**
* Проверка на возрастание
*/
{
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const targetPayments = $tables.payments.values.slice(1, leasingPeriod - 1);
for (let i = 2; i < targetPayments.length - 1; i += 1) {
if (targetPayments[i] > targetPayments[i - 1]) {
return 'Платежи должны убывать';
}
}
}
/**
* Если вид графика = Дегрессия И значения в "Соотношении платежей" у 2, 3 и 4 платежа отличаются друг от друга не более чем на 10
* (т.е. берем значения в этих полях, определяем максимальное и минимальное значение и смотрим на их разницу)
* то не осуществлять Расчет графика и выводить ошибку "Нельзя осуществить расчет - указана очень жетская дегрессия.
* На 2-4 платежах Соотношение платежа должен отличаться не более чем на 10%",
* иначе осуществлять расчет
*/
{
const targetPayments = $tables.payments.values.slice(1, 4);
if ((max(targetPayments) || 0) - (min(targetPayments) || 0) > 10) {
return 'Указана очень жесткая дегрессия. На 2-4 платежах Соотношение платежа должен отличаться не более чем на 10%';
}
}
/**
* Если вид графика = Дегрессия И значения в "Соотношении платежей" для строк с 2 До "Срок лизинга-1" как минимум 2 раза по 2 платежа должны между собой быть равны
* (т.е. берем значения "Соотношения платежей" для строк с 2 до "Срок лизинга-1" и делаем сводную таблицу - если кол-во одинаковых значение больше 2 встречаются 2 и более раза),
* то осуществлять расчет,
* иначе не осуществлять Расчет графика и выводить ошибку "Нельзя осуществить расчет - указана очень жетская дегрессия. Не менее чем у 4х платежей "Соотношение платежа" должно не отличаться между самой",
*/
{
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const targetPayments = $tables.payments.values.slice(1, leasingPeriod - 1);
const counts = counting(targetPayments, (v) => v);
if (Object.values(counts).filter((count) => count > 1).length < 2) {
return 'Указана очень жесткая дегрессия. Не менее чем у 4х платежей соотношение должно не отличаться между собой';
}
}
break;
}
case 100_000_003: {
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
if (leasingPeriod < 14) {
return 'При сезонном виде графика срок лизинга должен быть больше 14 месяцев';
}
const seasonType = $calculation.element('selectSeasonType').getValue();
if (!seasonType) {
return 'Не выбран тип сезонности';
}
const highSeasonStartOption = $calculation.element('selectHighSeasonStart').getOption();
if (!highSeasonStartOption) {
return 'Не выбрано смещение сезонности';
}
{
const seasons = $tables.payments.values.slice(1, SEASONS_PERIOD_NUMBER + 1);
const shiftNumber = Number.parseInt(highSeasonStartOption.label, 10) - 2;
const unshiftedSeasons = shift(seasons, -shiftNumber);
const positions = SEASONS_PERIODS[seasonType];
const seasonsValues = positions.map((position) => unshiftedSeasons[position]);
if (isSorted(seasonsValues)) {
return 'Сезонные платежи должны убывать';
}
}
break;
}
// Легкий старт
case 100_000_004: {
const targetPayments = $tables.payments.values.slice(1, 4);
const sortedPayments = sort(targetPayments, (x) => x);
const areEqualPayments = new Set(targetPayments).size === 1;
if (!areEqual(targetPayments, sortedPayments) || areEqualPayments) {
return '2, 3, 4 платежи должны возрастать';
}
break;
}
default: {
return null;
}
}
return null;
}

View File

@ -1,64 +1,56 @@
import validatePaymentsTable from '../lib/validation';
import { MIN_LASTPAYMENT_NSIB } from '@/constants/values';
import { createValidationSchema } from '../validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { comparer, reaction, toJS } from 'mobx';
import { uid } from 'radash';
export default function reactions({ store }: ProcessContext) {
const { $calculation, $tables } = store;
const key = uid(7);
const validationHelper = new ValidationHelper();
export default function reactions(context: ProcessContext) {
const { $calculation, $tables } = context.store;
const validationSchema = createValidationSchema();
const helper = new ValidationHelper();
reaction(
() => {
const payments = toJS($tables.payments.values);
const graphType = $calculation.element('radioGraphType').getValue();
const seasonType = $calculation.element('selectSeasonType').getValue();
const highSeasonStart = $calculation.element('selectHighSeasonStart').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const values = $calculation.$values.getValues([
'graphType',
'highSeasonStart',
'leasingPeriod',
'seasonType',
'insNSIB',
'lastPaymentRub',
]);
return {
graphType,
highSeasonStart,
leasingPeriod,
payments,
seasonType,
payments: { values: payments },
...values,
};
},
() => {
validationHelper.removeErrors();
async (values) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
const errorText = validatePaymentsTable(store);
if (errorText) {
$tables.payments.validate({
helper: validationHelper,
invalid: errorText !== null,
message: errorText,
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Array<Elements & 'payments'>).forEach((elementName) => {
if (elementName === 'payments') {
const removeError = $tables.payments.setError({ key, message });
if (removeError) helper.add(removeError);
} else {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
}
});
});
}
},
{
delay: 50,
delay: 100,
equals: comparer.structural,
}
);
reaction(
() => {
const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue();
const insNSIB = $calculation.element('selectInsNSIB').getValue();
return {
insNSIB,
lastPaymentRub,
};
},
({ lastPaymentRub, insNSIB }) => {
$calculation.element('tbxLastPaymentRub').validate({
invalid: Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB,
message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`,
});
}
);
}

View File

@ -0,0 +1,215 @@
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable complexity */
import { SEASONS_PERIOD_NUMBER, SEASONS_PERIODS } from './lib/seasons-constants';
import { selectHighSeasonStart } from '@/config/default-options';
import PaymentsSchema from '@/config/schema/payments';
import ValuesSchema from '@/config/schema/values';
import { MIN_LASTPAYMENT_NSIB, MIN_PAYMENT } from '@/constants/values';
import { counting, max, min, shift, sort } from 'radash';
import { areEqual, isSorted } from 'tools/array';
import { z } from 'zod';
export function createValidationSchema() {
return ValuesSchema.pick({
graphType: true,
highSeasonStart: true,
insNSIB: true,
lastPaymentRub: true,
leasingPeriod: true,
seasonType: true,
})
.extend({
payments: PaymentsSchema,
})
.superRefine(
async (
{
graphType,
highSeasonStart,
leasingPeriod,
payments,
seasonType,
insNSIB,
lastPaymentRub,
},
ctx
) => {
if (Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Последний платеж не может быть меньше ${MIN_LASTPAYMENT_NSIB} руб. при наличии НСИБ, укажите большее значение`,
path: ['tbxLastPaymentRub'],
});
}
{
const targetPayments = payments.values.slice(1, leasingPeriod - 1);
if (!targetPayments.every((payment) => payment >= MIN_PAYMENT)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Минимальное значение платежа должно быть равно ${MIN_PAYMENT}`,
path: ['payments'],
});
}
}
switch (graphType) {
// Дегрессия
case 100_000_001: {
if (!seasonType) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не выбран тип дегрессии',
path: ['payments', 'selectSeasonType'],
});
break;
}
/**
* при Дегрессии все значения не должны быть равны друг другу
* + что при Легком старте 2,3 и 4 платежи не должны быть равны 100
*/
{
const targetPayments = payments.values.slice(1, leasingPeriod - 1);
if (new Set(targetPayments).size === 1) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Платежи не должны быть равны друг другу',
path: ['payments'],
});
}
}
/**
* Проверка на возрастание
*/
{
const targetPayments = payments.values.slice(1, leasingPeriod - 1);
for (let i = 2; i < targetPayments.length - 1; i += 1) {
if (targetPayments[i] > targetPayments[i - 1]) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Платежи должны убывать',
path: ['payments'],
});
}
}
}
/**
* Если вид графика = Дегрессия И значения в "Соотношении платежей" у 2, 3 и 4 платежа отличаются друг от друга не более чем на 10
* (т.е. берем значения в этих полях, определяем максимальное и минимальное значение и смотрим на их разницу)
* то не осуществлять Расчет графика и выводить ошибку "Нельзя осуществить расчет - указана очень жетская дегрессия.
* На 2-4 платежах Соотношение платежа должен отличаться не более чем на 10%",
* иначе осуществлять расчет
*/
{
const targetPayments = payments.values.slice(1, 4);
if ((max(targetPayments) || 0) - (min(targetPayments) || 0) > 10) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указана очень жесткая дегрессия. На 2-4 платежах Соотношение платежа должен отличаться не более чем на 10%',
path: ['payments'],
});
}
}
/**
* Если вид графика = Дегрессия И значения в "Соотношении платежей" для строк с 2 До "Срок лизинга-1" как минимум 2 раза по 2 платежа должны между собой быть равны
* (т.е. берем значения "Соотношения платежей" для строк с 2 до "Срок лизинга-1" и делаем сводную таблицу - если кол-во одинаковых значение больше 2 встречаются 2 и более раза),
* то осуществлять расчет,
* иначе не осуществлять Расчет графика и выводить ошибку "Нельзя осуществить расчет - указана очень жетская дегрессия. Не менее чем у 4х платежей "Соотношение платежа" должно не отличаться между самой",
*/
{
const targetPayments = payments.values.slice(1, leasingPeriod - 1);
const counts = counting(targetPayments, (v) => v);
if (Object.values(counts).filter((count) => count > 1).length < 2) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Указана очень жесткая дегрессия. Не менее чем у 4х платежей соотношение должно не отличаться между собой',
path: ['payments'],
});
}
}
break;
}
case 100_000_003: {
if (leasingPeriod < 14) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'При сезонном виде графика срок лизинга должен быть больше 14 месяцев',
path: ['payments', 'tbxLeasingPeriod'],
});
}
if (!seasonType) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не выбран тип сезонности',
path: ['payments', 'selectSeasonType'],
});
break;
}
if (!highSeasonStart) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не выбрано смещение сезонности',
path: ['payments', 'selectHighSeasonStart'],
});
break;
}
const seasons = payments.values.slice(1, SEASONS_PERIOD_NUMBER + 1);
const highSeasonStartOption = selectHighSeasonStart.find(
(x) => x.value === highSeasonStart
);
if (highSeasonStartOption) {
const shiftNumber = Number.parseInt(highSeasonStartOption.label, 10) - 2;
const unshiftedSeasons = shift(seasons, -shiftNumber);
const positions = SEASONS_PERIODS[seasonType];
const seasonsValues = positions.map((position) => unshiftedSeasons[position]);
if (isSorted(seasonsValues)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Сезонные платежи должны убывать',
path: ['payments'],
});
}
}
break;
}
// Легкий старт
case 100_000_004: {
const targetPayments = payments.values.slice(1, 4);
const sortedPayments = sort(targetPayments, (x) => x);
const areEqualPayments = new Set(targetPayments).size === 1;
if (!areEqual(targetPayments, sortedPayments) || areEqualPayments) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: '2, 3, 4 платежи должны возрастать',
path: ['payments'],
});
}
break;
}
default: {
break;
}
}
}
);
}

View File

@ -1,74 +1,45 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { VAT } from '@/constants/values';
import * as CRMTypes from '@/graphql/crm.types';
import { createValidationSchema } from '../validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { reaction } from 'mobx';
import { round } from 'tools';
import { uid } from 'radash';
export default function reactions({ store, apolloClient }: ProcessContext) {
const key = uid(7);
export default function reactions(context: ProcessContext) {
const { store } = context;
const { $calculation } = store;
const validationSchema = createValidationSchema(context);
const helper = new ValidationHelper();
reaction(
() =>
$calculation.$values.getValues([
'VATInLeaseObjectPrice',
'leaseObjectPriceWthtVAT',
'product',
'supplierDiscountRub',
'plPriceRub',
'firstPaymentRub',
'subsidySum',
]),
async ({ VATInLeaseObjectPrice, leaseObjectPriceWthtVAT, product: productId }) => {
let evo_sale_without_nds = false;
async (values) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
if (productId) {
const {
data: { evo_baseproduct },
} = await apolloClient.query({
query: CRMTypes.GetProductDocument,
variables: {
productId,
},
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Elements[]).forEach((elementName) => {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
});
});
if (evo_baseproduct?.evo_sale_without_nds) {
evo_sale_without_nds = evo_baseproduct.evo_sale_without_nds;
}
}
$calculation.element('tbxVATInLeaseObjectPrice').validate({
invalid:
evo_sale_without_nds && round(VATInLeaseObjectPrice / leaseObjectPriceWthtVAT, 2) >= VAT,
message:
'При продаже ПЛ после ФЛ размер НДС в стоимости ПЛ не может составлять 20% и более от стоимости с НДС. Проверьте корректность НДС, либо измените Продукт',
});
}
);
reaction(
() => $calculation.$values.getValues(['supplierDiscountRub', 'plPriceRub']),
({ supplierDiscountRub, plPriceRub }) => {
$calculation.element('tbxSupplierDiscountRub').validate({
invalid: supplierDiscountRub >= plPriceRub,
message: 'Скидка от поставщика не может быть больше или равна стоимости ПЛ',
});
}
);
reaction(
() => $calculation.$values.getValues(['firstPaymentRub', 'plPriceRub']),
({ firstPaymentRub, plPriceRub }) => {
$calculation.element('tbxFirstPaymentRub').validate({
invalid: firstPaymentRub >= plPriceRub,
message: 'Первый платеж не может быть больше или равен стоимости ПЛ',
});
}
);
reaction(
() => $calculation.$values.getValues(['firstPaymentRub', 'subsidySum']),
({ firstPaymentRub, subsidySum }) => {
$calculation.element('tbxFirstPaymentRub').validate({
invalid: firstPaymentRub - subsidySum < 0,
message:
'Первый платеж с учетом субсидии получается отрицательный, увеличьте первый платеж',
});
},
{
delay: 100,
}
);
}

View File

@ -0,0 +1,80 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ValidationContext } from '../types';
import ValuesSchema from '@/config/schema/values';
import { VAT } from '@/constants/values';
import * as CRMTypes from '@/graphql/crm.types';
import { round } from 'tools';
import { z } from 'zod';
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({
VATInLeaseObjectPrice: true,
firstPaymentRub: true,
leaseObjectPriceWthtVAT: true,
plPriceRub: true,
product: true,
subsidySum: true,
supplierDiscountRub: true,
}).superRefine(
async (
{
VATInLeaseObjectPrice,
leaseObjectPriceWthtVAT,
product: productId,
supplierDiscountRub,
plPriceRub,
firstPaymentRub,
subsidySum,
},
ctx
) => {
if (productId) {
const {
data: { evo_baseproduct },
} = await apolloClient.query({
query: CRMTypes.GetProductDocument,
variables: {
productId,
},
});
if (
evo_baseproduct?.evo_sale_without_nds &&
round(VATInLeaseObjectPrice / leaseObjectPriceWthtVAT, 2) >= VAT
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'При продаже ПЛ после ФЛ размер НДС в стоимости ПЛ не может составлять 20% и более от стоимости с НДС. Проверьте корректность НДС, либо измените Продукт',
path: ['tbxVATInLeaseObjectPrice'],
});
}
}
if (supplierDiscountRub >= plPriceRub) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Скидка не может быть больше или равна стоимости ПЛ',
path: ['tbxSupplierDiscountRub'],
});
}
if (firstPaymentRub >= plPriceRub) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Первый платеж не может быть больше или равен стоимости ПЛ',
path: ['tbxFirstPaymentRub'],
});
}
if (firstPaymentRub - subsidySum < 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message:
'Первый платеж с учетом субсидии получается отрицательный, увеличьте первый платеж',
path: ['tbxFirstPaymentRub'],
});
}
}
);
}

View File

@ -2,11 +2,10 @@
import type { AgentsFields, AgentsRewardConditionsFields, AgentsSumFields } from './types';
import * as CRMTypes from '@/graphql/crm.types';
import type RootStore from '@/stores/root';
import ValidationHelper from '@/stores/validation/helper';
import type { ApolloClient } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { autorun, reaction } from 'mobx';
import { reaction } from 'mobx';
import { normalizeOptions } from 'tools/entity';
import { makeDisposable } from 'tools/mobx';
@ -37,7 +36,7 @@ export function fillAgentRewardReaction(
query: CRMTypes.GetRewardConditionsDocument,
variables: {
agentid,
currentDate: dayjs().toISOString(),
currentDate: dayjs().utc(false).format('YYYY-MM-DD'),
},
});
@ -104,108 +103,3 @@ export function fillAgentRewardSummReaction(
}
);
}
export function validateAgentRewardSumm(
store: RootStore,
apolloClient: ApolloClient<object>,
agentParams: {
rewardConditionField: AgentsRewardConditionsFields;
rewardSummField: AgentsSumFields;
}
) {
const { $calculation } = store;
const { rewardConditionField, rewardSummField } = agentParams;
const validationHelper = new ValidationHelper();
reaction(
() => $calculation.element(rewardSummField).getValue(),
async (rewardSumm) => {
const conditionId = $calculation.element(rewardConditionField).getValue();
if (!conditionId) {
validationHelper.removeErrors();
return;
}
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardConditionQuery,
CRMTypes.GetRewardConditionQueryVariables
>({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId,
},
});
if (!evo_reward_condition) {
validationHelper.removeErrors();
return;
}
if (evo_reward_condition.evo_reward_summ) {
$calculation.element(rewardSummField).validate({
helper: validationHelper,
invalid: rewardSumm > evo_reward_condition?.evo_reward_summ,
message: 'Вознаграждение указано больше условия по агентскому договору!',
});
}
if (
evo_reward_condition?.evo_reduce_reward !== null &&
evo_reward_condition.evo_reward_summ
) {
$calculation.element(rewardSummField).validate({
helper: validationHelper,
invalid:
evo_reward_condition.evo_reduce_reward === false &&
rewardSumm < evo_reward_condition.evo_reward_summ,
message: 'Вознаграждение указано меньше условия по агентскому договору!',
});
}
if (evo_reward_condition?.evo_min_reward_summ !== null) {
$calculation.element(rewardSummField).validate({
helper: validationHelper,
invalid: rewardSumm < evo_reward_condition?.evo_min_reward_summ,
message: 'Вознаграждение указано меньше условия по агентскому договору!',
});
}
}
);
autorun(() => {
const rewardSumm = $calculation.element(rewardSummField).getValue();
const rewardConditionOptions = $calculation.$options.getOptions(rewardConditionField);
const conditionIds = rewardConditionOptions.map((x) => x.value);
const requests = conditionIds.map(async (conditionId) => {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardConditionQuery,
CRMTypes.GetRewardConditionQueryVariables
>({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId,
},
});
return evo_reward_condition;
});
Promise.all(requests).then((results) => {
const required_reward = results.some(
(x) => x?.evo_agency_agreementidData?.evo_required_reward === true
);
$calculation.element(rewardSummField).validate({
invalid: rewardSumm === 0 && required_reward,
message: 'Согласно агентскому договору обязательна выплата АВ. Заложите АВ в расчет',
});
});
});
}

View File

@ -6,12 +6,11 @@ import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { autorun, reaction } from 'mobx';
import { reaction } from 'mobx';
import { makeDisposable } from 'tools/mobx';
const { fillIndAgent, fillCalcBroker, fillCalcDoubleAgent, fillFinDepartment } = fillAgentsFromLead;
const { fillAgentRewardReaction, fillAgentRewardSummReaction, validateAgentRewardSumm } =
createReactions;
const { fillAgentRewardReaction, fillAgentRewardSummReaction } = createReactions;
dayjs.extend(utc);
@ -521,165 +520,3 @@ export function common({ store, apolloClient }: ProcessContext) {
);
}
}
export function validation({ store, apolloClient }: ProcessContext) {
const { $calculation } = store;
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectIndAgentRewardCondition',
rewardSummField: 'tbxIndAgentRewardSumm',
});
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectCalcDoubleAgentRewardCondition',
rewardSummField: 'tbxCalcDoubleAgentRewardSumm',
});
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectCalcBrokerRewardCondition',
rewardSummField: 'tbxCalcBrokerRewardSum',
});
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectFinDepartmentRewardCondtion',
rewardSummField: 'tbxFinDepartmentRewardSumm',
});
/**
* Добавить валидацию на кнопку Рассчитать:
* если tbxDealerRewardSumm > 0 и
* если selectDealerPerson = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectDealerPerson
* 2.если tbxDealerBrokerRewardSumm > 0 и
*
* если selectDealerBroker = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectDealerBroker
* 3. если tbxIndAgentRewardSumm > 0 и
*
* если selectIndAgent = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectIndAgent
* 4. если tbxCalcDoubleAgentRewardSumm > 0 и
*
* если selectCalcDoubleAgent = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* 5. если tbxCalcBrokerRewardSum > 0 и
*
* если selectCalcBroker = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectCalcBroker
* 6. если tbxFinDepartmentRewardSumm > 0 и
*
* если selectFinDepartment = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectFinDepartment
*/
// eslint-disable-next-line complexity, sonarjs/cognitive-complexity
autorun(() => {
const dealerRewardSumm = $calculation.element('tbxDealerRewardSumm').getValue();
const dealerBrokerRewardSumm = $calculation.element('tbxDealerBrokerRewardSumm').getValue();
const indAgentRewardSumm = $calculation.element('tbxIndAgentRewardSumm').getValue();
const calcDoubleAgentRewardSumm = $calculation
.element('tbxCalcDoubleAgentRewardSumm')
.getValue();
const calcBrokerRewardSum = $calculation.element('tbxCalcBrokerRewardSum').getValue();
const finDepartmentRewardSumm = $calculation.element('tbxFinDepartmentRewardSumm').getValue();
const dealerPerson = $calculation.element('selectDealerPerson').getValue();
const dealerBroker = $calculation.element('selectDealerBroker').getValue();
const indAgent = $calculation.element('selectIndAgent').getValue();
const calcDoubleAgent = $calculation.element('selectCalcDoubleAgent').getValue();
const calcBroker = $calculation.element('selectCalcBroker').getValue();
const calcFinDepartment = $calculation.element('selectCalcFinDepartment').getValue();
const message = 'Вы закладываете вознаграждение одному и тому же агенту дважды';
$calculation.element('selectDealerPerson').validate({
invalid:
dealerRewardSumm > 0 &&
Boolean(dealerPerson) &&
((dealerPerson === dealerBroker && dealerBrokerRewardSumm > 0) ||
(dealerPerson === indAgent && indAgentRewardSumm > 0) ||
(dealerPerson === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(dealerPerson === calcBroker && calcBrokerRewardSum > 0) ||
(dealerPerson === calcFinDepartment && finDepartmentRewardSumm > 0)),
message,
});
$calculation.element('selectDealerBroker').validate({
invalid:
dealerBrokerRewardSumm > 0 &&
Boolean(dealerBroker) &&
((dealerBroker === dealerPerson && dealerRewardSumm > 0) ||
(dealerBroker === indAgent && indAgentRewardSumm > 0) ||
(dealerBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(dealerBroker === calcBroker && calcBrokerRewardSum > 0) ||
(dealerBroker === calcFinDepartment && finDepartmentRewardSumm > 0)),
message,
});
$calculation.element('selectIndAgent').validate({
invalid:
indAgentRewardSumm > 0 &&
Boolean(indAgent) &&
((indAgent === dealerPerson && dealerRewardSumm > 0) ||
(indAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
(indAgent === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(indAgent === calcBroker && calcBrokerRewardSum > 0) ||
(indAgent === calcFinDepartment && finDepartmentRewardSumm > 0)),
message,
});
$calculation.element('selectCalcDoubleAgent').validate({
invalid:
calcDoubleAgentRewardSumm > 0 &&
Boolean(calcDoubleAgent) &&
((calcDoubleAgent === dealerPerson && dealerRewardSumm > 0) ||
(calcDoubleAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcDoubleAgent === indAgent && indAgentRewardSumm > 0) ||
(calcDoubleAgent === calcBroker && calcBrokerRewardSum > 0) ||
(calcDoubleAgent === calcFinDepartment && finDepartmentRewardSumm > 0)),
message,
});
$calculation.element('selectCalcBroker').validate({
invalid:
calcBrokerRewardSum > 0 &&
Boolean(calcBroker) &&
((calcBroker === dealerPerson && dealerRewardSumm > 0) ||
(calcBroker === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcBroker === indAgent && indAgentRewardSumm > 0) ||
(calcBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(calcBroker === calcFinDepartment && finDepartmentRewardSumm > 0)),
message,
});
$calculation.element('selectCalcFinDepartment').validate({
invalid:
finDepartmentRewardSumm > 0 &&
Boolean(calcFinDepartment) &&
((calcFinDepartment === dealerPerson && dealerRewardSumm > 0) ||
(calcFinDepartment === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcFinDepartment === indAgent && indAgentRewardSumm > 0) ||
(calcFinDepartment === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(calcFinDepartment === calcBroker && calcBrokerRewardSum > 0)),
message,
});
});
}

View File

@ -9,9 +9,6 @@ function common(context: ProcessContext) {
supplier.common(context);
}
function validation(context: ProcessContext) {
agents.validation(context);
supplier.validation(context);
}
export { common };
export { common, validation };
export { default as validation } from './validation';

View File

@ -1,6 +1,6 @@
import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import { autorun, reaction } from 'mobx';
import { reaction } from 'mobx';
export function common({ store, apolloClient }: ProcessContext) {
const { $calculation, $tables } = store;
@ -73,37 +73,4 @@ export function common({ store, apolloClient }: ProcessContext) {
}
}
);
/**
* В валидацию на кнопку Рассчитать внести изменение:
* 1) поле selectDealerPerson убрать из списка обязательных для расчета полей
* 2) добавить валидацию на поле selectDealerPerson :
* Если в поле selectDealer указан account, у которого evo_return_leasing_dealer = False (или null)
* и поле selectDealerPerson = null, то выводить ошибку и поле selectDealerPerson обводить красной рамкой,
* иначе все ок
*/
autorun(async () => {
const dealerId = $calculation.element('selectDealer').getValue();
const dealerPersonId = $calculation.element('selectDealerPerson').getValue();
let returnLeasing: boolean | null | undefined;
if (dealerId) {
const {
data: { dealer },
} = await apolloClient.query({
query: CRMTypes.GetDealerDocument,
variables: {
dealerId,
},
});
returnLeasing = dealer?.evo_return_leasing_dealer;
}
$calculation.element('selectDealerPerson').validate({
invalid: Boolean(dealerId) && !dealerPersonId && !returnLeasing,
message: 'Не заполнено поле',
});
});
}

View File

@ -157,15 +157,3 @@ export function common({ store, apolloClient }: ProcessContext) {
}
);
}
export function validation({ store, apolloClient }: ProcessContext) {
createReactions.validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectDealerRewardCondition',
rewardSummField: 'tbxDealerRewardSumm',
});
createReactions.validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectDealerBrokerRewardCondition',
rewardSummField: 'tbxDealerBrokerRewardSumm',
});
}

View File

@ -0,0 +1,70 @@
import { createValidationSchema } from '../validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import type { ProcessContext } from '@/process/types';
import ValidationHelper from '@/stores/validation/helper';
import { reaction } from 'mobx';
import { uid } from 'radash';
const key = uid(7);
export default function reactions(context: ProcessContext) {
const { store } = context;
const { $calculation } = store;
const validationSchema = createValidationSchema(context);
const helper = new ValidationHelper();
reaction(
() => {
const values = $calculation.$values.getValues([
'calcBrokerRewardCondition',
'calcBrokerRewardSum',
'calcDoubleAgentRewardCondition',
'calcDoubleAgentRewardSumm',
'dealer',
'dealerBroker',
'calcFinDepartment',
'dealerBrokerRewardCondition',
'dealerBrokerRewardSumm',
'dealerPerson',
'dealerRewardCondition',
'dealerRewardSumm',
'finDepartmentRewardCondtion',
'finDepartmentRewardSumm',
'indAgent',
'indAgentRewardCondition',
'indAgentRewardSumm',
'calcDoubleAgent',
'calcBroker',
]);
const options = (
[
'selectCalcBrokerRewardCondition',
'selectCalcDoubleAgentRewardCondition',
'selectDealerBrokerRewardCondition',
'selectDealerRewardCondition',
'selectFinDepartmentRewardCondtion',
'selectIndAgentRewardCondition',
] as Elements[]
).map((elementName) => $calculation.element(elementName).getOptions());
return { options, values };
},
async ({ values }) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Elements[]).forEach((elementName) => {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
});
});
}
},
{
delay: 100,
}
);
}

View File

@ -0,0 +1,388 @@
/* eslint-disable zod/require-strict */
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable complexity */
import type { ValidationContext } from '../types';
import type { Elements } from '@/Components/Calculation/config/map/values';
import ValuesSchema from '@/config/schema/values';
import * as CRMTypes from '@/graphql/crm.types';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { normalizeOptions } from 'tools';
import type { RefinementCtx } from 'zod';
import { z } from 'zod';
dayjs.extend(utc);
function helper({ apolloClient, ctx }: ValidationContext & { ctx: RefinementCtx }) {
return {
async validateRewardSum({
agentid,
conditionId,
sumFieldName,
sum,
}: {
agentid: string | null;
conditionId: string | null;
sum: number;
sumFieldName: Elements;
}) {
if (agentid) {
const {
data: { evo_reward_conditions },
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionsDocument,
variables: {
agentid,
currentDate: dayjs().utc(false).format('YYYY-MM-DD'),
},
});
const requests = normalizeOptions(evo_reward_conditions)?.map(async ({ value }) => {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardConditionQuery,
CRMTypes.GetRewardConditionQueryVariables
>({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: value,
},
});
return evo_reward_condition;
});
const requiredReward = (await Promise.all(requests)).some(
(x) => x?.evo_agency_agreementidData?.evo_required_reward === true
);
if (sum === 0 && requiredReward) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Согласно агентскому договору обязательна выплата АВ. Заложите АВ в расчет',
path: [sumFieldName],
});
}
}
if (conditionId) {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardConditionQuery,
CRMTypes.GetRewardConditionQueryVariables
>({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId,
},
});
if (evo_reward_condition?.evo_reward_summ && sum > evo_reward_condition?.evo_reward_summ) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Вознаграждение указано больше условия по агентскому договору!',
path: [sumFieldName],
});
}
if (
evo_reward_condition?.evo_reduce_reward === false &&
evo_reward_condition?.evo_reward_summ &&
sum < evo_reward_condition?.evo_reward_summ
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Вознаграждение указано меньше условия по агентскому договору!',
path: [sumFieldName],
});
}
if (
evo_reward_condition?.evo_min_reward_summ &&
sum < evo_reward_condition?.evo_min_reward_summ
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Вознаграждение указано меньше условия по агентскому договору!',
path: [sumFieldName],
});
}
}
},
};
}
const ERR_DOUBLE_REWARD = 'Вы закладываете вознаграждение одному и тому же агенту дважды';
const AgentsSchema = ValuesSchema.pick({
calcBroker: true,
calcDoubleAgent: true,
calcFinDepartment: true,
dealer: true,
dealerBroker: true,
dealerPerson: true,
indAgent: true,
});
const ConditionsSchema = ValuesSchema.pick({
calcBrokerRewardCondition: true,
calcDoubleAgentRewardCondition: true,
dealerBrokerRewardCondition: true,
dealerRewardCondition: true,
finDepartmentRewardCondtion: true,
indAgentRewardCondition: true,
});
const SumsSchema = ValuesSchema.pick({
calcBrokerRewardSum: true,
calcDoubleAgentRewardSumm: true,
dealerBrokerRewardSumm: true,
dealerRewardSumm: true,
finDepartmentRewardSumm: true,
indAgentRewardSumm: true,
});
export function createValidationSchema(context: ValidationContext) {
const { apolloClient } = context;
return z
.object({})
.merge(AgentsSchema)
.merge(ConditionsSchema)
.merge(SumsSchema)
.superRefine(async (values, ctx) => {
const {
calcBrokerRewardCondition,
calcBrokerRewardSum,
calcDoubleAgentRewardCondition,
calcDoubleAgentRewardSumm,
dealer: dealerId,
dealerBroker,
calcFinDepartment,
dealerBrokerRewardCondition,
dealerBrokerRewardSumm,
dealerPerson,
dealerRewardCondition,
dealerRewardSumm,
finDepartmentRewardCondtion,
finDepartmentRewardSumm,
indAgent,
indAgentRewardCondition,
indAgentRewardSumm,
calcDoubleAgent,
calcBroker,
} = values;
/**
* Добавить валидацию на кнопку Рассчитать:
* если tbxDealerRewardSumm > 0 и
* если selectDealerPerson = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectDealerPerson
* если selectDealerPerson = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectDealerPerson
* 2.если tbxDealerBrokerRewardSumm > 0 и
*
* если selectDealerBroker = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectDealerBroker
* если selectDealerBroker = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectDealerBroker
* 3. если tbxIndAgentRewardSumm > 0 и
*
* если selectIndAgent = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectIndAgent
* если selectIndAgent = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectIndAgent
* 4. если tbxCalcDoubleAgentRewardSumm > 0 и
*
* если selectCalcDoubleAgent = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectCalcDoubleAgent
* если selectCalcDoubleAgent = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectCalcDoubleAgent
* 5. если tbxCalcBrokerRewardSum > 0 и
*
* если selectCalcBroker = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectCalcBroker
* если selectCalcBroker = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectCalcBroker
* 6. если tbxFinDepartmentRewardSumm > 0 и
*
* если selectFinDepartment = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectFinDepartment
* если selectFinDepartment = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectFinDepartment
*/
if (
dealerRewardSumm > 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,
message: ERR_DOUBLE_REWARD,
path: ['selectDealerPerson'],
});
}
if (
dealerBrokerRewardSumm > 0 &&
Boolean(dealerBroker) &&
((dealerBroker === dealerPerson && dealerRewardSumm > 0) ||
(dealerBroker === indAgent && indAgentRewardSumm > 0) ||
(dealerBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(dealerBroker === calcBroker && calcBrokerRewardSum > 0) ||
(dealerBroker === calcFinDepartment && finDepartmentRewardSumm > 0))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: ERR_DOUBLE_REWARD,
path: ['selectDealerBroker'],
});
}
if (
indAgentRewardSumm > 0 &&
Boolean(indAgent) &&
((indAgent === dealerPerson && dealerRewardSumm > 0) ||
(indAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
(indAgent === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(indAgent === calcBroker && calcBrokerRewardSum > 0) ||
(indAgent === calcFinDepartment && finDepartmentRewardSumm > 0))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: ERR_DOUBLE_REWARD,
path: ['selectIndAgent'],
});
}
if (
calcDoubleAgentRewardSumm > 0 &&
Boolean(calcDoubleAgent) &&
((calcDoubleAgent === dealerPerson && dealerRewardSumm > 0) ||
(calcDoubleAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcDoubleAgent === indAgent && indAgentRewardSumm > 0) ||
(calcDoubleAgent === calcBroker && calcBrokerRewardSum > 0) ||
(calcDoubleAgent === calcFinDepartment && finDepartmentRewardSumm > 0))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: ERR_DOUBLE_REWARD,
path: ['selectCalcDoubleAgent'],
});
}
if (
calcBrokerRewardSum > 0 &&
Boolean(calcBroker) &&
((calcBroker === dealerPerson && dealerRewardSumm > 0) ||
(calcBroker === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcBroker === indAgent && indAgentRewardSumm > 0) ||
(calcBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(calcBroker === calcFinDepartment && finDepartmentRewardSumm > 0))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: ERR_DOUBLE_REWARD,
path: ['selectCalcBroker'],
});
}
if (
finDepartmentRewardSumm > 0 &&
Boolean(calcFinDepartment) &&
((calcFinDepartment === dealerPerson && dealerRewardSumm > 0) ||
(calcFinDepartment === dealerBroker && dealerBrokerRewardSumm > 0) ||
(calcFinDepartment === indAgent && indAgentRewardSumm > 0) ||
(calcFinDepartment === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
(calcFinDepartment === calcBroker && calcBrokerRewardSum > 0))
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: ERR_DOUBLE_REWARD,
path: ['selectCalcFinDepartment'],
});
}
/**
* В валидацию на кнопку Рассчитать внести изменение:
* 1) поле selectDealerPerson убрать из списка обязательных для расчета полей
* 2) добавить валидацию на поле selectDealerPerson :
* Если в поле selectDealer указан account, у которого evo_return_leasing_dealer = False (или null)
* и поле selectDealerPerson = null, то выводить ошибку и поле selectDealerPerson обводить красной рамкой,
* иначе все ок
*/
if (dealerId) {
const {
data: { dealer },
} = await apolloClient.query({
query: CRMTypes.GetDealerDocument,
variables: {
dealerId,
},
});
if (!dealerPerson && !dealer?.evo_return_leasing_dealer)
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['selectDealerPerson'],
});
}
const { validateRewardSum } = helper({ ...context, ctx });
await validateRewardSum({
agentid: dealerPerson,
conditionId: dealerRewardCondition,
sum: dealerRewardSumm,
sumFieldName: 'tbxDealerRewardSumm',
});
await validateRewardSum({
agentid: dealerBroker,
conditionId: dealerBrokerRewardCondition,
sum: dealerBrokerRewardSumm,
sumFieldName: 'tbxDealerBrokerRewardSumm',
});
await validateRewardSum({
agentid: indAgent,
conditionId: indAgentRewardCondition,
sum: indAgentRewardSumm,
sumFieldName: 'tbxIndAgentRewardSumm',
});
await validateRewardSum({
agentid: calcDoubleAgent,
conditionId: calcDoubleAgentRewardCondition,
sum: calcDoubleAgentRewardSumm,
sumFieldName: 'tbxCalcDoubleAgentRewardSumm',
});
await validateRewardSum({
agentid: calcBroker,
conditionId: calcBrokerRewardCondition,
sum: calcBrokerRewardSum,
sumFieldName: 'tbxCalcBrokerRewardSum',
});
await validateRewardSum({
agentid: calcFinDepartment,
conditionId: finDepartmentRewardCondtion,
sum: finDepartmentRewardSumm,
sumFieldName: 'tbxFinDepartmentRewardSumm',
});
});
}

View File

@ -13,3 +13,5 @@ export type ProcessContext = {
export type Process = {
reactions: Record<string, (context: ProcessContext) => void>;
};
export type ValidationContext = Omit<ProcessContext, 'store'>;

View File

@ -1,8 +1,11 @@
/* eslint-disable @typescript-eslint/naming-convention */
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 ValidationHelper from '@/stores/validation/helper';
import { reaction } from 'mobx';
import { uid } from 'radash';
export function common({ store, apolloClient }: ProcessContext) {
const { $calculation } = store;
@ -150,41 +153,6 @@ export function common({ store, apolloClient }: ProcessContext) {
}
);
/**
* Добавить реакцию на изменение Типа ПЛ selectLeaseObjectType , ПЛ БУ cbxLeaseObjectUsed и Моточасы tbxEngineHours:
* Если ПЛ БУ cbxLeaseObjectUsed = True и Тип ПЛ selectLeaseObjectType = Спецтехника (id=9) и Моточасы = 0,
* то поле Моточасы tbxEngineHours должно обводиться красной рамкой и выводиться сообщение
* "Укажите Моточасы, иначе красная рамка снимается.
* При красной рамке в данном поле нельзя осуществить расчет графика.
*/
{
const validationHelper = new ValidationHelper();
reaction(
() => $calculation.$values.getValues(['leaseObjectUsed', 'engineHours', 'leaseObjectType']),
async ({ leaseObjectType: leaseObjectTypeId, leaseObjectUsed, engineHours }) => {
if (!leaseObjectTypeId) {
validationHelper.removeErrors();
return;
}
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: { leaseObjectTypeId },
});
$calculation.element('tbxEngineHours').validate({
helper: validationHelper,
invalid: leaseObjectUsed && evo_leasingobject_type?.evo_id === '9' && !engineHours,
message: 'Не заполнено поле',
});
}
);
}
reaction(
() => $calculation.element('cbxLeaseObjectUsed').getValue(),
(leaseObjectUsed) => {
@ -196,16 +164,6 @@ export function common({ store, apolloClient }: ProcessContext) {
}
);
reaction(
() => $calculation.$values.getValues(['mileage', 'leaseObjectUsed']),
({ mileage, leaseObjectUsed }) => {
$calculation.element('tbxMileage').validate({
invalid: leaseObjectUsed && !mileage,
message: 'Не заполнено поле',
});
}
);
reaction(
() => $calculation.element('cbxLeaseObjectUsed').getValue(),
(leaseObjectUsed) => {
@ -273,38 +231,6 @@ export function common({ store, apolloClient }: ProcessContext) {
}
);
/**
* Если "Категория" содержит данные, то должны быть доступными для набора только арабские цифры и буквы латинского алфавита за исключением I, O, Q, так как они сходны по начертанию с цифрами 1, 0, 9. Можно использовать регулярное выражение: "^[A-HJ-NPR-Za-hj-npr-z0-9]{17}$".
* Иначе (если Категория = пусто) то требуется аналогичная первому условию маска, но без проверки 17ти символов (допускать и больше и меньше символов, мб так: "^[A-HJ-NPR-Za-hj-npr-z0-9]{99}$".
* Вот так: /^[A-HJ-NPR-Za-hj-npr-z0-9]+$/
*/
{
const vinRegex = /^[\dA-HJ-NPR-Za-hj-npr-z]+$/u;
const validationHelper = new ValidationHelper();
reaction(
() => $calculation.$values.getValues(['vin', 'leaseObjectCategory', 'leaseObjectUsed']),
({ vin, leaseObjectCategory }) => {
if (!vin) {
validationHelper.removeErrors();
return;
}
let invalid = vinRegex.test(vin) === false;
if (leaseObjectCategory && vin?.length !== 17) {
invalid = true;
}
$calculation.element('tbxVIN').validate({
helper: validationHelper,
invalid,
message: 'Неверно заполнено поле',
});
}
);
}
reaction(
() => $calculation.element('cbxLeaseObjectUsed').getValue(),
(leaseObjectUsed) => {
@ -316,3 +242,40 @@ export function common({ store, apolloClient }: ProcessContext) {
}
);
}
const key = uid(7);
export function validation(context: ProcessContext) {
const { store } = context;
const { $calculation } = store;
const validationSchema = createValidationSchema(context);
const helper = new ValidationHelper();
reaction(
() =>
$calculation.$values.getValues([
'engineHours',
'leaseObjectCategory',
'leaseObjectType',
'leaseObjectUsed',
'mileage',
'vin',
]),
async (values) => {
helper.removeErrors();
const validationResult = await validationSchema.safeParseAsync(values);
if (!validationResult.success) {
validationResult.error.errors.forEach(({ path, message }) => {
(path as Elements[]).forEach((elementName) => {
const removeError = $calculation.element(elementName).setError({ key, message });
if (removeError) helper.add(removeError);
});
});
}
},
{
delay: 100,
}
);
}

View File

@ -0,0 +1,81 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ValidationContext } from '../types';
import ValuesSchema from '@/config/schema/values';
import * as CRMTypes from '@/graphql/crm.types';
import { z } from 'zod';
const vinRegex = /^[\dA-HJ-NPR-Za-hj-npr-z]+$/u;
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({
engineHours: true,
leaseObjectCategory: true,
leaseObjectType: true,
leaseObjectUsed: true,
mileage: true,
vin: true,
}).superRefine(
async (
{
engineHours,
leaseObjectCategory,
leaseObjectType: leaseObjectTypeId,
leaseObjectUsed,
mileage,
vin,
},
ctx
) => {
/**
* Добавить реакцию на изменение Типа ПЛ selectLeaseObjectType , ПЛ БУ cbxLeaseObjectUsed и Моточасы tbxEngineHours:
* Если ПЛ БУ cbxLeaseObjectUsed = True и Тип ПЛ selectLeaseObjectType = Спецтехника (id=9) и Моточасы = 0,
* то поле Моточасы tbxEngineHours должно обводиться красной рамкой и выводиться сообщение
* "Укажите Моточасы, иначе красная рамка снимается.
* При красной рамке в данном поле нельзя осуществить расчет графика.
*/
if (leaseObjectTypeId) {
const {
data: { evo_leasingobject_type },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: { leaseObjectTypeId },
});
if (leaseObjectUsed && evo_leasingobject_type?.evo_id === '9' && !engineHours) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['tbxEngineHours'],
});
}
}
if (leaseObjectUsed && !mileage) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Не заполнено поле',
path: ['tbxMileage'],
});
}
/**
* Если "Категория" содержит данные, то должны быть доступными для набора только арабские цифры и буквы латинского алфавита за исключением I, O, Q, так как они сходны по начертанию с цифрами 1, 0, 9. Можно использовать регулярное выражение: "^[A-HJ-NPR-Za-hj-npr-z0-9]{17}$".
* Иначе (если Категория = пусто) то требуется аналогичная первому условию маска, но без проверки 17ти символов (допускать и больше и меньше символов, мб так: "^[A-HJ-NPR-Za-hj-npr-z0-9]{99}$".
* Вот так: /^[A-HJ-NPR-Za-hj-npr-z0-9]+$/
*/
if (vin) {
let invalid = vinRegex.test(vin) === false;
if (leaseObjectCategory && vin?.length !== 17) {
invalid = true;
}
if (invalid) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Неверно заполнено поле',
path: ['tbxVIN'],
});
}
}
}
);
}

View File

@ -1,4 +1,4 @@
import type { RemoveError, ValidationParams } from '../validation/types';
import type { ValidationParams } from '../validation/types';
import OptionsStore from './options';
import StatusStore from './statuses';
import ValuesStore from './values';
@ -56,6 +56,10 @@ export default class CalculationStore {
return this.$values.getValue(valueName) as Values.ElementsTypes[E];
},
removeError: (params: Pick<ValidationParams, 'key'>) => {
this.$validation[elementName]?.removeError(params);
},
reset: () => {
const valueName = getValueName(elementName);
this.$values.resetValue(valueName);
@ -80,6 +84,12 @@ export default class CalculationStore {
return this.element(elementName);
},
setError: (params: ValidationParams) => {
if (!this.$validation[elementName]) this.createElementValidation(elementName);
return this.$validation[elementName]?.setError(params);
},
setOptions: (options: Array<BaseOption<Values.ElementsTypes[E]>>) => {
this.$options.setOptions(elementName, options);
@ -98,20 +108,5 @@ export default class CalculationStore {
return this.element(elementName);
},
validate: ({ invalid, message, silent, helper }: ValidationParams) => {
if (!this.$validation[elementName]) this.createElementValidation(elementName);
let removeError: RemoveError | undefined;
if (invalid) {
removeError = this.$validation[elementName]?.addError(message, silent);
if (helper && removeError) helper.add(removeError);
} else {
this.$validation[elementName]?.removeError(message);
}
return removeError;
},
});
}

View File

@ -2,9 +2,8 @@ import { useStore } from '@/stores/hooks';
export function useValidation(elementName) {
const { $calculation } = useStore();
const messages = $calculation.$validation[elementName]?.getMessages();
if (messages?.length) {
const hasErrors = $calculation.$validation?.[elementName]?.hasErrors;
if (hasErrors) {
return {
help: 'Некорректные данные',
isValid: false,

View File

@ -1,5 +1,5 @@
import Validation from '../../validation';
import type { RemoveError, ValidationParams } from '../../validation/types';
import type { ValidationParams } from '../../validation/types';
import type * as FinGAP from '@/Components/Calculation/Form/Insurance/FinGAPTable/types';
import type RootStore from '@/stores/root';
import type { IObservableArray } from 'mobx';
@ -38,17 +38,10 @@ export default class FinGAPTable {
.reduce((sum, risk) => sum + risk.premium, 0);
}
public validate = ({ invalid, message, helper }: ValidationParams) => {
let removeError: RemoveError | undefined;
public setError = (params: ValidationParams) => this.validation.setError(params);
if (invalid) {
removeError = this.validation?.addError(message);
if (helper && removeError) helper.add(removeError);
} else {
this.validation?.removeError(message);
}
return removeError;
public removeError = (params: Pick<ValidationParams, 'key'>) => {
this.validation.removeError(params);
};
public clear = () => {

View File

@ -1,5 +1,5 @@
import Validation from '../../validation';
import type { RemoveError, ValidationParams } from '../../validation/types';
import type { ValidationParams } from '../../validation/types';
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
import * as insuranceTableConfig from '@/config/tables/insurance-table';
import type RootStore from '@/stores/root';
@ -40,17 +40,10 @@ export default class InsuranceTable {
if (initialStatuses) this.statuses = initialStatuses;
};
public validate = ({ invalid, message, helper }: ValidationParams) => {
let removeError: RemoveError | undefined;
public setError = (params: ValidationParams) => this.validation.setError(params);
if (invalid) {
removeError = this.validation?.addError(message);
if (helper && removeError) helper.add(removeError);
} else {
this.validation?.removeError(message);
}
return removeError;
public removeError = (params: Pick<ValidationParams, 'key'>) => {
this.validation.removeError(params);
};
public reset = () => {
@ -67,6 +60,39 @@ export default class InsuranceTable {
return this.row(key);
},
column: <V extends Insurance.Values>(valueName: V) => ({
block: () => {
this.row(key).block(valueName);
return this.row(key).column(valueName);
},
resetOptions: () => {
this.row(key).resetOptions(valueName);
return this.row(key).column(valueName);
},
resetValue: () => {
this.row(key).resetValue(valueName);
return this.row(key).column(valueName);
},
setOptions: (options: Insurance.RowOptions[V]) => {
this.row(key).setOptions(valueName, options);
return this.row(key).column(valueName);
},
setValue: (value: Insurance.RowValues[V]) => {
this.row(key).setValue(valueName, value);
return this.row(key).column(valueName);
},
unblock: () => {
this.row(key).unblock(valueName);
return this.row(key).column(valueName);
},
}),
getOptions: <V extends Insurance.Values>(valueName: V) => this.options[key][valueName],
getStatus: (valueName: Insurance.Values) => this.statuses[key][valueName],
@ -77,6 +103,12 @@ export default class InsuranceTable {
return this.values[rowIndex][valueName];
},
getValues: () => {
const rowIndex = this.values.findIndex((x) => x.key === key);
return this.values[rowIndex];
},
reset: (valueName: Insurance.Values) => {
this.row(key).resetValue(valueName).resetStatus(valueName).resetOptions(valueName);

View File

@ -1,5 +1,5 @@
import Validation from '../../validation';
import type { RemoveError, ValidationParams } from '../../validation/types';
import type { ValidationParams } from '../../validation/types';
import type { Row } from './types';
import type RootStore from '@/stores/root';
import type { IObservableArray } from 'mobx';
@ -72,17 +72,10 @@ export default class PaymentsTable {
this.setStatuses(statuses);
};
public validate = ({ invalid, message, helper }: ValidationParams) => {
let removeError: RemoveError | undefined;
public setError = (params: ValidationParams) => this.validation.setError(params);
if (invalid) {
removeError = this.validation?.addError(message);
if (helper && removeError) helper.add(removeError);
} else {
this.validation?.removeError(message);
}
return removeError;
public removeError = (params: Pick<ValidationParams, 'key'>) => {
this.validation.removeError(params);
};
public reset = () => {

View File

@ -1,32 +1,38 @@
import type { RemoveError, ValidationConfig } from './types';
import type { RemoveError, ValidationConfig, ValidationError, ValidationParams } from './types';
import { makeAutoObservable } from 'mobx';
import notification from 'ui/elements/notification';
export default class Validation {
private params: ValidationConfig;
private messages: Set<string>;
private errors: Set<ValidationError>;
constructor(config: ValidationConfig) {
this.params = config;
this.messages = new Set();
this.errors = new Set();
makeAutoObservable(this);
}
public get hasErrors() {
return this.messages.size > 0;
return this.errors.size > 0;
}
public getMessages() {
return [...this.messages];
public getErrors() {
return [...this.errors];
}
public removeError = (message: string) => {
this.messages.delete(message);
if (this.messages.size === 0) notification.close(this.params.err_key);
public removeError = ({ key }: Pick<ValidationError, 'key'>) => {
const error = [...this.errors].find((x) => x.key === key);
if (error) this.errors.delete(error);
if (this.errors.size === 0) notification.close(this.params.err_key);
};
public addError = (message: string, silent?: boolean) => {
if (!silent && !this.messages.has(message)) {
public setError = ({ key, message, silent }: ValidationParams) => {
const error = [...this.errors].find((x) => x.key === key);
if (error) this.removeError({ key });
this.errors.add({ key, message });
if (!silent) {
notification.error({
description: message,
key: this.params.err_key,
@ -34,13 +40,11 @@ export default class Validation {
});
}
this.messages.add(message);
return (() => this.removeError(message)) as RemoveError;
return (() => this.removeError({ key })) as RemoveError;
};
public clearErrors = () => {
this.messages.clear();
this.errors.clear();
notification.close(this.params.err_key);
};
}

View File

@ -1,15 +1,10 @@
import type ValidationHelper from './helper';
export type ValidationConfig = {
err_key: string;
err_title: string;
};
export type ValidationParams = {
helper?: ValidationHelper;
invalid: boolean;
message: string;
silent?: boolean;
};
export type ValidationError = { key: string; message: string };
export type ValidationParams = ValidationError & { silent?: boolean };
export type RemoveError = () => void;

View File

@ -26,7 +26,6 @@ export const trpcClient = createTRPCNext<AppRouter>({
transformer: SuperJSON,
};
},
ssr: true,
});
export const trpcPureClient = createTRPCProxyClient<AppRouter>({

View File

@ -3,6 +3,7 @@
import { t } from '../server';
import defaultValues from '@/config/default-values';
import * as insuranceTable from '@/config/tables/insurance-table';
import * as addProduct from '@/process/add-product';
import * as bonuses from '@/process/bonuses';
import * as configurator from '@/process/configurator';
import * as fingapProcess from '@/process/fingap';
@ -46,6 +47,7 @@ const quoteRouter = t.router({
gibdd,
subsidy,
insuranceProcess,
addProduct,
].map(({ getKPData }) => getKPData(input))
);