merge migration/random-4
This commit is contained in:
parent
9d45a7bff0
commit
5442905966
2
.env
2
.env
@ -8,5 +8,7 @@ USERS_SUPER=["akalinina","vchikalkin"]
|
||||
####### URLS ########
|
||||
URL_GET_USER_DIRECT=
|
||||
URL_CRM_GRAPHQL_DIRECT=
|
||||
URL_CRM_CREATEKP_DIRECT=
|
||||
URL_CORE_FINGAP_DIRECT=
|
||||
URL_CORE_CALCULATE_DIRECT=
|
||||
URL_1C_TRANSTAX_DIRECT=
|
||||
@ -8,7 +8,12 @@ export const rows: FormTabRows = [
|
||||
[['selectOpportunity'], defaultRowStyle],
|
||||
[['cbxRecalcWithRevision'], defaultRowStyle],
|
||||
[['selectQuote'], defaultRowStyle],
|
||||
[['btnCalculate'], defaultRowStyle],
|
||||
[
|
||||
['btnCalculate', 'btnCreateKPMini'],
|
||||
{
|
||||
gridTemplateColumns: ['1fr 0.15fr'],
|
||||
},
|
||||
],
|
||||
|
||||
{ title: 'Параметры расчета' },
|
||||
[['labelIrrInfo'], defaultRowStyle],
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import type { Elements } from '../config/map/actions';
|
||||
import { useProcessContext } from '@/process/hooks';
|
||||
import { useStatus } from '@/stores/calculation/statuses/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import type { ComponentType } from 'react';
|
||||
@ -15,9 +16,12 @@ export default function buildAction<T>(
|
||||
return observer((props: T) => {
|
||||
const status = useStatus(elementName);
|
||||
|
||||
const context = useProcessContext();
|
||||
|
||||
return (
|
||||
<Component
|
||||
action={() => import(`process/${processName}/action`).then((module) => module.action())}
|
||||
action={() =>
|
||||
import(`process/${processName}/action`).then((module) => module.action(context))}
|
||||
status={status}
|
||||
{...props}
|
||||
/>
|
||||
|
||||
@ -142,6 +142,7 @@ const components = wrapComponentsMap({
|
||||
|
||||
/** Button Elements */
|
||||
btnCreateKP: e.Button,
|
||||
btnCreateKPMini: e.Button,
|
||||
btnCalculate: e.Button,
|
||||
|
||||
/** Link Elements */
|
||||
|
||||
@ -5,7 +5,7 @@ import type { ElementsProps } from './elements-components';
|
||||
import { MAX_FRANCHISE, MAX_LEASING_PERIOD } from '@/constants/values';
|
||||
import dayjs from 'dayjs';
|
||||
import { formatter, formatterExtra, parser } from 'tools/number';
|
||||
import { DownloadOutlined } from 'ui/elements/icons';
|
||||
import { DownloadOutlined, PlusOutlined } from 'ui/elements/icons';
|
||||
|
||||
const props: Partial<ElementsProps> = {
|
||||
tbxLeaseObjectPrice: {
|
||||
@ -296,9 +296,21 @@ const props: Partial<ElementsProps> = {
|
||||
optionType: 'button',
|
||||
buttonStyle: 'solid',
|
||||
},
|
||||
btnCalculate: {
|
||||
text: 'Рассчитать график',
|
||||
type: 'primary',
|
||||
block: true,
|
||||
},
|
||||
btnCreateKP: {
|
||||
type: 'primary',
|
||||
text: 'Создать КП',
|
||||
icon: <PlusOutlined />,
|
||||
},
|
||||
btnCreateKPMini: {
|
||||
text: '',
|
||||
type: 'primary',
|
||||
icon: <PlusOutlined />,
|
||||
block: true,
|
||||
},
|
||||
tbxCreditRate: {
|
||||
min: 0,
|
||||
@ -345,10 +357,6 @@ const props: Partial<ElementsProps> = {
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
},
|
||||
btnCalculate: {
|
||||
text: 'Рассчитать график',
|
||||
type: 'primary',
|
||||
},
|
||||
tbxIRR_Perc: {
|
||||
min: 0,
|
||||
max: 500,
|
||||
|
||||
@ -143,6 +143,7 @@ const titles: Record<ActionElements | ValuesElements, string> = {
|
||||
/** Action Elements */
|
||||
btnCalculate: '',
|
||||
btnCreateKP: '',
|
||||
btnCreateKPMini: '',
|
||||
};
|
||||
|
||||
export default titles;
|
||||
|
||||
@ -171,6 +171,7 @@ const types = wrapElementsTypes({
|
||||
tbxSubsidySum: t.Readonly,
|
||||
|
||||
btnCreateKP: t.Action,
|
||||
btnCreateKPMini: t.Action,
|
||||
btnCalculate: t.Action,
|
||||
|
||||
linkDownloadKp: t.Readonly,
|
||||
|
||||
@ -5,6 +5,7 @@ function wrapElementsMap<T extends Record<string, string>>(arg: T) {
|
||||
const elementsToActions = wrapElementsMap({
|
||||
btnCalculate: 'calculate',
|
||||
btnCreateKP: 'create-kp',
|
||||
btnCreateKPMini: 'create-kp',
|
||||
});
|
||||
|
||||
export default elementsToActions;
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable sonarjs/no-small-switch */
|
||||
import Button from 'ui/elements/Button';
|
||||
import Result from 'ui/elements/Result';
|
||||
|
||||
@ -5,7 +6,12 @@ function handleRetry() {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function openSupport() {
|
||||
window.open('https://support.evoleasing.ru', '_blank').focus();
|
||||
}
|
||||
|
||||
const RetryButton = <Button action={handleRetry} text="Попробовать еще раз" />;
|
||||
const SupportButton = <Button action={openSupport} text="Обратиться в поддержку" />;
|
||||
|
||||
export function CRMError({ error }) {
|
||||
return (
|
||||
@ -17,3 +23,18 @@ export function CRMError({ error }) {
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function Forbidden() {
|
||||
return <Result status="403" title="Доступ запрещен" extra={SupportButton} />;
|
||||
}
|
||||
|
||||
export function Error({ statusCode, ...props }) {
|
||||
switch (statusCode) {
|
||||
case 403: {
|
||||
return <Forbidden />;
|
||||
}
|
||||
default: {
|
||||
return <CRMError {...props} />;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { getUser } from '@/api/user/query';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import { min } from '@/styles/mq';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import styled from 'styled-components';
|
||||
@ -19,8 +20,8 @@ const UserText = styled.span`
|
||||
`;
|
||||
|
||||
function User() {
|
||||
const { data: user } = useQuery(['user'], () => getUser(), {
|
||||
enabled: false,
|
||||
const { data: user } = useQuery(['user'], ({ signal }) => getUser({ signal }), {
|
||||
staleTime: STALE_TIME,
|
||||
});
|
||||
|
||||
return <UserText>{user?.displayName}</UserText>;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import type { Payment } from './types';
|
||||
import type { ResultPayment } from '@/stores/results/types';
|
||||
import type { ColumnsType } from 'antd/lib/table';
|
||||
|
||||
export const columns: ColumnsType<Payment> = [
|
||||
export const columns: ColumnsType<ResultPayment> = [
|
||||
{
|
||||
key: 'num',
|
||||
dataIndex: 'num',
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
export type Payment = {
|
||||
key: string;
|
||||
ndsCompensation: string;
|
||||
num: number;
|
||||
paymentSum: string;
|
||||
redemptionAmount: string;
|
||||
};
|
||||
@ -1,9 +1,10 @@
|
||||
import type { Values } from '@/stores/results/types';
|
||||
import type { ResultValues } from '@/stores/results/types';
|
||||
import { moneyFormatter, percentFormatter } from 'tools';
|
||||
|
||||
export const id = 'output';
|
||||
export const title = 'Результаты';
|
||||
|
||||
export const titles: Record<Values, string> = {
|
||||
export const titles: Record<keyof ResultValues, string> = {
|
||||
resultAB_FL: 'АВ ФЛ, без НДФЛ.',
|
||||
resultAB_UL: 'АВ ЮЛ, с НДС.',
|
||||
resultBonusDopProd: 'Бонус МПЛ за доп.продукты, без НДФЛ',
|
||||
@ -18,55 +19,31 @@ export const titles: Record<Values, string> = {
|
||||
resultInsKasko: 'КАСКО, НС, ДГО в графике',
|
||||
resultInsOsago: 'ОСАГО в графике',
|
||||
resultLastPayment: 'Последний платеж',
|
||||
resultParticipationAmount: 'Сумма участия (для принятия решения)',
|
||||
resultPlPrice: 'Стоимость ПЛ с НДС',
|
||||
resultPriceUpPr: 'Удорожание, год',
|
||||
resultTerm: 'Срок, мес.',
|
||||
resultTotalGraphwithNDS: 'Итого по графику, с НДС',
|
||||
};
|
||||
|
||||
const moneyFormatters = Object.fromEntries(
|
||||
(
|
||||
[
|
||||
'resultTotalGraphwithNDS',
|
||||
'resultPlPrice',
|
||||
'resultInsKasko',
|
||||
'resultInsOsago',
|
||||
'resultDopProdSum',
|
||||
'resultFirstPayment',
|
||||
'resultLastPayment',
|
||||
'resultAB_FL',
|
||||
'resultAB_UL',
|
||||
'resultBonusMPL',
|
||||
'resultDopMPLLeasing',
|
||||
'resultBonusDopProd',
|
||||
'tbxSubsidySum',
|
||||
'resultBonusSafeFinance',
|
||||
'resultPriceUpPr',
|
||||
] as Values[]
|
||||
).map((a) => [
|
||||
a,
|
||||
Intl.NumberFormat('ru', {
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}).format,
|
||||
])
|
||||
);
|
||||
|
||||
const percentFormatters = Object.fromEntries(
|
||||
(['resultIRRGraphPerc', 'resultIRRNominalPerc', 'resultFirstPaymentRiskPolicy'] as Values[]).map(
|
||||
(a) => [
|
||||
a,
|
||||
Intl.NumberFormat('ru', {
|
||||
maximumFractionDigits: 2,
|
||||
minimumFractionDigits: 2,
|
||||
style: 'percent',
|
||||
}).format,
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
const defaultFormatters = {
|
||||
export const formatters = {
|
||||
resultAB_FL: moneyFormatter,
|
||||
resultAB_UL: moneyFormatter,
|
||||
resultBonusDopProd: moneyFormatter,
|
||||
resultBonusMPL: moneyFormatter,
|
||||
resultBonusSafeFinance: moneyFormatter,
|
||||
resultDopMPLLeasing: moneyFormatter,
|
||||
resultDopProdSum: moneyFormatter,
|
||||
resultFirstPayment: moneyFormatter,
|
||||
resultFirstPaymentRiskPolicy: percentFormatter,
|
||||
resultIRRGraphPerc: percentFormatter,
|
||||
resultIRRNominalPerc: percentFormatter,
|
||||
resultInsKasko: moneyFormatter,
|
||||
resultInsOsago: moneyFormatter,
|
||||
resultLastPayment: moneyFormatter,
|
||||
resultParticipationAmount: moneyFormatter,
|
||||
resultPlPrice: moneyFormatter,
|
||||
resultPriceUpPr: moneyFormatter,
|
||||
resultTerm: Intl.NumberFormat('ru').format,
|
||||
resultTotalGraphwithNDS: moneyFormatter,
|
||||
};
|
||||
|
||||
export const formatters = Object.assign(moneyFormatters, percentFormatters, defaultFormatters);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import type { RequestFinGAP, ResponseFinGAP } from './types';
|
||||
import type { RequestCalculate, RequestFinGAP, ResponseCalculate, ResponseFinGAP } from './types';
|
||||
import getUrls from '@/config/urls';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import axios from 'axios';
|
||||
|
||||
const { URL_CORE_FINGAP } = getUrls();
|
||||
const { URL_CORE_FINGAP, URL_CORE_CALCULATE } = getUrls();
|
||||
|
||||
export async function calculateFinGAP(payload: RequestFinGAP, { signal }: QueryFunctionContext) {
|
||||
const { data } = await axios.post<ResponseFinGAP>(URL_CORE_FINGAP, payload, {
|
||||
@ -12,3 +12,10 @@ export async function calculateFinGAP(payload: RequestFinGAP, { signal }: QueryF
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function calculate(payload: RequestCalculate): Promise<ResponseCalculate> {
|
||||
return await axios
|
||||
.post<ResponseCalculate>(URL_CORE_CALCULATE, payload)
|
||||
.then((response) => response.data)
|
||||
.catch((error) => error.response.data);
|
||||
}
|
||||
|
||||
426
apps/web/api/core/types/calculate.ts
Normal file
426
apps/web/api/core/types/calculate.ts
Normal file
@ -0,0 +1,426 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const PreparedValuesSchema = z.object({
|
||||
acceptSum: z.number(),
|
||||
agentsSum: z.number(),
|
||||
balanceHolder: z.number(),
|
||||
baseRatCost: z.number(),
|
||||
baseRegistration: z.number(),
|
||||
bonus: z.number(),
|
||||
bonusCoefficient: z.number(),
|
||||
bonusFinGAP: z.number(),
|
||||
bonusFix: z.number(),
|
||||
bonusNsPr: z.number(),
|
||||
bonusNsibPr: z.number(),
|
||||
bonusRatPr: z.number(),
|
||||
brandId: z.string().nullable(),
|
||||
brokerOfDeliverySum: z.number(),
|
||||
brokerSum: z.number(),
|
||||
calcDate: z.date(),
|
||||
calcType: z.number(),
|
||||
carCapacity: z.number(),
|
||||
carCarrying: z.number(),
|
||||
carSeats: z.number(),
|
||||
cityc: z.string(),
|
||||
comissionRub: z.number(),
|
||||
configurationId: z.string().nullable(),
|
||||
deliverySum: z.number(),
|
||||
deliveryTime: z.number(),
|
||||
deprecationTime: z.number(),
|
||||
directorBonus: z.number(),
|
||||
directorBonusFinGAP: z.number(),
|
||||
directorBonusFix: z.number(),
|
||||
directorBonusNsib: z.number(),
|
||||
directorExtraBonus: z.number(),
|
||||
discount: z.number(),
|
||||
districtRate: z.number(),
|
||||
dogDate: z.date(),
|
||||
doubleAgentsSum: z.number(),
|
||||
extraBonus: z.number(),
|
||||
financialDeptOfDeliverySum: z.number(),
|
||||
firstPayment: z.number(),
|
||||
firstPaymentAbs: z.number(),
|
||||
firstPaymentNdsAbs: z.number(),
|
||||
firstPaymentSum: z.number(),
|
||||
firstPaymentWithNdsAbs: z.number(),
|
||||
fuelCardSum: z.number(),
|
||||
gpsCostPaymentSum: z.number(),
|
||||
iRR_MSFO_Plan: z.number(),
|
||||
importProgramSum: z.number(),
|
||||
importerSum: z.number(),
|
||||
insuranceBonus: z.number(),
|
||||
insuranceBonusLoss: z.number(),
|
||||
insuranceContract: z.number(),
|
||||
insuranceEvoKasko: z.number(),
|
||||
insuranceFinGAP: z.number(),
|
||||
insuranceKasko: z.number(),
|
||||
insuranceKaskoNmper: z.number(),
|
||||
insuranceOsago: z.number(),
|
||||
irrExpected: z.number(),
|
||||
lastPayment: z.number(),
|
||||
lastPaymentFix: z.boolean(),
|
||||
lastPaymentSum: z.number(),
|
||||
leasing0K: z.number(),
|
||||
loanRate: z.number(),
|
||||
loanRatePeriod: z.number(),
|
||||
marketRate: z.number(),
|
||||
modelId: z.string().nullable(),
|
||||
motorVolume: z.number(),
|
||||
nmper: z.number(),
|
||||
nmperDeprecation: z.number(),
|
||||
nmperFinGAP: z.number(),
|
||||
nmperInsurance: z.number(),
|
||||
npvniDelta: z.number(),
|
||||
npvniExpected: z.number(),
|
||||
nsBonus: z.number(),
|
||||
nsibBase: z.number(),
|
||||
nsibBonus: z.number(),
|
||||
nsibBrutto: z.number(),
|
||||
nsibBruttoPr: z.number(),
|
||||
nsibNetto: z.number(),
|
||||
nsibNettoPr: z.number(),
|
||||
paymentDateNew: z.date().nullable(),
|
||||
plEngineType: z.number().nullable(),
|
||||
plPrice: z.number(),
|
||||
plPriceVAT: z.number(),
|
||||
plPriceWithVAT: z.number(),
|
||||
plTypeId: z.string().nullable(),
|
||||
plYear: z.number(),
|
||||
profitExpected: z.number(),
|
||||
ratBonus: z.number(),
|
||||
rats: z.number(),
|
||||
regionalDirectorBonus: z.number(),
|
||||
regionalDirectorBonusFinGAP: z.number(),
|
||||
regionalDirectorBonusFix: z.number(),
|
||||
regionalDirectorBonusNsib: z.number(),
|
||||
regionalDirectorExtraBonus: z.number(),
|
||||
registration: z.number(),
|
||||
repayment: z.number(),
|
||||
retroBonus: z.number(),
|
||||
salaryRate: z.number(),
|
||||
scheduleOfPayments: z.number(),
|
||||
subsidyPaymentNumber: z.number(),
|
||||
subsidySum: z.number(),
|
||||
supplierFinancing: z.boolean(),
|
||||
tlmCost: z.number(),
|
||||
tlmCostPaymentSum: z.number(),
|
||||
totalExpected: z.number(),
|
||||
trackerCost: z.number(),
|
||||
transIncludeGr: z.boolean(),
|
||||
transTax: z.number(),
|
||||
transportTaxGr: z.number(),
|
||||
transportTaxGrYear: z.number(),
|
||||
});
|
||||
|
||||
export type PreparedValues = z.infer<typeof PreparedValuesSchema>;
|
||||
|
||||
const PaymentRowSchema = z.object({
|
||||
gpsBasePayment: z.number(),
|
||||
gpsCostPayment: z.number(),
|
||||
numberPayment: z.number(),
|
||||
percentPayment: z.number(),
|
||||
sumPayment: z.number(),
|
||||
tlmBasePayment: z.number(),
|
||||
tlmCostPayment: z.number(),
|
||||
});
|
||||
|
||||
const PreparedPaymentSchema = z.object({
|
||||
rows: PaymentRowSchema.array(),
|
||||
});
|
||||
|
||||
export type PreparedPayments = z.infer<typeof PreparedPaymentSchema>;
|
||||
|
||||
const AdditionalDataSchema = z.object({
|
||||
maxAllAgencyPerc: z.number().nullable(),
|
||||
maxCashflowMSFONominal: z.number().nullable(),
|
||||
minCashflowMSFONominal: z.number().nullable(),
|
||||
});
|
||||
|
||||
export type AdditionalData = z.infer<typeof AdditionalDataSchema>;
|
||||
|
||||
export const RequestCalculateSchema = z.object({
|
||||
additionalData: AdditionalDataSchema,
|
||||
preparedPayments: PreparedPaymentSchema,
|
||||
preparedValues: PreparedValuesSchema,
|
||||
});
|
||||
|
||||
export type RequestCalculate = z.infer<typeof RequestCalculateSchema>;
|
||||
|
||||
const PostValuesSchema = z.object({
|
||||
baseCost: z.number(),
|
||||
bonusBase: z.number(),
|
||||
bonusResult: z.number(),
|
||||
contractEconomy: z.number(),
|
||||
contractEconomyWithVAT: z.number(),
|
||||
directorBonus: z.number(),
|
||||
directorExtraBonus: z.number(),
|
||||
npvni: z.number(),
|
||||
priceUP: z.number(),
|
||||
priceUP_PR: z.number(),
|
||||
priceUP_Year: z.number(),
|
||||
priceUP_Year_PR: z.number(),
|
||||
regionalDirectorBonus: z.number(),
|
||||
regionalDirectorExtraBonus: z.number(),
|
||||
});
|
||||
|
||||
const ColumnsSchema = z.object({
|
||||
acceptInsuranceColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
acceptKaskoColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
acceptOsagoColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
acceptSumColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
agentComissionExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowLeasingColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowMsfoColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
nominal: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowMsfoFinal2Column: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
nominal: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowMsfoFinalColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
nominal: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowNpvColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowNpvFinal2Column: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowNpvFinalColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
cashflowNsibColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
nominal: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
comissionBonusExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
creditColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
creditVATColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
dateColumn: z.object({
|
||||
values: z.array(z.string()),
|
||||
}),
|
||||
dateTempColumn: z.object({
|
||||
values: z.array(z.string()),
|
||||
}),
|
||||
deprecationColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
deprecationLdColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
deprecationLpColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
directorBonusSumColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
evoKaskoNmperGrColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
expensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
extraBonusSumColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
finGAPNmperGrColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
gpsExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
gpsGrColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
insuranceBonusExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
interestColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
irrGrColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
kaskoBonusGrSumColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
kaskoNmperGrColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
negativeCashflowColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
niColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
npvBonusExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
npvColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
nominal: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
npvFinal2Column: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
nominal: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
npvFinalColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
nominal: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
npvWeightColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
nsibBruttoGrColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
nsibExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
percentPaymentColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
ratExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
registrExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
revenueColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
subsidyExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumColumn: z.object({
|
||||
dates: z.array(z.string()),
|
||||
irr: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumCreditColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumCurrentColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumCurrentInterestColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumCurrentNegativeColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumCurrentTlmColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumRepaymentColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumVATCreditColumn: z.object({
|
||||
values: z.number().array(),
|
||||
}),
|
||||
sumWithVatColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
taxColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
tlmExpensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
tlmGrColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
transExprensesColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
vatColumn: z.object({
|
||||
sum: z.number(),
|
||||
values: z.number().array(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ResponseCalculateSchema = z.object({
|
||||
columns: ColumnsSchema,
|
||||
errors: z.string().array(),
|
||||
postValues: PostValuesSchema,
|
||||
preparedValues: PreparedValuesSchema.extend({
|
||||
insuranceFinGAPNmper: z.number(),
|
||||
niAtInception: z.number(),
|
||||
}),
|
||||
});
|
||||
|
||||
export type ResponseCalculate = z.infer<typeof ResponseCalculateSchema>;
|
||||
2
apps/web/api/core/types/index.ts
Normal file
2
apps/web/api/core/types/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './calculate';
|
||||
export * from './fingap';
|
||||
12
apps/web/api/crm/query.ts
Normal file
12
apps/web/api/crm/query.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type { RequestCreateKP, ResponseCreateKP } from './types';
|
||||
import getUrls from '@/config/urls';
|
||||
import axios from 'axios';
|
||||
|
||||
const { URL_CRM_CREATEKP } = getUrls();
|
||||
|
||||
export async function createKP(payload: RequestCreateKP): Promise<ResponseCreateKP> {
|
||||
return await axios
|
||||
.post(URL_CRM_CREATEKP, payload)
|
||||
.then((response) => ({ ...response.data, success: true }))
|
||||
.catch((error) => ({ ...error.response.data, success: false }));
|
||||
}
|
||||
41
apps/web/api/crm/types.ts
Normal file
41
apps/web/api/crm/types.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { RequestCalculateSchema, ResponseCalculateSchema } from '../core/types';
|
||||
import { RiskSchema } from '@/config/schema/fingap';
|
||||
import { RowSchema } from '@/config/schema/insurance';
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const RequestCreateKPSchema = z.object({
|
||||
calculation: z
|
||||
.object({
|
||||
calculationValues: ValuesSchema,
|
||||
})
|
||||
.and(
|
||||
RequestCalculateSchema.omit({
|
||||
preparedValues: true,
|
||||
})
|
||||
)
|
||||
.and(
|
||||
ResponseCalculateSchema.omit({
|
||||
errors: true,
|
||||
})
|
||||
),
|
||||
domainName: z.string(),
|
||||
finGAP: RiskSchema.array(),
|
||||
insurance: RowSchema.array(),
|
||||
});
|
||||
|
||||
export type RequestCreateKP = z.infer<typeof RequestCreateKPSchema>;
|
||||
|
||||
export const ResponseCreateKPSchema = z.union([
|
||||
z.object({
|
||||
evo_quotename: z.string(),
|
||||
success: z.literal(true),
|
||||
}),
|
||||
z.object({
|
||||
fullMessage: z.string(),
|
||||
message: z.string(),
|
||||
success: z.literal(false),
|
||||
}),
|
||||
]);
|
||||
|
||||
export type ResponseCreateKP = z.infer<typeof ResponseCreateKPSchema>;
|
||||
@ -3,6 +3,7 @@ import type { CalculationStatuses } from '@/stores/calculation/statuses/types';
|
||||
const defaultStatuses: CalculationStatuses = {
|
||||
btnCalculate: 'Default',
|
||||
btnCreateKP: 'Default',
|
||||
btnCreateKPMini: 'Default',
|
||||
cbxCostIncrease: 'Default',
|
||||
cbxDisableChecks: 'Default',
|
||||
cbxFullPriceWithDiscount: 'Default',
|
||||
|
||||
@ -4,7 +4,9 @@ const envSchema = z.object({
|
||||
BASE_PATH: z.string().optional().default(''),
|
||||
PORT: z.string().optional(),
|
||||
URL_1C_TRANSTAX_DIRECT: z.string(),
|
||||
URL_CORE_CALCULATE_DIRECT: z.string(),
|
||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||
URL_CRM_CREATEKP_DIRECT: z.string(),
|
||||
URL_CRM_GRAPHQL_DIRECT: z.string(),
|
||||
URL_GET_USER_DIRECT: z.string(),
|
||||
USE_DEV_COLORS: z.unknown().optional().transform(Boolean),
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const RiskSchema = z
|
||||
.object({
|
||||
export const RiskSchema = z.object({
|
||||
calcType: z.number(),
|
||||
key: z.string(),
|
||||
keys: z.array(z.string()).optional(),
|
||||
@ -10,5 +9,4 @@ export const RiskSchema = z
|
||||
riskId: z.string(),
|
||||
riskName: z.string(),
|
||||
sum: z.number(),
|
||||
})
|
||||
.strict();
|
||||
});
|
||||
|
||||
@ -2,13 +2,19 @@ import { z } from 'zod';
|
||||
|
||||
export const KeysSchema = z.enum(['osago', 'kasko', 'fingap']);
|
||||
|
||||
export const RowSchema = z
|
||||
.object({
|
||||
export const RowSchema = z.object({
|
||||
insCost: z.number(),
|
||||
insTerm: z.number().nullable(),
|
||||
insuranceCompany: z.string().nullable(),
|
||||
insured: z.number().nullable(),
|
||||
key: KeysSchema,
|
||||
policyType: z.string(),
|
||||
})
|
||||
.strict();
|
||||
});
|
||||
|
||||
export const InsuranceSchema = z.object({
|
||||
values: z.object({
|
||||
fingap: RowSchema,
|
||||
kasko: RowSchema,
|
||||
osago: RowSchema,
|
||||
}),
|
||||
});
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const PaymentsSchema = z
|
||||
.object({
|
||||
const PaymentsSchema = z.object({
|
||||
values: z.number().array(),
|
||||
})
|
||||
.strict();
|
||||
});
|
||||
|
||||
export default PaymentsSchema;
|
||||
|
||||
33
apps/web/config/schema/results.ts
Normal file
33
apps/web/config/schema/results.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const ResultValuesSchema = z.object({
|
||||
resultAB_FL: z.number(),
|
||||
resultAB_UL: z.number(),
|
||||
resultBonusDopProd: z.number(),
|
||||
resultBonusMPL: z.number(),
|
||||
resultBonusSafeFinance: z.number(),
|
||||
resultDopMPLLeasing: z.number(),
|
||||
resultDopProdSum: z.number(),
|
||||
resultFirstPayment: z.number(),
|
||||
resultFirstPaymentRiskPolicy: z.number(),
|
||||
resultIRRGraphPerc: z.number(),
|
||||
resultIRRNominalPerc: z.number(),
|
||||
resultInsKasko: z.number(),
|
||||
resultInsOsago: z.number(),
|
||||
resultLastPayment: z.number(),
|
||||
resultParticipationAmount: z.number(),
|
||||
resultPlPrice: z.number(),
|
||||
resultPriceUpPr: z.number(),
|
||||
resultTerm: z.number(),
|
||||
resultTotalGraphwithNDS: z.number(),
|
||||
});
|
||||
|
||||
export const ResultPaymentSchema = z.object({
|
||||
key: z.string(),
|
||||
ndsCompensation: z.number(),
|
||||
num: z.number(),
|
||||
paymentSum: z.number(),
|
||||
redemptionAmount: z.number(),
|
||||
});
|
||||
|
||||
export const ResultPaymentsSchema = ResultPaymentSchema.array();
|
||||
@ -10,7 +10,9 @@ const serverRuntimeConfigSchema = envSchema.pick({
|
||||
BASE_PATH: true,
|
||||
PORT: true,
|
||||
URL_1C_TRANSTAX_DIRECT: true,
|
||||
URL_CORE_CALCULATE_DIRECT: true,
|
||||
URL_CORE_FINGAP_DIRECT: true,
|
||||
URL_CRM_CREATEKP_DIRECT: true,
|
||||
URL_CRM_GRAPHQL_DIRECT: true,
|
||||
URL_GET_USER_DIRECT: true,
|
||||
});
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { z } from 'zod';
|
||||
|
||||
const ValuesSchema = z
|
||||
.object({
|
||||
const ValuesSchema = z.object({
|
||||
addEquipmentPrice: z.number(),
|
||||
balanceHolder: z.number().nullable(),
|
||||
balanceHolder: z.number(),
|
||||
bonusCoefficient: z.number(),
|
||||
brand: z.string().nullable(),
|
||||
calcBroker: z.string().nullable(),
|
||||
@ -14,7 +13,7 @@ const ValuesSchema = z
|
||||
calcDoubleAgentRewardCondition: z.string().nullable(),
|
||||
calcDoubleAgentRewardSumm: z.number(),
|
||||
calcFinDepartment: z.string().nullable(),
|
||||
calcType: z.number().nullable(),
|
||||
calcType: z.number(),
|
||||
clientRisk: z.string().nullable(),
|
||||
clientType: z.string().nullable(),
|
||||
comissionPerc: z.number(),
|
||||
@ -30,7 +29,7 @@ const ValuesSchema = z
|
||||
dealerPerson: z.string().nullable(),
|
||||
dealerRewardCondition: z.string().nullable(),
|
||||
dealerRewardSumm: z.number(),
|
||||
deliveryTime: z.number().nullable(),
|
||||
deliveryTime: z.number(),
|
||||
disableChecks: z.boolean(),
|
||||
engineHours: z.number(),
|
||||
engineType: z.number().nullable(),
|
||||
@ -43,7 +42,7 @@ const ValuesSchema = z
|
||||
fullPriceWithDiscount: z.boolean(),
|
||||
GPSBrand: z.string().nullable(),
|
||||
GPSModel: z.string().nullable(),
|
||||
graphType: z.number().nullable(),
|
||||
graphType: z.number(),
|
||||
highSeasonStart: z.number().nullable(),
|
||||
importerRewardPerc: z.number(),
|
||||
importerRewardRub: z.number(),
|
||||
@ -144,7 +143,6 @@ const ValuesSchema = z
|
||||
plPriceRub: z.number(),
|
||||
registrationDescription: z.string().nullable(),
|
||||
subsidySum: z.number(),
|
||||
})
|
||||
.strict();
|
||||
});
|
||||
|
||||
export default ValuesSchema;
|
||||
|
||||
@ -14,6 +14,8 @@ function getUrls() {
|
||||
URL_GET_USER_DIRECT,
|
||||
URL_CORE_FINGAP_DIRECT,
|
||||
URL_1C_TRANSTAX_DIRECT,
|
||||
URL_CORE_CALCULATE_DIRECT,
|
||||
URL_CRM_CREATEKP_DIRECT,
|
||||
PORT,
|
||||
} = serverRuntimeConfigSchema.parse(serverRuntimeConfig);
|
||||
|
||||
@ -21,7 +23,9 @@ function getUrls() {
|
||||
BASE_PATH,
|
||||
PORT,
|
||||
URL_1C_TRANSTAX: URL_1C_TRANSTAX_DIRECT,
|
||||
URL_CORE_CALCULATE: URL_CORE_CALCULATE_DIRECT,
|
||||
URL_CORE_FINGAP: URL_CORE_FINGAP_DIRECT,
|
||||
URL_CRM_CREATEKP: URL_CRM_CREATEKP_DIRECT,
|
||||
URL_CRM_GRAPHQL: URL_CRM_GRAPHQL_DIRECT,
|
||||
URL_GET_USER: URL_GET_USER_DIRECT,
|
||||
};
|
||||
@ -34,7 +38,9 @@ function getUrls() {
|
||||
return {
|
||||
BASE_PATH,
|
||||
URL_1C_TRANSTAX: withBasePath(urls.URL_1C_TRANSTAX_PROXY),
|
||||
URL_CORE_CALCULATE: withBasePath(urls.URL_CORE_CALCULATE_PROXY),
|
||||
URL_CORE_FINGAP: withBasePath(urls.URL_CORE_FINGAP_PROXY),
|
||||
URL_CRM_CREATEKP: withBasePath(urls.URL_CRM_CREATEKP_PROXY),
|
||||
URL_CRM_GRAPHQL: withBasePath(urls.URL_CRM_GRAPHQL_PROXY),
|
||||
URL_GET_USER: withBasePath(urls.URL_GET_USER_PROXY),
|
||||
};
|
||||
|
||||
@ -1 +1,10 @@
|
||||
export const STALE_TIME = Number.POSITIVE_INFINITY;
|
||||
import dayjs from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration';
|
||||
|
||||
dayjs.extend(duration);
|
||||
|
||||
export const STALE_TIME = dayjs
|
||||
.duration({
|
||||
hours: 1,
|
||||
})
|
||||
.asMilliseconds();
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
module.exports = {
|
||||
URL_1C_TRANSTAX_PROXY: '/api/1c/transtax',
|
||||
URL_CORE_CALCULATE_PROXY: '/api/core/calculate',
|
||||
URL_CORE_FINGAP_PROXY: '/api/core/fingap',
|
||||
URL_CRM_CREATEKP_PROXY: '/api/crm/create-kp',
|
||||
URL_CRM_GRAPHQL_PROXY: '/api/graphql/crm',
|
||||
URL_GET_USER_PROXY: '/api/auth/user',
|
||||
};
|
||||
|
||||
@ -9,3 +9,6 @@ export const MIN_PAYMENT = 3;
|
||||
export const VAT = 0.2;
|
||||
export const MAX_MASS = 3500;
|
||||
export const MAX_VEHICLE_SEATS = 20;
|
||||
export const ESN = 1.3;
|
||||
export const NSIB_MAX = 5_000_000;
|
||||
export const NDFL = 0.13;
|
||||
|
||||
@ -12,6 +12,7 @@ query GetTransactionCurrency($currencyid: Uuid!) {
|
||||
transactioncurrency(transactioncurrencyid: $currencyid) {
|
||||
currencysymbol
|
||||
isocurrencycode
|
||||
transactioncurrencyid
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,6 +98,7 @@ query GetQuote($quoteId: Uuid!) {
|
||||
evo_seats
|
||||
evo_year
|
||||
evo_last_payment_perc
|
||||
evo_maximum_percentage_av
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,6 +136,8 @@ query GetTarif($tarifId: Uuid!) {
|
||||
evo_datefrom
|
||||
evo_rateid
|
||||
}
|
||||
evo_irr_plan
|
||||
evo_margin_min
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,6 +159,8 @@ query GetRates($currentDate: DateTime) {
|
||||
query GetRate($rateId: Uuid!) {
|
||||
evo_rate(evo_rateid: $rateId) {
|
||||
evo_base_rate
|
||||
evo_credit_period
|
||||
evo_id
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,6 +193,7 @@ query GetProduct($productId: Uuid!) {
|
||||
evo_cut_proportion_bonus_director
|
||||
evo_cut_irr_with_bonus
|
||||
evo_sale_without_nds
|
||||
evo_id
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,6 +226,7 @@ query GetSubsidy($subsidyId: Uuid!) {
|
||||
evo_subsidy_summ
|
||||
evo_percent_subsidy
|
||||
evo_max_subsidy_summ
|
||||
evo_get_subsidy_payment
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,6 +303,10 @@ query GetLeaseObjectType($leaseObjectTypeId: Uuid!) {
|
||||
evo_category
|
||||
evo_vehicle_type_tax
|
||||
evo_category_tr
|
||||
evo_expluatation_period1
|
||||
evo_expluatation_period2
|
||||
evo_depreciation_rate1
|
||||
evo_depreciation_rate2
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,7 +422,9 @@ query GetRewardCondition($conditionId: Uuid!) {
|
||||
evo_agency_agreementidData {
|
||||
evo_required_reward
|
||||
evo_reward_without_other_agent
|
||||
evo_leasingobject_price
|
||||
}
|
||||
evo_calc_reward_rules
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,14 +444,32 @@ query GetCoefficients($currentDate: DateTime, $jobTitleId: Uuid!) {
|
||||
evo_sot_coefficient_typeid
|
||||
evo_baseproducts {
|
||||
evo_baseproductid
|
||||
evo_id
|
||||
}
|
||||
evo_sot_coefficient
|
||||
evo_corfficient_type
|
||||
evo_sot_coefficient_typeidData {
|
||||
evo_id
|
||||
}
|
||||
evo_correction_coefficient
|
||||
evo_min_period
|
||||
evo_max_period
|
||||
evo_season_type
|
||||
evo_graph_type
|
||||
evo_businessunits {
|
||||
evo_sale_businessunitid
|
||||
}
|
||||
evo_risk_delta
|
||||
}
|
||||
}
|
||||
|
||||
query GetSystemUser($domainname: String) {
|
||||
systemuser(domainname: $domainname) {
|
||||
evo_job_titleid
|
||||
businessunitid
|
||||
roles {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -462,6 +494,19 @@ query GetAddProductType($addproductTypeId: Uuid!) {
|
||||
evo_addproduct_type(evo_addproduct_typeid: $addproductTypeId) {
|
||||
evo_description
|
||||
evo_helpcard_type
|
||||
evo_planpayments {
|
||||
evo_name
|
||||
evo_cost_price_telematics_withoutnds
|
||||
evo_cost_equipment_withoutnds
|
||||
evo_cost_telematics_withoutnds
|
||||
}
|
||||
evo_graph_price_withoutnds
|
||||
evo_cost_service_provider_withoutnds
|
||||
evo_retro_bonus_withoutnds
|
||||
evo_evokasko_calc_type
|
||||
evo_loss_kv
|
||||
evo_price_service_provider_withoutnds
|
||||
evo_graph_price
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ export type GetTransactionCurrencyQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetTransactionCurrencyQuery = { __typename?: 'Query', transactioncurrency: { __typename?: 'transactioncurrency', currencysymbol: string | null, isocurrencycode: string | null } | null };
|
||||
export type GetTransactionCurrencyQuery = { __typename?: 'Query', transactioncurrency: { __typename?: 'transactioncurrency', currencysymbol: string | null, isocurrencycode: string | null, transactioncurrencyid: string | null } | null };
|
||||
|
||||
export type GetCurrencyChangesQueryVariables = Exact<{
|
||||
currentDate: InputMaybe<Scalars['DateTime']>;
|
||||
@ -175,7 +175,7 @@ export type GetQuoteQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null, evo_one_year_insurance: boolean | null, evo_min_change_price: number | null, evo_max_price_change: number | null, evo_discount_supplier_currency: number | null, evo_equip_price: number | null, evo_program_import_subsidy_sum: number | null, evo_nds_in_price_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_approved_first_payment: number | null, evo_recalc_limit: number | null, evo_max_mass: number | null, evo_seats: number | null, evo_year: number | null, evo_last_payment_perc: number | null } | null };
|
||||
export type GetQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null, evo_one_year_insurance: boolean | null, evo_min_change_price: number | null, evo_max_price_change: number | null, evo_discount_supplier_currency: number | null, evo_equip_price: number | null, evo_program_import_subsidy_sum: number | null, evo_nds_in_price_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_approved_first_payment: number | null, evo_recalc_limit: number | null, evo_max_mass: number | null, evo_seats: number | null, evo_year: number | null, evo_last_payment_perc: number | null, evo_maximum_percentage_av: number | null } | null };
|
||||
|
||||
export type GetTarifsQueryVariables = Exact<{
|
||||
currentDate: InputMaybe<Scalars['DateTime']>;
|
||||
@ -189,7 +189,7 @@ export type GetTarifQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetTarifQuery = { __typename?: 'Query', evo_tarif: { __typename?: 'evo_tarif', evo_irr: number | null, evo_graphtype_exception: Array<number> | null, evo_seasons_type_exception: Array<number> | null, evo_min_decreasing_perc: number | null, evo_min_irr: number | null, evo_cut_irr_with_bonus_coefficient: number | null, evo_max_irr: number | null, evo_rates: Array<{ __typename?: 'evo_rate', evo_datefrom: string | null, evo_rateid: string | null } | null> | null } | null };
|
||||
export type GetTarifQuery = { __typename?: 'Query', evo_tarif: { __typename?: 'evo_tarif', evo_irr: number | null, evo_graphtype_exception: Array<number> | null, evo_seasons_type_exception: Array<number> | null, evo_min_decreasing_perc: number | null, evo_min_irr: number | null, evo_cut_irr_with_bonus_coefficient: number | null, evo_max_irr: number | null, evo_irr_plan: number | null, evo_margin_min: number | null, evo_rates: Array<{ __typename?: 'evo_rate', evo_datefrom: string | null, evo_rateid: string | null } | null> | null } | null };
|
||||
|
||||
export type GetRatesQueryVariables = Exact<{
|
||||
currentDate: InputMaybe<Scalars['DateTime']>;
|
||||
@ -203,7 +203,7 @@ export type GetRateQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetRateQuery = { __typename?: 'Query', evo_rate: { __typename?: 'evo_rate', evo_base_rate: number | null } | null };
|
||||
export type GetRateQuery = { __typename?: 'Query', evo_rate: { __typename?: 'evo_rate', evo_base_rate: number | null, evo_credit_period: number | null, evo_id: string | null } | null };
|
||||
|
||||
export type GetProductsQueryVariables = Exact<{
|
||||
currentDate: InputMaybe<Scalars['DateTime']>;
|
||||
@ -217,7 +217,7 @@ export type GetProductQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array<number> | null, evo_sale_without_nds: boolean | null, evo_cut_proportion_bonus_director: boolean | null, evo_cut_irr_with_bonus: boolean | 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 GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array<number> | null, evo_sale_without_nds: boolean | null, evo_cut_proportion_bonus_director: boolean | null, evo_cut_irr_with_bonus: boolean | null, evo_id: string | 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']>;
|
||||
@ -231,7 +231,7 @@ export type GetSubsidyQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
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 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_get_subsidy_payment: 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'];
|
||||
@ -281,7 +281,7 @@ export type GetLeaseObjectTypeQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetLeaseObjectTypeQuery = { __typename?: 'Query', evo_leasingobject_type: { __typename?: 'evo_leasingobject_type', evo_vehicle_type: Array<number> | null, evo_id: string | null, evo_category: number | null, evo_vehicle_type_tax: number | null, evo_category_tr: Array<number> | null } | null };
|
||||
export type GetLeaseObjectTypeQuery = { __typename?: 'Query', evo_leasingobject_type: { __typename?: 'evo_leasingobject_type', evo_vehicle_type: Array<number> | null, evo_id: string | null, evo_category: number | null, evo_vehicle_type_tax: number | null, evo_category_tr: Array<number> | null, evo_expluatation_period1: number | null, evo_expluatation_period2: number | null, evo_depreciation_rate1: number | null, evo_depreciation_rate2: number | null } | null };
|
||||
|
||||
export type GetBrandsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
@ -369,7 +369,7 @@ export type GetRewardConditionQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
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 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_calc_reward_rules: number | null, evo_agency_agreementidData: { __typename?: 'evo_agency_agreement', evo_required_reward: boolean | null, evo_reward_without_other_agent: boolean | null, evo_leasingobject_price: number | null } | null } | null };
|
||||
|
||||
export type GetSotCoefficientTypeQueryVariables = Exact<{
|
||||
evo_id: InputMaybe<Scalars['String']>;
|
||||
@ -384,14 +384,14 @@ export type GetCoefficientsQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetCoefficientsQuery = { __typename?: 'Query', evo_coefficients: Array<{ __typename?: 'evo_coefficient', evo_job_titleid: string | null, evo_sot_coefficient_typeid: string | null, evo_sot_coefficient: number | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null } | null> | null };
|
||||
export type GetCoefficientsQuery = { __typename?: 'Query', evo_coefficients: Array<{ __typename?: 'evo_coefficient', evo_job_titleid: string | null, evo_sot_coefficient_typeid: string | null, evo_sot_coefficient: number | null, evo_corfficient_type: number | null, evo_correction_coefficient: number | null, evo_min_period: number | null, evo_max_period: number | null, evo_season_type: number | null, evo_graph_type: number | null, evo_risk_delta: number | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null, evo_id: string | null } | null> | null, evo_sot_coefficient_typeidData: { __typename?: 'evo_sot_coefficient_type', evo_id: string | null } | null, evo_businessunits: Array<{ __typename?: 'evo_businessunit', evo_sale_businessunitid: string | null } | null> | null } | null> | null };
|
||||
|
||||
export type GetSystemUserQueryVariables = Exact<{
|
||||
domainname: InputMaybe<Scalars['String']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type GetSystemUserQuery = { __typename?: 'Query', systemuser: { __typename?: 'systemuser', evo_job_titleid: string | null } | null };
|
||||
export type GetSystemUserQuery = { __typename?: 'Query', systemuser: { __typename?: 'systemuser', evo_job_titleid: string | null, businessunitid: string | null, roles: Array<{ __typename?: 'role', name: string | null } | null> | null } | null };
|
||||
|
||||
export type CoreAddProductTypesFieldsFragment = { __typename?: 'evo_addproduct_type', evo_graph_price: number | null, label: string | null, value: string | null };
|
||||
|
||||
@ -407,7 +407,7 @@ export type GetAddProductTypeQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetAddProductTypeQuery = { __typename?: 'Query', evo_addproduct_type: { __typename?: 'evo_addproduct_type', evo_description: string | null, evo_helpcard_type: number | null } | null };
|
||||
export type GetAddProductTypeQuery = { __typename?: 'Query', evo_addproduct_type: { __typename?: 'evo_addproduct_type', evo_description: string | null, evo_helpcard_type: number | null, evo_graph_price_withoutnds: number | null, evo_cost_service_provider_withoutnds: number | null, evo_retro_bonus_withoutnds: number | null, evo_evokasko_calc_type: number | null, evo_loss_kv: number | null, evo_price_service_provider_withoutnds: number | null, evo_graph_price: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_name: string | null, evo_cost_price_telematics_withoutnds: number | null, evo_cost_equipment_withoutnds: number | null, evo_cost_telematics_withoutnds: number | null } | null> | null } | null };
|
||||
|
||||
export type GetRegistrationTypesQueryVariables = Exact<{
|
||||
currentDate: InputMaybe<Scalars['DateTime']>;
|
||||
@ -591,22 +591,22 @@ export type GetQuoteAgentsDataQuery = { __typename?: 'Query', quote: { __typenam
|
||||
|
||||
export const CoreAddProductTypesFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<CoreAddProductTypesFieldsFragment, unknown>;
|
||||
export const GetTransactionCurrenciesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransactionCurrencies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactioncurrencies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"currencyname"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"isocurrencycode"}},{"kind":"Field","name":{"kind":"Name","value":"currencysymbol"}}]}}]}}]} as unknown as DocumentNode<GetTransactionCurrenciesQuery, GetTransactionCurrenciesQueryVariables>;
|
||||
export const GetTransactionCurrencyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransactionCurrency"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currencyid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactioncurrency"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"transactioncurrencyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currencyid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencysymbol"}},{"kind":"Field","name":{"kind":"Name","value":"isocurrencycode"}}]}}]}}]} as unknown as DocumentNode<GetTransactionCurrencyQuery, GetTransactionCurrencyQueryVariables>;
|
||||
export const 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"}},{"kind":"Field","name":{"kind":"Name","value":"transactioncurrencyid"}}]}}]}}]} 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 GetLeadsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeads"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"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"}}]}}]}}]} as unknown as DocumentNode<GetLeadsQuery, GetLeadsQueryVariables>;
|
||||
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"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","name":{"kind":"Name","value":"accountidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_address_legalidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_city_fias_id"}}]}}]}}]}}]}}]} as unknown as DocumentNode<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"}},{"kind":"Field","name":{"kind":"Name","value":"accountidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_address_legalidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_city_fias_id"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOpportunityQuery, GetOpportunityQueryVariables>;
|
||||
export const GetOpportunitiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunities"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"owner_domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"opportunityid"}}]}}]}}]} as unknown as DocumentNode<GetOpportunitiesQuery, GetOpportunitiesQueryVariables>;
|
||||
export const GetQuotesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quotes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_quotename"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"quoteid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_statuscodeidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_purchases_participation"}}]}}]}}]} 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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_one_year_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidy_sum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_approved_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}}]}}]}}]} as unknown as DocumentNode<GetQuoteQuery, GetQuoteQueryVariables>;
|
||||
export const GetQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_one_year_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidy_sum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_approved_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_maximum_percentage_av"}}]}}]}}]} as unknown as DocumentNode<GetQuoteQuery, GetQuoteQueryVariables>;
|
||||
export const GetTarifsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarifs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_used"}}]}}]}}]} as unknown as DocumentNode<GetTarifsQuery, GetTarifsQueryVariables>;
|
||||
export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarif"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarif"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_tarifid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphtype_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_decreasing_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus_coefficient"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_datefrom"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}}]}}]}}]}}]} as unknown as DocumentNode<GetTarifQuery, GetTarifQueryVariables>;
|
||||
export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarif"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarif"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_tarifid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphtype_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_decreasing_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus_coefficient"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_datefrom"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_irr_plan"}},{"kind":"Field","name":{"kind":"Name","value":"evo_margin_min"}}]}}]}}]} as unknown as DocumentNode<GetTarifQuery, GetTarifQueryVariables>;
|
||||
export const GetRatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRates"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}}]}}]}}]}}]} as unknown as DocumentNode<GetRatesQuery, GetRatesQueryVariables>;
|
||||
export const GetRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_rateid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_base_rate"}}]}}]}}]} as unknown as DocumentNode<GetRateQuery, GetRateQueryVariables>;
|
||||
export const GetRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_rateid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_base_rate"}},{"kind":"Field","name":{"kind":"Name","value":"evo_credit_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}}]}}]} as unknown as DocumentNode<GetRateQuery, GetRateQueryVariables>;
|
||||
export const GetProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProducts"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_relation"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode<GetProductsQuery, GetProductsQueryVariables>;
|
||||
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"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_proportion_bonus_director"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}}]}}]}}]} as unknown as DocumentNode<GetProductQuery, GetProductQueryVariables>;
|
||||
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"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_proportion_bonus_director"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}}]}}]} 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 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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_get_subsidy_payment"}}]}}]}}]} 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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunit_evolution"}}]}}]}}]} as unknown as DocumentNode<GetRegionsQuery, GetRegionsQueryVariables>;
|
||||
export const GetRegionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_oktmo"}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]}}]} as unknown as DocumentNode<GetRegionQuery, GetRegionQueryVariables>;
|
||||
@ -614,7 +614,7 @@ export const GetTownsDocument = {"kind":"Document","definitions":[{"kind":"Opera
|
||||
export const GetGpsBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_brandid"}}]}}]}}]} as unknown as DocumentNode<GetGpsBrandsQuery, GetGpsBrandsQueryVariables>;
|
||||
export const GetGpsModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSModels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"gpsBrandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_models"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_gps_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"gpsBrandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_modelid"}}]}}]}}]} as unknown as DocumentNode<GetGpsModelsQuery, GetGpsModelsQueryVariables>;
|
||||
export const GetLeaseObjectTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypesQuery, GetLeaseObjectTypesQueryVariables>;
|
||||
export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypeQuery, GetLeaseObjectTypeQueryVariables>;
|
||||
export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_expluatation_period1"}},{"kind":"Field","name":{"kind":"Name","value":"evo_expluatation_period2"}},{"kind":"Field","name":{"kind":"Name","value":"evo_depreciation_rate1"}},{"kind":"Field","name":{"kind":"Name","value":"evo_depreciation_rate2"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypeQuery, GetLeaseObjectTypeQueryVariables>;
|
||||
export const GetBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode<GetBrandsQuery, GetBrandsQueryVariables>;
|
||||
export const GetBrandDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrand"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brand"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}}]}}]}}]} as unknown as DocumentNode<GetBrandQuery, GetBrandQueryVariables>;
|
||||
export const GetModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode<GetModelsQuery, GetModelsQueryVariables>;
|
||||
@ -627,12 +627,12 @@ export const GetDealerPersonsDocument = {"kind":"Document","definitions":[{"kind
|
||||
export const GetDealerPersonDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealerPerson"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dealerPersonId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerPersonId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_type"}}]}}]}}]} as unknown as DocumentNode<GetDealerPersonQuery, GetDealerPersonQueryVariables>;
|
||||
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 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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_calc_reward_rules"}}]}}]}}]} as unknown as DocumentNode<GetRewardConditionQuery, GetRewardConditionQueryVariables>;
|
||||
export const GetSotCoefficientTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSotCoefficientType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"evo_id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"evo_id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}}]}}]}}]} as unknown as DocumentNode<GetSotCoefficientTypeQuery, GetSotCoefficientTypeQueryVariables>;
|
||||
export const GetCoefficientsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoefficients"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_coefficients"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_job_titleid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient"}}]}}]}}]} as unknown as DocumentNode<GetCoefficientsQuery, GetCoefficientsQueryVariables>;
|
||||
export const GetSystemUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSystemUser"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"systemuser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}}]}}]}}]} as unknown as DocumentNode<GetSystemUserQuery, GetSystemUserQueryVariables>;
|
||||
export const GetCoefficientsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoefficients"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_coefficients"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_job_titleid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient"}},{"kind":"Field","name":{"kind":"Name","value":"evo_corfficient_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_correction_coefficient"}},{"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_season_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunits"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sale_businessunitid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_risk_delta"}}]}}]}}]} as unknown as DocumentNode<GetCoefficientsQuery, GetCoefficientsQueryVariables>;
|
||||
export const GetSystemUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSystemUser"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"systemuser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}},{"kind":"Field","name":{"kind":"Name","value":"businessunitid"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetSystemUserQuery, GetSystemUserQueryVariables>;
|
||||
export const GetAddproductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddproductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetAddproductTypesQuery, GetAddproductTypesQueryVariables>;
|
||||
export const GetAddProductTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddProductType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_addproduct_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_description"}},{"kind":"Field","name":{"kind":"Name","value":"evo_helpcard_type"}}]}}]}}]} as unknown as DocumentNode<GetAddProductTypeQuery, GetAddProductTypeQueryVariables>;
|
||||
export const GetAddProductTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddProductType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_addproduct_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"addproductTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_description"}},{"kind":"Field","name":{"kind":"Name","value":"evo_helpcard_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_price_telematics_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_equipment_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_telematics_withoutnds"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_retro_bonus_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_evokasko_calc_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_loss_kv"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}}]}}]}}]} as unknown as DocumentNode<GetAddProductTypeQuery, GetAddProductTypeQueryVariables>;
|
||||
export const GetRegistrationTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegistrationTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_whom_register"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gibdd_region"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_towtruck"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetRegistrationTypesQuery, GetRegistrationTypesQueryVariables>;
|
||||
export const GetTechnicalCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTechnicalCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000000"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_helpcard_type"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetTechnicalCardsQuery, GetTechnicalCardsQueryVariables>;
|
||||
export const GetFuelCardsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFuelCards"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000005"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode<GetFuelCardsQuery, GetFuelCardsQueryVariables>;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
async function initMocks() {
|
||||
if (typeof window === 'undefined') {
|
||||
const { server } = await import('./server');
|
||||
server.listen();
|
||||
server.listen({ onUnhandledRequest: 'bypass' });
|
||||
} else {
|
||||
const { worker } = await import('./browser');
|
||||
worker.start();
|
||||
worker.start({ onUnhandledRequest: 'bypass' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,38 @@
|
||||
/* eslint-disable jsdoc/check-tag-names */
|
||||
/* eslint-disable canonical/filename-match-regex */
|
||||
import appRouter from '@/trpc/routers';
|
||||
import { createContext } from '@/server/context';
|
||||
import { appRouter } from '@/server/routers/_app';
|
||||
import * as trpcNext from '@trpc/server/adapters/next';
|
||||
|
||||
export default trpcNext.createNextApiHandler({
|
||||
createContext: () => ({}),
|
||||
/**
|
||||
* Enable query batching
|
||||
*/
|
||||
batching: {
|
||||
enabled: true,
|
||||
},
|
||||
|
||||
/**
|
||||
* @link https://trpc.io/docs/context
|
||||
*/
|
||||
createContext,
|
||||
|
||||
/**
|
||||
* @link https://trpc.io/docs/error-handling
|
||||
*/
|
||||
onError({ error }) {
|
||||
if (error.code === 'INTERNAL_SERVER_ERROR') {
|
||||
// send to bug reporting
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Something went wrong', error);
|
||||
}
|
||||
},
|
||||
|
||||
router: appRouter,
|
||||
/**
|
||||
* @link https://trpc.io/docs/caching#api-response-caching
|
||||
*/
|
||||
// responseMeta() {
|
||||
// // ...
|
||||
// },
|
||||
});
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import { getUser } from '@/api/user/query';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import * as Calculation from '@/Components/Calculation';
|
||||
import { CRMError } from '@/Components/Common/Error';
|
||||
import { Error } from '@/Components/Common/Error';
|
||||
import Output from '@/Components/Output';
|
||||
import { useDefaultReactions } from '@/config/process';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import * as init from '@/process/init';
|
||||
import { min } from '@/styles/mq';
|
||||
import { dehydrate, QueryClient } from '@tanstack/react-query';
|
||||
@ -35,12 +36,12 @@ const Grid = styled(Box)`
|
||||
}
|
||||
`;
|
||||
|
||||
function Home({ error }) {
|
||||
function Home(props) {
|
||||
init.useMainData();
|
||||
init.useInsuranceData();
|
||||
useDefaultReactions();
|
||||
|
||||
if (error) return <CRMError error={error} />;
|
||||
if (props.statusCode !== 200) return <Error {...props} />;
|
||||
|
||||
return (
|
||||
<Grid>
|
||||
@ -56,19 +57,35 @@ function Home({ error }) {
|
||||
/** @type {import('next').GetServerSideProps} */
|
||||
export const getServerSideProps = async ({ req }) => {
|
||||
const { cookie = '' } = req.headers;
|
||||
const queryGetUser = () =>
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const user = await queryClient.fetchQuery(['user'], ({ signal }) =>
|
||||
getUser({
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
const user = await queryClient.fetchQuery(['user'], queryGetUser);
|
||||
signal,
|
||||
})
|
||||
);
|
||||
|
||||
const apolloClient = initializeApollo();
|
||||
|
||||
try {
|
||||
const {
|
||||
data: { systemuser },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetSystemUserDocument,
|
||||
variables: {
|
||||
domainname: user.domainName,
|
||||
},
|
||||
});
|
||||
|
||||
if (!systemuser.roles.some((x) => x.name === 'МПЛ')) {
|
||||
return {
|
||||
props: { statusCode: 403 },
|
||||
};
|
||||
}
|
||||
const { values, options } = await init.getInitialData(apolloClient, user);
|
||||
|
||||
return {
|
||||
@ -79,12 +96,14 @@ export const getServerSideProps = async ({ req }) => {
|
||||
},
|
||||
initialApolloState: apolloClient.cache.extract(),
|
||||
initialQueryState: dehydrate(queryClient),
|
||||
statusCode: 200,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
props: {
|
||||
error: JSON.stringify(error),
|
||||
statusCode: 500,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -1,23 +1,17 @@
|
||||
import type { ValidationContext } from '../../types';
|
||||
import { getUser } from '@/api/user/query';
|
||||
import type { ElementsTypes } from '@/Components/Calculation/config/map/values';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export type ProductId = ElementsTypes['selectProduct'];
|
||||
|
||||
export default function helper({ apolloClient, queryClient }: ValidationContext) {
|
||||
export default function helper({ apolloClient, user }: ValidationContext) {
|
||||
return {
|
||||
async getCoefficient(productId: ProductId) {
|
||||
if (!productId) {
|
||||
if (!productId || !user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const user = await queryClient.fetchQuery(['user'], () => getUser(), {
|
||||
staleTime: STALE_TIME,
|
||||
});
|
||||
|
||||
const {
|
||||
data: { systemuser },
|
||||
} = await apolloClient.query({
|
||||
@ -43,19 +37,9 @@ export default function helper({ apolloClient, queryClient }: ValidationContext)
|
||||
},
|
||||
});
|
||||
|
||||
const {
|
||||
data: { evo_sot_coefficient_type },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetSotCoefficientTypeDocument,
|
||||
variables: {
|
||||
evo_id: 'BONUS_LEASING',
|
||||
},
|
||||
});
|
||||
|
||||
return evo_coefficients?.find(
|
||||
(evo_coefficient) =>
|
||||
evo_coefficient?.evo_sot_coefficient_typeid ===
|
||||
evo_sot_coefficient_type?.evo_sot_coefficient_typeid &&
|
||||
evo_coefficient?.evo_sot_coefficient_typeidData?.evo_id === 'BONUS_LEASING' &&
|
||||
evo_coefficient?.evo_baseproducts?.some((x) => x?.evo_baseproductid === productId)
|
||||
);
|
||||
},
|
||||
|
||||
@ -15,7 +15,7 @@ export function createValidationSchema(context: ValidationContext) {
|
||||
if (round(saleBonus, 2) > round(maxBonus, 2)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Размер бонуса МПЛ не может быть выше установленного по СОТ',
|
||||
message: 'Бонус не может быть выше установленного по СОТ',
|
||||
path: ['tbxSaleBonus'],
|
||||
});
|
||||
}
|
||||
|
||||
@ -1 +1,63 @@
|
||||
export function action() {}
|
||||
import type { ProcessContext } from '../types';
|
||||
import { toJS } from 'mobx';
|
||||
import notification from 'ui/elements/notification';
|
||||
|
||||
const key = 'ACTION_CALCULATE';
|
||||
const errorMessage = 'Ошибка во время расчета графика!';
|
||||
const successMessage = 'Расчет графика завершен успешно!';
|
||||
|
||||
export async function action({ store, trpcClient }: ProcessContext) {
|
||||
const { $calculation, $tables, $results } = store;
|
||||
|
||||
$calculation.$status.setStatus('btnCalculate', 'Loading');
|
||||
$calculation.$status.setStatus('btnCreateKP', 'Loading');
|
||||
$calculation.$status.setStatus('btnCreateKPMini', 'Loading');
|
||||
$results.clear();
|
||||
|
||||
const values = $calculation.$values.getValues();
|
||||
|
||||
const insurance = {
|
||||
fingap: toJS($tables.insurance.row('fingap').getValues()),
|
||||
kasko: toJS($tables.insurance.row('kasko').getValues()),
|
||||
osago: toJS($tables.insurance.row('osago').getValues()),
|
||||
};
|
||||
|
||||
const payments = toJS($tables.payments.values);
|
||||
|
||||
trpcClient.calculate
|
||||
.mutate({
|
||||
insurance: { values: insurance },
|
||||
payments: { values: payments },
|
||||
values,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.success === false) {
|
||||
notification.error({
|
||||
description: res.error,
|
||||
key,
|
||||
message: errorMessage,
|
||||
});
|
||||
} else {
|
||||
$results.setPayments(res.data.resultPayments);
|
||||
$results.setValues(res.data.resultValues);
|
||||
$calculation.$values.setValues(res.data.values);
|
||||
|
||||
notification.success({
|
||||
key,
|
||||
message: successMessage,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
notification.error({
|
||||
description: JSON.stringify(error),
|
||||
key,
|
||||
message: errorMessage,
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
$calculation.$status.setStatus('btnCalculate', 'Default');
|
||||
$calculation.$status.setStatus('btnCreateKP', 'Default');
|
||||
$calculation.$status.setStatus('btnCreateKPMini', 'Default');
|
||||
});
|
||||
}
|
||||
|
||||
52
apps/web/process/calculate/lib/helper.ts
Normal file
52
apps/web/process/calculate/lib/helper.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import type { z } from 'zod';
|
||||
|
||||
const InputSchema = ValuesSchema.pick({
|
||||
bonusCoefficient: true,
|
||||
product: true,
|
||||
tarif: true,
|
||||
});
|
||||
|
||||
export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloClient'>) {
|
||||
return {
|
||||
async getIrr({
|
||||
product: productId,
|
||||
tarif: tarifId,
|
||||
bonusCoefficient,
|
||||
}: z.infer<typeof InputSchema>) {
|
||||
let max = 0;
|
||||
let min = 0;
|
||||
|
||||
if (productId && tarifId) {
|
||||
const {
|
||||
data: { evo_baseproduct },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetProductDocument,
|
||||
variables: {
|
||||
productId,
|
||||
},
|
||||
});
|
||||
|
||||
const {
|
||||
data: { evo_tarif },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetTarifDocument,
|
||||
variables: {
|
||||
tarifId,
|
||||
},
|
||||
});
|
||||
|
||||
min = evo_tarif?.evo_min_irr ?? 0;
|
||||
max = evo_tarif?.evo_max_irr ?? 0;
|
||||
|
||||
if (evo_baseproduct?.evo_cut_irr_with_bonus && bonusCoefficient < 1) {
|
||||
min -= (1 - bonusCoefficient) * (evo_tarif?.evo_cut_irr_with_bonus_coefficient ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
return { max, min };
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import helper from '../lib/helper';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { reaction } from 'mobx';
|
||||
import { formatter } from 'tools';
|
||||
@ -27,39 +27,11 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
|
||||
const { getIrr } = helper({ apolloClient });
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
|
||||
async ({ product: productId, tarif: tarifId, bonusCoefficient }) => {
|
||||
let max = 0;
|
||||
let min = 0;
|
||||
|
||||
if (productId && tarifId) {
|
||||
const {
|
||||
data: { evo_baseproduct },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetProductDocument,
|
||||
variables: {
|
||||
productId,
|
||||
},
|
||||
});
|
||||
|
||||
const {
|
||||
data: { evo_tarif },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetTarifDocument,
|
||||
variables: {
|
||||
tarifId,
|
||||
},
|
||||
});
|
||||
|
||||
min = evo_tarif?.evo_min_irr ?? 0;
|
||||
max = evo_tarif?.evo_max_irr ?? 0;
|
||||
|
||||
if (evo_baseproduct?.evo_cut_irr_with_bonus && bonusCoefficient < 1) {
|
||||
min -= (1 - bonusCoefficient) * (evo_tarif?.evo_cut_irr_with_bonus_coefficient ?? 0);
|
||||
}
|
||||
}
|
||||
async (values) => {
|
||||
const { min, max } = await getIrr(values);
|
||||
|
||||
$calculation.element('labelIrrInfo').setValue(`${formatter(min)}% - ${formatter(max)}%`);
|
||||
}
|
||||
|
||||
@ -34,9 +34,11 @@ export default function reactions({ store }: ProcessContext) {
|
||||
if (hasErrors) {
|
||||
$calculation.$status.setStatus('btnCalculate', 'Disabled');
|
||||
$calculation.$status.setStatus('btnCreateKP', 'Disabled');
|
||||
$calculation.$status.setStatus('btnCreateKPMini', 'Disabled');
|
||||
} else {
|
||||
$calculation.$status.setStatus('btnCalculate', 'Default');
|
||||
$calculation.$status.setStatus('btnCreateKP', 'Default');
|
||||
$calculation.$status.setStatus('btnCreateKPMini', 'Default');
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -1 +1,69 @@
|
||||
export function action() {}
|
||||
import { updateSelectQuote } from '../lead-opportunity/reactions/common';
|
||||
import type { ProcessContext } from '../types';
|
||||
import { toJS } from 'mobx';
|
||||
import notification from 'ui/elements/notification';
|
||||
|
||||
const key = 'ACTION_CREATEKP';
|
||||
const errorMessage = 'Ошибка во время создания КП!';
|
||||
const successMessage = 'КП создано!';
|
||||
|
||||
export function action({ store, trpcClient, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $tables, $results } = store;
|
||||
|
||||
$calculation.$status.setStatus('btnCalculate', 'Loading');
|
||||
$calculation.$status.setStatus('btnCreateKP', 'Loading');
|
||||
$calculation.$status.setStatus('btnCreateKPMini', 'Loading');
|
||||
$results.clear();
|
||||
|
||||
const values = $calculation.$values.getValues();
|
||||
|
||||
const insurance = {
|
||||
fingap: toJS($tables.insurance.row('fingap').getValues()),
|
||||
kasko: toJS($tables.insurance.row('kasko').getValues()),
|
||||
osago: toJS($tables.insurance.row('osago').getValues()),
|
||||
};
|
||||
|
||||
const fingap = $tables.fingap.getSelectedRisks();
|
||||
|
||||
const payments = toJS($tables.payments.values);
|
||||
|
||||
trpcClient.createQuote
|
||||
.mutate({
|
||||
fingap,
|
||||
insurance: { values: insurance },
|
||||
payments: { values: payments },
|
||||
values,
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.success === false) {
|
||||
notification.error({
|
||||
description: res.error,
|
||||
key,
|
||||
message: errorMessage,
|
||||
});
|
||||
} else {
|
||||
$results.setPayments(res.data.resultPayments);
|
||||
$results.setValues(res.data.resultValues);
|
||||
$calculation.$values.setValues(res.data.values);
|
||||
|
||||
notification.success({
|
||||
key,
|
||||
message: successMessage,
|
||||
});
|
||||
|
||||
await updateSelectQuote({ apolloClient, store });
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
notification.error({
|
||||
description: JSON.stringify(error),
|
||||
key,
|
||||
message: errorMessage,
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
$calculation.$status.setStatus('btnCalculate', 'Default');
|
||||
$calculation.$status.setStatus('btnCreateKP', 'Default');
|
||||
$calculation.$status.setStatus('btnCreateKPMini', 'Default');
|
||||
});
|
||||
}
|
||||
|
||||
@ -7,13 +7,11 @@ export function common({ store }: ProcessContext) {
|
||||
reaction(
|
||||
() => $calculation.element('radioBalanceHolder').getValue(),
|
||||
(balanceHolder) => {
|
||||
if (balanceHolder) {
|
||||
if (balanceHolder === 100_000_001) {
|
||||
$calculation.element('cbxLastPaymentRedemption').setValue(true).block();
|
||||
} else {
|
||||
$calculation.element('cbxLastPaymentRedemption').unblock();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -1,21 +1,34 @@
|
||||
import type { Process } from '@/process/types';
|
||||
import { getUser } from '@/api/user/query';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import type { Process, ProcessContext } from '@/process/types';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { trpcPureClient } from '@/trpc/client';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
export function useProcess({ reactions }: Process) {
|
||||
const context = useProcessContext();
|
||||
|
||||
Object.keys(reactions).forEach((name) => {
|
||||
const injector = reactions[name];
|
||||
injector(context);
|
||||
});
|
||||
}
|
||||
|
||||
export function useProcessContext(): ProcessContext {
|
||||
const store = useStore();
|
||||
const apolloClient = useApolloClient();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
Object.keys(reactions).forEach((name) => {
|
||||
const injector = reactions[name];
|
||||
injector({
|
||||
const { data: user } = useQuery(['user'], ({ signal }) => getUser({ signal }), {
|
||||
staleTime: STALE_TIME,
|
||||
});
|
||||
|
||||
return {
|
||||
apolloClient,
|
||||
queryClient,
|
||||
store,
|
||||
trpcClient: trpcPureClient,
|
||||
});
|
||||
});
|
||||
user,
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -285,10 +285,12 @@ export function validation(context: ProcessContext) {
|
||||
|
||||
return {
|
||||
insurance: {
|
||||
values: {
|
||||
fingap: toJS($tables.insurance.row('fingap').getValues()),
|
||||
kasko: toJS($tables.insurance.row('kasko').getValues()),
|
||||
osago: toJS($tables.insurance.row('osago').getValues()),
|
||||
},
|
||||
},
|
||||
...values,
|
||||
};
|
||||
},
|
||||
|
||||
@ -1,19 +1,11 @@
|
||||
/* eslint-disable zod/require-strict */
|
||||
import type { ValidationContext } from '../types';
|
||||
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
|
||||
import { RowSchema } from '@/config/schema/insurance';
|
||||
import { InsuranceSchema } from '@/config/schema/insurance';
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { z } from 'zod';
|
||||
|
||||
const InsuranceSchema = z.object({
|
||||
insurance: z.object({
|
||||
fingap: RowSchema,
|
||||
kasko: RowSchema,
|
||||
osago: RowSchema,
|
||||
}),
|
||||
});
|
||||
|
||||
export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
return ValuesSchema.pick({
|
||||
insDecentral: true,
|
||||
@ -22,7 +14,10 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
quote: true,
|
||||
recalcWithRevision: true,
|
||||
})
|
||||
.merge(InsuranceSchema)
|
||||
.extend({
|
||||
insurance: InsuranceSchema,
|
||||
})
|
||||
|
||||
.superRefine(
|
||||
async (
|
||||
{
|
||||
@ -46,7 +41,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
recalcWithRevision &&
|
||||
quote?.evo_one_year_insurance === true &&
|
||||
leasingPeriod > 15 &&
|
||||
insurance.kasko.insTerm === 100_000_001
|
||||
insurance.values.kasko.insTerm === 100_000_001
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
@ -58,7 +53,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
}
|
||||
|
||||
(['osago', 'kasko'] as Insurance.Keys[]).forEach((key) => {
|
||||
const { insCost, insured, policyType, insuranceCompany, insTerm } = insurance[key];
|
||||
const { insCost, insured, policyType, insuranceCompany, insTerm } = insurance.values[key];
|
||||
|
||||
if (insured === 100_000_001 && insCost < 1000) {
|
||||
ctx.addIssue({
|
||||
@ -96,14 +91,14 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
||||
if (
|
||||
!leasingWithoutKasko &&
|
||||
!insDecentral &&
|
||||
insurance.osago.insuranceCompany &&
|
||||
insurance.kasko.insuranceCompany !== insurance.osago.insuranceCompany
|
||||
insurance.values.osago.insuranceCompany &&
|
||||
insurance.values.kasko.insuranceCompany !== insurance.values.osago.insuranceCompany
|
||||
) {
|
||||
const {
|
||||
data: { account },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetInsuranceCompanyDocument,
|
||||
variables: { accountId: insurance.osago.insuranceCompany },
|
||||
variables: { accountId: insurance.values.osago.insuranceCompany },
|
||||
});
|
||||
|
||||
if (account?.evo_osago_with_kasko) {
|
||||
|
||||
@ -92,7 +92,20 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['recalcWithRevision', 'lead']),
|
||||
async ({ lead: leadid, recalcWithRevision }) => {
|
||||
async () => {
|
||||
await updateSelectQuote({ apolloClient, store });
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export async function updateSelectQuote({
|
||||
store,
|
||||
apolloClient,
|
||||
}: Pick<ProcessContext, 'apolloClient' | 'store'>) {
|
||||
const { $calculation } = store;
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
const recalcWithRevision = $calculation.element('cbxRecalcWithRevision').getValue();
|
||||
|
||||
if (leadid) {
|
||||
const {
|
||||
data: { quotes },
|
||||
@ -120,5 +133,3 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
$calculation.element('selectQuote').reset();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ export async function getKPData({
|
||||
brand: quote?.evo_brandid,
|
||||
configuration: quote?.evo_equipmentid,
|
||||
countSeats: quote?.evo_seats ?? defaultValues.countSeats,
|
||||
deliveryTime: quote?.evo_delivery_time,
|
||||
deliveryTime: quote?.evo_delivery_time ?? defaultValues.deliveryTime,
|
||||
engineHours: quote?.evo_engine_hours ?? defaultValues.engineHours,
|
||||
engineType: quote?.evo_engine_type,
|
||||
engineVolume: quote?.evo_engine_volume ?? defaultValues.engineVolume,
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -20,7 +20,7 @@ export function common({ store, trpcClient }: ProcessContext) {
|
||||
key,
|
||||
});
|
||||
|
||||
trpcClient.quote.getData
|
||||
trpcClient.getQuote
|
||||
.query({
|
||||
values: {
|
||||
quote: quote.value,
|
||||
|
||||
@ -1,52 +1,3 @@
|
||||
/* eslint-disable zod/require-strict */
|
||||
import { RiskSchema } from '@/config/schema/fingap';
|
||||
import { KeysSchema, RowSchema } from '@/config/schema/insurance';
|
||||
import PaymentsSchema from '@/config/schema/payments';
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import { z } from 'zod';
|
||||
|
||||
const { quote, recalcWithRevision, lead, opportunity } = ValuesSchema.shape;
|
||||
|
||||
export const GetQuoteInputDataSchema = z
|
||||
.object({
|
||||
values: z
|
||||
.object({
|
||||
lead,
|
||||
opportunity,
|
||||
quote: quote.unwrap(),
|
||||
recalcWithRevision,
|
||||
})
|
||||
.required(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type GetQuoteInputData = z.infer<typeof GetQuoteInputDataSchema>;
|
||||
|
||||
const FinGAPSchema = z.object({
|
||||
keys: z.array(RiskSchema.shape.key),
|
||||
});
|
||||
|
||||
const InsuranceSchema = z.object({
|
||||
values: z.record(KeysSchema, RowSchema),
|
||||
});
|
||||
|
||||
export const GetQuoteOutputDataSchema = z
|
||||
.object({
|
||||
fingap: FinGAPSchema,
|
||||
insurance: InsuranceSchema,
|
||||
payments: PaymentsSchema,
|
||||
values: ValuesSchema,
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type GetQuoteOutputData = z.infer<typeof GetQuoteOutputDataSchema>;
|
||||
|
||||
export const GetQuoteProcessDataSchema = GetQuoteOutputDataSchema.omit({
|
||||
values: true,
|
||||
})
|
||||
.extend({
|
||||
values: ValuesSchema.partial(),
|
||||
})
|
||||
.partial();
|
||||
|
||||
export type GetQuoteProcessData = z.infer<typeof GetQuoteProcessDataSchema>;
|
||||
export type { GetQuoteInputData } from '@/server/routers/quote/types';
|
||||
export type { GetQuoteOutputData } from '@/server/routers/quote/types';
|
||||
export type { GetQuoteProcessData } from '@/server/routers/quote/types';
|
||||
|
||||
@ -65,7 +65,7 @@ export async function getKPData({
|
||||
},
|
||||
values: {
|
||||
firstPaymentPerc: quote?.evo_first_payment_perc ?? defaultValues.firstPaymentPerc,
|
||||
graphType: quote?.evo_graph_type,
|
||||
graphType: quote?.evo_graph_type ?? defaultValues.graphType,
|
||||
highSeasonStart: quote?.evo_high_season,
|
||||
lastPaymentPerc: quote?.evo_last_payment_perc ?? defaultValues.lastPaymentPerc,
|
||||
leasingPeriod,
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -117,7 +117,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
reaction(
|
||||
() => $calculation.element('tbxFirstPaymentRub').getValue(),
|
||||
(firstPaymentRub) => {
|
||||
const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.values;
|
||||
const { plPriceRub, addEquipmentPrice, importProgramSum } =
|
||||
$calculation.$values.getValues();
|
||||
const perc =
|
||||
(firstPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100;
|
||||
$calculation.element('tbxFirstPaymentPerc').setValue(perc);
|
||||
@ -139,7 +140,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
reaction(
|
||||
() => $calculation.element('tbxComissionRub').getValue(),
|
||||
(comissionRub) => {
|
||||
const { plPriceRub } = $calculation.$values.values;
|
||||
const { plPriceRub } = $calculation.$values.getValues();
|
||||
const perc = (comissionRub / plPriceRub) * 100;
|
||||
$calculation.element('tbxComissionPerc').setValue(perc);
|
||||
}
|
||||
@ -170,7 +171,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
reaction(
|
||||
() => $calculation.element('tbxLastPaymentRub').getValue(),
|
||||
(lastPaymentRub) => {
|
||||
const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.values;
|
||||
const { plPriceRub, addEquipmentPrice, importProgramSum } =
|
||||
$calculation.$values.getValues();
|
||||
const perc = (lastPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100;
|
||||
$calculation.element('tbxLastPaymentPerc').setValue(perc);
|
||||
}
|
||||
|
||||
@ -1,23 +1,24 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { autorun } from 'mobx';
|
||||
|
||||
dayjs.extend(utc);
|
||||
import { createCurrencyUtility } from '@/utils/currency';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
autorun(
|
||||
async () => {
|
||||
const supplierCurrencyId = $calculation.element('selectSupplierCurrency').getValue();
|
||||
const leaseObjectPrice = $calculation.element('tbxLeaseObjectPrice').getValue();
|
||||
const supplierDiscountRub = $calculation.element('tbxSupplierDiscountRub').getValue();
|
||||
const { RUB } = createCurrencyUtility({ apolloClient });
|
||||
|
||||
reaction(
|
||||
() =>
|
||||
$calculation.$values.getValues([
|
||||
'supplierCurrency',
|
||||
'leaseObjectPrice',
|
||||
'supplierDiscountRub',
|
||||
]),
|
||||
async ({ supplierCurrency: supplierCurrencyId, supplierDiscountRub, leaseObjectPrice }) => {
|
||||
if (!supplierCurrencyId) {
|
||||
$calculation.$values.setValue('plPriceRub', leaseObjectPrice);
|
||||
$calculation.$values.setValue('discountRub', supplierDiscountRub);
|
||||
$calculation.$values.resetValue('plPriceRub');
|
||||
$calculation.$values.resetValue('discountRub');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -38,27 +39,20 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_currencychanges },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetCurrencyChangesDocument,
|
||||
variables: {
|
||||
currentDate: dayjs().utc(false).format('YYYY-MM-DD'),
|
||||
},
|
||||
});
|
||||
|
||||
const evo_currencychange = evo_currencychanges?.find(
|
||||
(x) => x?.evo_ref_transactioncurrency === supplierCurrencyId
|
||||
);
|
||||
|
||||
$calculation.$values.setValue(
|
||||
'plPriceRub',
|
||||
leaseObjectPrice * (evo_currencychange?.evo_currencychange || 0)
|
||||
await RUB({
|
||||
currencyid: supplierCurrencyId,
|
||||
value: leaseObjectPrice,
|
||||
})
|
||||
);
|
||||
|
||||
$calculation.$values.setValue(
|
||||
'discountRub',
|
||||
supplierDiscountRub * (evo_currencychange?.evo_currencychange || 0)
|
||||
await RUB({
|
||||
currencyid: supplierCurrencyId,
|
||||
value: supplierDiscountRub,
|
||||
})
|
||||
);
|
||||
},
|
||||
{
|
||||
|
||||
@ -1 +1,2 @@
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import type { User } from '@/api/user/types';
|
||||
import type RootStore from '@/stores/root';
|
||||
import type { TRPCPureClient } from '@/trpc/types';
|
||||
import type { TRPCPureClient } from '@/trpc/client';
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
import type { QueryClient } from '@tanstack/react-query';
|
||||
|
||||
@ -8,10 +9,11 @@ export type ProcessContext = {
|
||||
queryClient: QueryClient;
|
||||
store: RootStore;
|
||||
trpcClient: TRPCPureClient;
|
||||
user: User | undefined;
|
||||
};
|
||||
|
||||
export type Process = {
|
||||
reactions: Record<string, (context: ProcessContext) => void>;
|
||||
};
|
||||
|
||||
export type ValidationContext = Omit<ProcessContext, 'store'>;
|
||||
export type ValidationContext = Omit<ProcessContext, 'store' | 'trpcClient'>;
|
||||
|
||||
@ -1 +1,2 @@
|
||||
export * as reactions from './reactions';
|
||||
export * from './validation';
|
||||
|
||||
19
apps/web/server/context.ts
Normal file
19
apps/web/server/context.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { getUser } from '@/api/user/query';
|
||||
import type { inferAsyncReturnType } from '@trpc/server';
|
||||
import type { CreateNextContextOptions } from '@trpc/server/adapters/next';
|
||||
|
||||
export async function createContext({ req }: CreateNextContextOptions) {
|
||||
const { cookie = '' } = req.headers;
|
||||
|
||||
const user = await getUser({
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
user,
|
||||
};
|
||||
}
|
||||
|
||||
export type Context = inferAsyncReturnType<typeof createContext>;
|
||||
21
apps/web/server/middleware.ts
Normal file
21
apps/web/server/middleware.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { t } from './trpc';
|
||||
import { TRPCError } from '@trpc/server';
|
||||
|
||||
/**
|
||||
* @see https://trpc.io/docs/v10/middlewares
|
||||
*/
|
||||
export const userMiddleware = t.middleware(({ ctx, next }) => {
|
||||
if (process.env.NODE_ENV !== 'development' && !ctx.user) {
|
||||
throw new TRPCError({
|
||||
code: 'UNAUTHORIZED',
|
||||
});
|
||||
}
|
||||
|
||||
return next({
|
||||
ctx: {
|
||||
isAdmin: false,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
export const middleware = t.middleware;
|
||||
12
apps/web/server/procedure.ts
Normal file
12
apps/web/server/procedure.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { userMiddleware } from './middleware';
|
||||
import { t } from './trpc';
|
||||
|
||||
/**
|
||||
* Create an unprotected procedure
|
||||
*
|
||||
* @see https://trpc.io/docs/v10/procedures
|
||||
*/
|
||||
|
||||
export const publicProcedure = t.procedure;
|
||||
|
||||
export const protectedProcedure = t.procedure.use(userMiddleware);
|
||||
7
apps/web/server/routers/_app.ts
Normal file
7
apps/web/server/routers/_app.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { mergeRouters } from '../trpc';
|
||||
import { calculateRouter } from './calculate';
|
||||
import { quoteRouter } from './quote';
|
||||
|
||||
export const appRouter = mergeRouters(quoteRouter, calculateRouter);
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
||||
65
apps/web/server/routers/calculate/index.ts
Normal file
65
apps/web/server/routers/calculate/index.ts
Normal file
@ -0,0 +1,65 @@
|
||||
import { router } from '../../trpc';
|
||||
import { createRequestData } from './lib/request';
|
||||
import { transformCalculateResults } from './lib/transform';
|
||||
import { validate } from './lib/validation';
|
||||
import { CalculateInputSchema, CalculateOutputSchema } from './types';
|
||||
import { calculate } from '@/api/core/query';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import { protectedProcedure } from '@/server/procedure';
|
||||
import { QueryClient } from '@tanstack/react-query';
|
||||
|
||||
export const calculateRouter = router({
|
||||
calculate: protectedProcedure
|
||||
.input(CalculateInputSchema)
|
||||
.output(CalculateOutputSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
const apolloClient = initializeApollo();
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const validationResult = await validate({
|
||||
context: {
|
||||
apolloClient,
|
||||
queryClient,
|
||||
user: ctx.user,
|
||||
},
|
||||
input,
|
||||
});
|
||||
|
||||
if (validationResult.success === false) {
|
||||
return {
|
||||
error: validationResult.error,
|
||||
success: false,
|
||||
};
|
||||
}
|
||||
|
||||
const requestData = await createRequestData({
|
||||
context: {
|
||||
apolloClient,
|
||||
queryClient,
|
||||
user: ctx.user,
|
||||
},
|
||||
input,
|
||||
user: ctx.user,
|
||||
});
|
||||
|
||||
const calculateResult = await calculate(requestData);
|
||||
|
||||
if (calculateResult.errors?.length > 0) {
|
||||
return {
|
||||
error: calculateResult.errors[0],
|
||||
success: false,
|
||||
};
|
||||
}
|
||||
|
||||
const result = transformCalculateResults({
|
||||
calculateInput: input,
|
||||
requestCalculate: requestData,
|
||||
responseCalculate: calculateResult,
|
||||
});
|
||||
|
||||
return {
|
||||
data: result,
|
||||
success: true,
|
||||
};
|
||||
}),
|
||||
});
|
||||
1238
apps/web/server/routers/calculate/lib/request.ts
Normal file
1238
apps/web/server/routers/calculate/lib/request.ts
Normal file
File diff suppressed because it is too large
Load Diff
95
apps/web/server/routers/calculate/lib/transform.ts
Normal file
95
apps/web/server/routers/calculate/lib/transform.ts
Normal file
@ -0,0 +1,95 @@
|
||||
import type { CalculateInput, OutputData } from '../types';
|
||||
import type { RequestCalculate, ResponseCalculate } from '@/api/core/types';
|
||||
import { ESN, NDFL, VAT } from '@/constants/values';
|
||||
import { last } from 'radash';
|
||||
|
||||
type Input = {
|
||||
calculateInput: CalculateInput;
|
||||
requestCalculate: RequestCalculate;
|
||||
responseCalculate: ResponseCalculate;
|
||||
};
|
||||
|
||||
export function transformCalculateResults({
|
||||
responseCalculate,
|
||||
calculateInput,
|
||||
}: Input): OutputData {
|
||||
const { values: inputValues } = calculateInput;
|
||||
const { postValues, columns, preparedValues } = responseCalculate;
|
||||
|
||||
const resultPayments: OutputData['resultPayments'] = Array.from(
|
||||
{
|
||||
length: preparedValues.nmper,
|
||||
},
|
||||
(_, i) => ({
|
||||
key: String(i + 1),
|
||||
ndsCompensation: columns.vatColumn.values[i + 1],
|
||||
num: i + 1,
|
||||
paymentSum: columns.sumWithVatColumn.values[i + 1],
|
||||
redemptionAmount: columns.sumRepaymentColumn.values[i + 1],
|
||||
})
|
||||
);
|
||||
|
||||
const resultValues: OutputData['resultValues'] = {
|
||||
resultAB_FL: ((preparedValues.agentsSum + preparedValues.doubleAgentsSum) / ESN) * (1 - NDFL),
|
||||
resultAB_UL:
|
||||
(preparedValues.deliverySum +
|
||||
preparedValues.brokerSum +
|
||||
preparedValues.brokerOfDeliverySum +
|
||||
preparedValues.financialDeptOfDeliverySum) *
|
||||
(1 + VAT),
|
||||
resultBonusDopProd: Math.abs(
|
||||
(columns?.npvBonusExpensesColumn?.values[1] / (1 + preparedValues?.salaryRate)) * (1 - NDFL)
|
||||
),
|
||||
resultBonusMPL: Math.abs(
|
||||
(columns.npvBonusExpensesColumn.values[2] / (1 + preparedValues.salaryRate)) * (1 - NDFL)
|
||||
),
|
||||
resultBonusSafeFinance: preparedValues?.bonusFinGAP * (1 - NDFL),
|
||||
resultDopMPLLeasing: Math.abs(
|
||||
(columns.extraBonusSumColumn.values[2] / (1 + preparedValues.salaryRate)) * (1 - NDFL)
|
||||
),
|
||||
resultDopProdSum:
|
||||
preparedValues.rats +
|
||||
preparedValues.registration +
|
||||
preparedValues.trackerCost +
|
||||
preparedValues.tlmCost +
|
||||
preparedValues.nsibBrutto +
|
||||
preparedValues.insuranceFinGAPNmper,
|
||||
resultFirstPayment: preparedValues.firstPaymentSum * (1 + VAT) - inputValues.subsidySum,
|
||||
resultFirstPaymentRiskPolicy: preparedValues?.firstPayment * 100,
|
||||
resultIRRGraphPerc: columns.sumColumn.irr * 100,
|
||||
resultIRRNominalPerc: columns.cashflowMsfoColumn.nominal * 100,
|
||||
resultInsKasko: preparedValues.insuranceKasko,
|
||||
resultInsOsago: preparedValues.insuranceOsago,
|
||||
resultLastPayment: preparedValues.lastPaymentSum * (1 + VAT),
|
||||
resultParticipationAmount:
|
||||
preparedValues.niAtInception +
|
||||
(preparedValues.ratBonus + preparedValues.nsBonus + preparedValues.nsibBonus) *
|
||||
preparedValues.marketRate *
|
||||
preparedValues.districtRate +
|
||||
Math.abs(columns.npvBonusExpensesColumn.values[0]) +
|
||||
Math.abs(
|
||||
columns.extraBonusSumColumn.values[0] +
|
||||
preparedValues.importerSum +
|
||||
preparedValues.agentsSum +
|
||||
preparedValues.deliverySum +
|
||||
preparedValues.brokerSum +
|
||||
preparedValues.brokerOfDeliverySum +
|
||||
preparedValues.financialDeptOfDeliverySum
|
||||
),
|
||||
resultPlPrice:
|
||||
preparedValues.plPriceWithVAT -
|
||||
inputValues.supplierDiscountRub -
|
||||
inputValues.importProgramSum,
|
||||
resultPriceUpPr: postValues.priceUP_Year_PR * 100,
|
||||
resultTerm: preparedValues.nmper,
|
||||
resultTotalGraphwithNDS: columns.sumWithVatColumn.values[0] - inputValues.subsidySum,
|
||||
};
|
||||
|
||||
const values: OutputData['values'] = {
|
||||
IRR_Perc: columns?.cashflowMsfoColumn?.nominal * 100,
|
||||
lastPaymentRub: last(columns?.sumWithVatColumn?.values) || 0,
|
||||
totalPayments: columns?.sumWithVatColumn?.values[0] - inputValues.subsidySum,
|
||||
};
|
||||
|
||||
return { resultPayments, resultValues, values };
|
||||
}
|
||||
58
apps/web/server/routers/calculate/lib/validation.ts
Normal file
58
apps/web/server/routers/calculate/lib/validation.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import type { CalculateInput, Context } from '../types';
|
||||
import elementsTitles from '@/Components/Calculation/config/elements-titles';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import * as bonuses from '@/process/bonuses';
|
||||
import * as configurator from '@/process/configurator';
|
||||
import * as gibdd from '@/process/gibdd';
|
||||
import * as insuranceProcess from '@/process/insurance';
|
||||
import * as leasingObject from '@/process/leasing-object';
|
||||
import * as paymentsProcess from '@/process/payments';
|
||||
import * as price from '@/process/price';
|
||||
import * as supplierAgent from '@/process/supplier-agent';
|
||||
import type { ZodIssue } from 'zod';
|
||||
|
||||
const processes = [
|
||||
configurator,
|
||||
supplierAgent,
|
||||
paymentsProcess,
|
||||
price,
|
||||
bonuses,
|
||||
leasingObject,
|
||||
gibdd,
|
||||
insuranceProcess,
|
||||
];
|
||||
|
||||
const titles = Object.assign(elementsTitles, {
|
||||
insurance: 'Таблица страхования',
|
||||
payments: 'Таблица платежей',
|
||||
});
|
||||
|
||||
function getMessage(errors: ZodIssue[]) {
|
||||
const elementName = errors?.at(0)?.path.at(0) as Elements;
|
||||
const title = titles[elementName];
|
||||
const message = errors?.at(0)?.message;
|
||||
|
||||
return `${title}: ${message}`;
|
||||
}
|
||||
|
||||
export async function validate({ input, context }: { context: Context; input: CalculateInput }) {
|
||||
for (const { createValidationSchema } of processes) {
|
||||
const validationSchema = createValidationSchema(context);
|
||||
const validationResult = await validationSchema.safeParseAsync({
|
||||
...input.values,
|
||||
insurance: input.insurance,
|
||||
payments: input.payments,
|
||||
});
|
||||
|
||||
if (validationResult.success === false) {
|
||||
const error = getMessage(validationResult.error.errors);
|
||||
|
||||
return { error, success: false };
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
error: '',
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
43
apps/web/server/routers/calculate/types.ts
Normal file
43
apps/web/server/routers/calculate/types.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { InsuranceSchema } from '@/config/schema/insurance';
|
||||
import PaymentsSchema from '@/config/schema/payments';
|
||||
import { ResultPaymentsSchema, ResultValuesSchema } from '@/config/schema/results';
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { z } from 'zod';
|
||||
|
||||
export type Context = Pick<ProcessContext, 'apolloClient' | 'queryClient' | 'user'>;
|
||||
|
||||
export const CalculateInputSchema = z
|
||||
.object({
|
||||
insurance: InsuranceSchema,
|
||||
payments: PaymentsSchema,
|
||||
values: ValuesSchema,
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type CalculateInput = z.infer<typeof CalculateInputSchema>;
|
||||
|
||||
export const OutputDataSchema = z.object({
|
||||
resultPayments: ResultPaymentsSchema,
|
||||
resultValues: ResultValuesSchema,
|
||||
values: ValuesSchema.pick({
|
||||
IRR_Perc: true,
|
||||
lastPaymentRub: true,
|
||||
totalPayments: true,
|
||||
}),
|
||||
});
|
||||
|
||||
export type OutputData = z.infer<typeof OutputDataSchema>;
|
||||
|
||||
export const CalculateOutputSchema = z.union([
|
||||
z.object({
|
||||
data: OutputDataSchema,
|
||||
success: z.literal(true),
|
||||
}),
|
||||
z.object({
|
||||
error: z.string(),
|
||||
success: z.literal(false),
|
||||
}),
|
||||
]);
|
||||
|
||||
export type CalculateOutput = z.infer<typeof CalculateOutputSchema>;
|
||||
190
apps/web/server/routers/quote/index.ts
Normal file
190
apps/web/server/routers/quote/index.ts
Normal file
@ -0,0 +1,190 @@
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { protectedProcedure, publicProcedure } from '../../procedure';
|
||||
import { router } from '../../trpc';
|
||||
import { createRequestData } from '../calculate/lib/request';
|
||||
import { transformCalculateResults } from '../calculate/lib/transform';
|
||||
import { validate } from '../calculate/lib/validation';
|
||||
import type { Context } from '../calculate/types';
|
||||
import {
|
||||
CreateQuoteInputDataSchema,
|
||||
CreateQuoteOutputDataSchema,
|
||||
GetQuoteInputDataSchema,
|
||||
GetQuoteOutputDataSchema,
|
||||
} from './types';
|
||||
import { calculate } from '@/api/core/query';
|
||||
import { createKP } from '@/api/crm/query';
|
||||
import initializeApollo from '@/apollo/client';
|
||||
import defaultValues from '@/config/default-values';
|
||||
import * as insuranceTable from '@/config/tables/insurance-table';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import * as addProduct from '@/process/add-product';
|
||||
import * as bonuses from '@/process/bonuses';
|
||||
import * as configurator from '@/process/configurator';
|
||||
import * as fingapProcess from '@/process/fingap';
|
||||
import * as gibdd from '@/process/gibdd';
|
||||
import * as insuranceProcess from '@/process/insurance';
|
||||
import * as leasingObject from '@/process/leasing-object';
|
||||
import * as paymentsProcess from '@/process/payments';
|
||||
import * as price from '@/process/price';
|
||||
import * as subsidy from '@/process/subsidy';
|
||||
import * as supplierAgent from '@/process/supplier-agent';
|
||||
import type { CalculationValues } from '@/stores/calculation/values/types';
|
||||
import { QueryClient } from '@tanstack/react-query';
|
||||
|
||||
const { DEFAULT_FINGAP_ROW, DEFAULT_KASKO_ROW, DEFAULT_OSAGO_ROW } = insuranceTable;
|
||||
|
||||
const defaultInsurance = {
|
||||
values: {
|
||||
fingap: DEFAULT_FINGAP_ROW,
|
||||
kasko: DEFAULT_KASKO_ROW,
|
||||
osago: DEFAULT_OSAGO_ROW,
|
||||
},
|
||||
};
|
||||
|
||||
const defaultFingap = { keys: [] };
|
||||
const defaultPayments = { values: [] };
|
||||
|
||||
export const quoteRouter = router({
|
||||
getQuote: publicProcedure
|
||||
.input(GetQuoteInputDataSchema)
|
||||
.output(GetQuoteOutputDataSchema)
|
||||
.query(async ({ input }) => {
|
||||
const processData = await Promise.all(
|
||||
[
|
||||
configurator,
|
||||
supplierAgent,
|
||||
paymentsProcess,
|
||||
price,
|
||||
bonuses,
|
||||
leasingObject,
|
||||
fingapProcess,
|
||||
gibdd,
|
||||
subsidy,
|
||||
insuranceProcess,
|
||||
addProduct,
|
||||
].map(({ getKPData }) => getKPData(input))
|
||||
);
|
||||
|
||||
const values = processData.reduce(
|
||||
(obj, data) => Object.assign(obj, data.values),
|
||||
defaultValues
|
||||
);
|
||||
const payments = processData.find((x) => x.payments)?.payments ?? defaultPayments;
|
||||
const insurance = processData.find((x) => x.insurance)?.insurance ?? defaultInsurance;
|
||||
const fingap = processData.find((x) => x.fingap)?.fingap ?? defaultFingap;
|
||||
|
||||
return {
|
||||
values,
|
||||
payments,
|
||||
insurance,
|
||||
fingap,
|
||||
};
|
||||
}),
|
||||
|
||||
createQuote: protectedProcedure
|
||||
.input(CreateQuoteInputDataSchema)
|
||||
.output(CreateQuoteOutputDataSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
const apolloClient = initializeApollo();
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const validationResult = await validate({
|
||||
context: {
|
||||
apolloClient,
|
||||
queryClient,
|
||||
user: ctx.user,
|
||||
},
|
||||
input,
|
||||
});
|
||||
|
||||
if (validationResult.success === false) {
|
||||
return {
|
||||
error: validationResult.error,
|
||||
success: false,
|
||||
};
|
||||
}
|
||||
|
||||
const requestData = await createRequestData({
|
||||
context: {
|
||||
apolloClient,
|
||||
queryClient,
|
||||
user: ctx.user,
|
||||
},
|
||||
input,
|
||||
user: ctx.user,
|
||||
});
|
||||
|
||||
const calculateResult = await calculate(requestData);
|
||||
|
||||
if (calculateResult.errors?.length > 0) {
|
||||
return {
|
||||
error: calculateResult.errors[0],
|
||||
success: false,
|
||||
};
|
||||
}
|
||||
|
||||
const createKPResult = await createKP({
|
||||
domainName: ctx.user.domainName,
|
||||
finGAP: input.fingap,
|
||||
insurance: Object.values(input.insurance.values),
|
||||
calculation: {
|
||||
calculationValues: await compatValues(input.values, { apolloClient }),
|
||||
...calculateResult,
|
||||
preparedPayments: requestData.preparedPayments,
|
||||
additionalData: requestData.additionalData,
|
||||
},
|
||||
});
|
||||
|
||||
if (createKPResult.success === false) {
|
||||
return {
|
||||
success: false,
|
||||
error: createKPResult.message || createKPResult.fullMessage,
|
||||
};
|
||||
}
|
||||
|
||||
const result = transformCalculateResults({
|
||||
calculateInput: input,
|
||||
requestCalculate: requestData,
|
||||
responseCalculate: calculateResult,
|
||||
});
|
||||
|
||||
return {
|
||||
data: result,
|
||||
success: true,
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
async function compatValues(
|
||||
values: CalculationValues,
|
||||
{ apolloClient }: Pick<Context, 'apolloClient'>
|
||||
) {
|
||||
let product = null;
|
||||
if (values.product) {
|
||||
const {
|
||||
data: { evo_baseproduct },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetProductDocument,
|
||||
variables: {
|
||||
productId: values.product,
|
||||
},
|
||||
});
|
||||
if (evo_baseproduct?.evo_id) product = evo_baseproduct?.evo_id;
|
||||
}
|
||||
|
||||
let rate = null;
|
||||
if (values.rate) {
|
||||
const {
|
||||
data: { evo_rate },
|
||||
} = await apolloClient.query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetRateDocument,
|
||||
variables: {
|
||||
rateId: values.rate,
|
||||
},
|
||||
});
|
||||
if (evo_rate?.evo_id) rate = evo_rate?.evo_id;
|
||||
}
|
||||
|
||||
return { ...values, product, rate };
|
||||
}
|
||||
59
apps/web/server/routers/quote/types.ts
Normal file
59
apps/web/server/routers/quote/types.ts
Normal file
@ -0,0 +1,59 @@
|
||||
/* eslint-disable zod/require-strict */
|
||||
import { CalculateInputSchema } from '../calculate/types';
|
||||
import { RiskSchema } from '@/config/schema/fingap';
|
||||
import { KeysSchema, RowSchema } from '@/config/schema/insurance';
|
||||
import PaymentsSchema from '@/config/schema/payments';
|
||||
import ValuesSchema from '@/config/schema/values';
|
||||
import { z } from 'zod';
|
||||
|
||||
const { quote, recalcWithRevision, lead, opportunity } = ValuesSchema.shape;
|
||||
|
||||
export const GetQuoteInputDataSchema = z
|
||||
.object({
|
||||
values: z
|
||||
.object({
|
||||
lead,
|
||||
opportunity,
|
||||
quote: quote.unwrap(),
|
||||
recalcWithRevision,
|
||||
})
|
||||
.required(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type GetQuoteInputData = z.infer<typeof GetQuoteInputDataSchema>;
|
||||
|
||||
const FinGAPSchema = z.object({
|
||||
keys: z.array(RiskSchema.shape.key),
|
||||
});
|
||||
|
||||
const InsuranceSchema = z.object({
|
||||
values: z.record(KeysSchema, RowSchema),
|
||||
});
|
||||
|
||||
export const GetQuoteOutputDataSchema = z
|
||||
.object({
|
||||
fingap: FinGAPSchema,
|
||||
insurance: InsuranceSchema,
|
||||
payments: PaymentsSchema,
|
||||
values: ValuesSchema,
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type GetQuoteOutputData = z.infer<typeof GetQuoteOutputDataSchema>;
|
||||
|
||||
export const GetQuoteProcessDataSchema = GetQuoteOutputDataSchema.omit({
|
||||
values: true,
|
||||
})
|
||||
.extend({
|
||||
values: ValuesSchema.partial(),
|
||||
})
|
||||
.partial();
|
||||
|
||||
export type GetQuoteProcessData = z.infer<typeof GetQuoteProcessDataSchema>;
|
||||
|
||||
export const CreateQuoteInputDataSchema = CalculateInputSchema.extend({
|
||||
fingap: RiskSchema.array(),
|
||||
});
|
||||
|
||||
export { CalculateOutputSchema as CreateQuoteOutputDataSchema } from '../calculate/types';
|
||||
40
apps/web/server/trpc.ts
Normal file
40
apps/web/server/trpc.ts
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* This is your entry point to setup the root configuration for tRPC on the server.
|
||||
* - `initTRPC` should only be used once per app.
|
||||
* - We export only the functionality that we use so we can enforce which base procedures should be used
|
||||
*
|
||||
* Learn how to create protected base procedures and other things below:
|
||||
*
|
||||
* @see https://trpc.io/docs/v10/router
|
||||
* @see https://trpc.io/docs/v10/procedures
|
||||
*/
|
||||
|
||||
import type { Context } from './context';
|
||||
import { initTRPC } from '@trpc/server';
|
||||
import SuperJSON from 'superjson';
|
||||
|
||||
export const t = initTRPC.context<Context>().create({
|
||||
/**
|
||||
* @see https://trpc.io/docs/v10/error-formatting
|
||||
*/
|
||||
errorFormatter({ shape }) {
|
||||
return shape;
|
||||
},
|
||||
|
||||
/**
|
||||
* @see https://trpc.io/docs/v10/data-transformers
|
||||
*/
|
||||
transformer: SuperJSON,
|
||||
});
|
||||
|
||||
/**
|
||||
* Create a router
|
||||
*
|
||||
* @see https://trpc.io/docs/v10/router
|
||||
*/
|
||||
export const router = t.router;
|
||||
|
||||
/**
|
||||
* @see https://trpc.io/docs/v10/merging-routers
|
||||
*/
|
||||
export const mergeRouters = t.mergeRouters;
|
||||
@ -1,12 +1,12 @@
|
||||
import type RootStore from '../../root';
|
||||
import type { CalculationValues, Values } from './types';
|
||||
import defaultValues from '@/config/default-values';
|
||||
import { makeAutoObservable } from 'mobx';
|
||||
import { makeAutoObservable, toJS } from 'mobx';
|
||||
import { pick } from 'radash';
|
||||
|
||||
export default class ValuesStore {
|
||||
private root: RootStore;
|
||||
public values = defaultValues;
|
||||
private values = defaultValues;
|
||||
|
||||
constructor(rootStore: RootStore) {
|
||||
makeAutoObservable(this);
|
||||
@ -17,7 +17,11 @@ export default class ValuesStore {
|
||||
this.values = { ...defaultValues, ...initialValues };
|
||||
};
|
||||
|
||||
public getValues = <K extends keyof CalculationValues>(keys: K[]) => pick(this.values, keys);
|
||||
public getValues = <K extends keyof CalculationValues>(keys?: K[]) => {
|
||||
if (keys) return pick(this.values, keys);
|
||||
|
||||
return toJS(this.values);
|
||||
};
|
||||
|
||||
public setValues = (values: Partial<CalculationValues>) => {
|
||||
(Object.keys(values) as Array<keyof CalculationValues>).forEach((valueName) => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type { ResultsValues } from './types';
|
||||
import type { ResultValues } from './types';
|
||||
|
||||
export const defaultResultsValues: ResultsValues = {
|
||||
export const defaultResultsValues: ResultValues = {
|
||||
resultAB_FL: 0,
|
||||
resultAB_UL: 0,
|
||||
resultBonusDopProd: 0,
|
||||
@ -15,6 +15,7 @@ export const defaultResultsValues: ResultsValues = {
|
||||
resultInsKasko: 0,
|
||||
resultInsOsago: 0,
|
||||
resultLastPayment: 0,
|
||||
resultParticipationAmount: 0,
|
||||
resultPlPrice: 0,
|
||||
resultPriceUpPr: 0,
|
||||
resultTerm: 0,
|
||||
|
||||
@ -1,28 +1,27 @@
|
||||
import { defaultResultsValues } from './default-values';
|
||||
import type { ResultsValues } from './types';
|
||||
import type { Payment } from '@/Components/Output/PaymentsTable/types';
|
||||
import type { ResultPayment, ResultValues } from './types';
|
||||
import type RootStore from '@/stores/root';
|
||||
import type { IObservableArray } from 'mobx';
|
||||
import { makeAutoObservable, observable } from 'mobx';
|
||||
|
||||
export default class Results {
|
||||
private root: RootStore;
|
||||
public payments: IObservableArray<Payment>;
|
||||
public values: ResultsValues;
|
||||
public payments: IObservableArray<ResultPayment>;
|
||||
public values: ResultValues;
|
||||
|
||||
constructor(rootStore: RootStore) {
|
||||
this.payments = observable<Payment>([]);
|
||||
this.payments = observable<ResultPayment>([]);
|
||||
this.values = defaultResultsValues;
|
||||
makeAutoObservable(this);
|
||||
|
||||
this.root = rootStore;
|
||||
}
|
||||
|
||||
public setPayments = (payments: Payment[]) => {
|
||||
public setPayments = (payments: ResultPayment[]) => {
|
||||
this.payments.replace(payments);
|
||||
};
|
||||
|
||||
public setValues = (values: ResultsValues) => {
|
||||
public setValues = (values: ResultValues) => {
|
||||
this.values = values;
|
||||
};
|
||||
|
||||
|
||||
@ -1,22 +1,12 @@
|
||||
export type ResultsValues = {
|
||||
resultAB_FL: number;
|
||||
resultAB_UL: number;
|
||||
resultBonusDopProd: number;
|
||||
resultBonusMPL: number;
|
||||
resultBonusSafeFinance: number;
|
||||
resultDopMPLLeasing: number;
|
||||
resultDopProdSum: number;
|
||||
resultFirstPayment: number;
|
||||
resultFirstPaymentRiskPolicy: number;
|
||||
resultIRRGraphPerc: number;
|
||||
resultIRRNominalPerc: number;
|
||||
resultInsKasko: number;
|
||||
resultInsOsago: number;
|
||||
resultLastPayment: number;
|
||||
resultPlPrice: number;
|
||||
resultPriceUpPr: number;
|
||||
resultTerm: number;
|
||||
resultTotalGraphwithNDS: number;
|
||||
};
|
||||
import type {
|
||||
ResultPaymentSchema,
|
||||
ResultPaymentsSchema,
|
||||
ResultValuesSchema,
|
||||
} from '@/config/schema/results';
|
||||
import type { z } from 'zod';
|
||||
|
||||
export type Values = keyof ResultsValues;
|
||||
export type ResultValues = z.infer<typeof ResultValuesSchema>;
|
||||
|
||||
export type ResultPayment = z.infer<typeof ResultPaymentSchema>;
|
||||
|
||||
export type ResultPayments = z.infer<typeof ResultPaymentsSchema>;
|
||||
|
||||
@ -3,7 +3,7 @@ import type { ValidationParams } from '../../validation/types';
|
||||
import type * as FinGAP from '@/Components/Calculation/Form/Insurance/FinGAPTable/types';
|
||||
import type RootStore from '@/stores/root';
|
||||
import type { IObservableArray } from 'mobx';
|
||||
import { makeAutoObservable, observable } from 'mobx';
|
||||
import { makeAutoObservable, observable, toJS } from 'mobx';
|
||||
|
||||
export default class FinGAPTable {
|
||||
private root: RootStore;
|
||||
@ -24,6 +24,10 @@ export default class FinGAPTable {
|
||||
this.root = rootStore;
|
||||
}
|
||||
|
||||
public getSelectedRisks() {
|
||||
return toJS(this.risks.filter((x) => this.selectedKeys.has(x.key)));
|
||||
}
|
||||
|
||||
public setRisks = (risks: FinGAP.Risk[]) => {
|
||||
this.risks.replace(risks);
|
||||
};
|
||||
|
||||
@ -1,10 +1,24 @@
|
||||
import type { AppRouter } from './routers';
|
||||
import getUrls from '@/config/urls';
|
||||
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
|
||||
import type { AppRouter } from '@/server/routers/_app';
|
||||
import { createTRPCProxyClient, httpBatchLink, loggerLink } from '@trpc/client';
|
||||
import { createTRPCNext } from '@trpc/next';
|
||||
import type { NextPageContext } from 'next';
|
||||
import SuperJSON from 'superjson';
|
||||
import { isServer } from 'tools/common';
|
||||
|
||||
export type SSRContext = NextPageContext & {
|
||||
/**
|
||||
* Set HTTP Status code
|
||||
*
|
||||
* @example
|
||||
* const utils = trpc.useContext();
|
||||
* if (utils.ssrContext) {
|
||||
* utils.ssrContext.status = 404;
|
||||
* }
|
||||
*/
|
||||
status?: number;
|
||||
};
|
||||
|
||||
const { BASE_PATH, PORT } = getUrls();
|
||||
|
||||
function getBaseUrl() {
|
||||
@ -13,27 +27,108 @@ function getBaseUrl() {
|
||||
return `http://localhost:${PORT ?? 3000}${BASE_PATH}`;
|
||||
}
|
||||
|
||||
const url = `${getBaseUrl()}/api/trpc`;
|
||||
|
||||
export const trpcClient = createTRPCNext<AppRouter>({
|
||||
config() {
|
||||
config({ ctx }) {
|
||||
/**
|
||||
* If you want to use SSR, you need to use the server's full URL
|
||||
*
|
||||
* @link https://trpc.io/docs/ssr
|
||||
*/
|
||||
return {
|
||||
/**
|
||||
* @link https://trpc.io/docs/links
|
||||
*/
|
||||
links: [
|
||||
// adds pretty logs to your console in development and logs errors in production
|
||||
loggerLink({
|
||||
enabled: (opts) =>
|
||||
process.env.NODE_ENV === 'development' ||
|
||||
(opts.direction === 'down' && opts.result instanceof Error),
|
||||
}),
|
||||
httpBatchLink({
|
||||
url,
|
||||
/**
|
||||
* Set custom request headers on every request from tRPC
|
||||
*
|
||||
* @link https://trpc.io/docs/ssr
|
||||
*/
|
||||
headers() {
|
||||
if (!ctx?.req?.headers) {
|
||||
return {};
|
||||
}
|
||||
// To use SSR properly, you need to forward the client's headers to the server
|
||||
// This is so you can pass through things like cookies when we're server-side rendering
|
||||
|
||||
const {
|
||||
// If you're using Node 18 before 18.15.0, omit the "connection" header
|
||||
connection: _connection,
|
||||
...headers
|
||||
} = ctx.req.headers;
|
||||
|
||||
return headers;
|
||||
},
|
||||
|
||||
url: `${getBaseUrl()}/api/trpc`,
|
||||
}),
|
||||
],
|
||||
|
||||
/**
|
||||
* @link https://trpc.io/docs/data-transformers
|
||||
*/
|
||||
transformer: SuperJSON,
|
||||
/**
|
||||
* @link https://react-query.tanstack.com/reference/QueryClient
|
||||
*/
|
||||
// queryClientConfig: { defaultOptions: { queries: { staleTime: 60 } } },
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Set headers or status code when doing SSR
|
||||
*/
|
||||
responseMeta(opts) {
|
||||
const ctx = opts.ctx as SSRContext;
|
||||
|
||||
if (ctx.status) {
|
||||
// If HTTP status set, propagate that
|
||||
return {
|
||||
status: ctx.status,
|
||||
};
|
||||
}
|
||||
|
||||
const error = opts.clientErrors[0];
|
||||
if (error) {
|
||||
// Propagate http first error from API calls
|
||||
return {
|
||||
status: error.data?.httpStatus ?? 500,
|
||||
};
|
||||
}
|
||||
|
||||
// for app caching with SSR see https://trpc.io/docs/caching
|
||||
|
||||
return {};
|
||||
},
|
||||
|
||||
/**
|
||||
* @link https://trpc.io/docs/ssr
|
||||
*/
|
||||
ssr: true,
|
||||
});
|
||||
|
||||
export type TRPCClient = typeof trpcClient;
|
||||
|
||||
export const trpcPureClient = createTRPCProxyClient<AppRouter>({
|
||||
links: [
|
||||
// adds pretty logs to your console in development and logs errors in production
|
||||
loggerLink({
|
||||
enabled: (opts) =>
|
||||
process.env.NODE_ENV === 'development' ||
|
||||
(opts.direction === 'down' && opts.result instanceof Error),
|
||||
}),
|
||||
httpBatchLink({
|
||||
url,
|
||||
url: `${getBaseUrl()}/api/trpc`,
|
||||
}),
|
||||
],
|
||||
transformer: SuperJSON,
|
||||
});
|
||||
|
||||
export type TRPCPureClient = typeof trpcPureClient;
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
import { t } from '../server';
|
||||
import quoteRouter from './quote';
|
||||
|
||||
const appRouter = t.router({
|
||||
quote: quoteRouter,
|
||||
});
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
||||
|
||||
export default appRouter;
|
||||
@ -1,71 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable canonical/sort-keys */
|
||||
import { t } from '../server';
|
||||
import defaultValues from '@/config/default-values';
|
||||
import * as insuranceTable from '@/config/tables/insurance-table';
|
||||
import * as addProduct from '@/process/add-product';
|
||||
import * as bonuses from '@/process/bonuses';
|
||||
import * as configurator from '@/process/configurator';
|
||||
import * as fingapProcess from '@/process/fingap';
|
||||
import * as gibdd from '@/process/gibdd';
|
||||
import * as insuranceProcess from '@/process/insurance';
|
||||
import * as leasingObject from '@/process/leasing-object';
|
||||
import * as loadKP from '@/process/load-kp';
|
||||
import * as paymentsProcess from '@/process/payments';
|
||||
import * as price from '@/process/price';
|
||||
import * as subsidy from '@/process/subsidy';
|
||||
import * as supplierAgent from '@/process/supplier-agent';
|
||||
|
||||
const { GetQuoteInputDataSchema, GetQuoteOutputDataSchema } = loadKP;
|
||||
const { DEFAULT_FINGAP_ROW, DEFAULT_KASKO_ROW, DEFAULT_OSAGO_ROW } = insuranceTable;
|
||||
|
||||
const defaultInsurance = {
|
||||
values: {
|
||||
fingap: DEFAULT_FINGAP_ROW,
|
||||
kasko: DEFAULT_KASKO_ROW,
|
||||
osago: DEFAULT_OSAGO_ROW,
|
||||
},
|
||||
};
|
||||
|
||||
const defaultFingap = { keys: [] };
|
||||
const defaultPayments = { values: [] };
|
||||
|
||||
const quoteRouter = t.router({
|
||||
getData: t.procedure
|
||||
.input(GetQuoteInputDataSchema)
|
||||
.output(GetQuoteOutputDataSchema)
|
||||
.query(async ({ input }) => {
|
||||
const processData = await Promise.all(
|
||||
[
|
||||
configurator,
|
||||
supplierAgent,
|
||||
paymentsProcess,
|
||||
price,
|
||||
bonuses,
|
||||
leasingObject,
|
||||
fingapProcess,
|
||||
gibdd,
|
||||
subsidy,
|
||||
insuranceProcess,
|
||||
addProduct,
|
||||
].map(({ getKPData }) => getKPData(input))
|
||||
);
|
||||
|
||||
const values = processData.reduce(
|
||||
(obj, data) => Object.assign(obj, data.values),
|
||||
defaultValues
|
||||
);
|
||||
const payments = processData.find((x) => x.payments)?.payments ?? defaultPayments;
|
||||
const insurance = processData.find((x) => x.insurance)?.insurance ?? defaultInsurance;
|
||||
const fingap = processData.find((x) => x.fingap)?.fingap ?? defaultFingap;
|
||||
|
||||
return {
|
||||
values,
|
||||
payments,
|
||||
insurance,
|
||||
fingap,
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
export default quoteRouter;
|
||||
@ -1,6 +0,0 @@
|
||||
import { initTRPC } from '@trpc/server';
|
||||
import SuperJSON from 'superjson';
|
||||
|
||||
export const t = initTRPC.create({
|
||||
transformer: SuperJSON,
|
||||
});
|
||||
@ -1,5 +0,0 @@
|
||||
import type { trpcClient, trpcPureClient } from './client';
|
||||
|
||||
export type TRPCClient = typeof trpcClient;
|
||||
|
||||
export type TRPCPureClient = typeof trpcPureClient;
|
||||
37
apps/web/utils/currency.ts
Normal file
37
apps/web/utils/currency.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
type Context = {
|
||||
apolloClient: ApolloClient<object>;
|
||||
};
|
||||
|
||||
type Input = {
|
||||
currencyid: string;
|
||||
value: number;
|
||||
};
|
||||
|
||||
export function createCurrencyUtility({ apolloClient }: Context) {
|
||||
return {
|
||||
async RUB({ currencyid, value }: Input) {
|
||||
const {
|
||||
data: { evo_currencychanges },
|
||||
} = await apolloClient.query({
|
||||
fetchPolicy: 'network-only',
|
||||
query: CRMTypes.GetCurrencyChangesDocument,
|
||||
variables: {
|
||||
currentDate: dayjs().utc(false).format('YYYY-MM-DD'),
|
||||
},
|
||||
});
|
||||
|
||||
const evo_currencychange = evo_currencychanges?.find(
|
||||
(x) => x?.evo_ref_transactioncurrency === currencyid
|
||||
);
|
||||
|
||||
return value * (evo_currencychange?.evo_currencychange || 0);
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
"husky": "^8.0.3",
|
||||
"prettier": "^2.8.4",
|
||||
"tools": "*",
|
||||
"turbo": "^1.8.3"
|
||||
"turbo": "^1.8.5"
|
||||
},
|
||||
"packageManager": "yarn@1.22.17",
|
||||
"engines": {
|
||||
|
||||
@ -19,6 +19,17 @@ export const formatterExtra = (value?: number) =>
|
||||
minimumFractionDigits: 2,
|
||||
}).format(value || 0);
|
||||
|
||||
export const moneyFormatter = Intl.NumberFormat('ru', {
|
||||
currency: 'RUB',
|
||||
style: 'currency',
|
||||
}).format;
|
||||
|
||||
export const percentFormatter = Intl.NumberFormat('ru', {
|
||||
maximumFractionDigits: 2,
|
||||
minimumFractionDigits: 2,
|
||||
style: 'percent',
|
||||
}).format;
|
||||
|
||||
export function round(value: number, precision: number = 0) {
|
||||
return Number.parseFloat(value.toFixed(precision));
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ type ElementProps = {
|
||||
type ButtonProps = BaseButtonProps & Pick<ElementProps, 'text'>;
|
||||
|
||||
function Button({ status, action, text, ...props }: BaseElementProps<never> & ElementProps) {
|
||||
const throttledAction = useThrottledCallback(action, 1_200, {
|
||||
const throttledAction = useThrottledCallback(action, 1200, {
|
||||
trailing: false,
|
||||
});
|
||||
|
||||
|
||||
68
yarn.lock
68
yarn.lock
@ -9315,47 +9315,47 @@ tunnel-agent@^0.6.0:
|
||||
dependencies:
|
||||
safe-buffer "^5.0.1"
|
||||
|
||||
turbo-darwin-64@1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.8.3.tgz#f220459e7636056d9a67bc9ead8dc01c495f9d55"
|
||||
integrity sha512-bLM084Wr17VAAY/EvCWj7+OwYHvI9s/NdsvlqGp8iT5HEYVimcornCHespgJS/yvZDfC+mX9EQkn3V2JmYgGGw==
|
||||
turbo-darwin-64@1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.8.5.tgz#6fdd2e9e2b8afead04e17380fc222863794e6007"
|
||||
integrity sha512-CAYh56bzeHfnh7jTm03r29bh8p5a/EjQo1Id5yLUH7hS7msTau/+YpxJWPodLbN0UQsUYivUqHQkglJ+eMJ7xA==
|
||||
|
||||
turbo-darwin-arm64@1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.8.3.tgz#1529f0755cd683e372140d6b9532efe4ca523b38"
|
||||
integrity sha512-4oZjXtzakopMK110kue3z/hqu3WLv+eDLZOX1NGdo49gqca9BeD8GbH+sXpAp6tqyeuzpss+PIliVYuyt7LgbA==
|
||||
turbo-darwin-arm64@1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.8.5.tgz#8d72d67a87b6d247565de79477b0c7aed6a83c2b"
|
||||
integrity sha512-R3jCPOv+lu3dcvMhj8b/Defv6dyUwX6W+tbX7d6YUCA46Plf/bGCQ8+MSbxmr/4E1GyGOVFsn1wRfiYk0us/Dg==
|
||||
|
||||
turbo-linux-64@1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.8.3.tgz#1aed7f4bb4492cb4c9d8278044a66d3c6107ee5b"
|
||||
integrity sha512-uvX2VKotf5PU14FCxJA5iHItPQno2JWzerMd+g3/h/Asay6dvxvtVjc39MQeGT0H5njSvzVKFkT+3/5q8lgOEg==
|
||||
turbo-linux-64@1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.8.5.tgz#a080015aa1c725604637a743a5b878d100aaf88b"
|
||||
integrity sha512-YRc/KNRZeUVvth11UO4SDQZR2IqGgl9MSsbzqoHuFz4B4Q5QXH7onHogv9aXWE/BZBBbcrSBTlwBSG0Gg+J8hg==
|
||||
|
||||
turbo-linux-arm64@1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.8.3.tgz#0269b31b2947c40833052325361a94193ca46150"
|
||||
integrity sha512-E1p+oH3XKMaPS4rqWhYsL4j2Pzc0d/9P5KU7Kn1kqVLo2T3iRA7n2KVULEieUNE0nTH+aIJPXYXOpqCI5wFJaA==
|
||||
turbo-linux-arm64@1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.8.5.tgz#96fa915f10e81a16eccf74e122e96fcba4e132e0"
|
||||
integrity sha512-8exVZb7XBl/V3gHSweuUyG2D9IzfWqwLvlXoeLWlVYSj61Ajgdv+WU7lvUmx+H2s+sSKqmIFmewA5Lw6YY37sg==
|
||||
|
||||
turbo-windows-64@1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.8.3.tgz#cf94f427414eb8416c1fe22229f9a578dd1ec78b"
|
||||
integrity sha512-cnzAytHtoLXd0J7aNzRpZFpL/GTjcBmkvAPlbOdf/Pl1iwS4qzGrudZQ+OM1lmLgLIfBPIavsGHBknTwTNib4A==
|
||||
turbo-windows-64@1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.8.5.tgz#14ca1a577e982c34fd606fa6499eaf4fea0eca36"
|
||||
integrity sha512-fA8PU5ZNoFnQkapG06WiEqfsVQ5wbIPkIqTwUsd/M2Lp+KgxE79SQbuEI+2vQ9SmwM5qoMi515IPjgvXAJXgCw==
|
||||
|
||||
turbo-windows-arm64@1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.8.3.tgz#db5739fe1d6907d07874779f6d5fac87b3f3ca6a"
|
||||
integrity sha512-ulIiItNm2w/zYJdD5/oAzjzNns1IjbpweRzpsE8tLXaWwo6+fnXXkyloUug0IUhcd2k6fJXfoiDZfygqpOVuXg==
|
||||
turbo-windows-arm64@1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.8.5.tgz#286c7aacd8c9e2a8a0f5ab767268aadc8f6c7955"
|
||||
integrity sha512-SW/NvIdhckLsAWjU/iqBbCB0S8kXupKscUK3kEW1DZIr3MYcP/yIuaE/IdPuqcoF3VP0I3TLD4VTYCCKAo3tKA==
|
||||
|
||||
turbo@^1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.8.3.tgz#6fe1ce749a38b54f15f0fcb24ee45baefa98e948"
|
||||
integrity sha512-zGrkU1EuNFmkq6iky6LcMqD4h0OLE8XysVFxQWRIZbcTNnf0XAycbsbeEyiJpiWeqb7qtg2bVuY9EYcNoNhVuQ==
|
||||
turbo@^1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.8.5.tgz#933413257783ede75471b8ebf2435ebc7be50ad7"
|
||||
integrity sha512-UBnH2wIFb5g6OQCk8f34Ud15ZXV4xEMmugeDJTU5Ur2LpVRsNEny0isSCYdb3Iu3howoNyyXmtpaxWsAwNYkkg==
|
||||
optionalDependencies:
|
||||
turbo-darwin-64 "1.8.3"
|
||||
turbo-darwin-arm64 "1.8.3"
|
||||
turbo-linux-64 "1.8.3"
|
||||
turbo-linux-arm64 "1.8.3"
|
||||
turbo-windows-64 "1.8.3"
|
||||
turbo-windows-arm64 "1.8.3"
|
||||
turbo-darwin-64 "1.8.5"
|
||||
turbo-darwin-arm64 "1.8.5"
|
||||
turbo-linux-64 "1.8.5"
|
||||
turbo-linux-arm64 "1.8.5"
|
||||
turbo-windows-64 "1.8.5"
|
||||
turbo-windows-arm64 "1.8.5"
|
||||
|
||||
type-check@^0.4.0, type-check@~0.4.0:
|
||||
version "0.4.0"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user