merge migration/random-1

This commit is contained in:
vchikalkin 2023-02-03 08:30:24 +03:00
parent d6db50a582
commit 96c4a095b1
69 changed files with 3871 additions and 1314 deletions

View File

@ -1,4 +1,5 @@
.next
public
graphql
**/graphql/*.types.ts
**/graphql/*.schema.graphql
node_modules

View File

@ -6,6 +6,7 @@ generates:
plugins:
- typescript
- typescript-operations
- typed-document-node
config:
onlyOperationTypes: true
useTypeImports: true

View File

@ -9,7 +9,7 @@ export type RowValues = z.infer<typeof RowSchema>;
export type Values = Exclude<keyof RowValues, 'key'>;
export type RowOptions = {
[ValueName in Values]?: BaseOption<RowValues[ValueName]>[];
[ValueName in Values]: BaseOption<RowValues[ValueName]>[];
};
export type RowStatuses = Record<Values, Status>;

View File

@ -9,4 +9,5 @@ export const rows: FormTabRows = [
[['selectLeaseObjectCategory', 'tbxMileage', 'tbxINNForCalc']],
[['tbxLeaseObjectMotorPower', 'cbxWithTrailer', 'selectGPSBrand']],
[['tbxEngineVolume', 'cbxInsDecentral', 'selectGPSModel']],
[['selectLeasingWithoutKasko', 'selectInsNSIB']],
];

View File

@ -1,25 +1,14 @@
import { gql, useQuery } from '@apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import { useQuery } from '@apollo/client';
import * as CRMTypes from 'graphql/crm.types';
import { observer } from 'mobx-react-lite';
import { useStore } from 'stores/hooks';
const QUERY_GET_CURRENCY_SYMBOL = gql`
query GetCurrencySymbol($currencyid: Uuid!) {
transactioncurrency(transactioncurrencyid: $currencyid) {
currencysymbol
}
}
`;
const CurrencyAddon = observer(() => {
const { $calculation } = useStore();
const currencyid = $calculation.element('selectSupplierCurrency').getValue();
const { data } = useQuery<
CRMTypes.GetCurrencySymbolQuery,
CRMTypes.GetCurrencySymbolQueryVariables
>(QUERY_GET_CURRENCY_SYMBOL, {
const { data } = useQuery(CRMTypes.GetTransactionCurrencyDocument, {
variables: {
currencyid: currencyid!,
},

View File

@ -0,0 +1,4 @@
export { default as buildAction } from './build-action';
export { default as buildOptions } from './build-options';
export { default as buildReadonly } from './build-readonly';
export { default as buildValue } from './build-value';

View File

@ -1,153 +0,0 @@
import buildAction from '../builders/build-action';
import buildOptions from '../builders/build-options';
import buildReadonly from '../builders/build-readonly';
import buildValue from '../builders/build-value';
import type { Elements as ActionElements } from './map/actions';
import type { Elements as ValuesElements } from './map/values';
function wrapElementsBuilders<C, T extends Record<ValuesElements | ActionElements, C>>(arg: T) {
return arg;
}
const builders = wrapElementsBuilders({
cbxRecalcWithRevision: buildValue,
tbxLeaseObjectPrice: buildValue,
tbxLeaseObjectPriceWthtVAT: buildValue,
tbxVATInLeaseObjectPrice: buildValue,
tbxEngineHours: buildValue,
tbxSupplierDiscountRub: buildValue,
tbxSupplierDiscountPerc: buildValue,
tbxLeasingPeriod: buildValue,
tbxFirstPaymentPerc: buildValue,
tbxFirstPaymentRub: buildValue,
tbxLastPaymentPerc: buildValue,
tbxLastPaymentRub: buildValue,
selectImportProgram: buildOptions,
tbxImportProgramSum: buildReadonly,
tbxAddEquipmentPrice: buildValue,
tbxRedemptionPaymentSum: buildValue,
tbxParmentsDecreasePercent: buildValue,
tbxComissionPerc: buildValue,
tbxComissionRub: buildValue,
tbxSaleBonus: buildValue,
tbxIRR_Perc: buildValue,
tbxLeaseObjectCount: buildValue,
cbxWithTrailer: buildValue,
cbxLeaseObjectUsed: buildValue,
tbxMaxMass: buildValue,
tbxCountSeats: buildValue,
tbxMaxSpeed: buildValue,
tbxLeaseObjectYear: buildValue,
tbxLeaseObjectMotorPower: buildValue,
tbxEngineVolume: buildValue,
tbxDealerRewardSumm: buildValue,
tbxDealerBrokerRewardSumm: buildValue,
tbxIndAgentRewardSumm: buildValue,
tbxCalcDoubleAgentRewardSumm: buildValue,
tbxCalcBrokerRewardSum: buildValue,
tbxFinDepartmentRewardSumm: buildValue,
cbxInsDecentral: buildValue,
tbxInsFranchise: buildValue,
cbxInsUnlimitDrivers: buildValue,
tbxInsAgeDrivers: buildValue,
tbxInsExpDrivers: buildValue,
tbxINNForCalc: buildValue,
cbxLastPaymentRedemption: buildValue,
cbxPriceWithDiscount: buildValue,
cbxFullPriceWithDiscount: buildValue,
cbxCostIncrease: buildValue,
cbxInsurance: buildValue,
cbxRegistrationQuote: buildValue,
cbxTechnicalCardQuote: buildValue,
cbxNSIB: buildValue,
tbxQuoteName: buildValue,
cbxQuoteRedemptionGraph: buildValue,
cbxShowFinGAP: buildValue,
tbxCreditRate: buildValue,
tbxMaxPriceChange: buildValue,
tbxImporterRewardPerc: buildValue,
tbxImporterRewardRub: buildValue,
cbxDisableChecks: buildValue,
tbxMileage: buildValue,
tbxTotalPayments: buildValue,
tbxVehicleTaxInYear: buildValue,
tbxVehicleTaxInLeasingPeriod: buildValue,
tbxMinPriceChange: buildValue,
selectProduct: buildOptions,
selectClientRisk: buildOptions,
selectClientType: buildOptions,
selectSupplierCurrency: buildOptions,
selectSeasonType: buildOptions,
selectHighSeasonStart: buildOptions,
selectLeaseObjectType: buildOptions,
selectBrand: buildOptions,
selectModel: buildOptions,
selectConfiguration: buildOptions,
selectLeaseObjectUseFor: buildOptions,
selectLeaseObjectCategory: buildOptions,
selectEngineType: buildOptions,
selectDealer: buildOptions,
selectDealerPerson: buildOptions,
selectDealerRewardCondition: buildOptions,
selectDealerBroker: buildOptions,
selectDealerBrokerRewardCondition: buildOptions,
selectIndAgent: buildOptions,
selectIndAgentRewardCondition: buildOptions,
selectCalcDoubleAgent: buildOptions,
selectCalcDoubleAgentRewardCondition: buildOptions,
selectCalcBroker: buildOptions,
selectCalcBrokerRewardCondition: buildOptions,
selectCalcFinDepartment: buildOptions,
selectFinDepartmentRewardCondtion: buildOptions,
selectGPSBrand: buildOptions,
selectGPSModel: buildOptions,
selectRegionRegistration: buildOptions,
selectTownRegistration: buildOptions,
selectRegistration: buildOptions,
selectInsNSIB: buildOptions,
selectTracker: buildOptions,
selectTelematic: buildOptions,
selectTechnicalCard: buildOptions,
selectTarif: buildOptions,
selectRate: buildOptions,
selectLead: buildOptions,
selectOpportunity: buildOptions,
selectQuote: buildOptions,
selectObjectRegionRegistration: buildOptions,
selectObjectCategoryTax: buildOptions,
selectObjectTypeTax: buildOptions,
selectLegalClientRegion: buildOptions,
selectLegalClientTown: buildOptions,
selectSubsidy: buildOptions,
selectFuelCard: buildOptions,
radioBalanceHolder: buildOptions,
radioLastPaymentRule: buildOptions,
radioGraphType: buildOptions,
radioDeliveryTime: buildOptions,
radioInsKaskoType: buildOptions,
radioInfuranceOPF: buildOptions,
selectRequirementTelematic: buildOptions,
radioQuoteContactGender: buildOptions,
radioCalcType: buildOptions,
radioObjectRegistration: buildOptions,
radioTypePTS: buildOptions,
tbxBonusCoefficient: buildValue,
labelLeaseObjectRisk: buildReadonly,
tbxInsKaskoPriceLeasePeriod: buildReadonly,
labelIrrInfo: buildReadonly,
labelRegistrationDescription: buildReadonly,
labelDepreciationGroup: buildReadonly,
tbxSubsidySum: buildReadonly,
btnCreateKP: buildAction,
btnCalculate: buildAction,
linkDownloadKp: buildReadonly,
linkLeadUrl: buildReadonly,
linkOpportunityUrl: buildReadonly,
linkQuoteUrl: buildReadonly,
});
export default builders;

View File

@ -1,5 +1,5 @@
import type { ComponentProps } from 'react';
import * as elements from 'ui/elements';
import * as e from 'ui/elements';
import type { Elements as ActionElements } from './map/actions';
import type { Elements as ValuesElements } from './map/values';
@ -8,146 +8,147 @@ function wrapComponentsMap<C, T extends Record<ValuesElements | ActionElements,
}
const components = wrapComponentsMap({
selectProduct: elements.Select,
selectClientRisk: elements.Select,
selectClientType: elements.Select,
selectSupplierCurrency: elements.Select,
tbxLeaseObjectPrice: elements.InputNumber,
tbxLeaseObjectPriceWthtVAT: elements.InputNumber,
tbxVATInLeaseObjectPrice: elements.InputNumber,
tbxSupplierDiscountRub: elements.InputNumber,
tbxSupplierDiscountPerc: elements.InputNumber,
radioBalanceHolder: elements.Radio,
tbxSaleBonus: elements.InputNumber,
tbxFirstPaymentPerc: elements.InputNumber,
tbxFirstPaymentRub: elements.InputNumber,
radioLastPaymentRule: elements.Segmented,
tbxLastPaymentPerc: elements.InputNumber,
tbxLastPaymentRub: elements.InputNumber,
selectImportProgram: elements.Select,
tbxImportProgramSum: elements.InputNumber,
tbxAddEquipmentPrice: elements.InputNumber,
tbxRedemptionPaymentSum: elements.InputNumber,
tbxLeasingPeriod: elements.InputNumber,
radioGraphType: elements.Radio,
tbxParmentsDecreasePercent: elements.InputNumber,
selectSeasonType: elements.Select,
selectHighSeasonStart: elements.Select,
tbxComissionPerc: elements.InputNumber,
tbxComissionRub: elements.InputNumber,
selectLeaseObjectType: elements.Select,
selectBrand: elements.Select,
selectModel: elements.Select,
selectConfiguration: elements.Select,
cbxLeaseObjectUsed: elements.Checkbox,
radioDeliveryTime: elements.Segmented,
tbxLeaseObjectCount: elements.InputNumber,
selectLeaseObjectUseFor: elements.Select,
tbxLeaseObjectYear: elements.InputNumber,
selectLeaseObjectCategory: elements.Select,
selectEngineType: elements.Select,
tbxLeaseObjectMotorPower: elements.InputNumber,
tbxEngineVolume: elements.InputNumber,
tbxMaxMass: elements.InputNumber,
tbxCountSeats: elements.InputNumber,
tbxMaxSpeed: elements.InputNumber,
cbxWithTrailer: elements.Checkbox,
selectDealer: elements.Select,
selectDealerPerson: elements.Select,
selectDealerRewardCondition: elements.Select,
tbxDealerRewardSumm: elements.InputNumber,
selectDealerBroker: elements.Select,
selectDealerBrokerRewardCondition: elements.Select,
tbxDealerBrokerRewardSumm: elements.InputNumber,
selectIndAgent: elements.Select,
selectIndAgentRewardCondition: elements.Select,
tbxIndAgentRewardSumm: elements.InputNumber,
selectCalcDoubleAgent: elements.Select,
selectCalcDoubleAgentRewardCondition: elements.Select,
tbxCalcDoubleAgentRewardSumm: elements.InputNumber,
selectCalcBroker: elements.Select,
selectCalcBrokerRewardCondition: elements.Select,
tbxCalcBrokerRewardSum: elements.InputNumber,
selectCalcFinDepartment: elements.Select,
selectFinDepartmentRewardCondtion: elements.Select,
tbxFinDepartmentRewardSumm: elements.InputNumber,
cbxInsDecentral: elements.Switch,
radioInsKaskoType: elements.Radio,
tbxInsFranchise: elements.InputNumber,
cbxInsUnlimitDrivers: elements.Switch,
tbxInsAgeDrivers: elements.InputNumber,
tbxInsExpDrivers: elements.InputNumber,
tbxINNForCalc: elements.InputNumber,
selectGPSBrand: elements.Select,
selectGPSModel: elements.Select,
selectRegionRegistration: elements.Select,
selectTownRegistration: elements.Select,
radioInfuranceOPF: elements.Radio,
selectRegistration: elements.Select,
selectInsNSIB: elements.Select,
selectRequirementTelematic: elements.Select,
selectTracker: elements.Select,
selectTelematic: elements.Select,
selectTechnicalCard: elements.Select,
cbxLastPaymentRedemption: elements.Switch,
cbxPriceWithDiscount: elements.Switch,
cbxFullPriceWithDiscount: elements.Switch,
cbxCostIncrease: elements.Switch,
cbxInsurance: elements.Switch,
cbxRegistrationQuote: elements.Switch,
cbxTechnicalCardQuote: elements.Switch,
cbxNSIB: elements.Switch,
cbxQuoteRedemptionGraph: elements.Switch,
cbxShowFinGAP: elements.Switch,
tbxQuoteName: elements.Input,
radioQuoteContactGender: elements.Radio,
cbxDisableChecks: elements.Switch,
selectTarif: elements.Select,
tbxCreditRate: elements.InputNumber,
selectRate: elements.Select,
tbxMaxPriceChange: elements.InputNumber,
tbxImporterRewardPerc: elements.InputNumber,
tbxImporterRewardRub: elements.InputNumber,
selectLead: elements.Select,
selectOpportunity: elements.Select,
selectQuote: elements.Select,
cbxRecalcWithRevision: elements.Checkbox,
tbxIRR_Perc: elements.InputNumber,
tbxMileage: elements.InputNumber,
tbxEngineHours: elements.InputNumber,
radioCalcType: elements.Segmented,
tbxTotalPayments: elements.InputNumber,
radioObjectRegistration: elements.Radio,
selectObjectRegionRegistration: elements.Select,
tbxVehicleTaxInYear: elements.InputNumber,
tbxVehicleTaxInLeasingPeriod: elements.InputNumber,
selectObjectCategoryTax: elements.Select,
selectObjectTypeTax: elements.Select,
radioTypePTS: elements.Radio,
selectLegalClientRegion: elements.Select,
selectLegalClientTown: elements.Select,
selectSubsidy: elements.Select,
selectFuelCard: elements.Select,
tbxMinPriceChange: elements.InputNumber,
tbxBonusCoefficient: elements.InputNumber,
selectProduct: e.Select,
selectClientRisk: e.Select,
selectClientType: e.Select,
selectSupplierCurrency: e.Select,
tbxLeaseObjectPrice: e.InputNumber,
tbxLeaseObjectPriceWthtVAT: e.InputNumber,
tbxVATInLeaseObjectPrice: e.InputNumber,
tbxSupplierDiscountRub: e.InputNumber,
tbxSupplierDiscountPerc: e.InputNumber,
radioBalanceHolder: e.Radio,
tbxSaleBonus: e.InputNumber,
tbxFirstPaymentPerc: e.InputNumber,
tbxFirstPaymentRub: e.InputNumber,
radioLastPaymentRule: e.Segmented,
tbxLastPaymentPerc: e.InputNumber,
tbxLastPaymentRub: e.InputNumber,
selectImportProgram: e.Select,
tbxImportProgramSum: e.InputNumber,
tbxAddEquipmentPrice: e.InputNumber,
tbxRedemptionPaymentSum: e.InputNumber,
tbxLeasingPeriod: e.InputNumber,
radioGraphType: e.Radio,
tbxParmentsDecreasePercent: e.InputNumber,
selectSeasonType: e.Select,
selectHighSeasonStart: e.Select,
tbxComissionPerc: e.InputNumber,
tbxComissionRub: e.InputNumber,
selectLeaseObjectType: e.Select,
selectBrand: e.Select,
selectModel: e.Select,
selectConfiguration: e.Select,
cbxLeaseObjectUsed: e.Checkbox,
radioDeliveryTime: e.Segmented,
tbxLeaseObjectCount: e.InputNumber,
selectLeaseObjectUseFor: e.Select,
tbxLeaseObjectYear: e.InputNumber,
selectLeaseObjectCategory: e.Select,
selectEngineType: e.Select,
tbxLeaseObjectMotorPower: e.InputNumber,
tbxEngineVolume: e.InputNumber,
tbxMaxMass: e.InputNumber,
tbxCountSeats: e.InputNumber,
tbxMaxSpeed: e.InputNumber,
cbxWithTrailer: e.Checkbox,
selectDealer: e.Select,
selectDealerPerson: e.Select,
selectDealerRewardCondition: e.Select,
tbxDealerRewardSumm: e.InputNumber,
selectDealerBroker: e.Select,
selectDealerBrokerRewardCondition: e.Select,
tbxDealerBrokerRewardSumm: e.InputNumber,
selectIndAgent: e.Select,
selectIndAgentRewardCondition: e.Select,
tbxIndAgentRewardSumm: e.InputNumber,
selectCalcDoubleAgent: e.Select,
selectCalcDoubleAgentRewardCondition: e.Select,
tbxCalcDoubleAgentRewardSumm: e.InputNumber,
selectCalcBroker: e.Select,
selectCalcBrokerRewardCondition: e.Select,
tbxCalcBrokerRewardSum: e.InputNumber,
selectCalcFinDepartment: e.Select,
selectFinDepartmentRewardCondtion: e.Select,
tbxFinDepartmentRewardSumm: e.InputNumber,
cbxInsDecentral: e.Switch,
radioInsKaskoType: e.Radio,
tbxInsFranchise: e.InputNumber,
cbxInsUnlimitDrivers: e.Switch,
tbxInsAgeDrivers: e.InputNumber,
tbxInsExpDrivers: e.InputNumber,
tbxINNForCalc: e.InputNumber,
selectGPSBrand: e.Select,
selectGPSModel: e.Select,
selectRegionRegistration: e.Select,
selectTownRegistration: e.Select,
radioInfuranceOPF: e.Radio,
selectRegistration: e.Select,
selectInsNSIB: e.Select,
selectRequirementTelematic: e.Select,
selectTracker: e.Select,
selectTelematic: e.Select,
selectTechnicalCard: e.Select,
cbxLastPaymentRedemption: e.Switch,
cbxPriceWithDiscount: e.Switch,
cbxFullPriceWithDiscount: e.Switch,
cbxCostIncrease: e.Switch,
cbxInsurance: e.Switch,
cbxRegistrationQuote: e.Switch,
cbxTechnicalCardQuote: e.Switch,
cbxNSIB: e.Switch,
cbxQuoteRedemptionGraph: e.Switch,
cbxShowFinGAP: e.Switch,
tbxQuoteName: e.Input,
radioQuoteContactGender: e.Radio,
cbxDisableChecks: e.Switch,
selectTarif: e.Select,
tbxCreditRate: e.InputNumber,
selectRate: e.Select,
tbxMaxPriceChange: e.InputNumber,
tbxImporterRewardPerc: e.InputNumber,
tbxImporterRewardRub: e.InputNumber,
selectLead: e.Select,
selectOpportunity: e.Select,
selectQuote: e.Select,
cbxRecalcWithRevision: e.Checkbox,
tbxIRR_Perc: e.InputNumber,
tbxMileage: e.InputNumber,
tbxEngineHours: e.InputNumber,
radioCalcType: e.Segmented,
tbxTotalPayments: e.InputNumber,
radioObjectRegistration: e.Radio,
selectObjectRegionRegistration: e.Select,
tbxVehicleTaxInYear: e.InputNumber,
tbxVehicleTaxInLeasingPeriod: e.InputNumber,
selectObjectCategoryTax: e.Select,
selectObjectTypeTax: e.Select,
radioTypePTS: e.Radio,
selectLegalClientRegion: e.Select,
selectLegalClientTown: e.Select,
selectSubsidy: e.Select,
selectFuelCard: e.Select,
tbxMinPriceChange: e.InputNumber,
tbxBonusCoefficient: e.InputNumber,
selectLeasingWithoutKasko: e.Select,
/** Readonly Elements */
labelLeaseObjectRisk: elements.Text,
tbxInsKaskoPriceLeasePeriod: elements.InputNumber,
labelIrrInfo: elements.Text,
labelRegistrationDescription: elements.Text,
labelDepreciationGroup: elements.Text,
tbxSubsidySum: elements.InputNumber,
labelLeaseObjectRisk: e.Text,
tbxInsKaskoPriceLeasePeriod: e.InputNumber,
labelIrrInfo: e.Text,
labelRegistrationDescription: e.Text,
labelDepreciationGroup: e.Text,
tbxSubsidySum: e.InputNumber,
/** Button Elements */
btnCreateKP: elements.Button,
btnCalculate: elements.Button,
btnCreateKP: e.Button,
btnCalculate: e.Button,
/** Link Elements */
linkDownloadKp: elements.Link,
linkLeadUrl: elements.Link,
linkOpportunityUrl: elements.Link,
linkQuoteUrl: elements.Link,
linkDownloadKp: e.Link,
linkLeadUrl: e.Link,
linkOpportunityUrl: e.Link,
linkQuoteUrl: e.Link,
});
export default components;

View File

@ -6,10 +6,10 @@ import { useStore } from 'stores/hooks';
import Link from 'ui/elements/Link';
import Tooltip from 'ui/elements/Tooltip';
import buildReadonly from '../../builders/build-readonly';
import builders from '../elements-builders';
import components from '../elements-components';
import elementsProps from '../elements-props';
import titles from '../elements-titles';
import types from '../elements-types';
import map from '../map';
import type { RenderProps } from './types';
@ -26,7 +26,7 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
const valueName = map.selectLead;
const Component = components.selectLead;
const props = elementsProps.selectLead;
const builder = builders.selectLead;
const { builder } = types.selectLead();
const Element = builder(Component, {
elementName,
@ -58,7 +58,7 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
const valueName = map.selectOpportunity;
const Component = components.selectOpportunity;
const props = elementsProps.selectOpportunity;
const builder = builders.selectOpportunity;
const { builder } = types.selectOpportunity();
const Element = builder(Component, {
elementName,
@ -90,7 +90,7 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
const valueName = map.selectQuote;
const Component = components.selectQuote;
const props = elementsProps.selectQuote;
const builder = builders.selectQuote;
const { builder } = types.selectQuote();
const Element = builder(Component, {
elementName,
@ -122,7 +122,7 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
const valueName = map.tbxVehicleTaxInYear;
const Component = components.tbxVehicleTaxInYear;
const props = elementsProps.tbxVehicleTaxInYear;
const builder = builders.tbxVehicleTaxInYear;
const { builder } = types.tbxVehicleTaxInYear();
const Element = builder(Component, {
elementName,
@ -147,7 +147,7 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
const valueName = map.selectHighSeasonStart;
const Component = components.selectHighSeasonStart;
const props = elementsProps.selectHighSeasonStart;
const builder = builders.selectHighSeasonStart;
const { builder } = types.selectHighSeasonStart();
const Element = builder(Component, {
elementName,
@ -171,7 +171,7 @@ const overrideRender: Partial<Record<keyof typeof map, RenderProps>> = {
const valueName = map.selectSeasonType;
const Component = components.selectSeasonType;
const props = elementsProps.selectSeasonType;
const builder = builders.selectSeasonType;
const { builder } = types.selectSeasonType();
const Element = builder(Component, {
elementName,

View File

@ -1,9 +1,9 @@
/* eslint-disable object-curly-newline */
import { Container, Head } from 'Components/Layout/Element';
import builders from '../elements-builders';
import components from '../elements-components';
import elementsProps from '../elements-props';
import titles from '../elements-titles';
import types from '../elements-types';
import map from '../map';
const render = Object.keys(map).reduce((acc, elementName) => {
@ -11,7 +11,7 @@ const render = Object.keys(map).reduce((acc, elementName) => {
const valueName = map[elementName];
const Component = components[elementName];
const props = elementsProps[elementName];
const builder = builders[elementName];
const { builder } = types[elementName]();
const Element = builder(Component, {
elementName,

View File

@ -124,6 +124,7 @@ const titles: Record<ValuesElements | ActionElements, string> = {
tbxLeaseObjectPriceWthtVAT: 'Стоимость ПЛ без НДС',
tbxVATInLeaseObjectPrice: 'НДС в стоимости ПЛ',
tbxBonusCoefficient: 'Коэффициент снижения бонуса',
selectLeasingWithoutKasko: 'Лизинг без КАСКО',
/** Link Elements */
linkDownloadKp: '',

View File

@ -0,0 +1,182 @@
import { buildAction, buildOptions, buildReadonly, buildValue } from '../builders';
import type { Elements as ActionElements } from './map/actions';
import type { Elements as ValuesElements } from './map/values';
type ElementTypes = 'Value' | 'Readonly' | 'Options' | 'Action';
type Builders = typeof buildValue | typeof buildReadonly | typeof buildOptions | typeof buildAction;
type GetType = () => {
typeName: ElementTypes;
builder: Builders;
};
function wrapTypeGetters<G extends GetType, E extends Record<ElementTypes, G>>(arg: E) {
return arg;
}
const t = wrapTypeGetters({
Value: () => ({
typeName: 'Value',
builder: buildValue,
}),
Readonly: () => ({
typeName: 'Readonly',
builder: buildReadonly,
}),
Options: () => ({
typeName: 'Options',
builder: buildOptions,
}),
Action: () => ({
typeName: 'Action',
builder: buildAction,
}),
});
function wrapElementsTypes<T, E extends Record<ValuesElements | ActionElements, T>>(arg: E) {
return arg;
}
const types = wrapElementsTypes({
cbxRecalcWithRevision: t.Value,
tbxLeaseObjectPrice: t.Value,
tbxLeaseObjectPriceWthtVAT: t.Value,
tbxVATInLeaseObjectPrice: t.Value,
tbxEngineHours: t.Value,
tbxSupplierDiscountRub: t.Value,
tbxSupplierDiscountPerc: t.Value,
tbxLeasingPeriod: t.Value,
tbxFirstPaymentPerc: t.Value,
tbxFirstPaymentRub: t.Value,
tbxLastPaymentPerc: t.Value,
tbxLastPaymentRub: t.Value,
selectImportProgram: t.Options,
tbxImportProgramSum: t.Readonly,
tbxAddEquipmentPrice: t.Value,
tbxRedemptionPaymentSum: t.Value,
tbxParmentsDecreasePercent: t.Value,
tbxComissionPerc: t.Value,
tbxComissionRub: t.Value,
tbxSaleBonus: t.Value,
tbxIRR_Perc: t.Value,
tbxLeaseObjectCount: t.Value,
cbxWithTrailer: t.Value,
cbxLeaseObjectUsed: t.Value,
tbxMaxMass: t.Value,
tbxCountSeats: t.Value,
tbxMaxSpeed: t.Value,
tbxLeaseObjectYear: t.Value,
tbxLeaseObjectMotorPower: t.Value,
tbxEngineVolume: t.Value,
tbxDealerRewardSumm: t.Value,
tbxDealerBrokerRewardSumm: t.Value,
tbxIndAgentRewardSumm: t.Value,
tbxCalcDoubleAgentRewardSumm: t.Value,
tbxCalcBrokerRewardSum: t.Value,
tbxFinDepartmentRewardSumm: t.Value,
cbxInsDecentral: t.Value,
tbxInsFranchise: t.Value,
cbxInsUnlimitDrivers: t.Value,
tbxInsAgeDrivers: t.Value,
tbxInsExpDrivers: t.Value,
tbxINNForCalc: t.Value,
cbxLastPaymentRedemption: t.Value,
cbxPriceWithDiscount: t.Value,
cbxFullPriceWithDiscount: t.Value,
cbxCostIncrease: t.Value,
cbxInsurance: t.Value,
cbxRegistrationQuote: t.Value,
cbxTechnicalCardQuote: t.Value,
cbxNSIB: t.Value,
tbxQuoteName: t.Value,
cbxQuoteRedemptionGraph: t.Value,
cbxShowFinGAP: t.Value,
tbxCreditRate: t.Value,
tbxMaxPriceChange: t.Value,
tbxImporterRewardPerc: t.Value,
tbxImporterRewardRub: t.Value,
cbxDisableChecks: t.Value,
tbxMileage: t.Value,
tbxTotalPayments: t.Value,
tbxVehicleTaxInYear: t.Value,
tbxVehicleTaxInLeasingPeriod: t.Value,
tbxMinPriceChange: t.Value,
selectProduct: t.Options,
selectClientRisk: t.Options,
selectClientType: t.Options,
selectSupplierCurrency: t.Options,
selectSeasonType: t.Options,
selectHighSeasonStart: t.Options,
selectLeaseObjectType: t.Options,
selectBrand: t.Options,
selectModel: t.Options,
selectConfiguration: t.Options,
selectLeaseObjectUseFor: t.Options,
selectLeaseObjectCategory: t.Options,
selectEngineType: t.Options,
selectDealer: t.Options,
selectDealerPerson: t.Options,
selectDealerRewardCondition: t.Options,
selectDealerBroker: t.Options,
selectDealerBrokerRewardCondition: t.Options,
selectIndAgent: t.Options,
selectIndAgentRewardCondition: t.Options,
selectCalcDoubleAgent: t.Options,
selectCalcDoubleAgentRewardCondition: t.Options,
selectCalcBroker: t.Options,
selectCalcBrokerRewardCondition: t.Options,
selectCalcFinDepartment: t.Options,
selectFinDepartmentRewardCondtion: t.Options,
selectGPSBrand: t.Options,
selectGPSModel: t.Options,
selectRegionRegistration: t.Options,
selectTownRegistration: t.Options,
selectRegistration: t.Options,
selectInsNSIB: t.Options,
selectTracker: t.Options,
selectTelematic: t.Options,
selectTechnicalCard: t.Options,
selectTarif: t.Options,
selectRate: t.Options,
selectLead: t.Options,
selectOpportunity: t.Options,
selectQuote: t.Options,
selectObjectRegionRegistration: t.Options,
selectObjectCategoryTax: t.Options,
selectObjectTypeTax: t.Options,
selectLegalClientRegion: t.Options,
selectLegalClientTown: t.Options,
selectSubsidy: t.Options,
selectFuelCard: t.Options,
radioBalanceHolder: t.Options,
radioLastPaymentRule: t.Options,
radioGraphType: t.Options,
radioDeliveryTime: t.Options,
radioInsKaskoType: t.Options,
radioInfuranceOPF: t.Options,
selectRequirementTelematic: t.Options,
radioQuoteContactGender: t.Options,
radioCalcType: t.Options,
radioObjectRegistration: t.Options,
radioTypePTS: t.Options,
tbxBonusCoefficient: t.Value,
selectLeasingWithoutKasko: t.Options,
labelLeaseObjectRisk: t.Readonly,
tbxInsKaskoPriceLeasePeriod: t.Readonly,
labelIrrInfo: t.Readonly,
labelRegistrationDescription: t.Readonly,
labelDepreciationGroup: t.Readonly,
tbxSubsidySum: t.Readonly,
btnCreateKP: t.Action,
btnCalculate: t.Action,
linkDownloadKp: t.Readonly,
linkLeadUrl: t.Readonly,
linkOpportunityUrl: t.Readonly,
linkQuoteUrl: t.Readonly,
});
export default types;

View File

@ -135,6 +135,7 @@ const elementsToValues = wrapElementsMap({
labelIrrInfo: 'irrInfo',
labelRegistrationDescription: 'registrationDescription',
labelDepreciationGroup: 'depreciationGroup',
selectLeasingWithoutKasko: 'leasingWithoutKasko',
/** Link Elements */
linkDownloadKp: 'kpUrl',

View File

@ -48,8 +48,11 @@ function getPaymentsTableErrors($tables) {
function getInsuranceTableErrors($tables) {
const { insurance } = $tables;
const messages = insurance.validation.getMessages();
const title = insurance.validation.params.err_title;
return messages.map((message) => <Alert type="error" showIcon message={message} />);
return messages.map((message) => (
<Alert type="error" showIcon message={Message(title, message)} />
));
}
const Errors = observer(() => {

View File

@ -5,7 +5,12 @@ module.exports = {
name: 'crmgraphql',
localSchemaFile: `${__dirname}/graphql/crm.schema.graphql`,
},
excludes: ['**/graphql/**/*'],
includes: ['**/pages/**/*', '**/process/**/*', '**/Components/**/*'],
excludes: ['**/graphql/**/*.schema.graphql', '**/graphql/**/*.types.graphql'],
includes: [
'**/pages/**/*',
'**/process/**/*',
'**/Components/**/*',
'**/graphql/**/*.query.graphql',
],
},
};

View File

@ -46,6 +46,30 @@ export const selectHighSeasonStart = Array.from(
})
);
export const radioGraphType = [
{
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,
disabled: true,
},
];
const defaultOptions: CalculationOptions = {
radioLastPaymentRule: [
{
@ -73,28 +97,7 @@ const defaultOptions: CalculationOptions = {
},
],
radioGraphType: [
{
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,
},
],
radioGraphType,
selectSeasonType,
@ -503,6 +506,7 @@ const defaultOptions: CalculationOptions = {
linkOpportunityUrl: [],
linkQuoteUrl: [],
tbxBonusCoefficient: [],
selectLeasingWithoutKasko: [],
};
export default defaultOptions;

View File

@ -135,6 +135,7 @@ const defaultStatuses: CalculationStatuses = {
tbxBonusCoefficient: 'Default',
btnCalculate: 'Default',
btnCreateKP: 'Default',
selectLeasingWithoutKasko: 'Default',
};
export default defaultStatuses;

View File

@ -80,7 +80,7 @@ const defaultValues: CalculationValues = {
importerRewardRub: 0,
disableChecks: false,
insFranchise: 0,
rate: 'BASE',
rate: null,
calcType: 100_000_000,
totalPayments: 0,
vehicleTaxInYear: 0,
@ -137,6 +137,7 @@ const defaultValues: CalculationValues = {
bonusCoefficient: 1,
plPriceRub: 0,
discountRub: 0,
leasingWithoutKasko: null,
};
export default defaultValues;

View File

@ -123,6 +123,7 @@ const ValuesSchema = z.object({
VATInLeaseObjectPrice: z.number(),
engineHours: z.number(),
bonusCoefficient: z.number(),
leasingWithoutKasko: z.string().nullable(),
/** Link Values */
kpUrl: z.string().nullable(),

View File

@ -23,6 +23,9 @@ export const defaultOptions: Record<Insurance.Keys, Insurance.RowOptions> = {
value: 100_000_001,
},
],
insCost: [],
insuranceCompany: [],
policyType: [],
},
kasko: {
insured: [
@ -45,6 +48,9 @@ export const defaultOptions: Record<Insurance.Keys, Insurance.RowOptions> = {
value: 100_000_001,
},
],
insCost: [],
insuranceCompany: [],
policyType: [],
},
fingap: {
insured: [
@ -67,6 +73,9 @@ export const defaultOptions: Record<Insurance.Keys, Insurance.RowOptions> = {
value: 100_000_001,
},
],
insCost: [],
insuranceCompany: [],
policyType: [],
},
};

View File

@ -4,3 +4,4 @@ export const MIN_INSURANCE = 3000;
export const RATE = 7.75;
export const MAX_LEASING_PERIOD = 60;
export const MIN_LASTPAYMENT_NSIB = 3500;

View File

@ -0,0 +1,288 @@
query GetTransactionCurrencies {
transactioncurrencies {
label: currencyname
value: transactioncurrencyid
transactioncurrencyid
isocurrencycode
currencysymbol
}
}
query GetTransactionCurrency($currencyid: Uuid!) {
transactioncurrency(transactioncurrencyid: $currencyid) {
currencysymbol
isocurrencycode
}
}
query GetCurrencyChanges($currentDate: DateTime) {
evo_currencychanges(statecode: 0, evo_coursedate_param: { eq: $currentDate }) {
evo_currencychange
evo_ref_transactioncurrency
}
}
query GetLead($leadid: Uuid!) {
lead(leadid: $leadid) {
evo_agent_accountid
evo_double_agent_accountid
evo_broker_accountid
evo_fin_department_accountid
evo_opportunityidData {
label: name
value: opportunityid
}
}
}
query GetOpportunity($opportunityid: Uuid!) {
opportunity(opportunityid: $opportunityid) {
evo_leadid
}
}
query GetQuotes($leadid: Uuid!) {
quotes(evo_leadid: $leadid) {
label: evo_quotename
value: quoteid
}
}
query GetQuote($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_baseproductid
}
}
query GetTarifs($currentDate: DateTime) {
evo_tarifs(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_tarifid
evo_tarifid
evo_baseproductid
evo_min_period
evo_max_period
evo_delivery_time
evo_min_first_payment
evo_max_first_payment
evo_min_last_payment
evo_max_last_payment
evo_used
}
}
query GetTarif($tarifId: Uuid!) {
evo_tarif(evo_tarifid: $tarifId) {
evo_irr
evo_graphtype_exception
evo_seasons_type_exception
evo_min_decreasing_perc
}
}
query GetRates($currentDate: DateTime) {
evo_rates(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_rateid
evo_id
evo_tarifs {
evo_tarifid
}
}
}
query GetProducts($currentDate: DateTime) {
evo_baseproducts(
statecode: 0
evo_relation: [100000000]
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_baseproductid
evo_baseproductid
}
}
query GetProduct($productId: Uuid!) {
evo_baseproduct(evo_baseproductid: $productId) {
evo_leasingobject_types {
evo_leasingobject_typeid
}
evo_calculation_method
evo_baseproducts {
evo_baseproductid
}
evo_brands {
evo_brandid
}
}
}
query GetSubsidies($currentDate: DateTime) {
evo_subsidies(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_subsidyid
evo_subsidy_type
}
}
query GetSubsidy($subsidyId: Uuid!) {
evo_subsidy(evo_subsidyid: $subsidyId) {
evo_leasingobject_types {
evo_leasingobject_typeid
}
accounts {
accountid
}
evo_brands {
evo_brandid
}
evo_models {
evo_modelid
}
evo_subsidy_summ
evo_percent_subsidy
evo_max_subsidy_summ
}
}
query GetImportProgram($importProgramId: Uuid!) {
importProgram: evo_subsidy(evo_subsidyid: $importProgramId) {
evo_leasingobject_types {
evo_leasingobject_typeid
}
accounts {
accountid
}
evo_brands {
evo_brandid
}
evo_models {
evo_modelid
}
}
}
query GetRegions {
evo_regions {
label: evo_name
value: evo_regionid
}
}
query GetGPSBrands {
evo_gps_brands(statecode: 0) {
label: evo_name
value: evo_gps_brandid
}
}
query GetLeaseObjectTypes {
evo_leasingobject_types(statecode: 0) {
label: evo_name
value: evo_leasingobject_typeid
evo_leasingobject_typeid
}
}
query GetLeaseObjectType($leaseObjectTypeId: Uuid!) {
leaseObjectType: evo_leasingobject_type(evo_leasingobject_typeid: $leaseObjectTypeId) {
evo_vehicle_type
}
}
query GetBrands {
evo_brands(statecode: 0) {
label: evo_name
value: evo_brandid
evo_brandid
evo_vehicle_type
}
}
query GetModels($brandId: Uuid!) {
evo_models(statecode: 0, evo_brandid: $brandId) {
label: evo_name
value: evo_modelid
evo_modelid
evo_vehicle_type
}
}
query GetConfigurations($modelId: Uuid) {
evo_equipments(statecode: 0, evo_modelid: $modelId) {
label: evo_name
value: evo_equipmentid
}
}
query GetDealers {
dealers: accounts(evo_account_type: [100000001], statecode: 0, evo_legal_form: 100000001) {
label: name
value: accountid
accountid
}
}
query GetDealer($dealerId: Uuid!) {
dealer: account(accountid: $dealerId) {
evo_return_leasing_dealer
evo_broker_accountid
}
}
query GetDealerPersons($dealerId: Uuid!) {
dealerPersons: salon_providers(statecode: 0, salonaccountid: $dealerId) {
label: name
value: accountid
accountid
evo_inn
evo_kpp
}
}
query GetAgent($agentid: Uuid!) {
agent: account(accountid: $agentid) {
label: name
value: accountid
}
}
query GetRewardConditions($agentid: Uuid!, $currentDate: DateTime) {
evo_reward_conditions(
evo_agent_accountid: $agentid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: 0
evo_agency_agreementid_param: { has: true }
) {
label: evo_name
value: evo_reward_conditionid
evo_reward_summ
}
}
query GetRewardCondition($conditionId: Uuid!) {
evo_reward_condition(evo_reward_conditionid: $conditionId) {
evo_reward_summ
evo_reduce_reward
evo_min_reward_summ
evo_agency_agreementidData {
evo_required_reward
evo_reward_without_other_agent
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
@ -115,19 +116,204 @@ export type ActivitypartyInput = {
partyid_systemuser?: InputMaybe<Scalars['Uuid']>;
};
export type GetCurrencySymbolQueryVariables = Exact<{
export type GetTransactionCurrenciesQueryVariables = Exact<{ [key: string]: never; }>;
export type GetTransactionCurrenciesQuery = { __typename?: 'Query', transactioncurrencies: Array<{ __typename?: 'transactioncurrency', transactioncurrencyid: string | null, isocurrencycode: string | null, currencysymbol: string | null, label: string | null, value: string | null } | null> | null };
export type GetTransactionCurrencyQueryVariables = Exact<{
currencyid: Scalars['Uuid'];
}>;
export type GetCurrencySymbolQuery = { __typename?: 'Query', transactioncurrency: { __typename?: 'transactioncurrency', currencysymbol: string | null } | null };
export type GetTransactionCurrencyQuery = { __typename?: 'Query', transactioncurrency: { __typename?: 'transactioncurrency', currencysymbol: string | null, isocurrencycode: string | null } | null };
export type GetRisksDataFromQuoteQueryVariables = Exact<{
export type GetCurrencyChangesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetCurrencyChangesQuery = { __typename?: 'Query', evo_currencychanges: Array<{ __typename?: 'evo_currencychange', evo_currencychange: number | null, evo_ref_transactioncurrency: string | null } | null> | null };
export type GetLeadQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetLeadQuery = { __typename?: 'Query', lead: { __typename?: 'lead', evo_agent_accountid: string | null, evo_double_agent_accountid: string | null, evo_broker_accountid: string | null, evo_fin_department_accountid: string | null, evo_opportunityidData: { __typename?: 'opportunity', label: string | null, value: string | null } | null } | null };
export type GetOpportunityQueryVariables = Exact<{
opportunityid: Scalars['Uuid'];
}>;
export type GetOpportunityQuery = { __typename?: 'Query', opportunity: { __typename?: 'opportunity', evo_leadid: string | null } | null };
export type GetQuotesQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetQuotesQuery = { __typename?: 'Query', quotes: Array<{ __typename?: 'quote', label: string | null, value: string | null } | null> | null };
export type GetQuoteQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetRisksDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null }> | null } | null };
export type GetQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null } | null };
export type GetTarifsQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetTarifsQuery = { __typename?: 'Query', evo_tarifs: Array<{ __typename?: 'evo_tarif', evo_tarifid: string | null, evo_baseproductid: string | null, evo_min_period: number | null, evo_max_period: number | null, evo_delivery_time: Array<number> | null, evo_min_first_payment: number | null, evo_max_first_payment: number | null, evo_min_last_payment: number | null, evo_max_last_payment: number | null, evo_used: boolean | null, label: string | null, value: string | null } | null> | null };
export type GetTarifQueryVariables = Exact<{
tarifId: Scalars['Uuid'];
}>;
export type GetTarifQuery = { __typename?: 'Query', evo_tarif: { __typename?: 'evo_tarif', evo_irr: number | null, evo_graphtype_exception: Array<number> | null, evo_seasons_type_exception: Array<number> | null, evo_min_decreasing_perc: number | null } | null };
export type GetRatesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetRatesQuery = { __typename?: 'Query', evo_rates: Array<{ __typename?: 'evo_rate', evo_id: string | null, label: string | null, value: string | null, evo_tarifs: Array<{ __typename?: 'evo_tarif', evo_tarifid: string | null } | null> | null } | null> | null };
export type GetProductsQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetProductsQuery = { __typename?: 'Query', evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null, label: string | null, value: string | null } | null> | null };
export type GetProductQueryVariables = Exact<{
productId: Scalars['Uuid'];
}>;
export type GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array<number> | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null } | null };
export type GetSubsidiesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetSubsidiesQuery = { __typename?: 'Query', evo_subsidies: Array<{ __typename?: 'evo_subsidy', evo_subsidy_type: number | null, label: string | null, value: string | null } | null> | null };
export type GetSubsidyQueryVariables = Exact<{
subsidyId: Scalars['Uuid'];
}>;
export type GetSubsidyQuery = { __typename?: 'Query', evo_subsidy: { __typename?: 'evo_subsidy', evo_subsidy_summ: number | null, evo_percent_subsidy: number | null, evo_max_subsidy_summ: number | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, accounts: Array<{ __typename?: 'account', accountid: string | null } | null> | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null } | null };
export type GetImportProgramQueryVariables = Exact<{
importProgramId: Scalars['Uuid'];
}>;
export type GetImportProgramQuery = { __typename?: 'Query', importProgram: { __typename?: 'evo_subsidy', evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, accounts: Array<{ __typename?: 'account', accountid: string | null } | null> | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null, evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null } | null> | null } | null };
export type GetRegionsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetRegionsQuery = { __typename?: 'Query', evo_regions: Array<{ __typename?: 'evo_region', label: string | null, value: string | null } | null> | null };
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 GetLeaseObjectTypesQueryVariables = Exact<{ [key: string]: never; }>;
export type GetLeaseObjectTypesQuery = { __typename?: 'Query', evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null, label: string | null, value: string | null } | null> | null };
export type GetLeaseObjectTypeQueryVariables = Exact<{
leaseObjectTypeId: Scalars['Uuid'];
}>;
export type GetLeaseObjectTypeQuery = { __typename?: 'Query', leaseObjectType: { __typename?: 'evo_leasingobject_type', evo_vehicle_type: Array<number> | null } | null };
export type GetBrandsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetBrandsQuery = { __typename?: 'Query', evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null, evo_vehicle_type: Array<number> | null, label: string | null, value: string | null } | null> | null };
export type GetModelsQueryVariables = Exact<{
brandId: Scalars['Uuid'];
}>;
export type GetModelsQuery = { __typename?: 'Query', evo_models: Array<{ __typename?: 'evo_model', evo_modelid: string | null, evo_vehicle_type: number | null, label: string | null, value: string | null } | null> | null };
export type GetConfigurationsQueryVariables = Exact<{
modelId: InputMaybe<Scalars['Uuid']>;
}>;
export type GetConfigurationsQuery = { __typename?: 'Query', evo_equipments: Array<{ __typename?: 'evo_equipment', label: string | null, value: string | null } | null> | null };
export type GetDealersQueryVariables = Exact<{ [key: string]: never; }>;
export type GetDealersQuery = { __typename?: 'Query', dealers: Array<{ __typename?: 'account', accountid: string | null, label: string | null, value: string | null } | null> | null };
export type GetDealerQueryVariables = Exact<{
dealerId: Scalars['Uuid'];
}>;
export type GetDealerQuery = { __typename?: 'Query', dealer: { __typename?: 'account', evo_return_leasing_dealer: boolean | null, evo_broker_accountid: string | null } | null };
export type GetDealerPersonsQueryVariables = Exact<{
dealerId: Scalars['Uuid'];
}>;
export type GetDealerPersonsQuery = { __typename?: 'Query', dealerPersons: Array<{ __typename?: 'account', accountid: string | null, evo_inn: string | null, evo_kpp: string | null, label: string | null, value: string | null } | null> | null };
export type GetAgentQueryVariables = Exact<{
agentid: Scalars['Uuid'];
}>;
export type GetAgentQuery = { __typename?: 'Query', agent: { __typename?: 'account', label: string | null, value: string | null } | null };
export type GetRewardConditionsQueryVariables = Exact<{
agentid: Scalars['Uuid'];
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetRewardConditionsQuery = { __typename?: 'Query', evo_reward_conditions: Array<{ __typename?: 'evo_reward_condition', evo_reward_summ: number | null, label: string | null, value: string | null } | null> | null };
export type GetRewardConditionQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
}>;
export type GetRewardConditionQuery = { __typename?: 'Query', evo_reward_condition: { __typename?: 'evo_reward_condition', evo_reward_summ: number | null, evo_reduce_reward: boolean | null, evo_min_reward_summ: number | null, evo_agency_agreementidData: { __typename?: 'evo_agency_agreement', evo_required_reward: boolean | null, evo_reward_without_other_agent: boolean | null } | null } | null };
export type GetConfiguratorDataFromQuoteQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetConfiguratorDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null } | null };
export type GetFingapDataFromQuoteQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetFingapDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_fingap_accountid: string | null, evo_fingap_payer: number | null, evo_fingap_period: number | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null } | null };
export type GetFinGapAddProductTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
@ -143,38 +329,11 @@ export type GetInsuranceDataQueryVariables = Exact<{
export type GetInsuranceDataQuery = { __typename?: 'Query', osago: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, kasko: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null, fingap: Array<{ __typename?: 'account', value: string | null, label: string | null } | null> | null };
export type GetMainOptionsQueryVariables = Exact<{
export type GetAddproductTypesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetMainOptionsQuery = { __typename?: 'Query', selectSupplierCurrency: Array<{ __typename?: 'transactioncurrency', currencysymbol: string | null, label: string | null, value: string | null } | null> | null, selectProduct: Array<{ __typename?: 'evo_baseproduct', label: string | null, value: string | null } | null> | null, selectLeaseObjectType: Array<{ __typename?: 'evo_leasingobject_type', label: string | null, value: string | null } | null> | null, selectGPSBrand: Array<{ __typename?: 'evo_gps_brand', label: string | null, value: string | null } | null> | null };
export type GetSubsidiesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetSubsidiesQuery = { __typename?: 'Query', evo_subsidies: Array<{ __typename?: 'evo_subsidy', evo_subsidy_type: number | null, label: string | null, value: string | null } | null> | null };
export type GetRegionsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetRegionsQuery = { __typename?: 'Query', evo_regions: Array<{ __typename?: 'evo_region', label: string | null, value: string | null } | null> | null };
export type GetBrandsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetBrandsQuery = { __typename?: 'Query', selectBrand: Array<{ __typename?: 'evo_brand', label: string | null, value: string | null } | null> | null };
export type GetDealersQueryVariables = Exact<{ [key: string]: never; }>;
export type GetDealersQuery = { __typename?: 'Query', selectDealer: Array<{ __typename?: 'account', label: string | null, value: string | null } | null> | null };
export type GetAddproductTypesQueryVariables = Exact<{ [key: string]: never; }>;
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 GetOwnerDataQueryVariables = Exact<{
@ -184,32 +343,6 @@ export type GetOwnerDataQueryVariables = Exact<{
export type GetOwnerDataQuery = { __typename?: 'Query', selectLead: Array<{ __typename?: 'lead', label: string | null, value: string | null } | null> | null, selectOpportunity: Array<{ __typename?: 'opportunity', label: string | null, value: string | null } | null> | null };
export type GetTransactionCurrenciesQueryVariables = Exact<{ [key: string]: never; }>;
export type GetTransactionCurrenciesQuery = { __typename?: 'Query', transactioncurrencies: Array<{ __typename?: 'transactioncurrency', isocurrencycode: string | null, transactioncurrencyid: string | null } | null> | null };
export type GetOpportunityByLeadQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetOpportunityByLeadQuery = { __typename?: 'Query', lead: { __typename?: 'lead', evo_opportunityidData: { __typename?: 'opportunity', label: string | null, value: string | null } | null } | null };
export type GetLeadidByOpportunityQueryVariables = Exact<{
opportunityid: Scalars['Uuid'];
}>;
export type GetLeadidByOpportunityQuery = { __typename?: 'Query', opportunity: { __typename?: 'opportunity', evo_leadid: string | null } | null };
export type GetQuotesByLeadQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetQuotesByLeadQuery = { __typename?: 'Query', quotes: Array<{ __typename?: 'quote', label: string | null, value: string | null } | null> | null };
export type GetLeadUrlQueryVariables = Exact<{
id: Scalars['Uuid'];
}>;
@ -231,26 +364,33 @@ export type GetQuoteUrlQueryVariables = Exact<{
export type GetQuoteUrlQuery = { __typename?: 'Query', entity: { __typename?: 'quote', link: string | null } | null };
export type GetLeasingObjectDataFromQuoteQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetLeasingObjectDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_modelid: string | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | 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 GetPaymentsDataFromQuoteQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetPaymentsDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_period: number | null, evo_accept_period: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_graphs: Array<{ __typename?: 'evo_graph', createdon: string, evo_sumpay_withnds: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_payment_ratio: number | null }> | null }> | null } | null };
export type GetPaymentsDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_period: number | null, evo_accept_period: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_graphs: Array<{ __typename?: 'evo_graph', createdon: string | null, evo_sumpay_withnds: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_payment_ratio: number | null } | null> | null } | null> | null } | null };
export type GetCurrencyChangesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
export type GetPriceDataFromQuoteQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetCurrencyChangesQuery = { __typename?: 'Query', evo_currencychanges: Array<{ __typename?: 'evo_currencychange', evo_currencychange: number | null, evo_ref_transactioncurrency: string | null } | null> | null };
export type GetCurrencyIsoCodeQueryVariables = Exact<{
id: Scalars['Uuid'];
}>;
export type GetCurrencyIsoCodeQuery = { __typename?: 'Query', transactioncurrency: { __typename?: 'transactioncurrency', isocurrencycode: string | null } | null };
export type GetPriceDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_supplier_currency_price: number | null, evo_price_without_nds_supplier_currency: number | null, evo_nds_in_price_supplier_currency: number | null, evo_last_payment_rub: number | null, evo_last_payment_calc: number | null, evo_transactioncurrencyid: string | null, evo_discount_supplier_currency: number | null, evo_discount_perc: number | null, evo_comission_perc: number | null, evo_comission_rub: number | null, evo_sale_bonus: number | null } | null };
export type GetRewardRulesQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
@ -266,87 +406,47 @@ export type GetAgentsDataFromQuoteQueryVariables = Exact<{
export type GetAgentsDataFromQuoteQuery = { __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 type GetRewardConditionsQueryVariables = Exact<{
agentid: Scalars['Uuid'];
currentDate: InputMaybe<Scalars['DateTime']>;
}>;
export type GetRewardConditionsQuery = { __typename?: 'Query', evo_reward_conditions: Array<{ __typename?: 'evo_reward_condition', evo_reward_summ: number | null, label: string | null, value: string | null } | null> | null };
export type GetRewardSummQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
}>;
export type GetRewardSummQuery = { __typename?: 'Query', evo_reward_condition: { __typename?: 'evo_reward_condition', evo_reward_summ: number | null } | null };
export type GetRewardConditionQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
}>;
export type GetRewardConditionQuery = { __typename?: 'Query', evo_reward_condition: { __typename?: 'evo_reward_condition', evo_reward_summ: number | null, evo_reduce_reward: boolean | null, evo_min_reward_summ: number | null, evo_agency_agreementidData: { __typename?: 'evo_agency_agreement', evo_required_reward: boolean | null } | null } | null };
export type GetAgentAccountIdFromLeadQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetAgentAccountIdFromLeadQuery = { __typename?: 'Query', lead: { __typename?: 'lead', agentid: string | null } | null };
export type GetDoubleAgentAccountIdQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetDoubleAgentAccountIdQuery = { __typename?: 'Query', lead: { __typename?: 'lead', agentid: string | null } | null };
export type GetBrokerAccountIdQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetBrokerAccountIdQuery = { __typename?: 'Query', lead: { __typename?: 'lead', agentid: string | null } | null };
export type GetFinDepartmentAccountIdQueryVariables = Exact<{
leadid: Scalars['Uuid'];
}>;
export type GetFinDepartmentAccountIdQuery = { __typename?: 'Query', lead: { __typename?: 'lead', agentid: string | null } | null };
export type GetAgentQueryVariables = Exact<{
agentid: Scalars['Uuid'];
}>;
export type GetAgentQuery = { __typename?: 'Query', agent: { __typename?: 'account', label: string | null, value: string | null } | null };
export type GetRewardWithoutOtherAgentQueryVariables = Exact<{
conditionId: Scalars['Uuid'];
}>;
export type GetRewardWithoutOtherAgentQuery = { __typename?: 'Query', evo_reward_condition: { __typename?: 'evo_reward_condition', evo_agency_agreementidData: { __typename?: 'evo_agency_agreement', evo_reward_without_other_agent: boolean | null } | null } | null };
export type GetDealerReturnLeasingQueryVariables = Exact<{
dealerId: Scalars['Uuid'];
}>;
export type GetDealerReturnLeasingQuery = { __typename?: 'Query', dealer: { __typename?: 'account', evo_return_leasing_dealer: boolean | null } | null };
export type GetDealerPersonQueryVariables = Exact<{
dealerId: Scalars['Uuid'];
}>;
export type GetDealerPersonQuery = { __typename?: 'Query', salon_providers: Array<{ __typename?: 'account', evo_inn: string | null, evo_kpp: string | null, label: string | null, value: string | null } | null> | null };
export type GetBrokerAccountIdFromDealerQueryVariables = Exact<{
dealerId: Scalars['Uuid'];
}>;
export type GetBrokerAccountIdFromDealerQuery = { __typename?: 'Query', dealer: { __typename?: 'account', evo_broker_accountid: string | null } | null };
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>;
export const GetLeadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLead"},"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":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_opportunityidData"},"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<GetLeadQuery, GetLeadQueryVariables>;
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"}}]}}]}}]} as unknown as DocumentNode<GetOpportunityQuery, GetOpportunityQueryVariables>;
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 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"}}]}}]}}]} as unknown as DocumentNode<GetTarifQuery, GetTarifQueryVariables>;
export const GetRatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRates"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}}]}}]}}]}}]} as unknown as DocumentNode<GetRatesQuery, GetRatesQueryVariables>;
export const GetProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProducts"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_relation"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode<GetProductsQuery, GetProductsQueryVariables>;
export const GetProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_baseproductid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"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_calculation_method"}},{"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_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}}]}}]}}]} as unknown as DocumentNode<GetProductQuery, GetProductQueryVariables>;
export const GetSubsidiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidies"},"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_subsidies"},"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_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_type"}}]}}]}}]} as unknown as DocumentNode<GetSubsidiesQuery, GetSubsidiesQueryVariables>;
export const GetSubsidyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidy"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"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":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_percent_subsidy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_subsidy_summ"}}]}}]}}]} as unknown as DocumentNode<GetSubsidyQuery, GetSubsidyQueryVariables>;
export const GetImportProgramDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetImportProgram"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"importProgram"},"name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"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":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode<GetImportProgramQuery, GetImportProgramQueryVariables>;
export const GetRegionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_regions"},"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_regionid"}}]}}]}}]} as unknown as DocumentNode<GetRegionsQuery, GetRegionsQueryVariables>;
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 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","alias":{"kind":"Name","value":"leaseObjectType"},"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"}}]}}]}}]} 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 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 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":"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 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>;
export const GetDealerPersonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealerPersons"},"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":"dealerPersons"},"name":{"kind":"Name","value":"salon_providers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"salonaccountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}}}],"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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kpp"}}]}}]}}]} as unknown as DocumentNode<GetDealerPersonsQuery, GetDealerPersonsQueryVariables>;
export const GetAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agent"},"name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}}}],"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"}}]}}]}}]} as unknown as DocumentNode<GetAgentQuery, GetAgentQueryVariables>;
export const GetRewardConditionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardConditions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}},{"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_reward_conditions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_agent_accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}}},{"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":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_agency_agreementid_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"has"},"value":{"kind":"BooleanValue","value":true}}]}}],"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_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reward_summ"}}]}}]}}]} as unknown as DocumentNode<GetRewardConditionsQuery, GetRewardConditionsQueryVariables>;
export const GetRewardConditionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardCondition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reduce_reward"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agency_agreementidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_required_reward"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reward_without_other_agent"}}]}}]}}]}}]} as unknown as DocumentNode<GetRewardConditionQuery, GetRewardConditionQueryVariables>;
export const GetConfiguratorDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguratorDataFromQuote"},"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<GetConfiguratorDataFromQuoteQuery, GetConfiguratorDataFromQuoteQueryVariables>;
export const GetFingapDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFingapDataFromQuote"},"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_fingap_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode<GetFingapDataFromQuoteQuery, GetFingapDataFromQuoteQueryVariables>;
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 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 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 GetOwnerDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOwnerData"},"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","alias":{"kind":"Name","value":"selectLead"},"name":{"kind":"Name","value":"leads"},"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":"fullname"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"leadid"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"selectOpportunity"},"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<GetOwnerDataQuery, GetOwnerDataQueryVariables>;
export const GetLeadUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeadUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetLeadUrlQuery, GetLeadUrlQueryVariables>;
export const GetOpportunityUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunityUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetOpportunityUrlQuery, GetOpportunityUrlQueryVariables>;
export const GetQuoteUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetQuoteUrlQuery, GetQuoteUrlQueryVariables>;
export const GetLeasingObjectDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingObjectDataFromQuote"},"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_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode<GetLeasingObjectDataFromQuoteQuery, GetLeasingObjectDataFromQuoteQueryVariables>;
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 GetPaymentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentsDataFromQuote"},"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<GetPaymentsDataFromQuoteQuery, GetPaymentsDataFromQuoteQueryVariables>;
export const GetPriceDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPriceDataFromQuote"},"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_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_nds_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}}]}}]}}]} as unknown as DocumentNode<GetPriceDataFromQuoteQuery, GetPriceDataFromQuoteQueryVariables>;
export const GetRewardRulesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardRules"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_calc_reward_rules"}}]}}]}}]} as unknown as DocumentNode<GetRewardRulesQuery, GetRewardRulesQueryVariables>;
export const GetAgentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentsDataFromQuote"},"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_supplier_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_person_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_summ"}}]}}]}}]} as unknown as DocumentNode<GetAgentsDataFromQuoteQuery, GetAgentsDataFromQuoteQueryVariables>;

View File

@ -42,8 +42,10 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^2.16.3",
"@graphql-codegen/typed-document-node": "^2.3.13",
"@graphql-codegen/typescript": "^2.8.7",
"@graphql-codegen/typescript-operations": "^2.5.12",
"@graphql-typed-document-node/patch-cli": "^3.0.9",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/node": "^18.11.18",

View File

@ -1,8 +1,21 @@
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 { reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
import type { BaseOption } from 'ui/elements/types';
function hasInvalidValueOrOptions(value: unknown, options: BaseOption<unknown>[]) {
if (value === null) {
return false;
}
return (value && !options?.length) || !options.some((x) => x.value === value);
}
export default function validationReactions({ store }: ReactionsContext) {
const { $calculation, $tables } = store;
reaction(
() => {
const hasElementsErrors = Object.values($calculation.$validation).some(
@ -27,4 +40,98 @@ export default function validationReactions({ store }: ReactionsContext) {
fireImmediately: true,
}
);
/**
* Проверяем, что выбранное значение элемента есть в списке
*/
function validateOptionsElement(elementName: Values.Elements) {
const type = types[elementName];
if (type().typeName !== 'Options') {
return;
}
const element = $calculation.element(elementName);
reaction(
() => {
const options = element.getOptions();
const value = element.getValue();
return {
value,
options,
};
},
({ value, options }) => {
element.validate({
invalid: hasInvalidValueOrOptions(value, options),
message: 'Выбранное значение отсутствует в списке',
silent: true,
});
},
{
delay: 100,
}
);
reaction(
() => element.getOptions(),
(options) => {
const value = element.getValue();
if (hasInvalidValueOrOptions(value, options)) {
element.resetValue();
}
},
{
delay: 100,
}
);
}
(Object.keys(types) as Values.Elements[]).forEach((elementName) =>
validateOptionsElement(elementName)
);
function validateInsuranceCompany(rowKey: Insurance.Keys) {
const row = $tables.insurance.row(rowKey);
reaction(
() => {
const options = row.getOptions('insuranceCompany');
const value = row.getValue('insuranceCompany');
return {
value,
options,
};
},
({ value, options }) => {
$tables.insurance.validate({
invalid: hasInvalidValueOrOptions(value, options),
message: 'Выбранное значение отсутствует в списке',
silent: true,
});
},
{
delay: 100,
}
);
reaction(
() => row.getOptions('insuranceCompany'),
(options) => {
const value = row.getValue('insuranceCompany');
if (hasInvalidValueOrOptions(value, options)) {
row.resetValue('insuranceCompany');
}
},
{
delay: 100,
}
);
}
validateInsuranceCompany('kasko');
validateInsuranceCompany('osago');
validateInsuranceCompany('fingap');
}

View File

@ -0,0 +1,41 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import initializeApollo from 'apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types';
const QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE = gql`
query GetConfiguratorDataFromQuote($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_baseproductid
}
}
`;
type QuotePaymentsProcessData = {
values: Partial<GetQuoteDataOutput['values']>;
};
export default async function getConfiguratorDataFromKP({
values: { quote: quoteId },
}: GetQuoteDataInput): Promise<QuotePaymentsProcessData> {
const apolloClient = initializeApollo();
const {
data: { quote },
} = await apolloClient.query<
CRMTypes.GetConfiguratorDataFromQuoteQuery,
CRMTypes.GetConfiguratorDataFromQuoteQueryVariables
>({
query: QUERY_GET_CONFIGURATOR_DATA_FROM_QUOTE,
variables: {
quoteId,
},
});
return {
values: {
product: quote?.evo_baseproductid,
},
};
}

View File

@ -0,0 +1,370 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { radioGraphType, selectSeasonType } from 'config/default-options';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import * as CRMTypes from 'graphql/crm.types';
import { reaction } from 'mobx';
import { SEASON_TYPES } from 'process/payments/lib/seasons-constants';
import type { ReactionsContext } from 'process/types';
import { diff } from 'radash';
import { normalizeOptions } from 'tools';
dayjs.extend(utc);
export default function commonReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation } = store;
reaction(
() => {
const { product, subsidy, importProgram, dealer } = $calculation.$values.values;
return {
productId: product,
subsidyId: subsidy,
importProgramId: importProgram,
dealerId: dealer,
};
},
async ({ productId, subsidyId, importProgramId, dealerId }) => {
/**
#1
* DYN-190 При выборе значения в поле selectSubsidy необходимо добавить
* фильтрацию в полях при условии что selectSubsidy не равно null:
Тип предмета лизинга selectLeaseObjectType
если с записью Субсидия нет связанных Типов предмета лизинга,
то указываются все записи согласно текущей фильтрации,
иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectSubsidy
#2
* На изменение поля Продукт selectProduct добавляем фильтрацию списков:
в поле Тип предмета лизинга selectLeaseObjectType - указываются те, которые связаны с продуктом.
Если с Продуктом нет связанных Типов предмета лизинга,
то указывается весь список. Это надо добавить в текущие условия фильтрации данного поля
#3
Тип предмета лизинга selectLeaseObjectType
если с записью Субсидия нет связанных Типов предмета лизинга,
то указываются все записи согласно текущей фильтрации,
иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectImportProgram
*/
let {
data: { evo_leasingobject_types: leaseObjectTypes = [] },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypesDocument,
});
let {
data: { dealers = [] },
} = await apolloClient.query({
query: CRMTypes.GetDealersDocument,
});
let dealerPersons: CRMTypes.GetDealerPersonsQuery['dealerPersons'] = [];
if (dealerId) {
const { data } = await apolloClient.query({
query: CRMTypes.GetDealerPersonsDocument,
variables: {
dealerId,
},
});
({ dealerPersons = [] } = data);
}
if (productId) {
const {
data: { evo_baseproduct },
} = await apolloClient.query({
query: CRMTypes.GetProductDocument,
variables: {
productId,
},
});
if (leaseObjectTypes) {
leaseObjectTypes = leaseObjectTypes?.filter(
(leasingObjectType) =>
!evo_baseproduct?.evo_leasingobject_types?.length ||
evo_baseproduct.evo_leasingobject_types.filter(
(baseproduct_evo_leasingobject_type) =>
baseproduct_evo_leasingobject_type?.evo_leasingobject_typeid ===
leasingObjectType?.evo_leasingobject_typeid
)?.length
);
}
}
if (subsidyId) {
const {
data: { evo_subsidy: subsidy },
} = await apolloClient.query({
query: CRMTypes.GetSubsidyDocument,
variables: {
subsidyId,
},
});
if (leaseObjectTypes) {
leaseObjectTypes = leaseObjectTypes?.filter(
(leasingObjectType) =>
!subsidy?.evo_leasingobject_types?.length ||
subsidy.evo_leasingobject_types.filter(
(subsidy_evo_leasingobject_type) =>
subsidy_evo_leasingobject_type?.evo_leasingobject_typeid ===
leasingObjectType?.evo_leasingobject_typeid
)?.length
);
}
if (dealers) {
dealers = dealers.filter(
(dealer) =>
!subsidy?.accounts?.length ||
subsidy.accounts.filter(
(subsidy_account) => subsidy_account?.accountid === dealer?.accountid
)?.length
);
}
if (dealerPersons) {
dealerPersons = dealerPersons.filter(
(dealerPerson) =>
!subsidy?.accounts?.length ||
subsidy.accounts.filter(
(subsidy_account) => subsidy_account?.accountid === dealerPerson?.accountid
)?.length
);
}
}
if (importProgramId) {
const {
data: { importProgram },
} = await apolloClient.query<
CRMTypes.GetImportProgramQuery,
CRMTypes.GetImportProgramQueryVariables
>({
query: CRMTypes.GetImportProgramDocument,
variables: {
importProgramId,
},
});
if (leaseObjectTypes) {
leaseObjectTypes = leaseObjectTypes?.filter(
(leasingObjectType) =>
!importProgram?.evo_leasingobject_types?.length ||
importProgram.evo_leasingobject_types.filter(
(importProgram_evo_leasingobject_type) =>
importProgram_evo_leasingobject_type?.evo_leasingobject_typeid ===
leasingObjectType?.evo_leasingobject_typeid
)?.length
);
}
if (dealers) {
dealers = dealers.filter(
(dealer) =>
!importProgram?.accounts?.length ||
importProgram.accounts.filter(
(importProgram_account) => importProgram_account?.accountid === dealer?.accountid
)?.length
);
}
if (dealerPersons) {
dealerPersons = dealerPersons.filter(
(dealerPerson) =>
!importProgram?.accounts?.length ||
importProgram.accounts.filter(
(importProgram_account) =>
importProgram_account?.accountid === dealerPerson?.accountid
)?.length
);
}
}
$calculation.element('selectLeaseObjectType').setOptions(normalizeOptions(leaseObjectTypes));
$calculation.element('selectDealer').setOptions(normalizeOptions(dealers));
$calculation.element('selectDealerPerson').setOptions(normalizeOptions(dealerPersons));
}
);
/**
* На изменение поля Тариф selectTarif добавляем фильрацию в полях:
в поле Вид графика radioGraphType должны закрываться значения для выбора,
которые указаны в массиве поля "Недопустимые виды графиков" evo_graphtype_exception.
Если в массиве пусто, значит допустимы все значения
*/
reaction(
() => $calculation.element('selectTarif').getValue(),
async (tarifId) => {
let evo_tarif: CRMTypes.GetTarifQuery['evo_tarif'] = null;
if (tarifId) {
const { data } = await apolloClient.query({
query: CRMTypes.GetTarifDocument,
variables: {
tarifId,
},
});
({ evo_tarif } = data);
}
if (evo_tarif?.evo_graphtype_exception?.length) {
const filteredGraphTypes = radioGraphType.filter(
(type) => !evo_tarif?.evo_graphtype_exception?.includes(type.value)
);
$calculation.element('radioGraphType').setOptions(filteredGraphTypes);
} else {
$calculation.element('radioGraphType').resetOptions();
}
}
);
/**
* в поле Тип дегрессии/сезонности selectSeasonType должны отображаться только те значения,
* которых нет в массиве поля "Недопустимые Типы дегрессий/сезонности" evo_seasons_type_exception
* (добавить в текущую фильтрацию поля)
*/
reaction(
() => ({
tarif: $calculation.element('selectTarif').getValue(),
graphType: $calculation.element('radioGraphType').getValue(),
}),
async ({ tarif, graphType }) => {
let evo_tarif: CRMTypes.GetTarifQuery['evo_tarif'] = null;
if (tarif) {
const { data } = await apolloClient.query({
query: CRMTypes.GetTarifDocument,
variables: {
tarifId: tarif,
},
});
({ evo_tarif } = data);
}
const seasonTypesExeption = evo_tarif?.evo_seasons_type_exception || [];
let seasonTypes: Array<number> = [];
if (graphType === 100_000_001 || graphType === 100_000_003) {
seasonTypes = SEASON_TYPES[graphType];
}
const allowedSeasonTypes = diff(seasonTypes, seasonTypesExeption);
const filteredSeasonTypesOptions = selectSeasonType.filter((seasonTypeOption) =>
allowedSeasonTypes.includes(seasonTypeOption.value)
);
$calculation.element('selectSeasonType').setOptions(filteredSeasonTypesOptions);
}
);
/**
* При изменении Продукта selectProduct необходимо в поле "Расчет от"
* radioCalcType фильтровать значения согласно списку
* в поле "Доступные Методы расчета в калькуляторе" evo_calculation_method в selectProduct
*/
reaction(
() => $calculation.element('selectProduct').getValue(),
async (productId) => {
if (!productId) {
$calculation.element('radioCalcType').resetOptions();
return;
}
const {
data: { evo_baseproduct },
} = await apolloClient.query<CRMTypes.GetProductQuery, CRMTypes.GetProductQueryVariables>({
query: CRMTypes.GetProductDocument,
variables: {
productId,
},
});
if (evo_baseproduct?.evo_calculation_method) {
const filteredCalcTypeOptions = $calculation
.element('radioCalcType')
.getOptions()
.filter((calcType) => evo_baseproduct.evo_calculation_method?.includes(calcType.value));
$calculation.element('radioCalcType').setOptions(filteredCalcTypeOptions);
} else {
$calculation.element('radioCalcType').resetOptions();
}
}
);
/* eslint-disable max-len */
/**
* Добавить фильтр для поля selectProduct (работает на загрузку КП)
* если recalcWithRevision=True, то в списке поля selectProduct должны отображаться
* записи quote.evo_baseproductid из поля Предложение selectQuote + дать возможность выбирать продукт,
* связанный с оquote.evo_baseproductid из поля Предложение selectQuote по связи evo_evo_baseproduct_evo_baseproduct
/* eslint-enable */
reaction(
() => $calculation.element('selectQuote').getValue(),
async (quoteId) => {
const currentDate = dayjs().utc(false).toISOString();
const {
data: { evo_baseproducts },
} = await apolloClient.query({
query: CRMTypes.GetProductsDocument,
variables: {
currentDate,
},
fetchPolicy: 'network-only',
});
if (!$calculation.element('cbxRecalcWithRevision').getValue()) {
$calculation.element('selectProduct').setOptions(normalizeOptions(evo_baseproducts));
return;
}
let quote: CRMTypes.GetQuoteQuery['quote'] = null;
if (quoteId) {
const { data } = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: {
quoteId,
},
});
({ quote } = data);
}
if (quote?.evo_baseproductid) {
const {
data: { evo_baseproduct },
} = await apolloClient.query<CRMTypes.GetProductQuery, CRMTypes.GetProductQueryVariables>({
query: CRMTypes.GetProductDocument,
variables: {
productId: quote?.evo_baseproductid,
},
});
const allowedProducts = evo_baseproduct?.evo_baseproducts?.map(
(product) => product?.evo_baseproductid
);
const filteredSelectProductOptions = normalizeOptions(
evo_baseproducts?.filter((product) =>
allowedProducts?.includes(product?.evo_baseproductid)
)
);
$calculation.element('selectProduct').setOptions(filteredSelectProductOptions);
} else {
$calculation.element('selectProduct').setOptions(normalizeOptions(evo_baseproducts));
}
}
);
}

View File

@ -0,0 +1,3 @@
export { default as filters } from './filters';
export { default as validation } from './validation';
export { default as values } from './values';

View File

@ -0,0 +1,45 @@
import * as CRMTypes from 'graphql/crm.types';
import { reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
export default function validationReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation } = store;
/* eslint-disable max-len */
/**
* На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку:
* Если значение поля меньше значения в поле "Минимальный % убывания платежей" evo_min_decreasing_perc из записи,
* указанной в поле ТарифselectTarif , то поле Процет убывания платежей tbxParmentsDecreasePercent должно обводиться красной рамкой
* и выводиться сообщение "Процент убывания не может быть меньше минимального значения по данному тарифу
- <указывается значение из поля "Минимальный % убывания платежей">, иначе красная рамка снимается.
* При красной рамке в данном поле нельзя осуществить расчет графика.
*/
/* eslint-enable */
reaction(
() => ({
parmentsDecreasePercent: $calculation.element('tbxParmentsDecreasePercent').getValue(),
tarifId: $calculation.element('selectTarif').getValue(),
}),
async ({ parmentsDecreasePercent, tarifId }) => {
// eslint-disable-next-line @typescript-eslint/naming-convention
let evo_tarif: CRMTypes.GetTarifQuery['evo_tarif'] = null;
if (tarifId) {
const { data } = await apolloClient.query({
query: CRMTypes.GetTarifDocument,
variables: {
tarifId,
},
});
({ evo_tarif } = data);
}
$calculation.element('tbxParmentsDecreasePercent').validate({
invalid:
!!evo_tarif?.evo_min_decreasing_perc &&
parmentsDecreasePercent < evo_tarif?.evo_min_decreasing_perc,
message: `Процент убывания не может быть меньше минимального значения по данному тарифу - ${evo_tarif?.evo_min_decreasing_perc}`,
});
}
);
}

View File

@ -0,0 +1,142 @@
/* eslint-disable @typescript-eslint/naming-convention */
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { autorun, reaction } from 'mobx';
import * as CRMTypes from 'graphql/crm.types';
import type { ReactionsContext } from 'process/types';
import { makeDisposable, normalizeOptions } from 'tools';
dayjs.extend(utc);
export default function valuesReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation, $process } = store;
autorun(
async () => {
const {
product,
leasingPeriod,
leaseObjectUsed,
deliveryTime,
firstPaymentPerc,
lastPaymentPerc,
} = $calculation.$values.values;
const currentDate = dayjs().utc(false).toISOString();
let {
data: { evo_tarifs = [] },
} = await apolloClient.query({
query: CRMTypes.GetTarifsDocument,
variables: {
currentDate,
},
fetchPolicy: 'network-only',
});
if (product && leasingPeriod && deliveryTime && evo_tarifs) {
evo_tarifs = evo_tarifs?.filter(
(tarif) =>
tarif &&
tarif.evo_baseproductid === product &&
tarif.evo_min_period !== null &&
tarif.evo_min_period <= leasingPeriod &&
tarif.evo_max_period !== null &&
tarif.evo_max_period >= leasingPeriod &&
tarif.evo_delivery_time?.includes(deliveryTime) &&
tarif.evo_min_first_payment !== null &&
tarif.evo_min_first_payment <= firstPaymentPerc &&
tarif.evo_max_first_payment !== null &&
tarif.evo_max_first_payment >= firstPaymentPerc &&
tarif.evo_min_last_payment !== null &&
tarif.evo_min_last_payment <= lastPaymentPerc &&
tarif.evo_max_last_payment !== null &&
tarif.evo_max_last_payment >= lastPaymentPerc
);
} else {
$calculation.element('selectTarif').resetValue();
}
if (leaseObjectUsed === true && evo_tarifs) {
evo_tarifs = evo_tarifs?.filter((tarif) => {
if (leaseObjectUsed === true) {
return tarif?.evo_used;
}
return true;
});
}
$calculation
.element('selectTarif')
.setOptions(normalizeOptions(evo_tarifs))
.setValue(evo_tarifs?.at(0)?.evo_tarifid || null);
},
{
delay: 10,
}
);
makeDisposable(
() =>
reaction(
() => $calculation.element('selectTarif').getValue(),
async (tarifId) => {
if (!tarifId) {
$calculation.element('tbxIRR_Perc').resetValue();
return;
}
const {
data: { evo_tarif },
} = await apolloClient.query({
query: CRMTypes.GetTarifDocument,
variables: {
tarifId,
},
});
if (evo_tarif?.evo_irr) {
$calculation.element('tbxIRR_Perc').setValue(evo_tarif?.evo_irr);
} else {
$calculation.element('tbxIRR_Perc').resetValue();
}
}
),
() => $process.has('LoadKP')
);
reaction(
() => $calculation.element('selectTarif').getValue(),
async (tarifId) => {
if (!tarifId) {
$calculation.element('selectRate').resetValue();
return;
}
const currentDate = dayjs().utc(false).toISOString();
const {
data: { evo_rates },
} = await apolloClient.query({
query: CRMTypes.GetRatesDocument,
variables: {
currentDate,
},
});
const rates = evo_rates?.filter((rate) =>
rate?.evo_tarifs?.filter((tarif) => tarif?.evo_tarifid === tarifId)
);
const baseRate = rates?.find((x) => x?.evo_id === 'BASE');
$calculation
.element('selectRate')
.setOptions(normalizeOptions(rates))
.setValue(baseRate?.value ?? null);
}
);
}

View File

@ -6,8 +6,8 @@ import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types';
const DEFAULT_FINGAP_ROW = defaultValues.find((x) => x.key === 'fingap')!;
const QUERY_GET_RISKS = gql`
query GetRisksDataFromQuote($quoteId: Uuid!) {
const QUERY_GET_FINGAP_DATA_FROM_QUOTE = gql`
query GetFingapDataFromQuote($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_fingap_accountid
evo_fingap_payer
@ -34,10 +34,10 @@ export default async function getFingapDataFromKP({
const {
data: { quote },
} = await apolloClient.query<
CRMTypes.GetRisksDataFromQuoteQuery,
CRMTypes.GetRisksDataFromQuoteQueryVariables
CRMTypes.GetFingapDataFromQuoteQuery,
CRMTypes.GetFingapDataFromQuoteQueryVariables
>({
query: QUERY_GET_RISKS,
query: QUERY_GET_FINGAP_DATA_FROM_QUOTE,
variables: {
quoteId,
},
@ -45,7 +45,7 @@ export default async function getFingapDataFromKP({
const keys: Array<string> = [];
quote?.evo_product_risks?.forEach((x) => {
if (x.evo_addproduct_typeid) {
if (x?.evo_addproduct_typeid) {
keys.push(x.evo_addproduct_typeid);
}
});

View File

@ -2,85 +2,20 @@
import { gql, useApolloClient } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import * as CRMTypes from 'graphql/crm.types';
import { useEffect } from 'react';
import { useStore } from 'stores/hooks';
import { normalizeOptions } from 'tools';
dayjs.extend(utc);
const QUERY_GET_MAIN_OPTIONS = gql`
query GetMainOptions($currentDate: DateTime) {
selectSupplierCurrency: transactioncurrencies {
label: currencyname
currencysymbol
value: transactioncurrencyid
}
selectProduct: evo_baseproducts(
statecode: 0
evo_relation: [100000000]
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_baseproductid
}
selectLeaseObjectType: evo_leasingobject_types(statecode: 0) {
label: evo_name
value: evo_leasingobject_typeid
}
selectGPSBrand: evo_gps_brands(statecode: 0) {
label: evo_name
value: evo_gps_brandid
}
}
`;
const QUERY_GET_SUBSIDIES = gql`
query GetSubsidies($currentDate: DateTime) {
evo_subsidies(
statecode: 0
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
) {
label: evo_name
value: evo_subsidyid
evo_subsidy_type
}
}
`;
const QUERY_GET_REGIONS = gql`
query GetRegions {
evo_regions {
label: evo_name
value: evo_regionid
}
}
`;
const QUERY_GET_BRANDS = gql`
query GetBrands {
selectBrand: evo_brands(statecode: 0) {
label: evo_name
value: evo_brandid
}
}
`;
const QUERY_GET_DEALERS = gql`
query GetDealers {
selectDealer: accounts(evo_account_type: [100000001], statecode: 0, evo_legal_form: 100000001) {
label: name
value: accountid
}
}
`;
const QUERY_GET_ADDPRODUCT_TYPES = gql`
query GetAddproductTypes {
evo_addproduct_types(statecode: 0) {
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
@ -91,18 +26,55 @@ const QUERY_GET_ADDPRODUCT_TYPES = gql`
const currentDate = dayjs().utc(false).toISOString();
/**
*
* @param {import('@apollo/client').ApolloClient['query']} query
* @param {*} onCompleted
*/
function getMainData(query, onCompleted) {
query({
query: QUERY_GET_MAIN_OPTIONS,
query: CRMTypes.GetTransactionCurrenciesDocument,
variables: {
currentDate,
},
}).then(({ data }) => {
onCompleted(data);
onCompleted({
selectSupplierCurrency: data?.transactioncurrencies,
});
});
query({
query: QUERY_GET_SUBSIDIES,
query: CRMTypes.GetLeaseObjectTypesDocument,
variables: {
currentDate,
},
}).then(({ data }) => {
onCompleted({
selectLeaseObjectType: data?.evo_baseproducts,
});
});
query({
query: CRMTypes.GetGpsBrandsDocument,
}).then(({ data }) => {
onCompleted({
selectGPSBrand: data?.evo_gps_brands,
});
});
query({
query: CRMTypes.GetProductsDocument,
variables: {
currentDate,
},
}).then(({ data }) => {
onCompleted({
selectProduct: data?.evo_baseproducts,
});
});
query({
query: CRMTypes.GetSubsidiesDocument,
variables: {
currentDate,
},
@ -122,7 +94,7 @@ function getMainData(query, onCompleted) {
});
query({
query: QUERY_GET_REGIONS,
query: CRMTypes.GetRegionsDocument,
}).then(({ data }) => {
const selectRegionRegistration = data?.evo_regions;
const selectObjectRegionRegistration = data?.evo_regions;
@ -136,19 +108,26 @@ function getMainData(query, onCompleted) {
});
query({
query: QUERY_GET_BRANDS,
query: CRMTypes.GetBrandsDocument,
}).then(({ data }) => {
onCompleted(data);
onCompleted({
selectBrand: data?.evo_brands,
});
});
query({
query: QUERY_GET_DEALERS,
query: CRMTypes.GetDealersDocument,
}).then(({ data }) => {
onCompleted(data);
onCompleted({
selectDealer: data?.dealers,
});
});
query({
query: QUERY_GET_ADDPRODUCT_TYPES,
variables: {
currentDate,
},
}).then(({ data }) => {
const selectRegistration = data.evo_addproduct_types
?.filter((x) => x?.evo_product_type === 100_000_001)
@ -182,12 +161,28 @@ function getMainData(query, onCompleted) {
(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.GetTarifsDocument,
variables: {
currentDate,
},
}).then(({ data }) => {
onCompleted({
selectTarif: data?.evo_tarifs,
});
});
}
@ -199,7 +194,7 @@ export function useMainData() {
function handleOnCompleted(options) {
Object.keys(options).forEach((elementName) => {
const elementOptions = options[elementName];
$calculation.element(elementName).setOptions(elementOptions);
$calculation.element(elementName).setOptions(normalizeOptions(elementOptions));
});
}

View File

@ -1,9 +1,13 @@
import loadKpReactions from 'process/load-kp/reactions';
import * as calculateReactions from '../../calculate/reactions';
import * as configurator from '../../configurator/reactions';
import * as fingapReactions from '../../fingap/reactions';
import * as leadOpportunityReactions from '../../lead-opportunity/reactions';
import * as leasingObject from '../../leasing-object/reactions';
import * as leasingWithoutKaskoReactions from '../../leasing-without-kasko/reactions';
import paymentsReactions from '../../payments/reactions';
import * as priceReactions from '../../price/reactions';
import * as subsidyReactions from '../../subsidy/reactions';
import * as agentsReactions from '../../supplier-agent/reactions/agents';
import leasebackReactions from '../../supplier-agent/reactions/leaseback';
import * as supplierReactions from '../../supplier-agent/reactions/supplier';
@ -21,8 +25,17 @@ export default function injectDefaultReactions(context) {
agentsReactions.validationReactions(context);
leasebackReactions(context);
priceReactions.computed(context);
priceReactions.common(context);
fingapReactions.common(context);
fingapReactions.validation(context);
setInitialValuesReactions(context);
loadKpReactions(context);
leasingWithoutKaskoReactions.common(context);
subsidyReactions.computedReactions(context);
subsidyReactions.commonReactions(context);
leasingObject.common(context);
leasingObject.validation(context);
configurator.filters(context);
configurator.values(context);
configurator.validation(context);
}

View File

@ -1,19 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import type { GetTransactionCurrenciesQuery } from 'graphql/crm.types';
import { GetTransactionCurrenciesDocument } from 'graphql/crm.types';
import { when } from 'mobx';
import type { ReactionsContext } from 'process/types';
export default function setInitialValuesReactions({ store, apolloClient }: ReactionsContext) {
const QUERY_GET_TRANSACTION_CURRENCIES = gql`
query GetTransactionCurrencies {
transactioncurrencies {
isocurrencycode
transactioncurrencyid
}
}
`;
const { $calculation } = store;
when(
@ -21,8 +11,8 @@ export default function setInitialValuesReactions({ store, apolloClient }: React
async () => {
const {
data: { transactioncurrencies },
} = await apolloClient.query<GetTransactionCurrenciesQuery>({
query: QUERY_GET_TRANSACTION_CURRENCIES,
} = await apolloClient.query({
query: GetTransactionCurrenciesDocument,
});
const transactioncurrency_rub = transactioncurrencies?.find(

View File

@ -1,6 +1,5 @@
/* eslint-disable implicit-arrow-linebreak */
import { gql } from '@apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import * as CRMTypes from 'graphql/crm.types';
import { reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
import { normalizeOptions } from 'tools/entity';
@ -16,17 +15,6 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
* Иначе ничего не указывается
*/
const QUERY_GET_OPPORTUNITY_BY_LEAD = gql`
query GetOpportunityByLead($leadid: Uuid!) {
lead(leadid: $leadid) {
evo_opportunityidData {
label: name
value: opportunityid
}
}
}
`;
makeDisposable(
() =>
reaction(
@ -40,11 +28,8 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
const {
data: { lead },
} = await apolloClient.query<
CRMTypes.GetOpportunityByLeadQuery,
CRMTypes.GetOpportunityByLeadQueryVariables
>({
query: QUERY_GET_OPPORTUNITY_BY_LEAD,
} = await apolloClient.query({
query: CRMTypes.GetLeadDocument,
variables: {
leadid,
},
@ -60,20 +45,6 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
() => $process.has('LoadKP')
);
/**
* если opportunity содержит данные,
то в lead подгружается значение из поля Интерес
выбранной карточки Лизинговая сделка (opportunity.evo_leadid)
иначе ничего не делать
*/
const QUERY_GET_LEADID_BY_OPPORTUNITY = gql`
query GetLeadidByOpportunity($opportunityid: Uuid!) {
opportunity(opportunityid: $opportunityid) {
evo_leadid
}
}
`;
reaction(
() => $calculation.element('selectOpportunity').getValue(),
async (opportunityid) => {
@ -82,11 +53,8 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
if (leadid) {
const {
data: { lead },
} = await apolloClient.query<
CRMTypes.GetOpportunityByLeadQuery,
CRMTypes.GetOpportunityByLeadQueryVariables
>({
query: QUERY_GET_OPPORTUNITY_BY_LEAD,
} = await apolloClient.query({
query: CRMTypes.GetLeadDocument,
variables: {
leadid,
},
@ -100,11 +68,8 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
if (opportunityid) {
const {
data: { opportunity },
} = await apolloClient.query<
CRMTypes.GetLeadidByOpportunityQuery,
CRMTypes.GetLeadidByOpportunityQueryVariables
>({
query: QUERY_GET_LEADID_BY_OPPORTUNITY,
} = await apolloClient.query({
query: CRMTypes.GetOpportunityDocument,
variables: {
opportunityid,
},
@ -126,29 +91,18 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
Иначе очищать поле калькулятора quote.
*/
const QUERY_GET_QUOTES_BY_LEAD = gql`
query GetQuotesByLead($leadid: Uuid!) {
quotes(evo_leadid: $leadid) {
label: evo_quotename
value: quoteid
}
}
`;
reaction(
() => $calculation.element('selectLead').getValue(),
async (leadid) => {
if (leadid) {
const {
data: { quotes },
} = await apolloClient.query<
CRMTypes.GetQuotesByLeadQuery,
CRMTypes.GetQuotesByLeadQueryVariables
>({
query: QUERY_GET_QUOTES_BY_LEAD,
} = await apolloClient.query({
query: CRMTypes.GetQuotesDocument,
variables: {
leadid,
},
fetchPolicy: 'network-only',
});
$calculation.element('selectQuote').setOptions(normalizeOptions(quotes));

View File

@ -0,0 +1,55 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import initializeApollo from 'apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types';
const QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE = gql`
query GetLeasingObjectDataFromQuote($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_brandid
evo_modelid
evo_equipmentid
evo_leasingobject_typeid
}
}
`;
export type Quote = NonNullable<CRMTypes.GetLeasingObjectDataFromQuoteQuery['quote']>;
type QuoteLeasingObjectProcessData = {
values: Partial<GetQuoteDataOutput['values']>;
};
export default async function getLeasingObjectDataFromKP({
values: { quote: quoteId },
}: GetQuoteDataInput): Promise<QuoteLeasingObjectProcessData> {
const apolloClient = initializeApollo();
const {
data: { quote },
} = await apolloClient.query<
CRMTypes.GetLeasingObjectDataFromQuoteQuery,
CRMTypes.GetLeasingObjectDataFromQuoteQueryVariables
>({
query: QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE,
variables: {
quoteId,
},
});
if (!quote) {
throw new Error('Quote is empty');
}
const { evo_brandid, evo_modelid, evo_equipmentid, evo_leasingobject_typeid } = quote;
return {
values: {
brand: evo_brandid,
model: evo_modelid,
configuration: evo_equipmentid,
leaseObjectType: evo_leasingobject_typeid,
},
};
}

View File

@ -0,0 +1,282 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as CRMTypes from 'graphql/crm.types';
import { reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
import { intersects } from 'radash';
import { normalizeOptions } from 'tools';
export default function commonReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation } = store;
reaction(
() => {
const { brand, subsidy, importProgram, leaseObjectType } = $calculation.$values.values;
return {
brandId: brand,
subsidyId: subsidy,
importProgramId: importProgram,
leaseObjectTypeId: leaseObjectType,
};
},
async ({ brandId, subsidyId, importProgramId, leaseObjectTypeId }) => {
if (!brandId) {
$calculation.element('selectModel').reset();
return;
}
const {
data: { evo_models },
} = await apolloClient.query({
query: CRMTypes.GetModelsDocument,
variables: {
brandId,
},
});
let models = evo_models;
if (!models) {
$calculation.element('selectModel').reset();
return;
}
if (leaseObjectTypeId) {
const {
data: { leaseObjectType },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
models = models?.filter((model) => {
if (
model?.evo_vehicle_type &&
leaseObjectType?.evo_vehicle_type?.includes(model.evo_vehicle_type)
) {
return model;
}
return false;
});
}
if (subsidyId) {
const {
data: { evo_subsidy: subsidy },
} = await apolloClient.query({
query: CRMTypes.GetSubsidyDocument,
variables: {
subsidyId,
},
});
models = models?.filter((model) => {
if (
model &&
(!subsidy?.evo_models?.length ||
subsidy?.evo_models?.filter(
(subsidy_evo_model) => subsidy_evo_model?.evo_modelid === model.evo_modelid
)?.length)
) {
return model;
}
return false;
});
}
if (importProgramId) {
const {
data: { importProgram },
} = await apolloClient.query({
query: CRMTypes.GetImportProgramDocument,
variables: {
importProgramId,
},
});
models = models?.filter((model) => {
if (
model &&
(!importProgram?.evo_models?.length ||
importProgram?.evo_models?.filter(
(importProgram_evo_model) =>
importProgram_evo_model?.evo_modelid === model.evo_modelid
)?.length)
) {
return model;
}
return false;
});
}
$calculation.element('selectModel').setOptions(normalizeOptions(models));
}
);
reaction(
() => {
const { product, subsidy, importProgram, leaseObjectType } = $calculation.$values.values;
return {
productId: product,
subsidyId: subsidy,
importProgramId: importProgram,
leaseObjectTypeId: leaseObjectType,
};
},
async ({ productId, subsidyId, importProgramId, leaseObjectTypeId }) => {
const {
data: { evo_brands },
} = await apolloClient.query({
query: CRMTypes.GetBrandsDocument,
});
let brands = evo_brands;
if (!brands) {
$calculation.element('selectBrand').reset();
return;
}
if (productId) {
const {
data: { evo_baseproduct },
} = await apolloClient.query({
query: CRMTypes.GetProductDocument,
variables: {
productId,
},
});
brands = brands?.filter((brand) => {
if (
!evo_baseproduct?.evo_brands?.length ||
evo_baseproduct.evo_brands.filter(
(baseproduct_evo_brand) => baseproduct_evo_brand?.evo_brandid === brand?.evo_brandid
)?.length
) {
return true;
}
return false;
});
}
if (leaseObjectTypeId) {
const {
data: { leaseObjectType },
} = await apolloClient.query({
query: CRMTypes.GetLeaseObjectTypeDocument,
variables: {
leaseObjectTypeId,
},
});
brands = brands?.filter((brand) => {
if (
brand?.evo_vehicle_type?.length &&
leaseObjectType?.evo_vehicle_type &&
intersects(
brand.evo_vehicle_type?.filter((x) => x > 0),
leaseObjectType?.evo_vehicle_type
)
) {
return true;
}
return false;
});
}
if (subsidyId) {
const {
data: { evo_subsidy: subsidy },
} = await apolloClient.query({
query: CRMTypes.GetSubsidyDocument,
variables: {
subsidyId,
},
});
brands = brands?.filter((brand) => {
if (
!subsidy?.evo_brands?.length ||
subsidy?.evo_brands?.filter(
(subsidy_evo_brand) => subsidy_evo_brand?.evo_brandid === brand?.evo_brandid
)?.length
) {
return true;
}
return false;
});
}
if (importProgramId) {
const {
data: { importProgram },
} = await apolloClient.query({
query: CRMTypes.GetImportProgramDocument,
variables: {
importProgramId,
},
});
brands = brands?.filter((brand) => {
if (
!importProgram?.evo_brands?.length ||
importProgram?.evo_brands?.filter(
(importProgram_evo_brand) =>
importProgram_evo_brand?.evo_brandid === brand?.evo_brandid
)?.length
) {
return true;
}
return false;
});
}
$calculation.element('selectBrand').setOptions(normalizeOptions(brands));
}
);
reaction(
() => $calculation.element('selectLeaseObjectType').getValue(),
(leaseObjectTypeId) => {
if (!leaseObjectTypeId) {
$calculation.element('selectBrand').resetValue();
}
}
);
reaction(
() => $calculation.element('selectModel').getValue(),
async (modelId) => {
if (!modelId) {
$calculation.element('selectConfiguration').reset();
return;
}
const {
data: { evo_equipments },
} = await apolloClient.query({
query: CRMTypes.GetConfigurationsDocument,
variables: {
modelId,
},
});
$calculation.element('selectConfiguration').setOptions(normalizeOptions(evo_equipments));
}
);
}

View File

@ -0,0 +1,3 @@
/* eslint-disable import/prefer-default-export */
export { default as common } from './common';
export { default as validation } from './validation';

View File

@ -0,0 +1,25 @@
import { autorun } from 'mobx';
import type { ReactionsContext } from 'process/types';
export default function validationReactions({ store }: ReactionsContext) {
const { $calculation } = store;
/* eslint-disable max-len */
/**
* Если model содержит данные и по связи Модель-Комплектация в CRM у данной модели есть связанные активные записи Комплектаций,
* то configuration становится обязательным для заполнения, иначе configuration не обязателен для заполнения
*/
/* eslint-enable */
autorun(
() => {
const selectConfiguration = $calculation.element('selectConfiguration');
selectConfiguration.validate({
invalid: selectConfiguration.getOptions()?.length > 0 && !selectConfiguration.getValue(),
message: 'Не заполнено поле',
});
},
{
delay: 10,
}
);
}

View File

@ -0,0 +1,127 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
import { autorun, reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
import { uid } from 'radash';
import { normalizeOptions } from 'tools';
import notification from 'ui/elements/notification';
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 default function commonReactions({ store, apolloClient, queryClient }: ReactionsContext) {
const { $calculation, $tables } = store;
reaction(
() => $calculation.element('selectLeasingWithoutKasko').getValue(),
(nextValue, prevValue) => {
if (prevValue && !nextValue) {
notification.warning({
key: NOTIFICATION_KEY,
message: 'Внимание',
description: 'Лизинг без КАСКО был сброшен',
});
}
}
);
/* eslint-disable max-len */
/**
* если "Лизинг без КАСКО" (SelectLeasingWithoutKasko) содержит данные,
* то в таблице страхования в строке ФинГАП: Страховая компания insCompany = null и закрыть для редактирования
*/
/* eslint-enable */
reaction(
() => $calculation.element('selectLeasingWithoutKasko').getValue(),
(leasingWithoutKasko) => {
if (leasingWithoutKasko) {
$tables.insurance.row('fingap').resetValue('insuranceCompany').block('insuranceCompany');
} else {
$tables.insurance.row('fingap').unblock('insuranceCompany');
}
}
);
autorun(async () => {
const currentDate = dayjs().utc(false).toISOString();
const {
data: { evo_addproduct_types },
} = await apolloClient.query<
CRMTypes.GetLeasingWithoutKaskoOptionsQuery,
CRMTypes.GetLeasingWithoutKaskoOptionsQueryVariables
>({
query: QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS,
variables: {
currentDate,
},
});
const {
plPriceRub,
discountRub,
importProgramSum,
leasingPeriod,
addEquipmentPrice,
leaseObjectType,
firstPaymentPerc,
model: modelId,
} = $calculation.$values.values;
const options = evo_addproduct_types?.filter(
(x) =>
x?.evo_max_period &&
x.evo_max_period >= leasingPeriod &&
x?.evo_min_period &&
x.evo_min_period <= leasingPeriod &&
x?.evo_max_price &&
x.evo_max_price >= plPriceRub - discountRub - importProgramSum + addEquipmentPrice &&
x?.evo_min_price &&
x.evo_min_price <= plPriceRub - discountRub - importProgramSum + addEquipmentPrice &&
x.evo_leasingobject_types?.find(
(evo_leasingobject_type) =>
evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType
) &&
x.evo_visible_calc &&
x.evo_min_first_payment_perc &&
x.evo_min_first_payment_perc <= firstPaymentPerc &&
x.evo_max_first_payment_perc &&
x.evo_max_first_payment_perc >= firstPaymentPerc &&
!x.evo_models?.map((evo_model) => evo_model?.evo_modelid).includes(modelId)
);
$calculation.element('selectLeasingWithoutKasko').setOptions(normalizeOptions(options));
});
}

View File

@ -0,0 +1,2 @@
/* eslint-disable import/prefer-default-export */
export { default as common } from './common';

View File

@ -23,19 +23,30 @@ export default function loadKpReactions({ store, trpcClient }: ReactionsContext)
content: `Загружаем КП ${quoteName}...`,
});
const payload = {
values: {
quote: quoteId,
...pick($calculation.$values.values, ['recalcWithRevision']),
},
};
const { recalcWithRevision } = $calculation.$values.values;
trpcClient.quote.getData
.query(payload)
.query({
values: {
quote: quoteId,
recalcWithRevision,
},
})
.then(({ values, payments, insurance, fingap }) => {
const savedValues = pick($calculation.$values.values, [
'lead',
'opportunity',
'quote',
'leadUrl',
'opportunityUrl',
'quoteUrl',
]);
$calculation.$values.setValues({
values,
exclude: ['lead', 'opportunity', 'quote', 'leadUrl', 'opportunityUrl', 'quoteUrl'],
values: {
...values,
...savedValues,
},
});
$tables.payments.setValues(payments.values);

View File

@ -56,7 +56,7 @@ export default async function getPaymentsDataFromKP({
let paymentsValues: Array<number> = [];
if (quote?.evo_graphs) {
paymentsValues =
sort(quote?.evo_graphs, (evo_graph) => Date.parse(evo_graph?.createdon))
sort(quote?.evo_graphs, (evo_graph) => Date.parse(evo_graph?.createdon ?? '0'))
.at(0)
?.evo_planpayments?.slice(1, -1)
.slice(0, leasingPeriod - 2)

View File

@ -13,3 +13,8 @@ export const FORBIDDEN_HIGH_SEASON_START: Record<number, Array<string>> = {
export const SEASONS_PERIOD_NUMBER = 12;
export const DEFAULT_SEASONS_VALUES = [100, 75, 50];
export const SEASON_TYPES = {
100_000_001: [100_000_003, 100_000_004, 100_000_005, 100_000_006, 100_000_007],
100_000_003: [100_000_000, 100_000_001, 100_000_002],
};

View File

@ -1,5 +1,6 @@
/* eslint-disable implicit-arrow-linebreak */
import type { CalculationValues } from 'stores/calculation/values/types';
import type { Row } from 'stores/tables/payments/types';
import { SEASONS_PERIODS, SEASONS_PERIOD_NUMBER } from './seasons-constants';
type SeasonType = NonNullable<CalculationValues['seasonType']>;
@ -53,3 +54,19 @@ export function generateSeasonsPayments(leasingPeriod: LeasingPeriod, seasons: A
.concat(seasons.slice(0, (leasingPeriod - 2) % SEASONS_PERIOD_NUMBER))
);
}
export function generateSeasonPaymentsRows(
seasonType: number,
shiftNumber: number,
payments: number[]
) {
const shiftedPeriods = new Set(
SEASONS_PERIODS[seasonType].map((position) => (position + shiftNumber) % SEASONS_PERIOD_NUMBER)
);
const rows: Row[] = payments.map((value, i) => ({
value,
status: shiftedPeriods.has(i) ? 'Default' : 'Disabled',
}));
return rows;
}

View File

@ -1,10 +1,9 @@
/* eslint-disable function-paren-newline */
/* eslint-disable implicit-arrow-linebreak */
import { selectHighSeasonStart, selectSeasonType } from 'config/default-options';
import { selectHighSeasonStart } from 'config/default-options';
import { comparer, reaction, toJS } from 'mobx';
import type { ReactionsContext } from 'process/types';
import { shift } from 'radash';
import type { CalculationOptions } from 'stores/calculation/options/types';
import type { Row } from 'stores/tables/payments/types';
import ValidationHelper from 'stores/validation/helper';
import { difference } from 'tools/array';
@ -13,6 +12,22 @@ import * as seasonsConstants from './lib/seasons-constants';
import * as seasonsTools from './lib/seasons-tools';
import validatePaymentsTable from './validation';
const {
generateSeasonPaymentsRows,
generateSeasons,
generateSeasonsPayments,
getPositionIndex,
getSeasonsValues,
} = seasonsTools;
const {
DEFAULT_SEASONS_VALUES,
FORBIDDEN_HIGH_SEASON_START,
SEASONS_PERIODS,
SEASONS_PERIOD_NUMBER,
SEASON_TYPES,
} = seasonsConstants;
export default function paymentsReactions({ store }: ReactionsContext) {
const { $calculation, $tables, $process } = store;
@ -205,36 +220,36 @@ export default function paymentsReactions({ store }: ReactionsContext) {
}
);
/**
* Дегрессия
*/
// TODO: const exeption = tarif?.evo_seasons_type_exception
const degressionSeasonTypes = new Set([
100_000_003, 100_000_004, 100_000_005, 100_000_006, 100_000_007,
]);
const seasonSeasonTypes = new Set([100_000_000, 100_000_001, 100_000_002]);
// /**
// * Дегрессия
// */
reaction(
() => {
const graphType = $calculation.element('radioGraphType').getValue();
// reaction(
// () => {
// const graphType = $calculation.element('radioGraphType').getValue();
return graphType;
},
(graphType) => {
let selectSeasonTypeOptions: CalculationOptions['selectSeasonType'] = [];
// return graphType;
// },
// (graphType) => {
// if (!graphType) {
// $calculation.element('selectSeasonType').resetOptions();
if (graphType === 100_000_001) {
selectSeasonTypeOptions = selectSeasonType.filter((option) =>
degressionSeasonTypes.has(option.value)
);
} else if (graphType === 100_000_003) {
selectSeasonTypeOptions = selectSeasonType.filter((option) =>
seasonSeasonTypes.has(option.value)
);
}
$calculation.element('selectSeasonType').setOptions(selectSeasonTypeOptions);
}
);
// return;
// }
// if (graphType === 100_000_001 || graphType === 100_000_003) {
// const allowedSeasonTypes = SEASON_TYPES[graphType];
// const selectSeasonTypeOptions = selectSeasonType.filter((option) =>
// allowedSeasonTypes.includes(option.value)
// );
// $calculation.element('selectSeasonType').setOptions(selectSeasonTypeOptions);
// } else {
// $calculation.element('selectSeasonType').resetOptions();
// }
// }
// );
const degressionSteps: { [key: number]: Array<number> } = {
100_000_003: [100, 50, 25],
@ -423,27 +438,13 @@ export default function paymentsReactions({ store }: ReactionsContext) {
}
const highSeasonStartOptions = selectHighSeasonStart.filter(
(option) => !seasonsConstants.FORBIDDEN_HIGH_SEASON_START[seasonType].includes(option.label)
(option) => !FORBIDDEN_HIGH_SEASON_START[seasonType].includes(option.label)
);
$calculation.element('selectHighSeasonStart').setOptions(highSeasonStartOptions);
}
);
function generateSeasonPaymentsRows(seasonType: number, shiftNumber: number, payments: number[]) {
const shiftedPeriods = new Set(
seasonsConstants.SEASONS_PERIODS[seasonType].map(
(position) => (position + shiftNumber) % seasonsConstants.SEASONS_PERIOD_NUMBER
)
);
const rows: Row[] = payments.map((value, i) => ({
value,
status: shiftedPeriods.has(i) ? 'Default' : 'Disabled',
}));
return rows;
}
reaction(
() => {
const seasonType = $calculation.element('selectSeasonType').getValue();
@ -466,15 +467,9 @@ export default function paymentsReactions({ store }: ReactionsContext) {
return;
}
const seasons = seasonsTools.generateSeasons(
seasonType,
seasonsConstants.DEFAULT_SEASONS_VALUES
);
const seasons = generateSeasons(seasonType, DEFAULT_SEASONS_VALUES);
const shiftNumber = Number.parseInt(highSeasonStartOption.label, 10) - 2;
const payments = seasonsTools.generateSeasonsPayments(
leasingPeriod,
shift(seasons, shiftNumber)
);
const payments = generateSeasonsPayments(leasingPeriod, shift(seasons, shiftNumber));
const middlePayments: Row[] = generateSeasonPaymentsRows(seasonType, shiftNumber, payments);
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
@ -504,7 +499,7 @@ export default function paymentsReactions({ store }: ReactionsContext) {
reaction(
() => {
const payments = toJS($tables.payments.values);
const seasons = payments.slice(1, seasonsConstants.SEASONS_PERIOD_NUMBER + 1);
const seasons = payments.slice(1, SEASONS_PERIOD_NUMBER + 1);
return seasons;
},
@ -524,17 +519,14 @@ export default function paymentsReactions({ store }: ReactionsContext) {
if (changes === null || changes.length > 1) return;
const [changeIndex] = changes;
const positionIndex = seasonsTools.getPositionIndex(seasonType, changeIndex);
const positionIndex = getPositionIndex(seasonType, changeIndex);
const values = seasonsTools.getSeasonsValues(seasonType, unshiftedNextSeasons);
const values = getSeasonsValues(seasonType, unshiftedNextSeasons);
values[positionIndex] = unshiftedNextSeasons[changeIndex];
const seasons = seasonsTools.generateSeasons(seasonType, values);
const seasons = generateSeasons(seasonType, values);
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const payments = seasonsTools.generateSeasonsPayments(
leasingPeriod,
shift(seasons, shiftNumber)
);
const payments = generateSeasonsPayments(leasingPeriod, shift(seasons, shiftNumber));
const rows: Row[] = generateSeasonPaymentsRows(seasonType, shiftNumber, payments);
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();

View File

@ -0,0 +1,61 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import initializeApollo from 'apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types';
const QUERY_GET_PRICE_DATA_FROM_QUOTE = gql`
query GetPriceDataFromQuote($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_supplier_currency_price
evo_price_without_nds_supplier_currency
evo_nds_in_price_supplier_currency
evo_last_payment_rub
evo_last_payment_calc
evo_transactioncurrencyid
evo_discount_supplier_currency
evo_discount_perc
evo_comission_perc
evo_comission_rub
evo_sale_bonus
}
}
`;
type QuotePaymentsProcessData = {
values: Partial<GetQuoteDataOutput['values']>;
};
export default async function getPriceDataFromKP({
values: { quote: quoteId },
}: GetQuoteDataInput): Promise<QuotePaymentsProcessData> {
const apolloClient = initializeApollo();
const {
data: { quote },
} = await apolloClient.query<
CRMTypes.GetPriceDataFromQuoteQuery,
CRMTypes.GetPriceDataFromQuoteQueryVariables
>({
query: QUERY_GET_PRICE_DATA_FROM_QUOTE,
variables: {
quoteId,
},
});
return {
values: {
leaseObjectPrice: quote?.evo_supplier_currency_price || 0,
leaseObjectPriceWthtVAT: quote?.evo_price_without_nds_supplier_currency || 0,
VATInLeaseObjectPrice: quote?.evo_nds_in_price_supplier_currency || 0,
lastPaymentRub: quote?.evo_last_payment_rub || 0,
lastPaymentRule: quote?.evo_last_payment_calc,
supplierCurrency: quote?.evo_transactioncurrencyid,
supplierDiscountRub: quote?.evo_discount_supplier_currency || 0,
supplierDiscountPerc: quote?.evo_discount_perc || 0,
comissionPerc: quote?.evo_comission_perc || 0,
comissionRub: quote?.evo_comission_rub || 0,
saleBonus: quote?.evo_sale_bonus || 0,
},
};
}

View File

@ -0,0 +1,50 @@
import { MIN_LASTPAYMENT_NSIB } from 'constants/values';
import { reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
export default function commonReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation } = store;
reaction(
() => $calculation.element('radioLastPaymentRule').getValue(),
(lastPaymentRule) => {
switch (lastPaymentRule) {
case 100_000_000: {
$calculation.element('tbxLastPaymentPerc').block();
$calculation.element('tbxLastPaymentRub').unblock();
break;
}
case 100_000_001: {
$calculation.element('tbxLastPaymentPerc').unblock();
$calculation.element('tbxLastPaymentRub').block();
break;
}
default: {
$calculation.element('tbxLastPaymentPerc').block();
$calculation.element('tbxLastPaymentRub').block();
}
}
},
{
fireImmediately: true,
}
);
reaction(
() => {
const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue();
const insNSIB = $calculation.element('selectInsNSIB').getValue();
return {
lastPaymentRub,
insNSIB,
};
},
({ lastPaymentRub, insNSIB }) => {
$calculation.element('tbxLastPaymentRub').validate({
invalid: !!insNSIB && lastPaymentRub < MIN_LASTPAYMENT_NSIB,
message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`,
});
}
);
}

View File

@ -1,31 +1,13 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
import * as CRMTypes from 'graphql/crm.types';
import { autorun } from 'mobx';
import type { ReactionsContext } from 'process/types';
dayjs.extend(utc);
export default function computedReactions({ store, apolloClient }: ReactionsContext) {
const QUERY_GET_EVO_CURRENCY_CHANGES = gql`
query GetCurrencyChanges($currentDate: DateTime) {
evo_currencychanges(statecode: 0, evo_coursedate_param: { eq: $currentDate }) {
evo_currencychange
evo_ref_transactioncurrency
}
}
`;
const QUERY_GET_CURRENCY_ISOCODE = gql`
query GetCurrencyISOCode($id: Uuid!) {
transactioncurrency(transactioncurrencyid: $id) {
isocurrencycode
}
}
`;
const { $calculation } = store;
autorun(
@ -43,13 +25,10 @@ export default function computedReactions({ store, apolloClient }: ReactionsCont
const {
data: { transactioncurrency },
} = await apolloClient.query<
CRMTypes.GetCurrencyIsoCodeQuery,
CRMTypes.GetCurrencyIsoCodeQueryVariables
>({
query: QUERY_GET_CURRENCY_ISOCODE,
} = await apolloClient.query({
query: CRMTypes.GetTransactionCurrencyDocument,
variables: {
id: supplierCurrencyId,
currencyid: supplierCurrencyId,
},
});
@ -62,11 +41,8 @@ export default function computedReactions({ store, apolloClient }: ReactionsCont
const {
data: { evo_currencychanges },
} = await apolloClient.query<
CRMTypes.GetCurrencyChangesQuery,
CRMTypes.GetCurrencyChangesQueryVariables
>({
query: QUERY_GET_EVO_CURRENCY_CHANGES,
} = await apolloClient.query({
query: CRMTypes.GetCurrencyChangesDocument,
variables: {
currentDate: dayjs().utc(false).format('YYYY-MM-DD'),
},

View File

@ -1,2 +1,2 @@
/* eslint-disable import/prefer-default-export */
export { default as common } from './common';
export { default as computed } from './computed';

View File

@ -0,0 +1,60 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as CRMTypes from 'graphql/crm.types';
import { autorun } from 'mobx';
import type { ReactionsContext } from 'process/types';
/* eslint-disable max-len */
/**
* При изменении "Программа от производителя" selectImportProgram , Стоимости ПЛ tbxLeaseObjectPrice, Валюты selectSupplierCurrency, Скидка от поставщика, в валюте поставщика (tbxSupplierDiscountRub)
* необходимо заполнять поле "Скидка от производителя, руб., с НДС" labelImportProgramSum:
если поле selectImportProgram содержит данные,
то
если
поле "Сумма субсидии с НДС" evo_subsidy.evo_subsidy_summ из selectImportProgram > 0,
то указывает данное значение в поле labelImportProgramSum,
иначе:
1)labelImportProgramSum = ( (Стоимость ПЛ tbxLeaseObjectPrice ), переведенные в рубли - Скидка от поставщика, в валюте поставщика (tbxSupplierDiscountRub))* "% субсидии от стоимости ПЛ" evo_subsidy.evo_percent_subsidy из selectImportProgram / 100.
2) Если полученное значение больше значения в поле "Максимальная сумма субсидии с НДС, руб." evo_subsidy.evo_max_subsidy_summ из записи Субсидия в поле selectImportProgram ,
то в labelImportProgramSum указываем значение из поля "Максимальная сумма субсидии с НДС, руб." evo_subsidy.evo_max_subsidy_summ ,
иначе результат расчета п.1
иначе 0
*/
/* eslint-enable */
export function computedReactions({ store, apolloClient, queryClient }: ReactionsContext) {
const { $calculation } = store;
autorun(async () => {
const importProgramId = $calculation.element('selectImportProgram').getValue();
const plPriceRub = $calculation.$values.getValue('plPriceRub');
const supplierDiscountRub = $calculation.element('tbxSupplierDiscountRub').getValue();
if (importProgramId) {
const {
data: { evo_subsidy: importProgram },
} = await apolloClient.query({
query: CRMTypes.GetSubsidyDocument,
variables: {
subsidyId: importProgramId,
},
});
if (importProgram?.evo_subsidy_summ && importProgram?.evo_subsidy_summ > 0) {
$calculation.element('tbxImportProgramSum').setValue(importProgram?.evo_subsidy_summ);
} else {
const subsidyPercent = (importProgram?.evo_percent_subsidy || 0) / 100;
const sum = (plPriceRub - supplierDiscountRub) * subsidyPercent;
const maxSum = importProgram?.evo_max_subsidy_summ || 0;
$calculation.element('tbxImportProgramSum').setValue(Math.min(sum, maxSum));
}
} else {
$calculation.element('tbxImportProgramSum').setValue(0);
}
});
}
export function commonReactions({ store, apolloClient, queryClient }: ReactionsContext) {
const { $calculation, $tables } = store;
}

View File

@ -1,9 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { ApolloClient } from '@apollo/client';
import { gql } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
import * as CRMTypes from 'graphql/crm.types';
import { autorun, reaction } from 'mobx';
import type RootStore from 'stores/root';
import ValidationHelper from 'stores/validation/helper';
@ -13,22 +12,6 @@ import type { AgentsFields, AgentsRewardConditionsFields, AgentsSumFields } from
dayjs.extend(utc);
const QUERY_GET_REWARD_CONDITIONS = gql`
query GetRewardConditions($agentid: Uuid!, $currentDate: DateTime) {
evo_reward_conditions(
evo_agent_accountid: $agentid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: 0
evo_agency_agreementid_param: { has: true }
) {
label: evo_name
value: evo_reward_conditionid
evo_reward_summ
}
}
`;
export function fillAgentRewardReaction(
store: RootStore,
apolloClient: ApolloClient<object>,
@ -50,11 +33,8 @@ export function fillAgentRewardReaction(
}
const {
data: { evo_reward_conditions },
} = await apolloClient.query<
CRMTypes.GetRewardConditionsQuery,
CRMTypes.GetRewardConditionsQueryVariables
>({
query: QUERY_GET_REWARD_CONDITIONS,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionsDocument,
variables: {
agentid,
currentDate: dayjs().toISOString(),
@ -72,14 +52,6 @@ export function fillAgentRewardReaction(
);
}
const QUERY_GET_REWARD_SUMM = gql`
query GetRewardSumm($conditionId: Uuid!) {
evo_reward_condition(evo_reward_conditionid: $conditionId) {
evo_reward_summ
}
}
`;
export function fillAgentRewardSummReaction(
store: RootStore,
apolloClient: ApolloClient<object>,
@ -104,11 +76,8 @@ export function fillAgentRewardSummReaction(
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardSummQuery,
CRMTypes.GetRewardSummQueryVariables
>({
query: QUERY_GET_REWARD_SUMM,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: rewardConditionId,
},
@ -136,19 +105,6 @@ export function fillAgentRewardSummReaction(
);
}
const QUERY_GET_REWARD_CONDITION = gql`
query GetRewardCondition($conditionId: Uuid!) {
evo_reward_condition(evo_reward_conditionid: $conditionId) {
evo_reward_summ
evo_reduce_reward
evo_min_reward_summ
evo_agency_agreementidData {
evo_required_reward
}
}
}
`;
export function validateAgentRewardSumm(
store: RootStore,
apolloClient: ApolloClient<object>,
@ -178,7 +134,7 @@ export function validateAgentRewardSumm(
CRMTypes.GetRewardConditionQuery,
CRMTypes.GetRewardConditionQueryVariables
>({
query: QUERY_GET_REWARD_CONDITION,
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId,
},
@ -245,7 +201,7 @@ export function validateAgentRewardSumm(
CRMTypes.GetRewardConditionQuery,
CRMTypes.GetRewardConditionQueryVariables
>({
query: QUERY_GET_REWARD_CONDITION,
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId,
},

View File

@ -1,17 +1,19 @@
/* eslint-disable import/prefer-default-export */
import type { ApolloClient, DocumentNode } from '@apollo/client';
import { gql } from '@apollo/client';
import type { ApolloClient } from '@apollo/client';
import type { Elements } from 'Components/Calculation/config/map/values';
import type { GetAgentQuery, GetAgentQueryVariables } from 'graphql/crm.types';
import * as CRMTypes from 'graphql/crm.types';
import type RootStore from 'stores/root';
import { normalizeOptions } from 'tools/entity';
import { QUERY_GET_AGENT } from './query';
function makeFillAgentFromLead(
elementName: Elements,
queryGetAgentId: DocumentNode,
queryGetAgent: DocumentNode
) {
type AgentsLeadProp = keyof Pick<
NonNullable<CRMTypes.GetLeadQuery['lead']>,
| 'evo_agent_accountid'
| 'evo_broker_accountid'
| 'evo_double_agent_accountid'
| 'evo_fin_department_accountid'
>;
function makeFillAgentFromLead(elementName: Elements, leadProp: AgentsLeadProp) {
return async function fillAgentFromLead(
{ $calculation }: RootStore,
apolloClient: ApolloClient<object>,
@ -26,19 +28,21 @@ function makeFillAgentFromLead(
const {
data: { lead },
} = await apolloClient.query({
query: queryGetAgentId,
query: CRMTypes.GetLeadDocument,
variables: {
leadid,
},
});
if (lead?.agentid) {
const agentid = lead?.[leadProp];
if (agentid) {
const {
data: { agent },
} = await apolloClient.query<GetAgentQuery, GetAgentQueryVariables>({
query: queryGetAgent,
} = await apolloClient.query({
query: CRMTypes.GetAgentDocument,
variables: {
agentid: lead.agentid,
agentid,
},
});
@ -60,19 +64,8 @@ function makeFillAgentFromLead(
* записанную в поле Интереса "Агент" (lead.evo_agent_accountid account),
* иначе очищать поле калькулятора indAgent
*/
const QUERY_GET_AGENT_ACCOUNTID_FROM_LEAD = gql`
query GetAgentAccountIdFromLead($leadid: Uuid!) {
lead(leadid: $leadid) {
agentid: evo_agent_accountid
}
}
`;
export const fillIndAgent = makeFillAgentFromLead(
'selectIndAgent',
QUERY_GET_AGENT_ACCOUNTID_FROM_LEAD,
QUERY_GET_AGENT
);
export const fillIndAgent = makeFillAgentFromLead('selectIndAgent', 'evo_agent_accountid');
/**
* Если lead содержит данные,
@ -81,18 +74,9 @@ export const fillIndAgent = makeFillAgentFromLead(
* иначе очищать поле калькулятора calcDoubleAgent
*/
const QUERY_GET_DOUBLE_AGENT_ACCOUNTID = gql`
query GetDoubleAgentAccountId($leadid: Uuid!) {
lead(leadid: $leadid) {
agentid: evo_double_agent_accountid
}
}
`;
export const fillCalcDoubleAgent = makeFillAgentFromLead(
'selectCalcDoubleAgent',
QUERY_GET_DOUBLE_AGENT_ACCOUNTID,
QUERY_GET_AGENT
'evo_double_agent_accountid'
);
/**
@ -101,19 +85,7 @@ export const fillCalcDoubleAgent = makeFillAgentFromLead(
* иначе очищать поле калькулятора calcBroker
*/
const QUERY_GET_BROKER_ACCOUNTID_FROM_LEAD = gql`
query GetBrokerAccountId($leadid: Uuid!) {
lead(leadid: $leadid) {
agentid: evo_broker_accountid
}
}
`;
export const fillCalcBroker = makeFillAgentFromLead(
'selectCalcBroker',
QUERY_GET_BROKER_ACCOUNTID_FROM_LEAD,
QUERY_GET_AGENT
);
export const fillCalcBroker = makeFillAgentFromLead('selectCalcBroker', 'evo_broker_accountid');
/**
* если lead содержит данные, то calcFinDepartment заполняется ссылкой
@ -122,16 +94,7 @@ export const fillCalcBroker = makeFillAgentFromLead(
* иначе очищать поле калькулятора calcFinDepartment
*/
const QUERY_GET_FIN_DEPARTMENT_ACCOUNTID = gql`
query GetFinDepartmentAccountId($leadid: Uuid!) {
lead(leadid: $leadid) {
agentid: evo_fin_department_accountid
}
}
`;
export const fillFinDepartment = makeFillAgentFromLead(
'selectCalcFinDepartment',
QUERY_GET_FIN_DEPARTMENT_ACCOUNTID,
QUERY_GET_AGENT
'evo_fin_department_accountid'
);

View File

@ -1,18 +0,0 @@
import { gql } from '@apollo/client';
export const QUERY_GET_AGENT = gql`
query GetAgent($agentid: Uuid!) {
agent: account(accountid: $agentid) {
label: name
value: accountid
}
}
`;
export const QUERY_GET_DEALER_RETURN_LEASING = gql`
query GetDealerReturnLeasing($dealerId: Uuid!) {
dealer: account(accountid: $dealerId) {
evo_return_leasing_dealer
}
}
`;

View File

@ -1,14 +1,17 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
import * as CRMTypes from 'graphql/crm.types';
import { autorun, reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
import { makeDisposable } from 'tools/mobx';
import * as createReactions from '../lib/create-reactions';
import * as fillAgentsFromLead from '../lib/fill-agents-from-lead';
const { fillIndAgent, fillCalcBroker, fillCalcDoubleAgent, fillFinDepartment } = fillAgentsFromLead;
const { fillAgentRewardReaction, fillAgentRewardSummReaction, validateAgentRewardSumm } =
createReactions;
dayjs.extend(utc);
export function fillReactions({ store, apolloClient }: ReactionsContext) {
@ -22,10 +25,10 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) {
reaction(
() => $calculation.element('selectLead').getValue(),
(leadid) => {
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
fillIndAgent(store, apolloClient, leadid);
fillCalcDoubleAgent(store, apolloClient, leadid);
fillCalcBroker(store, apolloClient, leadid);
fillFinDepartment(store, apolloClient, leadid);
}
),
() => $process.has('LoadKP')
@ -35,13 +38,13 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) {
* IndAgent
*/
// Заполняем selectIndAgentRewardCondition
createReactions.fillAgentRewardReaction(store, apolloClient, {
fillAgentRewardReaction(store, apolloClient, {
agentField: 'selectIndAgent',
rewardConditionField: 'selectIndAgentRewardCondition',
});
// Заполняем tbxIndAgentRewardSumm
createReactions.fillAgentRewardSummReaction(store, apolloClient, {
fillAgentRewardSummReaction(store, apolloClient, {
rewardConditionField: 'selectIndAgentRewardCondition',
rewardSummField: 'tbxIndAgentRewardSumm',
});
@ -50,13 +53,13 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) {
* CalcDoubleAgent
*/
// Заполняем selectCalcDoubleAgentRewardCondition
createReactions.fillAgentRewardReaction(store, apolloClient, {
fillAgentRewardReaction(store, apolloClient, {
agentField: 'selectCalcDoubleAgent',
rewardConditionField: 'selectCalcDoubleAgentRewardCondition',
});
// Заполняем tbxCalcDoubleAgentRewardSumm
createReactions.fillAgentRewardSummReaction(store, apolloClient, {
fillAgentRewardSummReaction(store, apolloClient, {
rewardConditionField: 'selectCalcDoubleAgentRewardCondition',
rewardSummField: 'tbxCalcDoubleAgentRewardSumm',
});
@ -65,13 +68,13 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) {
* CalcBroker
*/
// Заполняем selectCalcBrokerRewardCondition
createReactions.fillAgentRewardReaction(store, apolloClient, {
fillAgentRewardReaction(store, apolloClient, {
agentField: 'selectCalcBroker',
rewardConditionField: 'selectCalcBrokerRewardCondition',
});
// Заполняем tbxCalcBrokerRewardSum
createReactions.fillAgentRewardSummReaction(store, apolloClient, {
fillAgentRewardSummReaction(store, apolloClient, {
rewardConditionField: 'selectCalcBrokerRewardCondition',
rewardSummField: 'tbxCalcBrokerRewardSum',
});
@ -80,13 +83,13 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) {
* CalcFinDepartment
*/
// Заполняем selectFinDepartmentRewardCondtion
createReactions.fillAgentRewardReaction(store, apolloClient, {
fillAgentRewardReaction(store, apolloClient, {
agentField: 'selectCalcFinDepartment',
rewardConditionField: 'selectFinDepartmentRewardCondtion',
});
// Заполняем tbxCalcBrokerRewardSum
createReactions.fillAgentRewardSummReaction(store, apolloClient, {
fillAgentRewardSummReaction(store, apolloClient, {
rewardConditionField: 'selectFinDepartmentRewardCondtion',
rewardSummField: 'tbxFinDepartmentRewardSumm',
});
@ -109,16 +112,6 @@ class Helper {
export function commonReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation } = store;
const QUERY_GET_REWARD_WITHOUT_OTHER_AGENT = gql`
query GetRewardWithoutOtherAgent($conditionId: Uuid!) {
evo_reward_condition(evo_reward_conditionid: $conditionId) {
evo_agency_agreementidData {
evo_reward_without_other_agent
}
}
}
`;
/**
* Добавить реакцию на изменение списка в поле selectDealerRewardCondition :
Если в списке selectDealerRewardCondition есть запись,
@ -140,10 +133,10 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
async (rewardConditionId) => {
function fillAgents() {
const leadid = $calculation.element('selectLead').getValue();
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
fillIndAgent(store, apolloClient, leadid);
fillCalcDoubleAgent(store, apolloClient, leadid);
fillCalcBroker(store, apolloClient, leadid);
fillFinDepartment(store, apolloClient, leadid);
}
if (!rewardConditionId) {
@ -157,11 +150,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardWithoutOtherAgentQuery,
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
>({
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: rewardConditionId,
},
@ -212,10 +202,10 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
async (rewardConditionId) => {
function fillAgents() {
const leadid = $calculation.element('selectLead').getValue();
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
fillIndAgent(store, apolloClient, leadid);
fillCalcDoubleAgent(store, apolloClient, leadid);
fillCalcBroker(store, apolloClient, leadid);
fillFinDepartment(store, apolloClient, leadid);
}
if (!rewardConditionId) {
@ -229,11 +219,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardWithoutOtherAgentQuery,
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
>({
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: rewardConditionId,
},
@ -285,9 +272,9 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
async (rewardConditionId) => {
function fillAgents() {
const leadid = $calculation.element('selectLead').getValue();
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
fillCalcDoubleAgent(store, apolloClient, leadid);
fillCalcBroker(store, apolloClient, leadid);
fillFinDepartment(store, apolloClient, leadid);
}
if (!rewardConditionId) {
@ -301,11 +288,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardWithoutOtherAgentQuery,
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
>({
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: rewardConditionId,
},
@ -358,9 +342,9 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
async (rewardConditionId) => {
function fillAgents() {
const leadid = $calculation.element('selectLead').getValue();
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
fillIndAgent(store, apolloClient, leadid);
fillCalcBroker(store, apolloClient, leadid);
fillFinDepartment(store, apolloClient, leadid);
}
if (!rewardConditionId) {
@ -374,11 +358,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardWithoutOtherAgentQuery,
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
>({
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: rewardConditionId,
},
@ -431,9 +412,9 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
async (rewardConditionId) => {
function fillAgents() {
const leadid = $calculation.element('selectLead').getValue();
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
fillIndAgent(store, apolloClient, leadid);
fillCalcDoubleAgent(store, apolloClient, leadid);
fillFinDepartment(store, apolloClient, leadid);
}
if (!rewardConditionId) {
@ -447,11 +428,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardWithoutOtherAgentQuery,
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
>({
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: rewardConditionId,
},
@ -505,9 +483,9 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
async (rewardConditionId) => {
function fillAgents() {
const leadid = $calculation.element('selectLead').getValue();
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
fillIndAgent(store, apolloClient, leadid);
fillCalcDoubleAgent(store, apolloClient, leadid);
fillFinDepartment(store, apolloClient, leadid);
}
if (!rewardConditionId) {
@ -520,11 +498,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
}
const {
data: { evo_reward_condition },
} = await apolloClient.query<
CRMTypes.GetRewardWithoutOtherAgentQuery,
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
>({
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
} = await apolloClient.query({
query: CRMTypes.GetRewardConditionDocument,
variables: {
conditionId: rewardConditionId,
},
@ -553,22 +528,22 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
export function validationReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation } = store;
createReactions.validateAgentRewardSumm(store, apolloClient, {
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectIndAgentRewardCondition',
rewardSummField: 'tbxIndAgentRewardSumm',
});
createReactions.validateAgentRewardSumm(store, apolloClient, {
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectCalcDoubleAgentRewardCondition',
rewardSummField: 'tbxCalcDoubleAgentRewardSumm',
});
createReactions.validateAgentRewardSumm(store, apolloClient, {
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectCalcBrokerRewardCondition',
rewardSummField: 'tbxCalcBrokerRewardSum',
});
createReactions.validateAgentRewardSumm(store, apolloClient, {
validateAgentRewardSumm(store, apolloClient, {
rewardConditionField: 'selectFinDepartmentRewardCondtion',
rewardSummField: 'tbxFinDepartmentRewardSumm',
});

View File

@ -1,7 +1,6 @@
import type * as CRMTypes from 'graphql/crm.types';
import * as CRMTypes from 'graphql/crm.types';
import { autorun, reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
import * as query from '../lib/query';
export default function leasebackReactions({ store, apolloClient }: ReactionsContext) {
const { $calculation, $tables } = store;
@ -27,11 +26,8 @@ export default function leasebackReactions({ store, apolloClient }: ReactionsCon
const {
data: { dealer },
} = await apolloClient.query<
CRMTypes.GetDealerReturnLeasingQuery,
CRMTypes.GetDealerReturnLeasingQueryVariables
>({
query: query.QUERY_GET_DEALER_RETURN_LEASING,
} = await apolloClient.query({
query: CRMTypes.GetDealerDocument,
variables: {
dealerId,
},
@ -61,11 +57,8 @@ export default function leasebackReactions({ store, apolloClient }: ReactionsCon
if (dealerId) {
const {
data: { dealer },
} = await apolloClient.query<
CRMTypes.GetDealerReturnLeasingQuery,
CRMTypes.GetDealerReturnLeasingQueryVariables
>({
query: query.QUERY_GET_DEALER_RETURN_LEASING,
} = await apolloClient.query({
query: CRMTypes.GetDealerDocument,
variables: {
dealerId,
},
@ -101,11 +94,8 @@ export default function leasebackReactions({ store, apolloClient }: ReactionsCon
if (dealerId) {
const {
data: { dealer },
} = await apolloClient.query<
CRMTypes.GetDealerReturnLeasingQuery,
CRMTypes.GetDealerReturnLeasingQueryVariables
>({
query: query.QUERY_GET_DEALER_RETURN_LEASING,
} = await apolloClient.query({
query: CRMTypes.GetDealerDocument,
variables: {
dealerId,
},

View File

@ -1,14 +1,12 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
import * as CRMTypes from 'graphql/crm.types';
import { reaction } from 'mobx';
import type { ReactionsContext } from 'process/types';
import { sift } from 'radash';
import { normalizeOptions } from 'tools/entity';
import * as createReactions from '../lib/create-reactions';
import * as query from '../lib/query';
dayjs.extend(utc);
@ -22,17 +20,6 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
* И связаны с карточкой Контрагент из поля "Салон приобретения" по связи Салон-ЮЛ
*/
const QUERY_GET_DEALER_PERSON = gql`
query GetDealerPerson($dealerId: Uuid!) {
salon_providers(statecode: 0, salonaccountid: $dealerId) {
label: name
value: accountid
evo_inn
evo_kpp
}
}
`;
reaction(
() => $calculation.element('selectDealer').getValue(),
async (dealerId) => {
@ -44,11 +31,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { dealer },
} = await apolloClient.query<
CRMTypes.GetDealerReturnLeasingQuery,
CRMTypes.GetDealerReturnLeasingQueryVariables
>({
query: query.QUERY_GET_DEALER_RETURN_LEASING,
} = await apolloClient.query({
query: CRMTypes.GetDealerDocument,
variables: {
dealerId,
},
@ -59,28 +43,25 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
}
const {
data: { salon_providers },
} = await apolloClient.query<
CRMTypes.GetDealerPersonQuery,
CRMTypes.GetDealerPersonQueryVariables
>({
query: QUERY_GET_DEALER_PERSON,
data: { dealerPersons },
} = await apolloClient.query({
query: CRMTypes.GetDealerPersonsDocument,
variables: {
dealerId,
},
});
if (salon_providers && salon_providers.length > 0) {
if (dealerPersons && dealerPersons.length > 0) {
$calculation.element('selectDealerPerson').setOptions(
normalizeOptions(
salon_providers.map((dp) => ({
dealerPersons.map((dp) => ({
...dp,
label: `${dp?.label} ${sift([dp?.evo_inn, dp?.evo_kpp]).join(' | ')}`,
}))
)
);
const value = salon_providers.at(0)?.value;
const value = dealerPersons.at(0)?.value;
if (!$process.has('LoadKP') && value) {
$calculation.element('selectDealerPerson').setValue(value);
}
@ -94,14 +75,6 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
* Заполняем selectDealerBroker
*/
const QUERY_GET_BROKER_ACCOUNTID_FROM_DEALER = gql`
query GetBrokerAccountIdFromDealer($dealerId: Uuid!) {
dealer: account(accountid: $dealerId) {
evo_broker_accountid
}
}
`;
reaction(
() => $calculation.element('selectDealerPerson').getValue(),
async (dealerPersonId) => {
@ -113,11 +86,8 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { dealer },
} = await apolloClient.query<
CRMTypes.GetBrokerAccountIdFromDealerQuery,
CRMTypes.GetBrokerAccountIdFromDealerQueryVariables
>({
query: QUERY_GET_BROKER_ACCOUNTID_FROM_DEALER,
} = await apolloClient.query({
query: CRMTypes.GetDealerDocument,
variables: {
dealerId: dealerPersonId,
},
@ -127,7 +97,7 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
const {
data: { agent: dealerBroker },
} = await apolloClient.query<CRMTypes.GetAgentQuery, CRMTypes.GetAgentQueryVariables>({
query: query.QUERY_GET_AGENT,
query: CRMTypes.GetAgentDocument,
variables: {
agentid: dealer?.evo_broker_accountid,
},

View File

@ -82,6 +82,8 @@ export default class CalculationStore {
return this.$options.getOptions(elementName)?.find((x) => x.value === value);
},
getOptions: () => this.$options.getOptions(elementName),
setOptions: (options: BaseOption<Values.ElementsTypes[E]>[]) => {
this.$options.setOptions(elementName, options);
@ -94,12 +96,12 @@ export default class CalculationStore {
return this.element(elementName);
},
validate: ({ invalid, message }: ValidationParams) => {
validate: ({ invalid, message, silent }: ValidationParams) => {
if (!this.$validation[elementName]) this.createElementValidation(elementName);
let removeError: RemoveError | undefined;
if (invalid) {
removeError = this.$validation[elementName]?.addError(message);
removeError = this.$validation[elementName]?.addError(message, silent);
} else {
this.$validation[elementName]?.removeError(message);
}

View File

@ -26,19 +26,6 @@ export default class OptionsStore {
return options;
}
private checkValueInOptions = (elementName: Elements) => {
/**
* Проверяем, что значение есть в новом списке, иначе сбрасываем значение
*/
const value = this.root.$calculation.element(elementName).getValue();
if (
!this.options[elementName]?.length ||
!this.options[elementName].some((x) => x.value === value)
) {
this.root.$calculation.element(elementName).resetValue();
}
};
setOptions = <T extends Elements>(elementName: T, options: BaseOption<ElementsTypes[T]>[]) => {
/**
* TODO: use T instead of any in BaseOption type
@ -46,8 +33,6 @@ export default class OptionsStore {
* but infer works just perfect
*/
this.options[elementName] = options as BaseOption<any>[];
this.checkValueInOptions(elementName);
};
resetOptions = <T extends Elements>(elementName: T) => {

View File

@ -1,7 +1,6 @@
/* eslint-disable object-curly-newline */
import defaultValues from 'config/default-values';
import { makeAutoObservable } from 'mobx';
import { pick } from 'radash';
import type RootStore from '../../root';
import type { CalculationValues, Values } from './types';
@ -18,11 +17,10 @@ export default class ValuesStore {
this.values = initialValues;
};
setValues = (params: { values: CalculationValues; exclude: Values[] }) => {
const { values, exclude } = params;
setValues = (params: { values: CalculationValues }) => {
const { values } = params;
const savedValues = pick(this.values, exclude);
this.values = { ...values, ...savedValues };
this.values = values;
};
getValue<V extends Values>(valueName: V) {

View File

@ -63,7 +63,7 @@ export default class InsuranceTable {
getStatus: (valueName: Insurance.Values) => this.statuses[key][valueName],
getOptions: (valueName: Insurance.Values) => this.options[key][valueName],
getOptions: <V extends Insurance.Values>(valueName: V) => this.options[key][valueName],
setValue: <V extends Insurance.Values>(valueName: V, value: Insurance.RowValues[V]) => {
const rowIndex = this.values.findIndex((x) => x.key === key);

View File

@ -25,14 +25,16 @@ export default class Validation {
if (this.messages.size === 0) notification.close(this.params.err_key);
};
addError = (message: string) => {
addError = (message: string, silent?: boolean) => {
this.messages.add(message);
notification.error({
key: this.params.err_key,
message: this.params.err_title,
description: message,
});
if (!silent) {
notification.error({
key: this.params.err_key,
message: this.params.err_title,
description: message,
});
}
return () => this.removeError(message);
};

View File

@ -6,6 +6,7 @@ export type ValidationConfig = {
export type ValidationParams = {
invalid: boolean;
message: string;
silent?: boolean;
};
export type RemoveError = () => void;

View File

@ -1,8 +1,11 @@
import defaultValues from 'config/default-values';
import { defaultValues as defaultInsuranceValues } from 'config/tables/insurance-table';
import getConfiguratorDataFromKP from 'process/configurator/get-kp-data';
import getFingapDataFromKP from 'process/fingap/get-kp-data';
import getLeasingObjectDataFromKP from 'process/leasing-object/get-kp-data';
import { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } from 'process/load-kp/types';
import getPaymentsDataFromKP from 'process/payments/get-kp-data';
import getPriceDataFromKP from 'process/price/get-kp-data';
import getSupplierAgentsDataFromKP from 'process/supplier-agent/get-kp-values';
import { t } from '../server';
@ -14,15 +17,21 @@ const quoteRouter = t.router({
.input(GetQuoteDataInputSchema)
.output(GetQuoteDataOutputSchema)
.query(async ({ input }) => {
const { values: configuratorValues } = await getConfiguratorDataFromKP(input);
const { values: supplierAgentsValues } = await getSupplierAgentsDataFromKP(input);
const { values: paymentsValues, payments } = await getPaymentsDataFromKP(input);
const { values: priceValues } = await getPriceDataFromKP(input);
const { values: leasingObjectValues } = await getLeasingObjectDataFromKP(input);
const { fingap, insurance: fingapInsurance } = await getFingapDataFromKP(input);
return {
values: {
...defaultValues,
...configuratorValues,
...supplierAgentsValues,
...paymentsValues,
...priceValues,
...leasingObjectValues,
},
payments,
insurance: {

View File

@ -9,7 +9,7 @@
"scripts": {
"build": "dotenv -e .env turbo run build",
"clean": "turbo run clean",
"dev": "dotenv -e .env.local turbo run dev --parallel",
"dev": "dotenv -e .env.local turbo run dev",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx}\"",
"lint": "dotenv -e .env.local turbo run lint",
"lint:fix": "dotenv -e .env.local turbo run lint:fix",
@ -25,7 +25,7 @@
"husky": "^8.0.3",
"prettier": "^2.8.2",
"tools": "*",
"turbo": "latest"
"turbo": "^1.7.1"
},
"packageManager": "yarn@1.22.17",
"engines": {

View File

@ -3,5 +3,12 @@ import { isEmpty } from 'radash';
import type { BaseOption } from 'ui/elements/types';
export function normalizeOptions(options: any[] | null | undefined) {
return (isEmpty(options) ? [] : options) as BaseOption[];
if (isEmpty(options)) {
return [];
}
return options?.map(({ label, value }) => ({
label,
value,
})) as BaseOption[];
}

View File

@ -3,8 +3,7 @@
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**", "public/dist/**"],
"dependsOn": ["^build"],
"cache": false
"dependsOn": ["^build"]
},
"test": {
"cache": false
@ -18,7 +17,8 @@
"outputs": []
},
"dev": {
"cache": false
"cache": false,
"persistent": true
},
"clean": {
"cache": false

835
yarn.lock

File diff suppressed because it is too large Load Diff