Compare commits

...

27 Commits

Author SHA1 Message Date
vchikalkin
d86c7f360f process/supplier-agent: beautify validation file format 2023-03-10 09:33:14 +03:00
vchikalkin
630b6733ed process/supplier-agent: trigger validation on change condition options 2023-03-10 09:27:30 +03:00
vchikalkin
ba283d3b99 fix build 2023-03-09 19:06:08 +03:00
vchikalkin
e2dd8c6a65 imports: replace '@/../../packages/tools' with 'tools' 2023-03-09 16:17:40 +03:00
vchikalkin
007f4f1568 process/supplier-agent: use new validation 2023-03-09 16:13:07 +03:00
vchikalkin
441c19b49e fix validation reactions 2023-03-07 14:13:38 +03:00
vchikalkin
95bb7e0132 process/leasing-object: use new validation 2023-03-07 14:05:44 +03:00
vchikalkin
bb9bded60f process/price: use new validation 2023-03-07 13:47:21 +03:00
vchikalkin
a242fe26de process/used-pl: use new validation 2023-03-07 13:37:10 +03:00
vchikalkin
b9ddd193df revert processes 2023-03-07 13:24:44 +03:00
vchikalkin
54004173ae process/insurance: use new validation 2023-03-07 13:05:55 +03:00
vchikalkin
81517212fb process/gibdd: use new validation 2023-03-07 12:26:47 +03:00
vchikalkin
6d375dc638 process/payments: use new validation 2023-03-07 12:13:45 +03:00
vchikalkin
14c16ec1c4 add type ValidationContext 2023-03-07 11:24:59 +03:00
vchikalkin
49d652c7fe process/configurator: use new validation 2023-03-07 11:20:39 +03:00
vchikalkin
91899164c0 validate saleBonus using zod 2023-03-05 13:47:39 +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
68 changed files with 2352 additions and 1338 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

@ -79,12 +79,10 @@ const components = wrapComponentsMap({
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

@ -425,10 +425,6 @@ const props: Partial<ElementsProps> = {
showSearch: true,
optionFilterProp: 'label',
},
radioInfuranceOPF: {
optionType: 'button',
buttonStyle: 'solid',
},
radioGraphType: {
spaceProps: {
direction: 'vertical',

View File

@ -74,7 +74,6 @@ const titles: Record<ActionElements | ValuesElements, string> = {
selectGPSModel: 'Модель GPS',
selectRegionRegistration: 'Регион регистрации',
selectTownRegistration: 'Город регистрации',
radioInfuranceOPF: 'ОПФ для расчета страховки',
radioInsKaskoType: 'Тип страхования КАСКО',
cbxInsDecentral: 'Децентрализованное страхование',
tbxInsFranchise: 'Франшиза',
@ -116,7 +115,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,
@ -156,7 +155,6 @@ const types = wrapElementsTypes({
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,12 @@ 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

@ -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 { ApolloClient, InMemoryCache } from '@apollo/client';
import { cache, link } from '@/config/apollo';
import { ApolloClient } 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(),
cache,
link,
ssrMode: isServer(),
uri: URL_CRM_GRAPHQL,
});
}

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

@ -0,0 +1,36 @@
import getUrls from './urls';
import { ApolloLink, HttpLink, InMemoryCache } from '@apollo/client';
const { URL_CRM_GRAPHQL } = getUrls();
export const cache = new InMemoryCache();
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,93 @@ 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'
);
const defaultOptions: CalculationOptions = {
radioLastPaymentRule: [
{
@ -187,103 +274,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,
},
],
selectLeaseObjectUseFor,
radioInsKaskoType: [
{
@ -461,7 +452,6 @@ const defaultOptions: CalculationOptions = {
cbxInsUnlimitDrivers: [],
tbxInsAgeDrivers: [],
tbxInsExpDrivers: [],
tbxINNForCalc: [],
cbxLastPaymentRedemption: [],
cbxPriceWithDiscount: [],
cbxFullPriceWithDiscount: [],

View File

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

View File

@ -55,8 +55,6 @@ const defaultValues: CalculationValues = {
indAgent: null,
indAgentRewardCondition: null,
indAgentRewardSumm: 0,
infuranceOPF: null,
INNForCalc: 0,
insAgeDrivers: 0,
insDecentral: false,
insExpDrivers: 0,

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,8 +52,6 @@ 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(),

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
}
}
@ -249,6 +250,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
@ -306,6 +314,7 @@ query GetConfigurations($modelId: Uuid!) {
evo_equipments(statecode: 0, evo_modelid: $modelId) {
label: evo_name
value: evo_equipmentid
evo_start_production_year
}
}
@ -402,19 +411,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 +442,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 +454,93 @@ 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
}
}
}

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']>;
@ -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; }>;
@ -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,77 @@ 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 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 +491,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'];
@ -484,13 +542,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 +577,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,7 +586,7 @@ 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 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>;
@ -549,13 +600,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 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,14 +618,21 @@ 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 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>;
@ -581,7 +640,6 @@ export const GetLeadUrlDocument = {"kind":"Document","definitions":[{"kind":"Ope
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

@ -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

@ -306,7 +306,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,4 +1,5 @@
/* 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';
@ -29,7 +30,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 = [] },
@ -124,7 +125,7 @@ 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 },
@ -174,4 +175,29 @@ 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',
] 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

@ -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,166 @@
/* 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 } = 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,
}
);
}
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',
]);
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,82 @@
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';
export function createValidationSchema({ apolloClient }: ValidationContext) {
return ValuesSchema.pick({
leasingPeriod: true,
quote: true,
recalcWithRevision: true,
})
.extend({
insurance: z
.object({
fingap: RowSchema,
kasko: RowSchema,
osago: RowSchema,
})
.strict(),
})
.superRefine(async ({ leasingPeriod, recalcWithRevision, quote: quoteId, 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 (insCost === 0 && insured === 100_000_001) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Укажите стоимость ${policyType}, включаемую в график`,
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'],
});
}
});
});
}

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 = () => {
@ -77,6 +70,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

@ -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))
);