From 87e4783dd5ef240a51d3c184240deb4a54e0d63c Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 14 Apr 2023 10:57:02 +0300 Subject: [PATCH] merge migration/fix-3 & migration/upgrade-code-130423 --- .../Form/Insurance/FinGAPTable/index.jsx | 5 +- .../Form/Insurance/InsuranceTable/config.tsx | 4 +- .../Form/Insurance/InsuranceTable/index.jsx | 5 +- .../Calculation/Form/Insurance/index.jsx | 2 +- .../Calculation/Form/Leasing/config.ts | 4 +- .../Form/Payments/PaymentsParams.jsx | 2 +- .../Form/Payments/PaymentsTable/config.tsx | 2 +- .../Form/Payments/PaymentsTable/index.jsx | 3 +- .../web/Components/Calculation/Form/index.jsx | 2 +- .../Calculation/config/elements-components.ts | 1 + .../Calculation/config/elements-props.tsx | 7 + .../config/elements-render/override.tsx | 3 +- .../Calculation/config/elements-titles.ts | 1 + .../Calculation/config/elements-types.ts | 1 + .../Calculation/config/map/values.ts | 1 + .../Calculation/lib/render-rows.tsx | 3 +- apps/web/Components/Common/Error.jsx | 3 +- apps/web/Components/Layout/Auth.jsx | 2 +- apps/web/Components/Layout/Element.tsx | 2 +- apps/web/Components/Layout/Header.jsx | 2 +- apps/web/Components/Layout/Logo.jsx | 3 +- apps/web/Components/Layout/index.jsx | 2 +- .../Components/Output/PaymentsTable/index.jsx | 2 +- apps/web/Components/Output/Results/config.ts | 2 +- apps/web/Components/Output/Results/index.jsx | 2 +- apps/web/Components/Output/Validation.jsx | 2 +- apps/web/Components/Output/index.jsx | 2 +- apps/web/config/default-options.ts | 1 + apps/web/config/default-statuses.ts | 1 + apps/web/config/default-values.ts | 3 +- apps/web/config/schema/values.ts | 1 + apps/web/constants/values.js | 2 +- apps/web/graphql/crm.query.graphql | 23 ++ apps/web/graphql/crm.schema.graphql | 59 +++++ apps/web/graphql/crm.types.ts | 44 ++-- apps/web/pages/404.jsx | 3 +- apps/web/pages/500.jsx | 3 +- apps/web/process/add-product/index.ts | 1 + apps/web/process/add-product/reactions.ts | 180 ++++++++++++- apps/web/process/add-product/validation.ts | 28 ++ apps/web/process/bonuses/reactions/common.ts | 48 ++-- apps/web/process/bonuses/reactions/index.ts | 2 +- .../process/bonuses/reactions/validation.ts | 35 +-- apps/web/process/calculate/action.ts | 2 +- .../process/calculate/reactions/validation.ts | 67 ++--- .../process/configurator/reactions/filters.ts | 35 ++- .../process/configurator/reactions/index.ts | 2 +- .../configurator/reactions/unlimited.ts | 55 ++-- .../configurator/reactions/validation.ts | 35 +-- .../process/configurator/reactions/values.ts | 135 +++++----- apps/web/process/create-kp/action.ts | 2 +- apps/web/process/create-kp/get-kp-data.ts | 3 + apps/web/process/gibdd/reactions.ts | 247 ++++++++---------- apps/web/process/gibdd/validation.ts | 66 ++++- apps/web/process/hooks/init/get-main-data.js | 2 +- apps/web/process/hooks/init/get-users.js | 2 +- apps/web/process/insurance/reactions.ts | 74 +----- .../lead-opportunity/reactions/common.ts | 51 ++-- .../leasing-object/reactions/common.ts | 2 +- .../process/leasing-object/reactions/index.ts | 2 +- .../leasing-object/reactions/validation.ts | 65 +---- .../leasing-without-kasko/reactions.ts | 4 +- apps/web/process/load-kp/reactions.ts | 5 +- apps/web/process/payments/reactions/common.ts | 214 +++++++-------- apps/web/process/payments/reactions/index.ts | 2 +- .../process/payments/reactions/validation.ts | 56 +--- apps/web/process/price/get-kp-data.ts | 15 +- apps/web/process/price/reactions/common.ts | 153 +++++------ apps/web/process/price/reactions/computed.ts | 42 ++- apps/web/process/price/reactions/index.ts | 2 +- .../web/process/price/reactions/validation.ts | 44 +--- apps/web/process/recalc/reactions.ts | 172 ++++-------- apps/web/process/recalc/validation.ts | 40 +-- .../supplier-agent/get-kp-data/index.ts | 3 + .../supplier-agent/lib/create-reactions.ts | 51 ++-- .../lib/fill-agents-from-lead.ts | 2 +- .../supplier-agent/reactions/agents.ts | 24 +- .../process/supplier-agent/reactions/index.ts | 2 +- .../supplier-agent/reactions/supplier.ts | 37 ++- .../supplier-agent/reactions/validation.ts | 70 +---- apps/web/process/supplier-agent/validation.ts | 40 ++- apps/web/process/tools.ts | 79 ++++++ apps/web/process/used-pl/reactions.ts | 90 ++++--- .../server/routers/calculate/lib/request.ts | 21 +- .../server/routers/calculate/lib/transform.ts | 14 +- .../routers/calculate/lib/validation.ts | 2 + apps/web/stores/validation/index.ts | 2 +- apps/web/utils/currency.ts | 13 + {packages/tools => apps/web/utils}/entity.ts | 0 apps/web/utils/mobx.ts | 51 ++++ packages/tools/index.ts | 2 - packages/tools/mobx.ts | 22 -- packages/tools/package.json | 4 +- packages/ui/elements/Alert.js | 1 - packages/ui/elements/Result.js | 1 - packages/ui/elements/Table.js | 1 - packages/ui/elements/Tooltip.js | 1 - packages/ui/elements/badge.js | 1 - packages/ui/elements/index.ts | 31 ++- packages/ui/elements/layout/Divider.js | 1 - packages/ui/elements/layout/Tabs.js | 1 - packages/ui/elements/layout/index.ts | 2 - packages/ui/elements/message.js | 9 - packages/ui/elements/notification.ts | 8 - packages/ui/elements/tag.js | 1 - packages/ui/index.ts | 2 - 106 files changed, 1381 insertions(+), 1308 deletions(-) create mode 100644 apps/web/process/add-product/validation.ts create mode 100644 apps/web/process/tools.ts rename {packages/tools => apps/web/utils}/entity.ts (100%) create mode 100644 apps/web/utils/mobx.ts delete mode 100644 packages/tools/mobx.ts delete mode 100644 packages/ui/elements/Alert.js delete mode 100644 packages/ui/elements/Result.js delete mode 100644 packages/ui/elements/Table.js delete mode 100644 packages/ui/elements/Tooltip.js delete mode 100644 packages/ui/elements/badge.js delete mode 100644 packages/ui/elements/layout/Divider.js delete mode 100644 packages/ui/elements/layout/Tabs.js delete mode 100644 packages/ui/elements/layout/index.ts delete mode 100644 packages/ui/elements/message.js delete mode 100644 packages/ui/elements/notification.ts delete mode 100644 packages/ui/elements/tag.js delete mode 100644 packages/ui/index.ts diff --git a/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx b/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx index 459bcb6..a22f6b0 100644 --- a/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx +++ b/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx @@ -3,9 +3,8 @@ import { useStore } from '@/stores/hooks'; import { toJS } from 'mobx'; import { observer } from 'mobx-react-lite'; import styled from 'styled-components'; -import { Flex } from 'ui'; -import Alert from 'ui/elements/Alert'; -import Table from 'ui/elements/Table'; +import { Alert, Table } from 'ui/elements'; +import { Flex } from 'ui/grid'; const Grid = styled(Flex)` flex-direction: column; diff --git a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx index 5b6ca90..4262bf4 100644 --- a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx +++ b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx @@ -4,8 +4,8 @@ import type * as Insurance from './types'; import { MAX_INSURANCE } from '@/constants/values'; import type { ColumnsType } from 'antd/lib/table'; import { parser } from 'tools/number'; -import InputNumber, { createFormatter } from 'ui/elements/InputNumber'; -import Select from 'ui/elements/Select'; +import { InputNumber, Select } from 'ui/elements'; +import { createFormatter } from 'ui/elements/InputNumber'; export const columns: ColumnsType = [ { diff --git a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/index.jsx b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/index.jsx index 1a362ea..6f3eab2 100644 --- a/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/index.jsx +++ b/apps/web/Components/Calculation/Form/Insurance/InsuranceTable/index.jsx @@ -2,9 +2,8 @@ import { columns } from './config'; import { useStore } from '@/stores/hooks'; import { observer } from 'mobx-react-lite'; import styled from 'styled-components'; -import { Flex } from 'ui'; -import Alert from 'ui/elements/Alert'; -import Table from 'ui/elements/Table'; +import { Alert, Table } from 'ui/elements'; +import { Flex } from 'ui/grid'; const Grid = styled(Flex)` flex-direction: column; diff --git a/apps/web/Components/Calculation/Form/Insurance/index.jsx b/apps/web/Components/Calculation/Form/Insurance/index.jsx index eab56cb..94981b8 100644 --- a/apps/web/Components/Calculation/Form/Insurance/index.jsx +++ b/apps/web/Components/Calculation/Form/Insurance/index.jsx @@ -2,7 +2,7 @@ import renderFormRows from '../../lib/render-rows'; import { id, rows, title } from './config'; import FinGAPTable from './FinGAPTable'; import InsuranceTable from './InsuranceTable'; -import { Flex } from 'ui'; +import { Flex } from 'ui/grid'; function Insurance() { const renderedRows = renderFormRows(rows); diff --git a/apps/web/Components/Calculation/Form/Leasing/config.ts b/apps/web/Components/Calculation/Form/Leasing/config.ts index f23e0e4..4c8704e 100644 --- a/apps/web/Components/Calculation/Form/Leasing/config.ts +++ b/apps/web/Components/Calculation/Form/Leasing/config.ts @@ -7,8 +7,8 @@ export const rows: FormTabRows = [ [['selectProduct'], { gridTemplateColumns: '1fr' }], [['tbxLeaseObjectPrice', 'tbxVATInLeaseObjectPrice', 'tbxLeaseObjectPriceWthtVAT']], [['selectSupplierCurrency', 'tbxSupplierDiscountRub', 'tbxSupplierDiscountPerc']], - [['tbxFirstPaymentPerc', 'tbxFirstPaymentRub']], - [['tbxLeasingPeriod', 'tbxSaleBonus', 'tbxRedemptionPaymentSum']], + [['tbxFirstPaymentPerc', 'tbxFirstPaymentRub', 'cbxSupplierFinancing']], + [['tbxLeasingPeriod', 'tbxSaleBonus']], [['selectSubsidy', 'tbxSubsidySum'], { gridTemplateColumns: '2fr 1fr' }], [['selectImportProgram', 'tbxImportProgramSum', 'tbxAddEquipmentPrice']], [['radioLastPaymentRule'], { gridTemplateColumns: '1fr' }], diff --git a/apps/web/Components/Calculation/Form/Payments/PaymentsParams.jsx b/apps/web/Components/Calculation/Form/Payments/PaymentsParams.jsx index 2b362f0..a9a9244 100644 --- a/apps/web/Components/Calculation/Form/Payments/PaymentsParams.jsx +++ b/apps/web/Components/Calculation/Form/Payments/PaymentsParams.jsx @@ -2,7 +2,7 @@ import elementsRender from '../../config/elements-render'; import { elements } from './config'; import { useStore } from '@/stores/hooks'; import { observer } from 'mobx-react-lite'; -import { Flex } from 'ui'; +import { Flex } from 'ui/grid'; function PaymentsParams() { const renderedElements = elements.map((elementName) => { diff --git a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx index ba50492..9664aa3 100644 --- a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx +++ b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/config.tsx @@ -1,7 +1,7 @@ /* eslint-disable canonical/sort-keys */ import { buildValueComponent } from './builders'; import type { ColumnsType } from 'antd/lib/table'; -import InputNumber from 'ui/elements/InputNumber'; +import { InputNumber } from 'ui/elements'; type Payment = { key: number; diff --git a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/index.jsx b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/index.jsx index 7659990..863f52e 100644 --- a/apps/web/Components/Calculation/Form/Payments/PaymentsTable/index.jsx +++ b/apps/web/Components/Calculation/Form/Payments/PaymentsTable/index.jsx @@ -4,8 +4,7 @@ import { min } from '@/styles/mq'; import { computed } from 'mobx'; import { observer } from 'mobx-react-lite'; import styled from 'styled-components'; -import Alert from 'ui/elements/Alert'; -import Table from 'ui/elements/Table'; +import { Alert, Table } from 'ui/elements'; import { Box, Flex } from 'ui/grid'; const Grid = styled(Flex)` diff --git a/apps/web/Components/Calculation/Form/index.jsx b/apps/web/Components/Calculation/Form/index.jsx index 7ba84b9..3b1c3e0 100644 --- a/apps/web/Components/Calculation/Form/index.jsx +++ b/apps/web/Components/Calculation/Form/index.jsx @@ -9,7 +9,7 @@ import Unlimited from './Unlimited'; import Background from '@/Components/Layout/Background'; import { min } from '@/styles/mq'; import styled from 'styled-components'; -import Tabs from 'ui/elements/layout/Tabs'; +import { Tabs } from 'ui/elements'; const formTabs = [ Leasing, diff --git a/apps/web/Components/Calculation/config/elements-components.ts b/apps/web/Components/Calculation/config/elements-components.ts index 774b1de..df236fa 100644 --- a/apps/web/Components/Calculation/config/elements-components.ts +++ b/apps/web/Components/Calculation/config/elements-components.ts @@ -132,6 +132,7 @@ const components = wrapComponentsMap({ selectLeasingWithoutKasko: e.Select, tbxVIN: e.Input, selectUser: e.Select, + cbxSupplierFinancing: e.Switch, /** Readonly Elements */ labelLeaseObjectRisk: e.Text, diff --git a/apps/web/Components/Calculation/config/elements-props.tsx b/apps/web/Components/Calculation/config/elements-props.tsx index 10ac955..1e4375c 100644 --- a/apps/web/Components/Calculation/config/elements-props.tsx +++ b/apps/web/Components/Calculation/config/elements-props.tsx @@ -451,6 +451,13 @@ const props: Partial = { showSearch: true, optionFilterProp: 'label', }, + tbxBonusCoefficient: { + min: 0, + max: 10, + step: 0.1, + precision: 4, + formatter: createFormatter({ minimumFractionDigits: 4, maximumFractionDigits: 4 }), + }, }; export default props; diff --git a/apps/web/Components/Calculation/config/elements-render/override.tsx b/apps/web/Components/Calculation/config/elements-render/override.tsx index ad30059..fbfad70 100644 --- a/apps/web/Components/Calculation/config/elements-render/override.tsx +++ b/apps/web/Components/Calculation/config/elements-render/override.tsx @@ -10,9 +10,8 @@ import { useStore } from '@/stores/hooks'; import { useIsFetching } from '@tanstack/react-query'; import { observer } from 'mobx-react-lite'; import type { ComponentProps } from 'react'; +import { Link, Tooltip } from 'ui/elements'; import { LoadingOutlined } from 'ui/elements/icons'; -import Link from 'ui/elements/Link'; -import Tooltip from 'ui/elements/Tooltip'; const defaultLinkProps: ComponentProps = { text: 'Открыть в CRM', diff --git a/apps/web/Components/Calculation/config/elements-titles.ts b/apps/web/Components/Calculation/config/elements-titles.ts index 81b3f67..03a3b8d 100644 --- a/apps/web/Components/Calculation/config/elements-titles.ts +++ b/apps/web/Components/Calculation/config/elements-titles.ts @@ -126,6 +126,7 @@ const titles: Record = { selectLeasingWithoutKasko: 'Лизинг без КАСКО', tbxVIN: 'VIN', selectUser: 'Пользователь', + cbxSupplierFinancing: 'Финансирование поставщика', /** Link Elements */ linkDownloadKp: '', diff --git a/apps/web/Components/Calculation/config/elements-types.ts b/apps/web/Components/Calculation/config/elements-types.ts index de258b4..0b4a9a3 100644 --- a/apps/web/Components/Calculation/config/elements-types.ts +++ b/apps/web/Components/Calculation/config/elements-types.ts @@ -163,6 +163,7 @@ const types = wrapElementsTypes({ selectLeasingWithoutKasko: t.Options, tbxVIN: t.Value, selectUser: t.Options, + cbxSupplierFinancing: t.Value, labelLeaseObjectRisk: t.Readonly, tbxInsKaskoPriceLeasePeriod: t.Readonly, diff --git a/apps/web/Components/Calculation/config/map/values.ts b/apps/web/Components/Calculation/config/map/values.ts index 302a639..80a6dd5 100644 --- a/apps/web/Components/Calculation/config/map/values.ts +++ b/apps/web/Components/Calculation/config/map/values.ts @@ -129,6 +129,7 @@ const elementsToValues = wrapElementsMap({ tbxBonusCoefficient: 'bonusCoefficient', tbxVIN: 'vin', selectUser: 'user', + cbxSupplierFinancing: 'supplierFinancing', /** Readonly Elements */ labelLeaseObjectRisk: 'leaseObjectRiskName', diff --git a/apps/web/Components/Calculation/lib/render-rows.tsx b/apps/web/Components/Calculation/lib/render-rows.tsx index 35d0476..2a879f6 100644 --- a/apps/web/Components/Calculation/lib/render-rows.tsx +++ b/apps/web/Components/Calculation/lib/render-rows.tsx @@ -1,9 +1,8 @@ /* eslint-disable react/no-array-index-key */ - import elementsRender from '../config/elements-render'; import type { Elements as ActionElements } from '../config/map/actions'; import type { Elements as ValuesElements } from '../config/map/values'; -import Divider from 'ui/elements/layout/Divider'; +import { Divider } from 'ui/elements'; import type { BoxProps } from 'ui/grid'; import { Box } from 'ui/grid'; diff --git a/apps/web/Components/Common/Error.jsx b/apps/web/Components/Common/Error.jsx index 5a16ff4..a33386b 100644 --- a/apps/web/Components/Common/Error.jsx +++ b/apps/web/Components/Common/Error.jsx @@ -1,6 +1,5 @@ /* eslint-disable sonarjs/no-small-switch */ -import Button from 'ui/elements/Button'; -import Result from 'ui/elements/Result'; +import { Button, Result } from 'ui/elements'; function handleRetry() { window.location.reload(); diff --git a/apps/web/Components/Layout/Auth.jsx b/apps/web/Components/Layout/Auth.jsx index 1d54b08..af98214 100644 --- a/apps/web/Components/Layout/Auth.jsx +++ b/apps/web/Components/Layout/Auth.jsx @@ -3,7 +3,7 @@ import { STALE_TIME } from '@/constants/request'; import { min } from '@/styles/mq'; import { useQuery } from '@tanstack/react-query'; import styled from 'styled-components'; -import { Flex } from 'ui'; +import { Flex } from 'ui/grid'; const UserText = styled.span` margin: 0; diff --git a/apps/web/Components/Layout/Element.tsx b/apps/web/Components/Layout/Element.tsx index d62ad16..4cec38a 100644 --- a/apps/web/Components/Layout/Element.tsx +++ b/apps/web/Components/Layout/Element.tsx @@ -2,7 +2,7 @@ import { min } from '@/styles/mq'; import type { ReactNode } from 'react'; import styled from 'styled-components'; -import { Flex } from 'ui'; +import { Flex } from 'ui/grid'; const ElementTitle = styled.label` color: rgba(0, 0, 0, 0.75); diff --git a/apps/web/Components/Layout/Header.jsx b/apps/web/Components/Layout/Header.jsx index bf920f0..b4ec8ce 100644 --- a/apps/web/Components/Layout/Header.jsx +++ b/apps/web/Components/Layout/Header.jsx @@ -2,7 +2,7 @@ import Auth from './Auth'; import Logo from './Logo'; import { min } from '@/styles/mq'; import styled from 'styled-components'; -import { Flex } from 'ui'; +import { Flex } from 'ui/grid'; const HeaderContent = styled(Flex)` flex-direction: row; diff --git a/apps/web/Components/Layout/Logo.jsx b/apps/web/Components/Layout/Logo.jsx index 7edee39..9488349 100644 --- a/apps/web/Components/Layout/Logo.jsx +++ b/apps/web/Components/Layout/Logo.jsx @@ -7,7 +7,8 @@ import { observer } from 'mobx-react-lite'; import Image from 'next/image'; import logo from 'public/assets/images/logo-primary.svg'; import styled from 'styled-components'; -import { Flex, Tag } from 'ui'; +import { Tag } from 'ui/elements'; +import { Flex } from 'ui/grid'; const ImageWrapper = styled.div` width: 100px; diff --git a/apps/web/Components/Layout/index.jsx b/apps/web/Components/Layout/index.jsx index 54abe53..f433777 100644 --- a/apps/web/Components/Layout/index.jsx +++ b/apps/web/Components/Layout/index.jsx @@ -1,5 +1,5 @@ import Header from './Header'; -import { Flex } from 'ui'; +import { Flex } from 'ui/grid'; export default function Layout({ children }) { return ( diff --git a/apps/web/Components/Output/PaymentsTable/index.jsx b/apps/web/Components/Output/PaymentsTable/index.jsx index 2728fd9..afba73c 100644 --- a/apps/web/Components/Output/PaymentsTable/index.jsx +++ b/apps/web/Components/Output/PaymentsTable/index.jsx @@ -3,7 +3,7 @@ import { MAX_LEASING_PERIOD } from '@/constants/values'; import { useStore } from '@/stores/hooks'; import { toJS } from 'mobx'; import { observer } from 'mobx-react-lite'; -import Table from 'ui/elements/Table'; +import { Table } from 'ui/elements'; const PaymentsTable = observer(() => { const { $results } = useStore(); diff --git a/apps/web/Components/Output/Results/config.ts b/apps/web/Components/Output/Results/config.ts index a0f7848..12f92e9 100644 --- a/apps/web/Components/Output/Results/config.ts +++ b/apps/web/Components/Output/Results/config.ts @@ -53,7 +53,7 @@ export const formatters = { resultLastPayment: moneyFormatter, resultParticipationAmount: moneyFormatter, resultPlPrice: moneyFormatter, - resultPriceUpPr: moneyFormatter, + resultPriceUpPr: percentFormatter, resultTerm: Intl.NumberFormat('ru').format, resultTotalGraphwithNDS: moneyFormatter, }; diff --git a/apps/web/Components/Output/Results/index.jsx b/apps/web/Components/Output/Results/index.jsx index a577f30..b421a1e 100644 --- a/apps/web/Components/Output/Results/index.jsx +++ b/apps/web/Components/Output/Results/index.jsx @@ -5,7 +5,7 @@ import { min } from '@/styles/mq'; import { toJS } from 'mobx'; import { observer } from 'mobx-react-lite'; import styled from 'styled-components'; -import Text from 'ui/elements/Text'; +import { Text } from 'ui/elements'; import { Box } from 'ui/grid'; const Grid = styled(Box)` diff --git a/apps/web/Components/Output/Validation.jsx b/apps/web/Components/Output/Validation.jsx index e5397a4..f5f3547 100644 --- a/apps/web/Components/Output/Validation.jsx +++ b/apps/web/Components/Output/Validation.jsx @@ -2,7 +2,7 @@ import { useStore } from '@/stores/hooks'; import { observer } from 'mobx-react-lite'; import styled from 'styled-components'; -import Alert from 'ui/elements/Alert'; +import { Alert } from 'ui/elements'; import { Box, Flex } from 'ui/grid'; const Bold = styled.span` diff --git a/apps/web/Components/Output/index.jsx b/apps/web/Components/Output/index.jsx index 055e5ce..4493a1e 100644 --- a/apps/web/Components/Output/index.jsx +++ b/apps/web/Components/Output/index.jsx @@ -6,7 +6,7 @@ import { useStore } from '@/stores/hooks'; import { min } from '@/styles/mq'; import { observer } from 'mobx-react-lite'; import styled from 'styled-components'; -import { Badge, Tabs } from 'ui'; +import { Badge, Tabs } from 'ui/elements'; const outputTabs = [PaymentsTable, Results, Validation]; const items = outputTabs.map(({ Component, id, title }) => { diff --git a/apps/web/config/default-options.ts b/apps/web/config/default-options.ts index ab4c2a5..1f383dc 100644 --- a/apps/web/config/default-options.ts +++ b/apps/web/config/default-options.ts @@ -494,6 +494,7 @@ const defaultOptions: CalculationOptions = { selectLeasingWithoutKasko: [], tbxVIN: [], selectUser: [], + cbxSupplierFinancing: [], }; export default defaultOptions; diff --git a/apps/web/config/default-statuses.ts b/apps/web/config/default-statuses.ts index dbdcb41..e2bc520 100644 --- a/apps/web/config/default-statuses.ts +++ b/apps/web/config/default-statuses.ts @@ -18,6 +18,7 @@ const defaultStatuses: CalculationStatuses = { cbxRecalcWithRevision: 'Default', cbxRegistrationQuote: 'Default', cbxShowFinGAP: 'Default', + cbxSupplierFinancing: 'Disabled', cbxTechnicalCardQuote: 'Default', cbxWithTrailer: 'Default', labelDepreciationGroup: 'Default', diff --git a/apps/web/config/default-values.ts b/apps/web/config/default-values.ts index 3c15c2e..d83ae9d 100644 --- a/apps/web/config/default-values.ts +++ b/apps/web/config/default-values.ts @@ -111,7 +111,7 @@ const defaultValues: CalculationValues = { quoteUrl: null, rate: null, recalcWithRevision: false, - redemptionPaymentSum: 1000, + redemptionPaymentSum: 0, regionRegistration: null, registration: null, registrationDescription: '-', @@ -125,6 +125,7 @@ const defaultValues: CalculationValues = { supplierCurrency: null, supplierDiscountPerc: 0, supplierDiscountRub: 0, + supplierFinancing: false, tarif: null, technicalCard: null, technicalCardQuote: true, diff --git a/apps/web/config/schema/values.ts b/apps/web/config/schema/values.ts index cb2d5d8..e764341 100644 --- a/apps/web/config/schema/values.ts +++ b/apps/web/config/schema/values.ts @@ -110,6 +110,7 @@ const ValuesSchema = z.object({ supplierCurrency: z.string().nullable(), supplierDiscountPerc: z.number(), supplierDiscountRub: z.number(), + supplierFinancing: z.boolean(), tarif: z.string().nullable(), technicalCard: z.string().nullable(), technicalCardQuote: z.boolean(), diff --git a/apps/web/constants/values.js b/apps/web/constants/values.js index 34298ab..056a86d 100644 --- a/apps/web/constants/values.js +++ b/apps/web/constants/values.js @@ -8,7 +8,7 @@ export const MIN_LASTPAYMENT_NSIB = 3500; export const MIN_PAYMENT = 3; export const VAT = 0.2; export const MAX_MASS = 3500; -export const MAX_VEHICLE_SEATS = 20; +export const VEHICLE_SEATS = 20; export const ESN = 1.3; export const NSIB_MAX = 5_000_000; export const NDFL = 0.13; diff --git a/apps/web/graphql/crm.query.graphql b/apps/web/graphql/crm.query.graphql index 6847f24..29884a6 100644 --- a/apps/web/graphql/crm.query.graphql +++ b/apps/web/graphql/crm.query.graphql @@ -120,6 +120,10 @@ query GetTarifs($currentDate: DateTime) { evo_min_last_payment evo_max_last_payment evo_used + evo_leasingobject_types { + evo_leasingobject_typeid + } + evo_pl_use_type } } @@ -194,6 +198,10 @@ query GetProduct($productId: Uuid!) { evo_cut_irr_with_bonus evo_sale_without_nds evo_id + evo_supplier_financing_accept + accounts { + accountid + } } } @@ -227,6 +235,7 @@ query GetSubsidy($subsidyId: Uuid!) { evo_percent_subsidy evo_max_subsidy_summ evo_get_subsidy_payment + evo_delivery_time } } @@ -324,6 +333,7 @@ query GetBrand($brandId: Uuid!) { evo_id evo_importer_reward_perc evo_importer_reward_rub + evo_maximum_percentage_av } } @@ -367,6 +377,7 @@ query GetDealers { label: name value: accountid accountid + evo_supplier_financing_accept } } @@ -384,12 +395,14 @@ query GetDealerPersons($dealerId: Uuid!) { accountid evo_inn evo_kpp + evo_supplier_financing_accept } } query GetDealerPerson($dealerPersonId: Uuid!) { account(accountid: $dealerPersonId) { evo_supplier_type + evo_supplier_financing_accept } } @@ -596,6 +609,16 @@ query GetInsNSIBTypes($currentDate: DateTime) { evo_product_type: 100000002 ) { ...CoreAddProductTypesFields + evo_max_period + evo_min_period + evo_max_price + evo_min_price + evo_leasingobject_types { + evo_leasingobject_typeid + } + evo_visible_calc + evo_min_first_payment_perc + evo_max_first_payment_perc } } diff --git a/apps/web/graphql/crm.schema.graphql b/apps/web/graphql/crm.schema.graphql index 77f91f3..bf457ac 100644 --- a/apps/web/graphql/crm.schema.graphql +++ b/apps/web/graphql/crm.schema.graphql @@ -196,6 +196,10 @@ type evo_addcontract { evo_change_payment_date: Boolean evo_chassis: String evo_chassis_new: String + evo_check_success: Boolean + evo_claim_bill_date: DateTime + evo_claim_bill_number: String + evo_claim_sum_plan: Decimal evo_color: String evo_color_new: String evo_contractid: Uuid @@ -316,6 +320,7 @@ type evo_addcontract { evo_leasingobject_specification: String evo_leasingobject_specification_new: String evo_leasing_bonus_summ: Decimal + evo_leasing_profit: Decimal evo_log_activdate_1c: String evo_loss_kv: Decimal evo_maker: String @@ -398,6 +403,7 @@ type evo_addcontract { evo_pts_type_new: Int evo_quoteid: Uuid evo_reasons_calc: [Int!] + evo_reason_validation_doc: [Int!] evo_recalculate_demand: Boolean evo_refuse_reason: Int evo_regionid: Uuid @@ -518,6 +524,7 @@ type email { modifiedon: DateTime regardingobjectid_account: Uuid regardingobjectid_evo_contract: Uuid + regardingobjectid_evo_debtwork_contract: Uuid regardingobjectid_evo_insurance_period: Uuid regardingobjectid_evo_insurance_policy: Uuid regardingobjectid_evo_insurance_policyData: evo_insurance_policy @@ -722,6 +729,7 @@ type evo_request_client { evo_site_text: String evo_statuscodeid: Uuid evo_statuscodeidData: evo_statuscode + evo_statuscode_reason: String evo_storage: String incidents: [incidentGraphQL] link: String @@ -876,24 +884,35 @@ type account { evo_fingap_number_rules: Int evo_fin_department_accountid: Uuid evo_fin_department_accountidData: account + evo_foreign_countries_financing: Boolean evo_fuel_card_code: String evo_fuel_card_login: String evo_fuel_card_pass: String evo_fullname: String evo_group_sales_network: Uuid + evo_gt_sc: String evo_id_elt: String evo_id_elt_osago: String evo_id_elt_smr: String evo_ifns_code: String evo_ifns_code_branch: String evo_ifns_name: String + evo_individual_executive_docdate: DateTime + evo_individual_executive_docnum: String + evo_individual_executive_inn: String + evo_individual_executive_kpp: String + evo_individual_executive_oop: String evo_inn: String + evo_insurance_periods: [evo_insurance_period] evo_invoice_number_fix: String evo_invoice_number_rules: Int + evo_is_individual_executive: Boolean evo_kpp: String + evo_la: String evo_legal_form: Int evo_legal_region_calc: Boolean evo_licenses_list: String + evo_lkt: String evo_lk_regdate: DateTime evo_log_activdate_1c: String evo_management_disqualified: Boolean @@ -910,6 +929,10 @@ type account { evo_osago_with_kasko: Boolean evo_request_clients: [evo_request_client] evo_return_leasing_dealer: Boolean + evo_revenue_source_1: Boolean + evo_revenue_source_2: Boolean + evo_revenue_source_3: Boolean + evo_revenue_source_other: String evo_smb_category: Int evo_smb_issue_date: DateTime evo_special_accounting: Int @@ -941,6 +964,7 @@ type account { telephone2: String telephone3: String toObjectString: String + websiteurl: String } type contact { @@ -951,6 +975,7 @@ type contact { emailaddress2: String emailaddress3: String evo_consent_date: DateTime + evo_delegation_agreement: Boolean evo_docdate: DateTime evo_docnumber: String evo_fact_addressid: Uuid @@ -1060,6 +1085,7 @@ type evo_addproduct_type { } type evo_baseproduct { + accounts(statecode: Int): [account] createdon: DateTime evo_baseproductid: Uuid evo_baseproducts(statecode: Int): [evo_baseproduct] @@ -1118,6 +1144,7 @@ type evo_insurance_period { evo_close: Boolean evo_comment: String evo_contractid: Uuid + evo_contractidData: evo_contract evo_datefrom: DateTime evo_dateto: DateTime evo_dgo_price: Decimal @@ -1165,6 +1192,8 @@ type evo_insurance_period { evo_pay_summ_fact: Decimal evo_period_number: Int evo_prolong_listid: Uuid + evo_request_clientid: Uuid + evo_request_clientidData: evo_request_client evo_request_id_elt: String evo_request_status: Int evo_result_reward_factor: Decimal @@ -1175,6 +1204,7 @@ type evo_insurance_period { evo_territory_price: Decimal evo_under_payment_compensation: Decimal evo_unlimit_drivers: Boolean + link: String modifiedon: DateTime ownerid_systemuser: Uuid ownerid_team: Uuid @@ -1233,6 +1263,7 @@ type evo_external_supplier_code { evo_external_supplier_codeid: Uuid evo_id: String evo_manager_systemuserid: Uuid + evo_supplier_type: Int modifiedon: DateTime toObjectString: String } @@ -1286,6 +1317,7 @@ type evo_leasingobject { evo_engine_power_kvt: Decimal evo_engine_type: Int evo_engine_volume: Decimal + evo_epts_status: Int evo_equipmentid: Uuid evo_gosnumber: String evo_gos_akt: String @@ -1298,6 +1330,7 @@ type evo_leasingobject { evo_legal_regionid: Uuid evo_legal_townid: Uuid evo_maker: String + evo_maximum_percentage_av: Decimal evo_max_mass: Decimal evo_max_speed: Decimal evo_mileage: Decimal @@ -1397,6 +1430,7 @@ type lead { evo_comment: String evo_double_agent_accountid: Uuid evo_external_supplierid: Uuid + evo_failure: Boolean evo_fin_department_accountid: Uuid evo_firstname: String evo_inn: String @@ -1442,6 +1476,7 @@ type opportunity { evo_all_credit_evosmart: Decimal evo_approvallogs: [evo_approvallog] evo_assignor_accountid: Uuid + evo_board_of_directors: String evo_businessunitid: Uuid evo_businessunitidData: businessunit evo_cession_incidentid: Uuid @@ -1449,6 +1484,7 @@ type opportunity { evo_check_type_fact: [Int!] evo_client_riskid: Uuid evo_client_riskidData: evo_client_risk + evo_collective_executive: String evo_comment_description: String evo_contracts: [evo_contract] evo_credit_analyst_systemuserid: Uuid @@ -1456,6 +1492,7 @@ type opportunity { evo_declaration_revenue: Decimal evo_docpay_ka_received: Int evo_docpay_ka_require: Boolean + evo_financial_loan: Decimal evo_founder1_beneficial_owner: Boolean evo_founder1_contactid: Uuid evo_founder1_part: Decimal @@ -1479,10 +1516,13 @@ type opportunity { evo_guarantor2_contactid: Uuid evo_guarantor3_contactid: Uuid evo_guarantor4_contactid: Uuid + evo_high_level: String + evo_individual_executive: String evo_leadid: Uuid evo_leadidData: lead evo_mps_systemuserid: Uuid evo_oppnumber: String + evo_other_control: String evo_process_type: Int evo_programsolution: Int evo_report_year: Int @@ -1521,6 +1561,7 @@ type quote { customerid_contact: Uuid evo_accept_control_addproduct_typeid: Uuid evo_accept_control_addproduct_typeidData: evo_addproduct_type + evo_accept_param: [Int!] evo_accept_period: Int evo_accept_quoteid: Uuid evo_acquisition_costs: Decimal @@ -1833,6 +1874,7 @@ type evo_brand { evo_id: String evo_importer_reward_perc: Decimal evo_importer_reward_rub: Decimal + evo_maximum_percentage_av: Decimal evo_name: String evo_subsidies(statecode: Int): [evo_subsidy] evo_vehicle_type: [Int!] @@ -2124,6 +2166,7 @@ type evo_request_payment { type evo_documenttype { createdon: DateTime evo_check_edo: Boolean + evo_clientsign_field: String evo_code_wm: String evo_comment: String evo_documenttypeid: Uuid @@ -2203,6 +2246,7 @@ type evo_contract { evo_date_of_pledge_claim: DateTime evo_date_of_pledge_leasobject: DateTime evo_date_of_sending_dkp: DateTime + evo_date_of_sending_dl: DateTime evo_date_sor: DateTime evo_date_termination: DateTime evo_dealer_broker_accountid: Uuid @@ -2300,6 +2344,8 @@ type evo_contract { evo_leasing_bonus_pay_date: DateTime evo_leasing_bonus_summ: Decimal evo_leasing_pledge_agreementid: Uuid + evo_leasing_profit: Decimal + evo_leasing_profit_actual: Decimal evo_lessor_bank_detailsid: Uuid evo_log_activdate_1c: String evo_msfo_irr: Decimal @@ -2324,6 +2370,7 @@ type evo_contract { evo_payment_redemption: Int evo_payment_redemption_sum: Decimal evo_payment_redemption_sum_without_nds: Decimal + evo_paysum_before_act_date_plan: Decimal evo_period: Int evo_previous_accountid: Uuid evo_price_without_discount: Decimal @@ -2365,6 +2412,7 @@ type evo_contract { evo_subsidy_validity_date: DateTime evo_sumhold_date_sor: Decimal evo_sumhold_month: Decimal + evo_sum_pay_future: Decimal evo_supplier_accountid: Uuid evo_supplier_bank_detailsid: Uuid evo_supplier_bank_detailsidData: evo_bank_details @@ -2411,10 +2459,12 @@ type evo_external_system_request { evo_accountidData: account evo_addcontractid: Uuid evo_addproductid: Uuid + evo_addressid: Uuid evo_agency_agreementid: Uuid evo_contactid: Uuid evo_contractid: Uuid evo_credreg_report_code: String + evo_debtwork_contractid: Uuid evo_emailid: Uuid evo_emailidData: email evo_external_system_requestid: Uuid @@ -2441,6 +2491,7 @@ type evo_external_system_request { type evo_paymentorder { createdon: DateTime evo_account_name_text: String + evo_addcontractid: Uuid evo_comment: String evo_contractid: Uuid evo_correction_date_1c: DateTime @@ -2569,6 +2620,7 @@ type evo_tarif { evo_model_exceptions(statecode: Int): [evo_model] evo_name: String evo_pay_supplier_without_addcontract: Boolean + evo_pl_use_type: [Int!] evo_rates(statecode: Int): [evo_rate] evo_seasons_type_exception: [Int!] evo_tarifid: Uuid @@ -2651,6 +2703,7 @@ type evo_address { evo_flat: String evo_flat_type: String evo_flat_type_full: String + evo_geocoding_level: Int evo_geo_lat: String evo_geo_lon: String evo_house: String @@ -2690,6 +2743,7 @@ type systemuser { domainname: String evo_access_download_ni: Boolean evo_access_exception_addcontract: Boolean + evo_alt_lead: Boolean evo_available_assignment_director: Boolean evo_baseproducts(statecode: Int): [evo_baseproduct] evo_callrecords_access: Boolean @@ -2729,11 +2783,13 @@ type evo_identity_document { createdon: DateTime evo_citizenship_countryid: Uuid evo_code: String + evo_contactid: Uuid evo_docnumber: String evo_doctype: Int evo_employee_systemuserid: Uuid evo_identity_documentid: Uuid evo_issueby: String + evo_issueby_search_dadata: String evo_issuedate: DateTime evo_placebirth: String evo_registration_addressid: Uuid @@ -2905,6 +2961,7 @@ type evo_insurance_policy { evo_insurance_policyid: Uuid evo_insurer_accountid: Uuid evo_ins_change_comment: String + evo_name: String evo_nsib_ins_summ: Decimal evo_one_year_insurance: Boolean evo_owner_comment: String @@ -2914,6 +2971,7 @@ type evo_insurance_policy { evo_pre_polis_number: String evo_quoteid: Uuid evo_statuscodeid: Uuid + link: String modifiedon: DateTime ownerid: Uuid statecode: Int @@ -2982,6 +3040,7 @@ type evo_edo { evo_box_edoidData: evo_edo evo_box_id: String evo_box_name: String + evo_client_signer_contactid: Uuid evo_contractid: Uuid evo_contractidData: evo_contract evo_documentid: Uuid diff --git a/apps/web/graphql/crm.types.ts b/apps/web/graphql/crm.types.ts index fd58714..3ba305f 100644 --- a/apps/web/graphql/crm.types.ts +++ b/apps/web/graphql/crm.types.ts @@ -182,7 +182,7 @@ export type GetTarifsQueryVariables = Exact<{ }>; -export type GetTarifsQuery = { __typename?: 'Query', evo_tarifs: Array<{ __typename?: 'evo_tarif', evo_tarifid: string | null, evo_baseproductid: string | null, evo_min_period: number | null, evo_max_period: number | null, evo_delivery_time: Array | null, evo_min_first_payment: number | null, evo_max_first_payment: number | null, evo_min_last_payment: number | null, evo_max_last_payment: number | null, evo_used: boolean | null, label: string | null, value: string | null } | null> | null }; +export type GetTarifsQuery = { __typename?: 'Query', evo_tarifs: Array<{ __typename?: 'evo_tarif', evo_tarifid: string | null, evo_baseproductid: string | null, evo_min_period: number | null, evo_max_period: number | null, evo_delivery_time: Array | null, evo_min_first_payment: number | null, evo_max_first_payment: number | null, evo_min_last_payment: number | null, evo_max_last_payment: number | null, evo_used: boolean | null, evo_pl_use_type: Array | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null> | null }; export type GetTarifQueryVariables = Exact<{ tarifId: Scalars['Uuid']; @@ -217,7 +217,7 @@ export type GetProductQueryVariables = Exact<{ }>; -export type GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array | 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 GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array | 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_supplier_financing_accept: 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, accounts: Array<{ __typename?: 'account', accountid: string | null } | null> | null } | null }; export type GetSubsidiesQueryVariables = Exact<{ currentDate: InputMaybe; @@ -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_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 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_delivery_time: Array | 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']; @@ -293,7 +293,7 @@ export type GetBrandQueryVariables = Exact<{ }>; -export type GetBrandQuery = { __typename?: 'Query', evo_brand: { __typename?: 'evo_brand', evo_id: string | null, evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null } | null }; +export type GetBrandQuery = { __typename?: 'Query', evo_brand: { __typename?: 'evo_brand', evo_id: string | null, evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null, evo_maximum_percentage_av: number | null } | null }; export type GetModelsQueryVariables = Exact<{ brandId: Scalars['Uuid']; @@ -326,7 +326,7 @@ export type GetConfigurationQuery = { __typename?: 'Query', evo_equipment: { __t export type GetDealersQueryVariables = Exact<{ [key: string]: never; }>; -export type GetDealersQuery = { __typename?: 'Query', dealers: Array<{ __typename?: 'account', accountid: string | null, label: string | null, value: string | null } | null> | null }; +export type GetDealersQuery = { __typename?: 'Query', dealers: Array<{ __typename?: 'account', accountid: string | null, evo_supplier_financing_accept: boolean | null, label: string | null, value: string | null } | null> | null }; export type GetDealerQueryVariables = Exact<{ dealerId: Scalars['Uuid']; @@ -340,14 +340,14 @@ export type GetDealerPersonsQueryVariables = Exact<{ }>; -export type GetDealerPersonsQuery = { __typename?: 'Query', dealerPersons: Array<{ __typename?: 'account', accountid: string | null, evo_inn: string | null, evo_kpp: string | null, label: string | null, value: string | null } | null> | null }; +export type GetDealerPersonsQuery = { __typename?: 'Query', dealerPersons: Array<{ __typename?: 'account', accountid: string | null, evo_inn: string | null, evo_kpp: string | null, evo_supplier_financing_accept: boolean | null, label: string | null, value: string | null } | null> | null }; export type GetDealerPersonQueryVariables = Exact<{ dealerPersonId: Scalars['Uuid']; }>; -export type GetDealerPersonQuery = { __typename?: 'Query', account: { __typename?: 'account', evo_supplier_type: number | null } | null }; +export type GetDealerPersonQuery = { __typename?: 'Query', account: { __typename?: 'account', evo_supplier_type: number | null, evo_supplier_financing_accept: boolean | null } | null }; export type GetAgentQueryVariables = Exact<{ agentid: Scalars['Uuid']; @@ -449,7 +449,7 @@ export type GetInsNsibTypesQueryVariables = Exact<{ }>; -export type GetInsNsibTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, label: string | null, value: string | null } | null> | null }; +export type GetInsNsibTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_max_period: number | null, evo_min_period: number | null, evo_max_price: number | null, evo_min_price: number | null, evo_visible_calc: boolean | null, evo_min_first_payment_perc: number | null, evo_max_first_payment_perc: number | null, evo_graph_price: number | null, label: string | null, value: string | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null } | null> | null }; export type GetLeasingWithoutKaskoTypesQueryVariables = Exact<{ currentDate: InputMaybe; @@ -503,7 +503,7 @@ export type GetQuoteCreateKpDataQueryVariables = Exact<{ }>; -export type GetQuoteCreateKpDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_price_with_discount: boolean | null, evo_price_without_discount_quote: boolean | null, evo_cost_increace: boolean | null, evo_insurance: boolean | null, evo_registration_quote: boolean | null, evo_card_quote: boolean | null, evo_nsib_quote: boolean | null, evo_redemption_graph: boolean | null, evo_fingap_quote: boolean | null, evo_contact_name: string | null, evo_gender: number | null } | null }; +export type GetQuoteCreateKpDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_price_with_discount: boolean | null, evo_price_without_discount_quote: boolean | null, evo_cost_increace: boolean | null, evo_insurance: boolean | null, evo_registration_quote: boolean | null, evo_card_quote: boolean | null, evo_nsib_quote: boolean | null, evo_redemption_graph: boolean | null, evo_fingap_quote: boolean | null, evo_contact_name: string | null, evo_gender: number | null, evo_last_payment_redemption: boolean | null } | null }; export type GetQuoteFingapDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; @@ -580,7 +580,7 @@ export type GetQuotePriceDataQueryVariables = Exact<{ }>; -export type GetQuotePriceDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_comission_rub: number | null, evo_comission_perc: number | null, evo_discount_perc: number | null, evo_discount_supplier_currency: number | null, evo_first_payment_perc: number | null, evo_last_payment_calc: number | null, evo_last_payment_perc: number | null, evo_last_payment_rub: number | null, evo_nds_in_price_supplier_currency: number | null, evo_price_without_nds_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_transactioncurrencyid: string | null, evo_equip_price: number | null } | null }; +export type GetQuotePriceDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_comission_rub: number | null, evo_comission_perc: number | null, evo_discount_perc: number | null, evo_discount_supplier_currency: number | null, evo_first_payment_perc: number | null, evo_first_payment_rub: number | null, evo_last_payment_calc: number | null, evo_last_payment_perc: number | null, evo_last_payment_rub: number | null, evo_nds_in_price_supplier_currency: number | null, evo_price_without_nds_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_transactioncurrencyid: string | null, evo_equip_price: number | null } | null }; export type GetQuoteSubsidyDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']; @@ -601,7 +601,7 @@ export type GetQuoteAgentsDataQueryVariables = Exact<{ }>; -export type GetQuoteAgentsDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_supplier_accountid: string | null, evo_dealer_person_accountid: string | null, evo_dealer_reward_conditionid: string | null, evo_dealer_reward_total: number | null, evo_dealer_reward_summ: number | null, evo_dealer_broker_accountid: string | null, evo_dealer_broker_reward_conditionid: string | null, evo_dealer_broker_reward_total: number | null, evo_dealer_broker_reward_summ: number | null, evo_agent_accountid: string | null, evo_agent_reward_conditionid: string | null, evo_agent_reward_total: number | null, evo_agent_reward_summ: number | null, evo_double_agent_accountid: string | null, evo_double_agent_reward_conditionid: string | null, evo_double_agent_reward_total: number | null, evo_double_agent_reward_summ: number | null, evo_broker_accountid: string | null, evo_broker_reward_conditionid: string | null, evo_broker_reward_total: number | null, evo_broker_reward_summ: number | null, evo_fin_department_accountid: string | null, evo_fin_department_reward_conditionid: string | null, evo_fin_department_reward_total: number | null, evo_fin_department_reward_summ: number | null } | null }; +export type GetQuoteAgentsDataQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_supplier_accountid: string | null, evo_dealer_person_accountid: string | null, evo_dealer_reward_conditionid: string | null, evo_dealer_reward_total: number | null, evo_dealer_reward_summ: number | null, evo_dealer_broker_accountid: string | null, evo_dealer_broker_reward_conditionid: string | null, evo_dealer_broker_reward_total: number | null, evo_dealer_broker_reward_summ: number | null, evo_agent_accountid: string | null, evo_agent_reward_conditionid: string | null, evo_agent_reward_total: number | null, evo_agent_reward_summ: number | null, evo_double_agent_accountid: string | null, evo_double_agent_reward_conditionid: string | null, evo_double_agent_reward_total: number | null, evo_double_agent_reward_summ: number | null, evo_broker_accountid: string | null, evo_broker_reward_conditionid: string | null, evo_broker_reward_total: number | null, evo_broker_reward_summ: number | null, evo_fin_department_accountid: string | null, evo_fin_department_reward_conditionid: string | null, evo_fin_department_reward_total: number | null, evo_fin_department_reward_summ: number | null, evo_supplier_financing: boolean | null } | null }; export const CoreAddProductTypesFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode; 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; @@ -613,14 +613,14 @@ export const GetOpportunityDocument = {"kind":"Document","definitions":[{"kind": 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; 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; 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; -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; +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"}},{"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_pl_use_type"}}]}}]}}]} as unknown as DocumentNode; 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; 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; 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; 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; -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; +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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing_accept"}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]}}]} as unknown as DocumentNode; 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; -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; +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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}}]}}]}}]} as unknown as DocumentNode; 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; 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; 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; @@ -630,15 +630,15 @@ export const GetGpsModelsDocument = {"kind":"Document","definitions":[{"kind":"O 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; 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; 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; -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; +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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_maximum_percentage_av"}}]}}]}}]} as unknown as DocumentNode; 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; export const GetModelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_model"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}}]}}]}}]} as unknown as DocumentNode; export const GetConfigurationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfigurations"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_start_production_year"}}]}}]}}]} as unknown as DocumentNode; export const GetConfigurationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguration"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_equipmentid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetDealersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealers"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_legal_form"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]} as unknown as DocumentNode; +export const GetDealersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealers"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_legal_form"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing_accept"}}]}}]}}]} as unknown as DocumentNode; export const GetDealerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealer"},"name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_return_leasing_dealer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}}]}}]}}]} as unknown as DocumentNode; -export const GetDealerPersonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealerPersons"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealerPersons"},"name":{"kind":"Name","value":"salon_providers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"salonaccountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kpp"}}]}}]}}]} as unknown as DocumentNode; -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; +export const GetDealerPersonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealerPersons"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealerPersons"},"name":{"kind":"Name","value":"salon_providers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"salonaccountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dealerId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kpp"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing_accept"}}]}}]}}]} as unknown as DocumentNode; +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"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing_accept"}}]}}]}}]} as unknown as DocumentNode; 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; 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; 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; @@ -652,7 +652,7 @@ export const GetTechnicalCardsDocument = {"kind":"Document","definitions":[{"kin 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; export const GetTelematicTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTelematicTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000004"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_controls_program"}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}}]}}]}},{"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; export const GetTrackerTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTrackerTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000003"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_controls_program"}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}}]}}]}},{"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; -export const GetInsNsibTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsNSIBTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000002"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode; +export const GetInsNsibTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsNSIBTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000002"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}}]}}]}},{"kind":"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; export const GetLeasingWithoutKaskoTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000007"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CoreAddProductTypesFields"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CoreAddProductTypesFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"evo_addproduct_type"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_graph_price"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]} as unknown as DocumentNode; export const GetInsuranceCompanyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompany"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"accountId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_osago_with_kasko"}}]}}]}}]} as unknown as DocumentNode; export const GetInsuranceCompaniesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetInsuranceCompanies"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000002"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_type_ins_policy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_evokasko_access"}},{"kind":"Field","name":{"kind":"Name","value":"evo_inn"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; @@ -660,7 +660,7 @@ export const GetRolesDocument = {"kind":"Document","definitions":[{"kind":"Opera export const GetQuoteAddProductDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteAddProductData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteBonusDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteBonusData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteConfiguratorDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteConfiguratorData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_client_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_msfo_irr"}}]}}]}}]} as unknown as DocumentNode; -export const GetQuoteCreateKpDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteCreateKPData"},"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_price_with_discount"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_discount_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_increace"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_card_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_redemption_graph"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_contact_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gender"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteCreateKpDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteCreateKPData"},"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_price_with_discount"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_discount_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_increace"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_card_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_redemption_graph"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_contact_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gender"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_redemption"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteFingapDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteFingapData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetFinGapAddProductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFinGAPAddProductTypes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000006"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type_calc_cerebellum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteGibddDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteGibddData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_approved"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic_accept"}}]}}]}}]} as unknown as DocumentNode; @@ -671,7 +671,7 @@ export const GetOpportunityUrlDocument = {"kind":"Document","definitions":[{"kin export const GetQuoteUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteLeasingObjectDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteLeasingObjectData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vin"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}}]}}]}}]} as unknown as DocumentNode; export const GetQuotePaymentsDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePaymentsData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetQuotePriceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePriceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_comission_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_nds_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuotePriceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotePriceData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_comission_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_nds_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteSubsidyDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteSubsidyData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidyid"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardRulesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardRules"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_calc_reward_rules"}}]}}]}}]} as unknown as DocumentNode; -export const GetQuoteAgentsDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteAgentsData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_person_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_summ"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const GetQuoteAgentsDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteAgentsData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_person_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/apps/web/pages/404.jsx b/apps/web/pages/404.jsx index f6201ee..dc1870d 100644 --- a/apps/web/pages/404.jsx +++ b/apps/web/pages/404.jsx @@ -1,4 +1,5 @@ -import Result from 'ui/elements/Result'; +/* eslint-disable canonical/filename-match-regex */ +import { Result } from 'ui/elements'; export default function NotFound() { return ; diff --git a/apps/web/pages/500.jsx b/apps/web/pages/500.jsx index def8240..9fab1e8 100644 --- a/apps/web/pages/500.jsx +++ b/apps/web/pages/500.jsx @@ -1,4 +1,5 @@ -import Result from 'ui/elements/Result'; +/* eslint-disable canonical/filename-match-regex */ +import { Result } from 'ui/elements'; export default function ServerError() { return ; diff --git a/apps/web/process/add-product/index.ts b/apps/web/process/add-product/index.ts index e05ea2d..2bcf57b 100644 --- a/apps/web/process/add-product/index.ts +++ b/apps/web/process/add-product/index.ts @@ -1,2 +1,3 @@ export * from './get-kp-data'; export * as reactions from './reactions'; +export * from './validation'; diff --git a/apps/web/process/add-product/reactions.ts b/apps/web/process/add-product/reactions.ts index 3963bb4..36a0d25 100644 --- a/apps/web/process/add-product/reactions.ts +++ b/apps/web/process/add-product/reactions.ts @@ -1,18 +1,27 @@ +import { createValidationReaction } from '../tools'; import type { ProcessContext } from '../types'; +import { createValidationSchema } from './validation'; +import { selectRequirementTelematic } from '@/config/default-options'; import * as CRMTypes from '@/graphql/crm.types'; +import { normalizeOptions } from '@/utils/entity'; +import { debouncedReaction } from '@/utils/mobx'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; -import { reaction } from 'mobx'; -import { normalizeOptions } from 'tools'; +import { reaction, toJS } from 'mobx'; dayjs.extend(utc); export default function reactions({ store, apolloClient }: ProcessContext) { - const { $calculation } = store; + const { $calculation, $tables } = store; reaction( - () => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType']), - async ({ leasingPeriod, leaseObjectType }) => { + () => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType', 'maxMass']), + async ({ leasingPeriod, leaseObjectType, maxMass }) => { + if (maxMass >= 40_000) { + $calculation.element('selectTechnicalCard').setOptions([]); + + return; + } const currentDate = dayjs().utc(false).format('YYYY-MM-DD'); const { @@ -105,16 +114,171 @@ export default function reactions({ store, apolloClient }: ProcessContext) { ); reaction( - () => $calculation.element('tbxLeasingPeriod').getValue(), - (leasingPeriod) => { - if (leasingPeriod < 12) { + () => { + const values = $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']); + const kaskoInsured = toJS($tables.insurance.row('kasko').getValue('insured')); + const fingapInsured = toJS($tables.insurance.row('fingap').getValue('insured')); + + return { + ...values, + fingapInsured, + kaskoInsured, + }; + }, + ({ leasingPeriod, fingapInsured, kaskoInsured, leasingWithoutKasko }) => { + if ( + leasingPeriod < 12 || + leasingWithoutKasko || + kaskoInsured === 100_000_001 || + (fingapInsured === 100_000_001 && leasingPeriod < 36) + ) { $calculation.element('selectInsNSIB').resetValue().block(); } else { $calculation.element('selectInsNSIB').unblock(); } }, + { + delay: 10, + fireImmediately: true, + } + ); + + debouncedReaction( + () => + $calculation.$values.getValues([ + 'leasingPeriod', + 'leaseObjectType', + 'plPriceRub', + 'discountRub', + 'addEquipmentPrice', + 'importProgramSum', + 'firstPaymentPerc', + ]), + async ({ + addEquipmentPrice, + discountRub, + firstPaymentPerc, + importProgramSum, + leaseObjectType: leaseObjectTypeId, + leasingPeriod, + plPriceRub, + }) => { + const currentDate = dayjs().utc(false).format('YYYY-MM-DD'); + + const { + data: { evo_addproduct_types }, + } = await apolloClient.query({ + query: CRMTypes.GetInsNsibTypesDocument, + variables: { currentDate }, + }); + + const options = evo_addproduct_types?.filter( + (x) => + x && + Boolean(x?.evo_max_period && x.evo_max_period >= leasingPeriod) && + Boolean(x?.evo_min_period && x.evo_min_period <= leasingPeriod) && + Boolean( + x?.evo_max_price && + x.evo_max_price >= plPriceRub - discountRub - importProgramSum + addEquipmentPrice + ) && + Boolean( + x?.evo_min_price && + x.evo_min_price <= plPriceRub - discountRub - importProgramSum + addEquipmentPrice + ) && + x.evo_leasingobject_types?.find( + (evo_leasingobject_type) => + evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectTypeId + ) && + x.evo_visible_calc && + Boolean( + x.evo_min_first_payment_perc && x.evo_min_first_payment_perc <= firstPaymentPerc + ) && + Boolean(x.evo_max_first_payment_perc && x.evo_max_first_payment_perc >= firstPaymentPerc) + ); + + $calculation.element('selectInsNSIB').setOptions(normalizeOptions(options)); + }, + { + delay: 10, + wait: 100, + } + ); + + reaction( + () => $calculation.$values.getValues(['recalcWithRevision', 'leaseObjectType']), + async ({ recalcWithRevision, leaseObjectType: leaseObjectTypeId }) => { + if (recalcWithRevision === false) { + $calculation + .element('selectRequirementTelematic') + .setOptions( + selectRequirementTelematic.filter((x) => + [100_000_000, 100_000_001, 100_000_002, 100_000_003].includes(x.value) + ) + ); + + if (leaseObjectTypeId) { + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + + if (evo_leasingobject_type?.evo_id === '11') { + $calculation.element('selectRequirementTelematic').setValue(100_000_000).block(); + } else { + $calculation.element('selectRequirementTelematic').unblock(); + } + } + } else { + $calculation.element('selectRequirementTelematic').resetOptions(); + } + }, + { + fireImmediately: true, + } + ); + + reaction( + () => $calculation.$values.getValues(['requirementTelematic', 'recalcWithRevision']), + async ({ requirementTelematic, recalcWithRevision }) => { + const currentDate = dayjs().utc(false).format('YYYY-MM-DD'); + const { + data: { evo_addproduct_types: trackerTypes }, + } = await apolloClient.query({ + query: CRMTypes.GetTrackerTypesDocument, + variables: { currentDate }, + }); + + const { + data: { evo_addproduct_types: telematicTypes }, + } = await apolloClient.query({ + query: CRMTypes.GetTelematicTypesDocument, + variables: { currentDate }, + }); + + let filteredTrackerTypes = trackerTypes?.filter( + (x) => requirementTelematic && x?.evo_controls_program?.includes(requirementTelematic) + ); + + let filteredTelematicTypes = telematicTypes?.filter( + (x) => requirementTelematic && x?.evo_controls_program?.includes(requirementTelematic) + ); + + if (!recalcWithRevision) { + filteredTrackerTypes = filteredTrackerTypes?.filter((x) => x?.evo_visible_calc === true); + filteredTelematicTypes = filteredTelematicTypes?.filter( + (x) => x?.evo_visible_calc === true + ); + } + + $calculation.element('selectTracker').setOptions(normalizeOptions(filteredTrackerTypes)); + $calculation.element('selectTelematic').setOptions(normalizeOptions(filteredTelematicTypes)); + }, { fireImmediately: true, } ); } + +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/add-product/validation.ts b/apps/web/process/add-product/validation.ts new file mode 100644 index 0000000..0ee7a4e --- /dev/null +++ b/apps/web/process/add-product/validation.ts @@ -0,0 +1,28 @@ +import type { ValidationContext } from '../types'; +import ValuesSchema from '@/config/schema/values'; +import { z } from 'zod'; + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export function createValidationSchema(context: ValidationContext) { + return ValuesSchema.pick({ + requirementTelematic: true, + telematic: true, + tracker: true, + }).superRefine(async ({ requirementTelematic, telematic, tracker }, ctx) => { + if (requirementTelematic !== 100_000_004 && !telematic && !tracker) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Не заполнено поле', + path: ['selectTracker', 'selectTelematic'], + }); + } + + if (requirementTelematic === 100_000_004 && (telematic || tracker)) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Не требуется', + path: ['selectTracker', 'selectTelematic'], + }); + } + }); +} diff --git a/apps/web/process/bonuses/reactions/common.ts b/apps/web/process/bonuses/reactions/common.ts index b8af8b5..ba9aacd 100644 --- a/apps/web/process/bonuses/reactions/common.ts +++ b/apps/web/process/bonuses/reactions/common.ts @@ -1,10 +1,11 @@ import type { ProcessContext } from '../../types'; import helper from '../lib/helper'; import * as CRMTypes from '@/graphql/crm.types'; +import { disposableReaction } from '@/utils/mobx'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; -import { makeDisposable } from 'tools'; +import { round } from 'tools'; dayjs.extend(utc); @@ -20,33 +21,30 @@ export default function reactions(context: ProcessContext) { * Если продукта нет или нет коэффициента по условиям, то поле tbxSaleBonus = 0 и закрыто для редактирования */ - makeDisposable( - () => - reaction( - () => $calculation.element('selectProduct').getValue(), - async (productId) => { - if (!productId) { - $calculation.element('tbxSaleBonus').resetValue().block(); + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element('selectProduct').getValue(), + async (productId) => { + if (!productId) { + $calculation.element('tbxSaleBonus').resetValue().block(); - return; - } + return; + } - const coefficient = await getCoefficient(productId); + const coefficient = await getCoefficient(productId); - if (!coefficient?.evo_sot_coefficient) { - $calculation.element('tbxSaleBonus').resetValue().block(); + if (!coefficient?.evo_sot_coefficient) { + $calculation.element('tbxSaleBonus').resetValue().block(); - return; - } + return; + } - const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; - $calculation.element('tbxSaleBonus').setValue(maxBonus).unblock(); - }, - { - fireImmediately: true, - } - ), - () => $process.has('LoadKP') + const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; + $calculation.element('tbxSaleBonus').setValue(maxBonus).unblock(); + }, + { + fireImmediately: true, + } ); /** @@ -86,7 +84,9 @@ export default function reactions(context: ProcessContext) { const coefficient = await getCoefficient(productId); const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; - $calculation.element('tbxBonusCoefficient').setValue(maxBonus ? saleBonus / maxBonus : 0); + $calculation + .element('tbxBonusCoefficient') + .setValue(maxBonus ? round(saleBonus / maxBonus, 4) : 0); } else { $calculation.element('tbxBonusCoefficient').resetValue(); } diff --git a/apps/web/process/bonuses/reactions/index.ts b/apps/web/process/bonuses/reactions/index.ts index cc8d68a..4082721 100644 --- a/apps/web/process/bonuses/reactions/index.ts +++ b/apps/web/process/bonuses/reactions/index.ts @@ -1,2 +1,2 @@ export { default as common } from './common'; -export { default as validation } from './validation'; +export * from './validation'; diff --git a/apps/web/process/bonuses/reactions/validation.ts b/apps/web/process/bonuses/reactions/validation.ts index d8ff572..5d51679 100644 --- a/apps/web/process/bonuses/reactions/validation.ts +++ b/apps/web/process/bonuses/reactions/validation.ts @@ -1,35 +1,4 @@ import { createValidationSchema } from '../validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; -import type { ProcessContext } from '@/process/types'; -import ValidationHelper from '@/stores/validation/helper'; -import { reaction } from 'mobx'; -import { uid } from 'radash'; +import { createValidationReaction } from '@/process/tools'; -const key = uid(7); - -export default function reactions(context: ProcessContext) { - const { store } = context; - const { $calculation } = store; - const validationSchema = createValidationSchema(context); - - const helper = new ValidationHelper(); - reaction( - () => $calculation.$values.getValues(['product', 'saleBonus']), - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/calculate/action.ts b/apps/web/process/calculate/action.ts index 5948d2d..cb198b3 100644 --- a/apps/web/process/calculate/action.ts +++ b/apps/web/process/calculate/action.ts @@ -1,6 +1,6 @@ import type { ProcessContext } from '../types'; import { toJS } from 'mobx'; -import notification from 'ui/elements/notification'; +import { notification } from 'ui/elements'; const key = 'ACTION_CALCULATE'; const errorMessage = 'Ошибка во время расчета графика!'; diff --git a/apps/web/process/calculate/reactions/validation.ts b/apps/web/process/calculate/reactions/validation.ts index 36c042e..0249015 100644 --- a/apps/web/process/calculate/reactions/validation.ts +++ b/apps/web/process/calculate/reactions/validation.ts @@ -3,9 +3,9 @@ import type * as Values from '@/Components/Calculation/config/map/values'; import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types'; import type { ProcessContext } from '@/process/types'; import ValidationHelper from '@/stores/validation/helper'; +import { disposableReaction } from '@/utils/mobx'; import { reaction } from 'mobx'; -import { uid } from 'radash'; -import { makeDisposable } from 'tools'; +import { shake, uid } from 'radash'; import type { BaseOption } from 'ui/elements/types'; function hasInvalidValueOrOptions(value: unknown, options: Array>) { @@ -19,36 +19,33 @@ function hasInvalidValueOrOptions(value: unknown, options: Array - reaction( - () => { - const hasElementsErrors = Object.values($calculation.$validation).some( - (validation) => validation.hasErrors - ); + disposableReaction( + () => $process.has('Unlimited'), + () => { + const hasElementsErrors = Object.values($calculation.$validation).some( + (validation) => validation.hasErrors + ); - const hasPaymentsErrors = $tables.payments.validation.hasErrors; - const hasInsuranceErrors = $tables.insurance.validation.hasErrors; - const hasFingapErrors = $tables.fingap.validation.hasErrors; + const hasPaymentsErrors = $tables.payments.validation.hasErrors; + const hasInsuranceErrors = $tables.insurance.validation.hasErrors; + const hasFingapErrors = $tables.fingap.validation.hasErrors; - return hasElementsErrors || hasPaymentsErrors || hasInsuranceErrors || hasFingapErrors; - }, - (hasErrors) => { - 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'); - } - }, - { - fireImmediately: true, - } - ), - () => $process.has('Unlimited') + return hasElementsErrors || hasPaymentsErrors || hasInsuranceErrors || hasFingapErrors; + }, + (hasErrors) => { + 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'); + } + }, + { + fireImmediately: true, + } ); /** @@ -95,7 +92,8 @@ export default function reactions({ store }: ProcessContext) { } ); - reaction( + disposableReaction( + () => $process.has('LoadKP'), () => element.getOptions(), (options) => { const value = element.getValue(); @@ -109,7 +107,9 @@ export default function reactions({ store }: ProcessContext) { ); } - (Object.keys(types) as Values.Elements[]).forEach((elementName) => + const optionsTypes = shake(types, (type) => type().typeName !== 'Options'); + + (Object.keys(optionsTypes) as Values.Elements[]).forEach((elementName) => validateOptionsElement(elementName) ); @@ -145,7 +145,8 @@ export default function reactions({ store }: ProcessContext) { } ); - reaction( + disposableReaction( + () => $process.has('LoadKP'), () => row.getOptions('insuranceCompany'), (options) => { const value = row.getValue('insuranceCompany'); diff --git a/apps/web/process/configurator/reactions/filters.ts b/apps/web/process/configurator/reactions/filters.ts index 8434497..3be7740 100644 --- a/apps/web/process/configurator/reactions/filters.ts +++ b/apps/web/process/configurator/reactions/filters.ts @@ -2,11 +2,11 @@ import { radioCalcType, radioGraphType, selectSeasonType } from '@/config/defaul import * as CRMTypes from '@/graphql/crm.types'; import { SEASON_TYPES } from '@/process/payments/lib/seasons-constants'; import type { ProcessContext } from '@/process/types'; +import { normalizeOptions } from '@/utils/entity'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; import { diff } from 'radash'; -import { normalizeOptions } from 'tools'; dayjs.extend(utc); @@ -90,6 +90,39 @@ export default function reactions({ store, apolloClient }: ProcessContext) { )?.length ); } + + if (dealers) { + dealers = dealers + .filter( + (dealer) => + !evo_baseproduct?.accounts?.length || + evo_baseproduct.accounts.filter((x) => x?.accountid === dealer?.accountid)?.length + ) + .filter((dealer) => { + if (evo_baseproduct?.evo_supplier_financing_accept === true) { + return dealer?.evo_supplier_financing_accept; + } else { + return true; + } + }); + } + + if (dealerPersons) { + dealerPersons = dealerPersons + .filter( + (dealerPerson) => + !evo_baseproduct?.accounts?.length || + evo_baseproduct.accounts.filter((x) => x?.accountid === dealerPerson?.accountid) + ?.length + ) + .filter((dealerPerson) => { + if (evo_baseproduct?.evo_supplier_financing_accept) { + return dealerPerson?.evo_supplier_financing_accept; + } else { + return true; + } + }); + } } if (subsidyId) { diff --git a/apps/web/process/configurator/reactions/index.ts b/apps/web/process/configurator/reactions/index.ts index 1b87c74..82b539f 100644 --- a/apps/web/process/configurator/reactions/index.ts +++ b/apps/web/process/configurator/reactions/index.ts @@ -1,4 +1,4 @@ export { default as filters } from './filters'; export { default as unlimited } from './unlimited'; -export { default as validation } from './validation'; +export * from './validation'; export { default as values } from './values'; diff --git a/apps/web/process/configurator/reactions/unlimited.ts b/apps/web/process/configurator/reactions/unlimited.ts index a6ac905..aef3592 100644 --- a/apps/web/process/configurator/reactions/unlimited.ts +++ b/apps/web/process/configurator/reactions/unlimited.ts @@ -1,41 +1,38 @@ import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; -import { reaction } from 'mobx'; -import { makeDisposable, normalizeOptions } from 'tools'; +import { normalizeOptions } from '@/utils/entity'; +import { disposableReaction } from '@/utils/mobx'; export default function unlimitedReactions({ store, apolloClient }: ProcessContext) { const { $calculation, $process } = store; - makeDisposable( - () => - reaction( - () => $calculation.element('selectUser').getValue(), - async (domainname) => { - if (!domainname) { - $calculation.element('selectLead').reset(); - $calculation.element('selectOpportunity').reset(); + disposableReaction( + () => !$process.has('Unlimited'), + () => $calculation.element('selectUser').getValue(), + async (domainname) => { + if (!domainname) { + $calculation.element('selectLead').reset(); + $calculation.element('selectOpportunity').reset(); - return; - } - const { - data: { leads }, - } = await apolloClient.query({ - query: CRMTypes.GetLeadsDocument, - variables: { domainname }, - }); + return; + } + const { + data: { leads }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadsDocument, + variables: { domainname }, + }); - $calculation.element('selectLead').setOptions(normalizeOptions(leads)); + $calculation.element('selectLead').setOptions(normalizeOptions(leads)); - const { - data: { opportunities }, - } = await apolloClient.query({ - query: CRMTypes.GetOpportunitiesDocument, - variables: { domainname }, - }); + const { + data: { opportunities }, + } = await apolloClient.query({ + query: CRMTypes.GetOpportunitiesDocument, + variables: { domainname }, + }); - $calculation.element('selectOpportunity').setOptions(normalizeOptions(opportunities)); - } - ), - () => !$process.has('Unlimited') + $calculation.element('selectOpportunity').setOptions(normalizeOptions(opportunities)); + } ); } diff --git a/apps/web/process/configurator/reactions/validation.ts b/apps/web/process/configurator/reactions/validation.ts index 86a8dda..5d51679 100644 --- a/apps/web/process/configurator/reactions/validation.ts +++ b/apps/web/process/configurator/reactions/validation.ts @@ -1,35 +1,4 @@ import { createValidationSchema } from '../validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; -import type { ProcessContext } from '@/process/types'; -import ValidationHelper from '@/stores/validation/helper'; -import { reaction } from 'mobx'; -import { uid } from 'radash'; +import { createValidationReaction } from '@/process/tools'; -const key = uid(7); - -export default function reactions(context: ProcessContext) { - const { store } = context; - const { $calculation } = store; - const validationSchema = createValidationSchema(context); - - const helper = new ValidationHelper(); - reaction( - () => $calculation.$values.getValues(['parmentsDecreasePercent', 'tarif']), - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/configurator/reactions/values.ts b/apps/web/process/configurator/reactions/values.ts index 47dc84b..171891d 100644 --- a/apps/web/process/configurator/reactions/values.ts +++ b/apps/web/process/configurator/reactions/values.ts @@ -1,18 +1,19 @@ import type { Elements } from '@/Components/Calculation/config/map/values'; import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; +import { normalizeOptions } from '@/utils/entity'; +import { debouncedReaction, disposableReaction } from '@/utils/mobx'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; import { first, sort } from 'radash'; -import { makeDisposable, normalizeOptions } from 'tools'; dayjs.extend(utc); export default function valuesReactions({ store, apolloClient }: ProcessContext) { const { $calculation, $process } = store; - reaction( + debouncedReaction( () => $calculation.$values.getValues([ 'product', @@ -21,6 +22,7 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext) 'deliveryTime', 'firstPaymentPerc', 'lastPaymentPerc', + 'leaseObjectType', ]), async ({ product, @@ -29,6 +31,7 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext) deliveryTime, firstPaymentPerc, lastPaymentPerc, + leaseObjectType: leaseObjectTypeId, }) => { const currentDate = dayjs().utc(false).format('YYYY-MM-DD'); @@ -42,77 +45,87 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext) }, }); - $calculation.element('selectTarif').setOptions(normalizeOptions(evo_tarifs)); + $calculation.element('selectTarif').setOptions(normalizeOptions(evo_tarifs)).resetValue(); - if (product && leasingPeriod && deliveryTime && evo_tarifs) { - evo_tarifs = evo_tarifs?.filter( - (tarif) => - tarif && - tarif.evo_baseproductid === product && - tarif.evo_min_period !== null && - tarif.evo_min_period <= leasingPeriod && - tarif.evo_max_period !== null && - tarif.evo_max_period >= leasingPeriod && - tarif.evo_delivery_time?.includes(deliveryTime) && - tarif.evo_min_first_payment !== null && - tarif.evo_min_first_payment <= firstPaymentPerc && - tarif.evo_max_first_payment !== null && - tarif.evo_max_first_payment >= firstPaymentPerc && - tarif.evo_min_last_payment !== null && - tarif.evo_min_last_payment <= lastPaymentPerc && - tarif.evo_max_last_payment !== null && - tarif.evo_max_last_payment >= lastPaymentPerc - ); + if (evo_tarifs) { + evo_tarifs = evo_tarifs + ?.filter( + (tarif) => + tarif && + product && + tarif.evo_baseproductid === product && + tarif.evo_min_period !== null && + tarif.evo_min_period <= leasingPeriod && + tarif.evo_max_period !== null && + tarif.evo_max_period >= leasingPeriod && + tarif.evo_delivery_time?.includes(deliveryTime) && + tarif.evo_min_first_payment !== null && + tarif.evo_min_first_payment <= firstPaymentPerc && + tarif.evo_max_first_payment !== null && + tarif.evo_max_first_payment >= firstPaymentPerc && + tarif.evo_min_last_payment !== null && + tarif.evo_min_last_payment <= lastPaymentPerc && + tarif.evo_max_last_payment !== null && + tarif.evo_max_last_payment >= lastPaymentPerc + ) + .filter( + (tarif) => + !tarif?.evo_leasingobject_types?.length || + (leaseObjectTypeId && + tarif.evo_leasingobject_types + .map((x) => x?.evo_leasingobject_typeid) + .includes(leaseObjectTypeId)) + ) + .filter((tarif) => { + if (leaseObjectUsed === true) { + if (!tarif?.evo_pl_use_type?.length || tarif.evo_pl_use_type.includes(100_000_001)) { + return true; + } + } else if ( + !tarif?.evo_pl_use_type?.length || + tarif.evo_pl_use_type.includes(100_000_000) + ) { + return true; + } - $calculation.element('selectTarif').setValue(evo_tarifs?.at(0)?.evo_tarifid || null); - } else if (leaseObjectUsed === true && evo_tarifs) { - evo_tarifs = evo_tarifs?.filter((tarif) => { - if (leaseObjectUsed === true) { - return tarif?.evo_used; - } - - return true; - }); - $calculation.element('selectTarif').setValue(evo_tarifs?.at(0)?.evo_tarifid || null); - } else { - $calculation.element('selectTarif').resetValue(); + return false; + }); } + + $calculation.element('selectTarif').setValue(evo_tarifs?.at(0)?.evo_tarifid || null); }, { delay: 10, fireImmediately: true, + wait: 50, } ); - makeDisposable( - () => - reaction( - () => $calculation.element('selectTarif').getValue(), - async (tarifId) => { - if (!tarifId) { - $calculation.element('tbxIRR_Perc').resetValue(); + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element('selectTarif').getValue(), + async (tarifId) => { + if (!tarifId) { + $calculation.element('tbxIRR_Perc').resetValue(); - return; - } - const { - data: { evo_tarif }, - } = await apolloClient.query({ - fetchPolicy: 'network-only', - query: CRMTypes.GetTarifDocument, - variables: { - tarifId, - }, - }); + return; + } + const { + data: { evo_tarif }, + } = await apolloClient.query({ + fetchPolicy: 'network-only', + query: CRMTypes.GetTarifDocument, + variables: { + tarifId, + }, + }); - if (evo_tarif?.evo_irr) { - $calculation.element('tbxIRR_Perc').setValue(evo_tarif?.evo_irr); - } else { - $calculation.element('tbxIRR_Perc').resetValue(); - } - } - ), - - () => $process.has('LoadKP') + if (evo_tarif?.evo_irr) { + $calculation.element('tbxIRR_Perc').setValue(evo_tarif?.evo_irr); + } else { + $calculation.element('tbxIRR_Perc').resetValue(); + } + } ); reaction( diff --git a/apps/web/process/create-kp/action.ts b/apps/web/process/create-kp/action.ts index 2b2881c..47f0ce1 100644 --- a/apps/web/process/create-kp/action.ts +++ b/apps/web/process/create-kp/action.ts @@ -1,7 +1,7 @@ import { updateSelectQuote } from '../lead-opportunity/reactions/common'; import type { ProcessContext } from '../types'; import { toJS } from 'mobx'; -import notification from 'ui/elements/notification'; +import { notification } from 'ui/elements'; const key = 'ACTION_CREATEKP'; const errorMessage = 'Ошибка во время создания КП!'; diff --git a/apps/web/process/create-kp/get-kp-data.ts b/apps/web/process/create-kp/get-kp-data.ts index cf34cf3..1240700 100644 --- a/apps/web/process/create-kp/get-kp-data.ts +++ b/apps/web/process/create-kp/get-kp-data.ts @@ -19,6 +19,7 @@ const QUERY_GET_CREATEKP_DATA = gql` evo_fingap_quote evo_contact_name evo_gender + evo_last_payment_redemption } } `; @@ -44,6 +45,8 @@ export async function getKPData({ fullPriceWithDiscount: quote?.evo_price_without_discount_quote ?? defaultValues.fullPriceWithDiscount, insurance: quote?.evo_insurance ?? defaultValues.insurance, + lastPaymentRedemption: + quote?.evo_last_payment_redemption ?? defaultValues.lastPaymentRedemption, priceWithDiscount: quote?.evo_price_with_discount ?? defaultValues.priceWithDiscount, quoteContactGender: quote?.evo_gender ?? defaultValues.quoteContactGender, quoteName: quote?.evo_contact_name ?? defaultValues.quoteName, diff --git a/apps/web/process/gibdd/reactions.ts b/apps/web/process/gibdd/reactions.ts index 5888121..c65bdf6 100644 --- a/apps/web/process/gibdd/reactions.ts +++ b/apps/web/process/gibdd/reactions.ts @@ -1,18 +1,17 @@ +import { createValidationReaction } from '../tools'; import type { ProcessContext } from '../types'; import helper from './lib/helper'; import { createValidationSchema } from './validation'; import { getTransTax } from '@/api/1c/query'; -import type { Elements } from '@/Components/Calculation/config/map/values'; import { selectObjectCategoryTax } from '@/config/default-options'; import { STALE_TIME } from '@/constants/request'; import * as CRMTypes from '@/graphql/crm.types'; -import ValidationHelper from '@/stores/validation/helper'; +import { normalizeOptions } from '@/utils/entity'; +import { disposableReaction } from '@/utils/mobx'; import type { QueryFunctionContext } from '@tanstack/react-query'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; -import { uid } from 'radash'; -import { makeDisposable, normalizeOptions } from 'tools'; dayjs.extend(utc); @@ -20,8 +19,8 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) { const { $calculation, $process } = store; reaction( - () => $calculation.element('selectLeaseObjectType').getValue(), - async (leaseObjectTypeId) => { + () => $calculation.$values.getValues(['leaseObjectType', 'supplierFinancing']), + async ({ leaseObjectType: leaseObjectTypeId, supplierFinancing }) => { if (!leaseObjectTypeId) { $calculation.element('radioObjectRegistration').resetValue().unblock(); @@ -35,8 +34,9 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) { }); if ( - evo_leasingobject_type?.evo_id && - ['6', '9', '10', '11'].includes(evo_leasingobject_type.evo_id) + supplierFinancing || + (evo_leasingobject_type?.evo_id && + ['6', '9', '10', '11'].includes(evo_leasingobject_type.evo_id)) ) { $calculation.element('radioObjectRegistration').setValue(100_000_000).block(); } else { @@ -45,41 +45,38 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) { } ); - makeDisposable( + disposableReaction( + () => $process.has('LoadKP'), () => - reaction( - () => - $calculation.$values.getValues([ - 'leaseObjectType', - 'objectCategoryTax', - 'objectRegistration', - ]), - async ({ leaseObjectType: leaseObjectTypeId, objectRegistration, objectCategoryTax }) => { - if (objectRegistration === 100_000_001) { - if (objectCategoryTax && [100_000_006, 100_000_009].includes(objectCategoryTax)) { - $calculation.element('selectObjectTypeTax').setValue(100_000_002); - } else if (leaseObjectTypeId) { - const { - data: { evo_leasingobject_type }, - } = await apolloClient.query({ - query: CRMTypes.GetLeaseObjectTypeDocument, - variables: { leaseObjectTypeId }, - }); + $calculation.$values.getValues([ + 'leaseObjectType', + 'objectCategoryTax', + 'objectRegistration', + ]), + async ({ leaseObjectType: leaseObjectTypeId, objectRegistration, objectCategoryTax }) => { + if (objectRegistration === 100_000_001) { + if (objectCategoryTax && [100_000_006, 100_000_009].includes(objectCategoryTax)) { + $calculation.element('selectObjectTypeTax').setValue(100_000_002); + } else if (leaseObjectTypeId) { + const { + data: { evo_leasingobject_type }, + } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); - if (evo_leasingobject_type?.evo_vehicle_type_tax) { - $calculation - .element('selectObjectTypeTax') - .setValue(evo_leasingobject_type?.evo_vehicle_type_tax); - } else { - $calculation.element('selectObjectTypeTax').resetValue(); - } - } + if (evo_leasingobject_type?.evo_vehicle_type_tax) { + $calculation + .element('selectObjectTypeTax') + .setValue(evo_leasingobject_type?.evo_vehicle_type_tax); } else { $calculation.element('selectObjectTypeTax').resetValue(); } } - ), - () => $process.has('LoadKP') + } else { + $calculation.element('selectObjectTypeTax').resetValue(); + } + } ); reaction( @@ -149,82 +146,79 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) { return mapObjectTypeTaxToCategory[objectTypeTax as keyof typeof mapObjectTypeTaxToCategory]; } - makeDisposable( + disposableReaction( + () => $process.has('LoadKP'), () => - reaction( - () => - $calculation.$values.getValues([ - 'objectRegistration', - 'objectTypeTax', - 'regionRegistration', - 'leaseObjectYear', - 'leaseObjectMotorPower', - ]), - async ({ - objectRegistration, - objectTypeTax, - regionRegistration, - leaseObjectYear, - leaseObjectMotorPower, - }) => { - if ( - objectRegistration === null || - objectRegistration !== 100_000_001 || - objectTypeTax === null || - regionRegistration === null || - leaseObjectYear === 0 || - leaseObjectMotorPower === 0 - ) { - $calculation.element('tbxVehicleTaxInYear').resetValue(); + $calculation.$values.getValues([ + 'objectRegistration', + 'objectTypeTax', + 'regionRegistration', + 'leaseObjectYear', + 'leaseObjectMotorPower', + ]), + async ({ + objectRegistration, + objectTypeTax, + regionRegistration, + leaseObjectYear, + leaseObjectMotorPower, + }) => { + if ( + objectRegistration === null || + objectRegistration !== 100_000_001 || + objectTypeTax === null || + regionRegistration === null || + leaseObjectYear === 0 || + leaseObjectMotorPower === 0 + ) { + $calculation.element('tbxVehicleTaxInYear').resetValue(); - return; - } + return; + } - const { - data: { evo_region }, - } = await apolloClient.query({ - query: CRMTypes.GetRegionDocument, - variables: { - regionId: regionRegistration, + const { + data: { evo_region }, + } = await apolloClient.query({ + query: CRMTypes.GetRegionDocument, + variables: { + regionId: regionRegistration, + }, + }); + + const OKTMO = evo_region?.evo_oktmo; + const carCategory = getCarCategory(objectTypeTax); + + if (OKTMO) { + const currentDate = dayjs().utc(false).toDate(); + + const request = (context: QueryFunctionContext) => + getTransTax( + { + OKTMO, + calcDate: currentDate, + carCategory, + power: leaseObjectMotorPower, + year: leaseObjectYear, }, - }); - - const OKTMO = evo_region?.evo_oktmo; - const carCategory = getCarCategory(objectTypeTax); - - if (OKTMO) { - const currentDate = dayjs().utc(false).toDate(); - - const request = (context: QueryFunctionContext) => - getTransTax( - { - OKTMO, - calcDate: currentDate, - carCategory, - power: leaseObjectMotorPower, - year: leaseObjectYear, - }, - context - ); - const { tax, error } = await queryClient.fetchQuery( - ['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear], - request, - { - staleTime: STALE_TIME, - } - ); - - if (!error && tax) { - $calculation.element('tbxVehicleTaxInYear').setValue(tax); - } else { - $calculation.element('tbxVehicleTaxInYear').resetValue(); - } - } else { - $calculation.element('tbxVehicleTaxInYear').resetValue(); + context + ); + const { tax, error } = await queryClient.fetchQuery( + ['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear], + request, + { + staleTime: STALE_TIME, } + ); + + if (!error && tax) { + $calculation.element('tbxVehicleTaxInYear').setValue(tax); + } else { + $calculation.element('tbxVehicleTaxInYear').resetValue(); } - ), - () => $process.has('LoadKP') + } else { + $calculation.element('tbxVehicleTaxInYear').resetValue(); + } + } ); // Не дышать на реакцию @@ -514,41 +508,4 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) { ); } -const key = uid(7); - -export function validation(context: ProcessContext) { - const { store } = context; - const { $calculation } = store; - const validationSchema = createValidationSchema(context); - - const validationHelper = new ValidationHelper(); - reaction( - () => - $calculation.$values.getValues([ - 'leaseObjectCategory', - 'maxMass', - 'leaseObjectType', - 'typePTS', - 'objectRegistration', - 'objectCategoryTax', - 'insNSIB', - 'vehicleTaxInYear', - ]), - async (values) => { - validationHelper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) validationHelper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/gibdd/validation.ts b/apps/web/process/gibdd/validation.ts index b1fb526..d7681df 100644 --- a/apps/web/process/gibdd/validation.ts +++ b/apps/web/process/gibdd/validation.ts @@ -1,3 +1,5 @@ +/* eslint-disable sonarjs/cognitive-complexity */ +/* eslint-disable complexity */ import type { ValidationContext } from '../types'; import ValuesSchema from '@/config/schema/values'; import { MAX_MASS } from '@/constants/values'; @@ -11,8 +13,13 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { leaseObjectType: true, maxMass: true, objectCategoryTax: true, + objectRegionRegistration: true, objectRegistration: true, + regionRegistration: true, + registration: true, + townRegistration: true, typePTS: true, + vehicleTaxInLeasingPeriod: true, vehicleTaxInYear: true, }).superRefine( async ( @@ -25,6 +32,11 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { objectCategoryTax, insNSIB, vehicleTaxInYear, + vehicleTaxInLeasingPeriod, + objectRegionRegistration, + regionRegistration, + townRegistration, + registration, }, ctx ) => { @@ -74,21 +86,57 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { } } - if (objectRegistration === 100_000_001 && !(vehicleTaxInYear > 0)) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Значение должно быть больше 0', - path: ['tbxVehicleTaxInYear'], - }); + if (objectRegistration === 100_000_001) { + if (!(vehicleTaxInYear > 0)) + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Значение должно быть больше 0', + path: ['tbxVehicleTaxInYear'], + }); + + if (!(vehicleTaxInLeasingPeriod > 0)) + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Значение должно быть больше 0', + path: ['tbxVehicleTaxInLeasingPeriod'], + }); + + if (!objectRegionRegistration) + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Не заполнено поле', + path: ['selectObjectRegionRegistration'], + }); + + if (!typePTS) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Не заполнено поле', + path: ['radioTypePTS'], + }); + } } - if (objectRegistration === 100_000_001 && !typePTS) { + if (objectRegistration === 100_000_000 && !townRegistration) ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Не заполнено поле', - path: ['radioTypePTS'], + path: ['selectTownRegistration'], + }); + + if (!regionRegistration) + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Не заполнено поле', + path: ['selectRegionRegistration'], + }); + + if (!registration) + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Не заполнено поле', + path: ['selectRegistration'], }); - } } ); } diff --git a/apps/web/process/hooks/init/get-main-data.js b/apps/web/process/hooks/init/get-main-data.js index 5a5c232..376ae7d 100644 --- a/apps/web/process/hooks/init/get-main-data.js +++ b/apps/web/process/hooks/init/get-main-data.js @@ -1,11 +1,11 @@ /* eslint-disable canonical/sort-keys */ import * as CRMTypes from '@/graphql/crm.types'; import { useStore } from '@/stores/hooks'; +import { normalizeOptions } from '@/utils/entity'; import { useApolloClient } from '@apollo/client'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { useEffect } from 'react'; -import { normalizeOptions } from 'tools'; dayjs.extend(utc); diff --git a/apps/web/process/hooks/init/get-users.js b/apps/web/process/hooks/init/get-users.js index bd70a21..20faeba 100644 --- a/apps/web/process/hooks/init/get-users.js +++ b/apps/web/process/hooks/init/get-users.js @@ -1,8 +1,8 @@ import * as CRMTypes from '@/graphql/crm.types'; import { useStore } from '@/stores/hooks'; +import { normalizeOptions } from '@/utils/entity'; import { useApolloClient } from '@apollo/client'; import { useEffect } from 'react'; -import { normalizeOptions } from 'tools'; /** * @param {import('@apollo/client').ApolloClient} apolloClient diff --git a/apps/web/process/insurance/reactions.ts b/apps/web/process/insurance/reactions.ts index 52f9a86..d1afbde 100644 --- a/apps/web/process/insurance/reactions.ts +++ b/apps/web/process/insurance/reactions.ts @@ -1,12 +1,12 @@ +/* eslint-disable sonarjs/cognitive-complexity */ +import { createValidationReaction } from '../tools'; import type { ProcessContext } from '../types'; import { createValidationSchema } from './validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; import { selectLeaseObjectUseFor } from '@/config/default-options'; import * as CRMTypes from '@/graphql/crm.types'; -import ValidationHelper from '@/stores/validation/helper'; -import { comparer, reaction, toJS } from 'mobx'; -import { uid } from 'radash'; -import { normalizeOptions } from 'tools'; +import { normalizeOptions } from '@/utils/entity'; +import { debouncedReaction } from '@/utils/mobx'; +import { reaction } from 'mobx'; export function common({ store, apolloClient }: ProcessContext) { const { $calculation, $tables } = store; @@ -113,7 +113,7 @@ export function common({ store, apolloClient }: ProcessContext) { } ); - reaction( + debouncedReaction( () => $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']), async ({ leasingPeriod, leasingWithoutKasko }) => { const { @@ -168,11 +168,13 @@ export function common({ store, apolloClient }: ProcessContext) { } }, { + delay: 1, fireImmediately: true, + wait: 100, } ); - reaction( + debouncedReaction( () => $calculation.$values.getValues(['leaseObjectCategory', 'leasingWithoutKasko']), async ({ leaseObjectCategory, leasingWithoutKasko }) => { const { @@ -220,6 +222,10 @@ export function common({ store, apolloClient }: ProcessContext) { .setOptions(normalizeOptions(defaultOsagoOptions)); } } + }, + { + delay: 1, + wait: 100, } ); @@ -265,56 +271,4 @@ export function common({ store, apolloClient }: ProcessContext) { ); } -const key = uid(7); - -export function validation(context: ProcessContext) { - const { $calculation, $tables } = context.store; - - const validationSchema = createValidationSchema(context); - const helper = new ValidationHelper(); - - reaction( - () => { - const values = $calculation.$values.getValues([ - 'leasingPeriod', - 'quote', - 'recalcWithRevision', - 'leasingWithoutKasko', - 'insDecentral', - ]); - - return { - insurance: { - values: { - fingap: toJS($tables.insurance.row('fingap').getValues()), - kasko: toJS($tables.insurance.row('kasko').getValues()), - osago: toJS($tables.insurance.row('osago').getValues()), - }, - }, - ...values, - }; - }, - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Array).forEach((elementName) => { - if (elementName === 'insurance') { - const removeError = $tables.insurance.setError({ key, message }); - if (removeError) helper.add(removeError); - } else { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - } - }); - }); - } - }, - { - delay: 100, - equals: comparer.structural, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/lead-opportunity/reactions/common.ts b/apps/web/process/lead-opportunity/reactions/common.ts index 9571151..052b1aa 100644 --- a/apps/web/process/lead-opportunity/reactions/common.ts +++ b/apps/web/process/lead-opportunity/reactions/common.ts @@ -1,8 +1,8 @@ import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; +import { normalizeOptions } from '@/utils/entity'; +import { disposableReaction } from '@/utils/mobx'; import { reaction } from 'mobx'; -import { normalizeOptions } from 'tools/entity'; -import { makeDisposable } from 'tools/mobx'; export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation, $process } = store; @@ -14,34 +14,31 @@ export default function reactions({ store, apolloClient }: ProcessContext) { * Иначе ничего не указывается */ - makeDisposable( - () => - reaction( - () => $calculation.element('selectLead').getValue(), - async (leadid) => { - if (!leadid) { - $calculation.element('selectOpportunity').resetValue(); + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element('selectLead').getValue(), + async (leadid) => { + if (!leadid) { + $calculation.element('selectOpportunity').resetValue(); - return; - } + return; + } - const { - data: { lead }, - } = await apolloClient.query({ - query: CRMTypes.GetLeadDocument, - variables: { - leadid, - }, - }); + const { + data: { lead }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { + leadid, + }, + }); - if (lead?.evo_opportunityidData?.value) { - $calculation.element('selectOpportunity').setValue(lead?.evo_opportunityidData?.value); - } else { - $calculation.element('selectOpportunity').resetValue(); - } - } - ), - () => $process.has('LoadKP') + if (lead?.evo_opportunityidData?.value) { + $calculation.element('selectOpportunity').setValue(lead?.evo_opportunityidData?.value); + } else { + $calculation.element('selectOpportunity').resetValue(); + } + } ); reaction( diff --git a/apps/web/process/leasing-object/reactions/common.ts b/apps/web/process/leasing-object/reactions/common.ts index f43bf6b..14af7f5 100644 --- a/apps/web/process/leasing-object/reactions/common.ts +++ b/apps/web/process/leasing-object/reactions/common.ts @@ -1,8 +1,8 @@ import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; +import { normalizeOptions } from '@/utils/entity'; import { reaction } from 'mobx'; import { intersects } from 'radash'; -import { normalizeOptions } from 'tools'; export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation } = store; diff --git a/apps/web/process/leasing-object/reactions/index.ts b/apps/web/process/leasing-object/reactions/index.ts index cc8d68a..4082721 100644 --- a/apps/web/process/leasing-object/reactions/index.ts +++ b/apps/web/process/leasing-object/reactions/index.ts @@ -1,2 +1,2 @@ export { default as common } from './common'; -export { default as validation } from './validation'; +export * from './validation'; diff --git a/apps/web/process/leasing-object/reactions/validation.ts b/apps/web/process/leasing-object/reactions/validation.ts index d83b8db..e47f83f 100644 --- a/apps/web/process/leasing-object/reactions/validation.ts +++ b/apps/web/process/leasing-object/reactions/validation.ts @@ -1,65 +1,4 @@ +import { createValidationReaction } from '../../tools'; import { createValidationSchema } from '../validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; -import type { ProcessContext } from '@/process/types'; -import ValidationHelper from '@/stores/validation/helper'; -import { autorun, reaction } from 'mobx'; -import { uid } from 'radash'; -const key = uid(7); - -export default function reactions(context: ProcessContext) { - const { $calculation } = context.store; - - /** - * Если model содержит данные и по связи Модель-Комплектация в CRM у данной модели есть связанные активные записи Комплектаций, - * то configuration становится обязательным для заполнения, иначе configuration не обязателен для заполнения - */ - autorun( - () => { - const selectConfiguration = $calculation.element('selectConfiguration'); - if (selectConfiguration.getOptions()?.length > 0 && !selectConfiguration.getValue()) { - selectConfiguration.setError({ - key, - message: 'Не заполнено поле', - }); - } else { - selectConfiguration.removeError({ key }); - } - }, - { - delay: 10, - } - ); - - const validationSchema = createValidationSchema(context); - const helper = new ValidationHelper(); - - reaction( - () => - $calculation.$values.getValues([ - 'leaseObjectType', - 'engineVolume', - 'engineType', - 'leaseObjectMotorPower', - 'countSeats', - 'maxMass', - 'leaseObjectCategory', - ]), - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/leasing-without-kasko/reactions.ts b/apps/web/process/leasing-without-kasko/reactions.ts index fbe7912..d4039dc 100644 --- a/apps/web/process/leasing-without-kasko/reactions.ts +++ b/apps/web/process/leasing-without-kasko/reactions.ts @@ -2,12 +2,12 @@ import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; +import { normalizeOptions } from '@/utils/entity'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; import { uid } from 'radash'; -import { normalizeOptions } from 'tools'; -import notification from 'ui/elements/notification'; +import { notification } from 'ui/elements'; dayjs.extend(utc); diff --git a/apps/web/process/load-kp/reactions.ts b/apps/web/process/load-kp/reactions.ts index 1e4805a..ae02c0f 100644 --- a/apps/web/process/load-kp/reactions.ts +++ b/apps/web/process/load-kp/reactions.ts @@ -1,7 +1,7 @@ import type { ProcessContext } from '@/process/types'; import { reaction } from 'mobx'; import { omit } from 'radash'; -import message from 'ui/elements/message'; +import { message } from 'ui/elements'; const key = 'KP_LOADING_INFO'; @@ -39,6 +39,9 @@ export function common({ store, trpcClient }: ProcessContext) { 'opportunityUrl', 'quoteUrl', 'recalcWithRevision', + 'plPriceRub', + 'discountRub', + 'user', ]) ); diff --git a/apps/web/process/payments/reactions/common.ts b/apps/web/process/payments/reactions/common.ts index b9b1fd5..419fa05 100644 --- a/apps/web/process/payments/reactions/common.ts +++ b/apps/web/process/payments/reactions/common.ts @@ -5,10 +5,10 @@ import { selectHighSeasonStart } from '@/config/default-options'; import { MIN_PAYMENT } from '@/constants/values'; import type { ProcessContext } from '@/process/types'; import type { Row } from '@/stores/tables/payments/types'; +import { disposableReaction } from '@/utils/mobx'; import { comparer, reaction, toJS } from 'mobx'; import { shift } from 'radash'; import { difference } from 'tools/array'; -import { makeDisposable } from 'tools/mobx'; const { generateSeasonPaymentsRows, @@ -245,74 +245,68 @@ export default function reactions({ store }: ProcessContext) { // } // ); - makeDisposable( - () => - reaction( - () => $calculation.$values.getValues(['leasingPeriod', 'seasonType']), - ({ seasonType, leasingPeriod }) => { - const middlePayments: Row[] = degressionTools.generateDegressionRows({ - leasingPeriod, - seasonType, - }); + disposableReaction( + () => $calculation.element('radioGraphType').getValue() !== 100_000_001, + () => $calculation.$values.getValues(['leasingPeriod', 'seasonType']), + ({ seasonType, leasingPeriod }) => { + const middlePayments: Row[] = degressionTools.generateDegressionRows({ + leasingPeriod, + seasonType, + }); - const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue(); - const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue(); + const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue(); + const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue(); - const rows: Row[] = [ - { - status: 'Disabled', - value: firstPaymentPerc, - }, - ...middlePayments, - { - status: 'Disabled', - value: lastPaymentPerc, - }, - ]; + const rows: Row[] = [ + { + status: 'Disabled', + value: firstPaymentPerc, + }, + ...middlePayments, + { + status: 'Disabled', + value: lastPaymentPerc, + }, + ]; - if (!$process.has('LoadKP')) { - $tables.payments.setValues(rows.map((row) => row.value)); - } + if (!$process.has('LoadKP')) { + $tables.payments.setValues(rows.map((row) => row.value)); + } - $tables.payments.setStatuses(rows.map((row) => row.status)); - } - ), - () => $calculation.element('radioGraphType').getValue() !== 100_000_001 + $tables.payments.setStatuses(rows.map((row) => row.status)); + } ); - makeDisposable( - () => - reaction( - () => toJS($tables.payments.values), - (nextPayments, prevPayments) => { - const graphType = $calculation.element('radioGraphType').getValue(); - const degressionType = $calculation.element('selectSeasonType').getValue(); + disposableReaction( + () => $process.has('LoadKP'), + () => toJS($tables.payments.values), + (nextPayments, prevPayments) => { + const graphType = $calculation.element('radioGraphType').getValue(); + const degressionType = $calculation.element('selectSeasonType').getValue(); - if (graphType === 100_000_001 && degressionType === 100_000_007) { - const changes = difference(nextPayments, prevPayments); + if (graphType === 100_000_001 && degressionType === 100_000_007) { + const changes = difference(nextPayments, prevPayments); - if (!changes?.length || changes.length > 1) return; + if (!changes?.length || changes.length > 1) return; - const [changeIndex] = changes; - const value = nextPayments[changeIndex]; - const payments = nextPayments.slice(1, -1).map((payment, i) => { - if (i <= changeIndex - 2) return payment; + const [changeIndex] = changes; + const value = nextPayments[changeIndex]; + const payments = nextPayments.slice(1, -1).map((payment, i) => { + if (i <= changeIndex - 2) return payment; - return value; - }); + return value; + }); - const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue(); - const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue(); + const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue(); + const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue(); - $tables.payments.setValues([firstPaymentPerc, ...payments, lastPaymentPerc]); - } - }, - { - delay: 50, - equals: comparer.structural, - } - ), - () => $process.has('LoadKP') + $tables.payments.setValues([firstPaymentPerc, ...payments, lastPaymentPerc]); + } + }, + { + delay: 50, + equals: comparer.structural, + } ); /** @@ -408,72 +402,66 @@ export default function reactions({ store }: ProcessContext) { } ); - makeDisposable( - () => - reaction( - () => { - const payments = toJS($tables.payments.values); + disposableReaction( + () => $process.has('LoadKP'), + () => { + const payments = toJS($tables.payments.values); - return payments.slice(1, SEASONS_PERIOD_NUMBER + 1); - }, - (nextSeasons, prevSeasons) => { - const graphType = $calculation.element('radioGraphType').getValue(); - if (graphType !== 100_000_003) return; + return payments.slice(1, SEASONS_PERIOD_NUMBER + 1); + }, + (nextSeasons, prevSeasons) => { + const graphType = $calculation.element('radioGraphType').getValue(); + if (graphType !== 100_000_003) return; - const seasonType = $calculation.element('selectSeasonType').getValue(); - const highSeasonStartOption = $calculation.element('selectHighSeasonStart').getOption(); - if (!seasonType || !highSeasonStartOption) return; + const seasonType = $calculation.element('selectSeasonType').getValue(); + const highSeasonStartOption = $calculation.element('selectHighSeasonStart').getOption(); + if (!seasonType || !highSeasonStartOption) return; - const shiftNumber = Number.parseInt(highSeasonStartOption.label, 10) - 2; - const unshiftedNextSeasons = shift(nextSeasons, -shiftNumber); - const unshiftedPrevSeasons = shift(prevSeasons, -shiftNumber); + const shiftNumber = Number.parseInt(highSeasonStartOption.label, 10) - 2; + const unshiftedNextSeasons = shift(nextSeasons, -shiftNumber); + const unshiftedPrevSeasons = shift(prevSeasons, -shiftNumber); - const changes = difference(unshiftedNextSeasons, unshiftedPrevSeasons); - if (changes === null || changes.length > 1) return; + const changes = difference(unshiftedNextSeasons, unshiftedPrevSeasons); + if (changes === null || changes.length > 1) return; - const [changeIndex] = changes; - const positionIndex = getPositionIndex(seasonType, changeIndex); + const [changeIndex] = changes; + const positionIndex = getPositionIndex(seasonType, changeIndex); - const values = getSeasonsValues(seasonType, unshiftedNextSeasons); - values[positionIndex] = unshiftedNextSeasons[changeIndex]; + const values = getSeasonsValues(seasonType, unshiftedNextSeasons); + values[positionIndex] = unshiftedNextSeasons[changeIndex]; - const seasons = generateSeasons(seasonType, values); - const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); - const payments = generateSeasonsPayments(leasingPeriod, shift(seasons, shiftNumber)); - const rows: Row[] = generateSeasonPaymentsRows(seasonType, shiftNumber, payments); - const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue(); - const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue(); + const seasons = generateSeasons(seasonType, values); + const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); + const payments = generateSeasonsPayments(leasingPeriod, shift(seasons, shiftNumber)); + const rows: Row[] = generateSeasonPaymentsRows(seasonType, shiftNumber, payments); + const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue(); + const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue(); - $tables.payments.setRows([ - { - status: 'Disabled', - value: firstPaymentPerc, - }, - ...rows, - { - status: 'Disabled', - value: lastPaymentPerc, - }, - ]); - }, + $tables.payments.setRows([ { - delay: 50, - equals: comparer.structural, - } - ), - () => $process.has('LoadKP') + status: 'Disabled', + value: firstPaymentPerc, + }, + ...rows, + { + status: 'Disabled', + value: lastPaymentPerc, + }, + ]); + }, + { + delay: 50, + equals: comparer.structural, + } ); - makeDisposable( - () => - reaction( - () => $calculation.element('radioGraphType').getValue(), - () => { - $calculation.element('selectSeasonType').resetValue(); - $calculation.element('selectHighSeasonStart').resetValue(); - $calculation.element('tbxParmentsDecreasePercent').resetValue(); - } - ), - () => $process.has('LoadKP') + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element('radioGraphType').getValue(), + () => { + $calculation.element('selectSeasonType').resetValue(); + $calculation.element('selectHighSeasonStart').resetValue(); + $calculation.element('tbxParmentsDecreasePercent').resetValue(); + } ); } diff --git a/apps/web/process/payments/reactions/index.ts b/apps/web/process/payments/reactions/index.ts index cc8d68a..4082721 100644 --- a/apps/web/process/payments/reactions/index.ts +++ b/apps/web/process/payments/reactions/index.ts @@ -1,2 +1,2 @@ export { default as common } from './common'; -export { default as validation } from './validation'; +export * from './validation'; diff --git a/apps/web/process/payments/reactions/validation.ts b/apps/web/process/payments/reactions/validation.ts index 7338325..e47f83f 100644 --- a/apps/web/process/payments/reactions/validation.ts +++ b/apps/web/process/payments/reactions/validation.ts @@ -1,56 +1,4 @@ +import { createValidationReaction } from '../../tools'; import { createValidationSchema } from '../validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; -import type { ProcessContext } from '@/process/types'; -import ValidationHelper from '@/stores/validation/helper'; -import { comparer, reaction, toJS } from 'mobx'; -import { uid } from 'radash'; -const key = uid(7); - -export default function reactions(context: ProcessContext) { - const { $calculation, $tables } = context.store; - - const validationSchema = createValidationSchema(); - const helper = new ValidationHelper(); - - reaction( - () => { - const payments = toJS($tables.payments.values); - const values = $calculation.$values.getValues([ - 'graphType', - 'highSeasonStart', - 'leasingPeriod', - 'seasonType', - 'insNSIB', - 'lastPaymentRub', - ]); - - return { - payments: { values: payments }, - ...values, - }; - }, - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Array).forEach((elementName) => { - if (elementName === 'payments') { - const removeError = $tables.payments.setError({ key, message }); - if (removeError) helper.add(removeError); - } else { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - } - }); - }); - } - }, - { - delay: 100, - equals: comparer.structural, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/price/get-kp-data.ts b/apps/web/process/price/get-kp-data.ts index 7093e4b..be2a8a8 100644 --- a/apps/web/process/price/get-kp-data.ts +++ b/apps/web/process/price/get-kp-data.ts @@ -4,6 +4,7 @@ import defaultValues from '@/config/default-values'; import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars const QUERY_GET_QUOTE_PRICE_DATA = gql` query GetQuotePriceData($quoteId: Uuid!) { quote(quoteId: $quoteId) { @@ -12,6 +13,7 @@ const QUERY_GET_QUOTE_PRICE_DATA = gql` evo_discount_perc evo_discount_supplier_currency evo_first_payment_perc + evo_first_payment_rub evo_last_payment_calc evo_last_payment_perc evo_last_payment_rub @@ -44,16 +46,19 @@ export async function getKPData({ quote?.evo_nds_in_price_supplier_currency ?? defaultValues.VATInLeaseObjectPrice, addEquipmentPrice: quote?.evo_equip_price ?? defaultValues.addEquipmentPrice, comissionPerc: quote?.evo_comission_perc ?? defaultValues.comissionPerc, - // comissionRub: quote?.evo_comission_rub , + comissionRub: quote?.evo_comission_rub ?? defaultValues.comissionRub, firstPaymentPerc: quote?.evo_first_payment_perc ?? defaultValues.firstPaymentPerc, - // lastPaymentRub: quote?.evo_last_payment_rub , + firstPaymentRub: quote?.evo_first_payment_rub ?? defaultValues.firstPaymentRub, lastPaymentPerc: quote?.evo_last_payment_perc ?? defaultValues.lastPaymentPerc, + lastPaymentRub: quote?.evo_last_payment_rub ?? defaultValues.lastPaymentRub, lastPaymentRule: quote?.evo_last_payment_calc, leaseObjectPrice: quote?.evo_supplier_currency_price ?? defaultValues.leaseObjectPrice, - // leaseObjectPriceWthtVAT: quote?.evo_price_without_nds_supplier_currency , - supplierCurrency: quote?.evo_transactioncurrencyid, + leaseObjectPriceWthtVAT: + quote?.evo_price_without_nds_supplier_currency ?? defaultValues.leaseObjectPriceWthtVAT, + supplierCurrency: quote?.evo_transactioncurrencyid ?? defaultValues.supplierCurrency, supplierDiscountPerc: quote?.evo_discount_perc ?? defaultValues.supplierDiscountPerc, - // supplierDiscountRub: quote?.evo_discount_supplier_currency , + supplierDiscountRub: + quote?.evo_discount_supplier_currency ?? defaultValues.supplierDiscountRub, }, }; } diff --git a/apps/web/process/price/reactions/common.ts b/apps/web/process/price/reactions/common.ts index 771dc21..dc9eecc 100644 --- a/apps/web/process/price/reactions/common.ts +++ b/apps/web/process/price/reactions/common.ts @@ -1,8 +1,9 @@ import { VAT } from '@/constants/values'; import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; +import { disposableReaction } from '@/utils/mobx'; import { reaction } from 'mobx'; -import { makeDisposable, round } from 'tools'; +import { round } from 'tools'; export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation, $process } = store; @@ -35,25 +36,23 @@ export default function reactions({ store, apolloClient }: ProcessContext) { /** * Расчет размера скидки поставщика в валюте */ - makeDisposable( - () => - reaction( - () => $calculation.$values.getValues(['leaseObjectPrice', 'supplierDiscountRub']), - ({ leaseObjectPrice, supplierDiscountRub }) => { - // NaN fix - if (leaseObjectPrice === 0) { - $calculation.element('tbxSupplierDiscountPerc').resetValue(); - } else { - $calculation - .element('tbxSupplierDiscountPerc') - .setValue((supplierDiscountRub / leaseObjectPrice) * 100); - } - }, - { - fireImmediately: true, - } - ), - () => $process.has('LoadKP') + + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.$values.getValues(['leaseObjectPrice', 'supplierDiscountRub']), + ({ leaseObjectPrice, supplierDiscountRub }) => { + // NaN fix + if (leaseObjectPrice === 0) { + $calculation.element('tbxSupplierDiscountPerc').resetValue(); + } else { + $calculation + .element('tbxSupplierDiscountPerc') + .setValue((supplierDiscountRub / leaseObjectPrice) * 100); + } + }, + { + fireImmediately: true, + } ); /** @@ -103,7 +102,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) { } ); - reaction( + disposableReaction( + () => $process.has('LoadKP'), () => $calculation.$values.getValues([ 'firstPaymentPerc', @@ -117,19 +117,14 @@ export default function reactions({ store, apolloClient }: ProcessContext) { } ); - makeDisposable( - () => - reaction( - () => $calculation.element('tbxFirstPaymentRub').getValue(), - (firstPaymentRub) => { - const { plPriceRub, addEquipmentPrice, importProgramSum } = - $calculation.$values.getValues(); - const perc = - (firstPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; - $calculation.element('tbxFirstPaymentPerc').setValue(perc); - } - ), - () => $process.has('LoadKP') + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element('tbxFirstPaymentRub').getValue(), + (firstPaymentRub) => { + const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.getValues(); + const perc = (firstPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; + $calculation.element('tbxFirstPaymentPerc').setValue(perc); + } ); reaction( @@ -146,63 +141,53 @@ export default function reactions({ store, apolloClient }: ProcessContext) { } ); - makeDisposable( - () => - reaction( - () => $calculation.element('tbxComissionRub').getValue(), - (comissionRub) => { - const { plPriceRub, addEquipmentPrice, importProgramSum } = - $calculation.$values.getValues(); - const perc = (comissionRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; - $calculation.element('tbxComissionPerc').setValue(perc); - } - ), - () => $process.has('LoadKP') + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element('tbxComissionRub').getValue(), + (comissionRub) => { + const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.getValues(); + const perc = (comissionRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; + $calculation.element('tbxComissionPerc').setValue(perc); + } ); - makeDisposable( + disposableReaction( + () => $process.has('LoadKP'), () => - reaction( - () => - $calculation.$values.getValues([ - 'plPriceRub', - 'lastPaymentPerc', - 'addEquipmentPrice', - 'importProgramSum', - 'lastPaymentRule', - ]), - ({ addEquipmentPrice, lastPaymentPerc, plPriceRub, importProgramSum, lastPaymentRule }) => { - if (lastPaymentRule === 100_000_000) { - return; - } + $calculation.$values.getValues([ + 'plPriceRub', + 'lastPaymentPerc', + 'addEquipmentPrice', + 'importProgramSum', + 'lastPaymentRule', + ]), + ({ addEquipmentPrice, lastPaymentPerc, plPriceRub, importProgramSum, lastPaymentRule }) => { + if (lastPaymentRule === 100_000_000) { + return; + } - const rub = (lastPaymentPerc * (plPriceRub + addEquipmentPrice - importProgramSum)) / 100; - $calculation.element('tbxLastPaymentRub').setValue(rub); - } - ), - () => $process.has('LoadKP') + const rub = (lastPaymentPerc * (plPriceRub + addEquipmentPrice - importProgramSum)) / 100; + $calculation.element('tbxLastPaymentRub').setValue(rub); + } ); - makeDisposable( + disposableReaction( + () => $process.has('LoadKP'), () => - reaction( - () => - $calculation.$values.getValues([ - 'plPriceRub', - 'lastPaymentRub', - 'addEquipmentPrice', - 'importProgramSum', - 'lastPaymentRule', - ]), - ({ lastPaymentRub, plPriceRub, addEquipmentPrice, importProgramSum, lastPaymentRule }) => { - if (lastPaymentRule === 100_000_001) { - return; - } + $calculation.$values.getValues([ + 'plPriceRub', + 'lastPaymentRub', + 'addEquipmentPrice', + 'importProgramSum', + 'lastPaymentRule', + ]), + ({ lastPaymentRub, plPriceRub, addEquipmentPrice, importProgramSum, lastPaymentRule }) => { + if (lastPaymentRule === 100_000_001) { + return; + } - const perc = (lastPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; - $calculation.element('tbxLastPaymentPerc').setValue(perc); - } - ), - () => $process.has('LoadKP') + const perc = (lastPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; + $calculation.element('tbxLastPaymentPerc').setValue(perc); + } ); } diff --git a/apps/web/process/price/reactions/computed.ts b/apps/web/process/price/reactions/computed.ts index 199f479..9f883ee 100644 --- a/apps/web/process/price/reactions/computed.ts +++ b/apps/web/process/price/reactions/computed.ts @@ -1,4 +1,3 @@ -import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; import { createCurrencyUtility } from '@/utils/currency'; import { reaction } from 'mobx'; @@ -9,32 +8,10 @@ export default function reactions({ store, apolloClient }: ProcessContext) { const { RUB } = createCurrencyUtility({ apolloClient }); reaction( - () => - $calculation.$values.getValues([ - 'supplierCurrency', - 'leaseObjectPrice', - 'supplierDiscountRub', - ]), - async ({ supplierCurrency: supplierCurrencyId, supplierDiscountRub, leaseObjectPrice }) => { + () => $calculation.$values.getValues(['supplierCurrency', 'leaseObjectPrice']), + async ({ supplierCurrency: supplierCurrencyId, leaseObjectPrice }) => { if (!supplierCurrencyId) { $calculation.$values.resetValue('plPriceRub'); - $calculation.$values.resetValue('discountRub'); - - return; - } - - const { - data: { transactioncurrency }, - } = await apolloClient.query({ - query: CRMTypes.GetTransactionCurrencyDocument, - variables: { - currencyid: supplierCurrencyId, - }, - }); - - if (transactioncurrency?.isocurrencycode === 'RUB') { - $calculation.$values.setValue('plPriceRub', leaseObjectPrice); - $calculation.$values.setValue('discountRub', supplierDiscountRub); return; } @@ -46,6 +23,21 @@ export default function reactions({ store, apolloClient }: ProcessContext) { value: leaseObjectPrice, }) ); + }, + { + delay: 100, + fireImmediately: true, + } + ); + + reaction( + () => $calculation.$values.getValues(['supplierCurrency', 'supplierDiscountRub']), + async ({ supplierCurrency: supplierCurrencyId, supplierDiscountRub }) => { + if (!supplierCurrencyId) { + $calculation.$values.resetValue('discountRub'); + + return; + } $calculation.$values.setValue( 'discountRub', diff --git a/apps/web/process/price/reactions/index.ts b/apps/web/process/price/reactions/index.ts index 04e67d6..c0a451a 100644 --- a/apps/web/process/price/reactions/index.ts +++ b/apps/web/process/price/reactions/index.ts @@ -1,3 +1,3 @@ export { default as common } from './common'; export { default as computed } from './computed'; -export { default as validation } from './validation'; +export * from './validation'; diff --git a/apps/web/process/price/reactions/validation.ts b/apps/web/process/price/reactions/validation.ts index 236a9c5..e47f83f 100644 --- a/apps/web/process/price/reactions/validation.ts +++ b/apps/web/process/price/reactions/validation.ts @@ -1,44 +1,4 @@ +import { createValidationReaction } from '../../tools'; import { createValidationSchema } from '../validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; -import type { ProcessContext } from '@/process/types'; -import ValidationHelper from '@/stores/validation/helper'; -import { reaction } from 'mobx'; -import { uid } from 'radash'; -const key = uid(7); - -export default function reactions(context: ProcessContext) { - const { store } = context; - const { $calculation } = store; - const validationSchema = createValidationSchema(context); - - const helper = new ValidationHelper(); - reaction( - () => - $calculation.$values.getValues([ - 'VATInLeaseObjectPrice', - 'leaseObjectPriceWthtVAT', - 'product', - 'supplierDiscountRub', - 'plPriceRub', - 'firstPaymentRub', - 'subsidySum', - ]), - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/recalc/reactions.ts b/apps/web/process/recalc/reactions.ts index d122d51..eedd5d2 100644 --- a/apps/web/process/recalc/reactions.ts +++ b/apps/web/process/recalc/reactions.ts @@ -1,15 +1,12 @@ import type { ProcessContext } from '../types'; import { createValidationSchema } from './validation'; -import { makeDisposable, normalizeOptions } from '@/../../packages/tools'; import type { Elements } from '@/Components/Calculation/config/map/values'; -import { selectRequirementTelematic } from '@/config/default-options'; import * as CRMTypes from '@/graphql/crm.types'; -import type { Values } from '@/stores/calculation/values/types'; -import ValidationHelper from '@/stores/validation/helper'; +import { createValidationReaction } from '@/process/tools'; +import { disposableReaction } from '@/utils/mobx'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; -import { uid } from 'radash'; dayjs.extend(utc); @@ -21,34 +18,51 @@ export function common({ store, apolloClient }: ProcessContext) { () => $calculation.element('selectQuote').resetValue() ); - makeDisposable( + disposableReaction( + () => $calculation.element('cbxRecalcWithRevision').getValue() === true, () => - reaction( - () => - $calculation.$values.getValues([ - 'supplierDiscountRub', - 'addEquipmentPrice', - 'importProgramSum', - 'plPriceRub', - ]), - ({ supplierDiscountRub, importProgramSum, addEquipmentPrice, plPriceRub }) => { - const price = plPriceRub + addEquipmentPrice - importProgramSum; - const maxPriceChange = - price - supplierDiscountRub < 800_000 - ? price - supplierDiscountRub + 50_000 - : (price - supplierDiscountRub) * 1.05; + $calculation.$values.getValues([ + 'discountRub', + 'addEquipmentPrice', + 'importProgramSum', + 'plPriceRub', + 'leaseObjectType', + ]), + async ({ + discountRub, + importProgramSum, + addEquipmentPrice, + plPriceRub, + leaseObjectType: leaseObjectTypeId, + }) => { + let evo_leasingobject_type: CRMTypes.GetLeaseObjectTypeQuery['evo_leasingobject_type'] = null; - $calculation.element('tbxMaxPriceChange').setValue(maxPriceChange); + if (leaseObjectTypeId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); - const minPriceChange = - price - supplierDiscountRub < 800_000 - ? price - supplierDiscountRub - 50_000 - : (price - supplierDiscountRub) * 0.95; + ({ evo_leasingobject_type } = data); + } - $calculation.element('tbxMinPriceChange').setValue(minPriceChange); - } - ), - () => $calculation.element('cbxRecalcWithRevision').getValue() === true + const price = plPriceRub + addEquipmentPrice - importProgramSum; + const maxPriceChange = + price - discountRub < 800_000 + ? price - discountRub + 50_000 + : (price - discountRub) * + (evo_leasingobject_type?.evo_vehicle_type?.includes(100_000_001) || + evo_leasingobject_type?.evo_vehicle_type?.includes(100_000_005) + ? 1.01 + : 1.05); + + $calculation.element('tbxMaxPriceChange').setValue(maxPriceChange); + + const minPriceChange = + price - discountRub < 800_000 ? price - discountRub - 50_000 : (price - discountRub) * 0.95; + + $calculation.element('tbxMinPriceChange').setValue(minPriceChange); + } ); reaction( @@ -62,76 +76,6 @@ export function common({ store, apolloClient }: ProcessContext) { } ); - reaction( - () => $calculation.$values.getValues(['recalcWithRevision', 'leaseObjectType']), - async ({ recalcWithRevision, leaseObjectType: leaseObjectTypeId }) => { - if (recalcWithRevision === false) { - $calculation - .element('selectRequirementTelematic') - .setOptions( - selectRequirementTelematic.filter((x) => - [100_000_000, 100_000_001, 100_000_002, 100_000_003].includes(x.value) - ) - ); - - if (leaseObjectTypeId) { - const { - data: { evo_leasingobject_type }, - } = await apolloClient.query({ - query: CRMTypes.GetLeaseObjectTypeDocument, - variables: { leaseObjectTypeId }, - }); - - if (evo_leasingobject_type?.evo_id === '11') { - $calculation.element('selectRequirementTelematic').setValue(100_000_000).block(); - } else { - $calculation.element('selectRequirementTelematic').unblock(); - } - } - } else { - $calculation.element('selectRequirementTelematic').resetOptions(); - } - } - ); - - reaction( - () => $calculation.$values.getValues(['requirementTelematic', 'recalcWithRevision']), - async ({ requirementTelematic, recalcWithRevision }) => { - const currentDate = dayjs().utc(false).format('YYYY-MM-DD'); - const { - data: { evo_addproduct_types: trackerTypes }, - } = await apolloClient.query({ - query: CRMTypes.GetTrackerTypesDocument, - variables: { currentDate }, - }); - - const { - data: { evo_addproduct_types: telematicTypes }, - } = await apolloClient.query({ - query: CRMTypes.GetTelematicTypesDocument, - variables: { currentDate }, - }); - - let filteredTrackerTypes = trackerTypes?.filter( - (x) => requirementTelematic && x?.evo_controls_program?.includes(requirementTelematic) - ); - - let filteredTelematicTypes = telematicTypes?.filter( - (x) => requirementTelematic && x?.evo_controls_program?.includes(requirementTelematic) - ); - - if (!recalcWithRevision) { - filteredTrackerTypes = filteredTrackerTypes?.filter((x) => x?.evo_visible_calc === true); - filteredTelematicTypes = filteredTelematicTypes?.filter( - (x) => x?.evo_visible_calc === true - ); - } - - $calculation.element('selectTracker').setOptions(normalizeOptions(filteredTrackerTypes)); - $calculation.element('selectTelematic').setOptions(normalizeOptions(filteredTelematicTypes)); - } - ); - { const elements: Elements[] = [ 'cbxLeaseObjectUsed', @@ -221,32 +165,4 @@ export function common({ store, apolloClient }: ProcessContext) { } } -const key = uid(7); - -export function validation(context: ProcessContext) { - const { store } = context; - const { $calculation } = store; - const validationSchema = createValidationSchema(context); - - const helper = new ValidationHelper(); - reaction( - () => - $calculation.$values.getValues(Object.keys(validationSchema._def.schema.shape) as Values[]), - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/recalc/validation.ts b/apps/web/process/recalc/validation.ts index ac9b644..b9148ac 100644 --- a/apps/web/process/recalc/validation.ts +++ b/apps/web/process/recalc/validation.ts @@ -1,7 +1,8 @@ +/* eslint-disable sonarjs/cognitive-complexity */ /* eslint-disable complexity */ import type { ValidationContext } from '../types'; import ValuesSchema from '@/config/schema/values'; -import { MAX_MASS, MAX_VEHICLE_SEATS } from '@/constants/values'; +import { MAX_MASS, VEHICLE_SEATS } from '@/constants/values'; import * as CRMTypes from '@/graphql/crm.types'; import { z } from 'zod'; @@ -11,9 +12,11 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { balanceHolder: true, countSeats: true, dealerPerson: true, + discountRub: true, firstPaymentPerc: true, importProgramSum: true, lastPaymentPerc: true, + leaseObjectCategory: true, leaseObjectCount: true, leaseObjectPriceWthtVAT: true, leaseObjectUsed: true, @@ -23,7 +26,6 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { product: true, quote: true, recalcWithRevision: true, - supplierDiscountRub: true, }).superRefine( async ( { @@ -35,7 +37,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { product: productId, quote: quoteId, recalcWithRevision, - supplierDiscountRub, + discountRub, plPriceRub, firstPaymentPerc, leaseObjectCount, @@ -44,6 +46,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { leaseObjectYear, lastPaymentPerc, balanceHolder, + leaseObjectCategory, }, ctx ) => { @@ -51,6 +54,14 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { return; } + if (!quoteId) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Не указано предложение, по которому осуществляется Пересчет без пересмотра', + path: ['selectQuote'], + }); + } + if (dealerPersonId && quoteId && productId) { const { data: { account: dealerPerson }, @@ -79,7 +90,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { !evo_baseproduct?.evo_sale_without_nds && Boolean( quote?.evo_max_price_change && - plPriceRub - supplierDiscountRub + addEquipmentPrice - importProgramSum > + plPriceRub - discountRub + addEquipmentPrice - importProgramSum > quote.evo_max_price_change ); @@ -101,7 +112,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { quote.evo_discount_supplier_currency && quote.evo_equip_price && quote.evo_program_import_subsidy_sum && - plPriceRub - supplierDiscountRub + addEquipmentPrice - importProgramSum > + plPriceRub - discountRub + addEquipmentPrice - importProgramSum > quote?.evo_supplier_currency_price - quote.evo_discount_supplier_currency + quote.evo_equip_price - @@ -112,7 +123,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { !evo_baseproduct?.evo_sale_without_nds && Boolean( quote?.evo_min_change_price && - plPriceRub - supplierDiscountRub + addEquipmentPrice - importProgramSum < + plPriceRub - discountRub + addEquipmentPrice - importProgramSum < quote.evo_min_change_price ); @@ -179,8 +190,9 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { } if ( - (quote?.evo_max_mass && maxMass < MAX_MASS && quote.evo_max_mass < MAX_MASS) || - (quote?.evo_max_mass && maxMass >= MAX_MASS && quote?.evo_max_mass >= MAX_MASS) + quote?.evo_max_mass && + ((quote.evo_max_mass < MAX_MASS && maxMass >= MAX_MASS) || + (quote?.evo_max_mass >= MAX_MASS && maxMass < MAX_MASS)) ) { ctx.addIssue({ code: z.ZodIssueCode.custom, @@ -191,12 +203,10 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { } if ( - (quote?.evo_seats && - countSeats < MAX_VEHICLE_SEATS && - quote.evo_seats < MAX_VEHICLE_SEATS) || - (quote?.evo_seats && - countSeats >= MAX_VEHICLE_SEATS && - quote.evo_seats >= MAX_VEHICLE_SEATS) + leaseObjectCategory === 100_000_003 && + quote?.evo_seats && + ((quote.evo_seats < VEHICLE_SEATS && countSeats >= VEHICLE_SEATS) || + (quote.evo_seats >= VEHICLE_SEATS && countSeats < VEHICLE_SEATS)) ) { ctx.addIssue({ code: z.ZodIssueCode.custom, @@ -206,7 +216,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { }); } - if (quote?.evo_year && leaseObjectYear >= quote.evo_year) { + if (quote?.evo_year && leaseObjectYear < quote.evo_year) { ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'При пересчете без пересмотра год выпуска нельзя уменьшать', diff --git a/apps/web/process/supplier-agent/get-kp-data/index.ts b/apps/web/process/supplier-agent/get-kp-data/index.ts index 2845b9a..13b151e 100644 --- a/apps/web/process/supplier-agent/get-kp-data/index.ts +++ b/apps/web/process/supplier-agent/get-kp-data/index.ts @@ -6,6 +6,7 @@ import defaultValues from '@/config/default-values'; import * as CRMTypes from '@/graphql/crm.types'; import { gql } from '@apollo/client'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars const QUERY_GET_QUOTE_AGENTS_DATA = gql` query GetQuoteAgentsData($quoteId: Uuid!) { quote(quoteId: $quoteId) { @@ -34,6 +35,7 @@ const QUERY_GET_QUOTE_AGENTS_DATA = gql` evo_fin_department_reward_conditionid evo_fin_department_reward_total evo_fin_department_reward_summ + evo_supplier_financing } } `; @@ -78,6 +80,7 @@ export async function getKPData({ indAgent: quote?.evo_agent_accountid, indAgentRewardCondition: quote?.evo_agent_reward_conditionid, indAgentRewardSumm: sums?.indAgentRewardSumm ?? defaultValues.indAgentRewardSumm, + supplierFinancing: quote?.evo_supplier_financing ?? defaultValues.supplierFinancing, }, }; } diff --git a/apps/web/process/supplier-agent/lib/create-reactions.ts b/apps/web/process/supplier-agent/lib/create-reactions.ts index a0a38ed..26eccd5 100644 --- a/apps/web/process/supplier-agent/lib/create-reactions.ts +++ b/apps/web/process/supplier-agent/lib/create-reactions.ts @@ -1,12 +1,12 @@ import type { AgentsFields, AgentsRewardConditionsFields, AgentsSumFields } from './types'; import * as CRMTypes from '@/graphql/crm.types'; import type RootStore from '@/stores/root'; +import { normalizeOptions } from '@/utils/entity'; +import { disposableReaction } from '@/utils/mobx'; import type { ApolloClient } from '@apollo/client'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; -import { normalizeOptions } from 'tools/entity'; -import { makeDisposable } from 'tools/mobx'; dayjs.extend(utc); @@ -61,34 +61,31 @@ export function fillAgentRewardSummReaction( const { $calculation, $process } = store; const { rewardConditionField, rewardSummField } = agentParams; - makeDisposable( - () => - reaction( - () => $calculation.element(rewardConditionField).getValue(), - async (rewardConditionId) => { - if (!rewardConditionId) { - $calculation.element(rewardSummField).reset(); + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element(rewardConditionField).getValue(), + async (rewardConditionId) => { + if (!rewardConditionId) { + $calculation.element(rewardSummField).reset(); - return; - } + return; + } - const { - data: { evo_reward_condition }, - } = await apolloClient.query({ - query: CRMTypes.GetRewardConditionDocument, - variables: { - conditionId: rewardConditionId, - }, - }); + const { + data: { evo_reward_condition }, + } = await apolloClient.query({ + query: CRMTypes.GetRewardConditionDocument, + variables: { + conditionId: rewardConditionId, + }, + }); - if (evo_reward_condition?.evo_reward_summ) { - $calculation.element(rewardSummField).setValue(evo_reward_condition.evo_reward_summ); - } else { - $calculation.element(rewardSummField).resetValue(); - } - } - ), - () => $process.has('LoadKP') + if (evo_reward_condition?.evo_reward_summ) { + $calculation.element(rewardSummField).setValue(evo_reward_condition.evo_reward_summ); + } else { + $calculation.element(rewardSummField).resetValue(); + } + } ); reaction( diff --git a/apps/web/process/supplier-agent/lib/fill-agents-from-lead.ts b/apps/web/process/supplier-agent/lib/fill-agents-from-lead.ts index 5d85155..b427750 100644 --- a/apps/web/process/supplier-agent/lib/fill-agents-from-lead.ts +++ b/apps/web/process/supplier-agent/lib/fill-agents-from-lead.ts @@ -1,8 +1,8 @@ import type { Elements } from '@/Components/Calculation/config/map/values'; import * as CRMTypes from '@/graphql/crm.types'; import type RootStore from '@/stores/root'; +import { normalizeOptions } from '@/utils/entity'; import type { ApolloClient } from '@apollo/client'; -import { normalizeOptions } from 'tools/entity'; type AgentsLeadProp = keyof Pick< NonNullable, diff --git a/apps/web/process/supplier-agent/reactions/agents.ts b/apps/web/process/supplier-agent/reactions/agents.ts index 866de94..f0a661f 100644 --- a/apps/web/process/supplier-agent/reactions/agents.ts +++ b/apps/web/process/supplier-agent/reactions/agents.ts @@ -3,10 +3,10 @@ import * as createReactions from '../lib/create-reactions'; import * as fillAgentsFromLead from '../lib/fill-agents-from-lead'; import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; +import { disposableReaction } from '@/utils/mobx'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; -import { makeDisposable } from 'tools/mobx'; const { fillIndAgent, fillCalcBroker, fillCalcDoubleAgent, fillFinDepartment } = fillAgentsFromLead; const { fillAgentRewardReaction, fillAgentRewardSummReaction } = createReactions; @@ -33,18 +33,16 @@ export function common({ store, apolloClient }: ProcessContext) { /** * Заполняем агентов из Интереса */ - makeDisposable( - () => - reaction( - () => $calculation.element('selectLead').getValue(), - (leadid) => { - fillIndAgent(store, apolloClient, leadid); - fillCalcDoubleAgent(store, apolloClient, leadid); - fillCalcBroker(store, apolloClient, leadid); - fillFinDepartment(store, apolloClient, leadid); - } - ), - () => $process.has('LoadKP') + + disposableReaction( + () => $process.has('LoadKP'), + () => $calculation.element('selectLead').getValue(), + (leadid) => { + fillIndAgent(store, apolloClient, leadid); + fillCalcDoubleAgent(store, apolloClient, leadid); + fillCalcBroker(store, apolloClient, leadid); + fillFinDepartment(store, apolloClient, leadid); + } ); /** diff --git a/apps/web/process/supplier-agent/reactions/index.ts b/apps/web/process/supplier-agent/reactions/index.ts index 9a46f6f..1912f70 100644 --- a/apps/web/process/supplier-agent/reactions/index.ts +++ b/apps/web/process/supplier-agent/reactions/index.ts @@ -11,4 +11,4 @@ function common(context: ProcessContext) { export { common }; -export { default as validation } from './validation'; +export * from './validation'; diff --git a/apps/web/process/supplier-agent/reactions/supplier.ts b/apps/web/process/supplier-agent/reactions/supplier.ts index 1709be1..b639cfe 100644 --- a/apps/web/process/supplier-agent/reactions/supplier.ts +++ b/apps/web/process/supplier-agent/reactions/supplier.ts @@ -1,11 +1,11 @@ import * as createReactions from '../lib/create-reactions'; import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; +import { normalizeOptions } from '@/utils/entity'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { reaction } from 'mobx'; import { sift } from 'radash'; -import { normalizeOptions } from 'tools/entity'; dayjs.extend(utc); @@ -156,4 +156,39 @@ export function common({ store, apolloClient }: ProcessContext) { } } ); + + reaction( + () => $calculation.$values.getValues(['product', 'dealerPerson']), + async ({ product: productId, dealerPerson: dealerPersonId }) => { + let evo_baseproduct: CRMTypes.GetProductQuery['evo_baseproduct'] = null; + let dealerPerson: CRMTypes.GetDealerPersonQuery['account'] = null; + + if (productId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { productId }, + }); + + ({ evo_baseproduct } = data); + } + + if (dealerPersonId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetDealerPersonDocument, + variables: { dealerPersonId }, + }); + + ({ account: dealerPerson } = data); + } + + if ( + evo_baseproduct?.evo_supplier_financing_accept && + dealerPerson?.evo_supplier_financing_accept + ) { + $calculation.element('cbxSupplierFinancing').unblock(); + } else { + $calculation.element('cbxSupplierFinancing').setValue(false).block(); + } + } + ); } diff --git a/apps/web/process/supplier-agent/reactions/validation.ts b/apps/web/process/supplier-agent/reactions/validation.ts index 234660c..e47f83f 100644 --- a/apps/web/process/supplier-agent/reactions/validation.ts +++ b/apps/web/process/supplier-agent/reactions/validation.ts @@ -1,70 +1,4 @@ +import { createValidationReaction } from '../../tools'; import { createValidationSchema } from '../validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; -import type { ProcessContext } from '@/process/types'; -import ValidationHelper from '@/stores/validation/helper'; -import { reaction } from 'mobx'; -import { uid } from 'radash'; -const key = uid(7); - -export default function reactions(context: ProcessContext) { - const { store } = context; - const { $calculation } = store; - const validationSchema = createValidationSchema(context); - - const helper = new ValidationHelper(); - reaction( - () => { - const values = $calculation.$values.getValues([ - 'calcBrokerRewardCondition', - 'calcBrokerRewardSum', - 'calcDoubleAgentRewardCondition', - 'calcDoubleAgentRewardSumm', - 'dealer', - 'dealerBroker', - 'calcFinDepartment', - 'dealerBrokerRewardCondition', - 'dealerBrokerRewardSumm', - 'dealerPerson', - 'dealerRewardCondition', - 'dealerRewardSumm', - 'finDepartmentRewardCondtion', - 'finDepartmentRewardSumm', - 'indAgent', - 'indAgentRewardCondition', - 'indAgentRewardSumm', - 'calcDoubleAgent', - 'calcBroker', - ]); - - const options = ( - [ - 'selectCalcBrokerRewardCondition', - 'selectCalcDoubleAgentRewardCondition', - 'selectDealerBrokerRewardCondition', - 'selectDealerRewardCondition', - 'selectFinDepartmentRewardCondtion', - 'selectIndAgentRewardCondition', - ] as Elements[] - ).map((elementName) => $calculation.element(elementName).getOptions()); - - return { options, values }; - }, - async ({ values }) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/process/supplier-agent/validation.ts b/apps/web/process/supplier-agent/validation.ts index 6a5c0b7..f27389e 100644 --- a/apps/web/process/supplier-agent/validation.ts +++ b/apps/web/process/supplier-agent/validation.ts @@ -4,9 +4,9 @@ import type { ValidationContext } from '../types'; import type { Elements } from '@/Components/Calculation/config/map/values'; import ValuesSchema from '@/config/schema/values'; import * as CRMTypes from '@/graphql/crm.types'; +import { normalizeOptions } from '@/utils/entity'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; -import { normalizeOptions } from 'tools'; import type { RefinementCtx } from 'zod'; import { z } from 'zod'; @@ -176,8 +176,7 @@ const SumsSchema = ValuesSchema.pick({ export function createValidationSchema(context: ValidationContext) { const { apolloClient } = context; - return z - .object({}) + return ValuesSchema.pick({ brand: true }) .merge(AgentsSchema) .merge(ConditionsSchema) .merge(SumsSchema) @@ -202,6 +201,7 @@ export function createValidationSchema(context: ValidationContext) { indAgent, indAgentRewardCondition, indAgentRewardSumm, + brand: brandId, } = values; /** @@ -463,5 +463,39 @@ export function createValidationSchema(context: ValidationContext) { fieldName: 'selectIndAgentRewardCondition', }); } + + if (brandId) { + const { + data: { evo_brand }, + } = await apolloClient.query({ + query: CRMTypes.GetBrandDocument, + variables: { brandId }, + }); + + if ( + evo_brand?.evo_maximum_percentage_av && + indAgentRewardSumm + + calcDoubleAgentRewardSumm + + dealerRewardSumm + + calcBrokerRewardSum + + dealerBrokerRewardSumm + + finDepartmentRewardSumm > + evo_brand?.evo_maximum_percentage_av + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'В данном расчете АВ закладывается выше установленного максимума. Уменьшите размер АВ', + path: [ + 'tbxDealerRewardSumm', + 'tbxDealerBrokerRewardSumm', + 'tbxIndAgentRewardSumm', + 'tbxCalcDoubleAgentRewardSumm', + 'tbxCalcBrokerRewardSum', + 'tbxFinDepartmentRewardSumm', + ], + }); + } + } }); } diff --git a/apps/web/process/tools.ts b/apps/web/process/tools.ts new file mode 100644 index 0000000..208efb7 --- /dev/null +++ b/apps/web/process/tools.ts @@ -0,0 +1,79 @@ +/* eslint-disable sonarjs/cognitive-complexity */ +import { debouncedReaction } from '../utils/mobx'; +import type { ProcessContext } from './types'; +import type { Elements } from '@/Components/Calculation/config/map/values'; +import type { Values } from '@/stores/calculation/values/types'; +import ValidationHelper from '@/stores/validation/helper'; +import { comparer, toJS } from 'mobx'; +import { uid } from 'radash'; +import type { ZodTypeAny } from 'zod'; + +export function createValidationReaction( + createValidationSchema: (context: ProcessContext) => T +) { + const key = uid(7); + + return (context: ProcessContext) => { + const validationSchema = createValidationSchema(context); + const shapeValues = Object.keys(validationSchema._def.schema.shape) as string[]; + + const { store } = context; + const { $calculation, $tables } = store; + + const helper = new ValidationHelper(); + + debouncedReaction( + () => { + const values = $calculation.$values.getValues(shapeValues as Values[]); + if (shapeValues.includes('insurance')) + return { + ...values, + insurance: { + values: { + fingap: toJS($tables.insurance.row('fingap').getValues()), + kasko: toJS($tables.insurance.row('kasko').getValues()), + osago: toJS($tables.insurance.row('osago').getValues()), + }, + }, + }; + + if (shapeValues.includes('payments')) { + return { + ...values, + payments: { values: toJS($tables.payments.values) }, + }; + } + + return values; + }, + async (values) => { + helper.removeErrors(); + const validationResult = await validationSchema.safeParseAsync(values); + + if (validationResult.success === false) { + validationResult.error.errors.forEach(({ path, message }) => { + (path as Array).forEach((elementName) => { + if (elementName === 'insurance') { + const removeError = $tables.insurance.setError({ key, message }); + if (removeError) helper.add(removeError); + } else if (elementName === 'payments') { + const removeError = $tables.payments.setError({ key, message }); + if (removeError) helper.add(removeError); + } else { + const removeError = $calculation.element(elementName).setError({ key, message }); + if (removeError) helper.add(removeError); + } + }); + }); + } else { + helper.removeErrors(); + } + }, + { + delay: 1, + equals: comparer.structural, + wait: 100, + } + ); + }; +} diff --git a/apps/web/process/used-pl/reactions.ts b/apps/web/process/used-pl/reactions.ts index d0fcce3..d1067fa 100644 --- a/apps/web/process/used-pl/reactions.ts +++ b/apps/web/process/used-pl/reactions.ts @@ -1,10 +1,8 @@ import type { ProcessContext } from '../types'; import { createValidationSchema } from './validation'; -import type { Elements } from '@/Components/Calculation/config/map/values'; import * as CRMTypes from '@/graphql/crm.types'; -import ValidationHelper from '@/stores/validation/helper'; +import { createValidationReaction } from '@/process/tools'; import { reaction } from 'mobx'; -import { uid } from 'radash'; export function common({ store, apolloClient }: ProcessContext) { const { $calculation } = store; @@ -180,10 +178,24 @@ export function common({ store, apolloClient }: ProcessContext) { * то поле Срок поставки = 100 000 000 и закрыто для редактирования, иначе открыто для редактирования */ reaction( - () => $calculation.$values.getValues(['leaseObjectUsed', 'subsidy', 'product', 'dealer']), - async ({ leaseObjectUsed, subsidy, product: productId, dealer: dealerId }) => { + () => + $calculation.$values.getValues([ + 'leaseObjectUsed', + 'subsidy', + 'product', + 'dealer', + 'supplierFinancing', + ]), + async ({ + leaseObjectUsed, + subsidy: subsidyId, + product: productId, + dealer: dealerId, + supplierFinancing, + }) => { let evo_baseproduct: CRMTypes.GetProductQuery['evo_baseproduct'] = null; let dealer: CRMTypes.GetDealerQuery['dealer'] = null; + let evo_subsidy: CRMTypes.GetSubsidyQuery['evo_subsidy'] = null; if (productId) { const { data } = await apolloClient.query({ @@ -202,13 +214,30 @@ export function common({ store, apolloClient }: ProcessContext) { ({ dealer } = data); } + if (subsidyId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetSubsidyDocument, + variables: { subsidyId }, + }); + ({ evo_subsidy } = data); + } + + const evo_subsidy_evo_delivery_time = evo_subsidy?.evo_delivery_time?.filter((x) => x > 0); + if ( leaseObjectUsed || - subsidy || + (evo_subsidy_evo_delivery_time?.length === 1 && + evo_subsidy_evo_delivery_time.includes(100_000_000)) || evo_baseproduct?.evo_sale_without_nds || dealer?.evo_return_leasing_dealer ) { $calculation.element('radioDeliveryTime').setValue(100_000_000).block(); + } else if ( + (evo_subsidy_evo_delivery_time?.length === 1 && + evo_subsidy_evo_delivery_time.includes(100_000_001)) || + supplierFinancing + ) { + $calculation.element('radioDeliveryTime').setValue(100_000_001).block(); } else { $calculation.element('radioDeliveryTime').unblock(); } @@ -216,13 +245,17 @@ export function common({ store, apolloClient }: ProcessContext) { ); reaction( - () => $calculation.element('selectSubsidy').getValue(), - (subsidyId) => { - if (subsidyId) { + () => $calculation.$values.getValues(['subsidy', 'supplierFinancing']), + ({ subsidy: subsidyId, supplierFinancing }) => { + if (subsidyId || supplierFinancing) { $calculation.element('tbxLeaseObjectCount').setValue(1).block(); - $calculation.element('cbxLeaseObjectUsed').setValue(false).block(); } else { $calculation.element('tbxLeaseObjectCount').unblock(); + } + + if (subsidyId) { + $calculation.element('cbxLeaseObjectUsed').setValue(false).block(); + } else { $calculation.element('cbxLeaseObjectUsed').unblock(); } } @@ -240,39 +273,4 @@ export function common({ store, apolloClient }: ProcessContext) { ); } -const key = uid(7); - -export function validation(context: ProcessContext) { - const { store } = context; - const { $calculation } = store; - const validationSchema = createValidationSchema(context); - - const helper = new ValidationHelper(); - reaction( - () => - $calculation.$values.getValues([ - 'engineHours', - 'leaseObjectCategory', - 'leaseObjectType', - 'leaseObjectUsed', - 'mileage', - 'vin', - ]), - async (values) => { - helper.removeErrors(); - const validationResult = await validationSchema.safeParseAsync(values); - - if (!validationResult.success) { - validationResult.error.errors.forEach(({ path, message }) => { - (path as Elements[]).forEach((elementName) => { - const removeError = $calculation.element(elementName).setError({ key, message }); - if (removeError) helper.add(removeError); - }); - }); - } - }, - { - delay: 100, - } - ); -} +export const validation = createValidationReaction(createValidationSchema); diff --git a/apps/web/server/routers/calculate/lib/request.ts b/apps/web/server/routers/calculate/lib/request.ts index 4c50c66..014ef38 100644 --- a/apps/web/server/routers/calculate/lib/request.ts +++ b/apps/web/server/routers/calculate/lib/request.ts @@ -47,15 +47,6 @@ export async function createRequestData({ const currentUTCDate = dayjs().utc(false); - const transactioncurrency = values.supplierCurrency - ? ( - await apolloClient.query({ - query: CRMTypes.GetTransactionCurrencyDocument, - variables: { currencyid: values.supplierCurrency }, - }) - ).data.transactioncurrency - : null; - let systemuser: CRMTypes.GetSystemUserQuery['systemuser'] = null; if (user?.domainName) { @@ -396,7 +387,7 @@ export async function createRequestData({ }, async discount() { - if (values.supplierCurrency && transactioncurrency?.isocurrencycode !== 'RUB') { + if (values.supplierCurrency) { return ( ((await RUB({ currencyid: values.supplierCurrency, @@ -710,7 +701,7 @@ export async function createRequestData({ }, async lastPaymentFix() { - return values.lastPaymentRule === 100_000_002; + return values.lastPaymentRule !== 100_000_002; }, async lastPaymentSum() { @@ -921,7 +912,7 @@ export async function createRequestData({ }, async plPrice() { - if (values.supplierCurrency && transactioncurrency?.isocurrencycode !== 'RUB') { + if (values.supplierCurrency) { return ( (await RUB({ currencyid: values.supplierCurrency, @@ -935,7 +926,7 @@ export async function createRequestData({ }, async plPriceVAT() { - if (values.supplierCurrency && transactioncurrency?.isocurrencycode !== 'RUB') { + if (values.supplierCurrency) { return ( (await RUB({ currencyid: values.supplierCurrency, @@ -952,7 +943,7 @@ export async function createRequestData({ }, async plPriceWithVAT() { - if (values.supplierCurrency && transactioncurrency?.isocurrencycode !== 'RUB') { + if (values.supplierCurrency) { return ( (await RUB({ currencyid: values.supplierCurrency, @@ -1122,7 +1113,7 @@ export async function createRequestData({ }, async supplierFinancing() { - return false; + return values.supplierFinancing; }, async tlmCost() { diff --git a/apps/web/server/routers/calculate/lib/transform.ts b/apps/web/server/routers/calculate/lib/transform.ts index c215b56..e82bcd2 100644 --- a/apps/web/server/routers/calculate/lib/transform.ts +++ b/apps/web/server/routers/calculate/lib/transform.ts @@ -29,6 +29,10 @@ export function transformCalculateResults({ }) ); + const { subsidySum } = inputValues; + resultPayments[0].paymentSum -= subsidySum; + resultPayments[0].ndsCompensation -= subsidySum - subsidySum / (1 + VAT); + const resultValues: OutputData['resultValues'] = { resultAB_FL: ((preparedValues.agentsSum + preparedValues.doubleAgentsSum) / ESN) * (1 - NDFL), resultAB_UL: @@ -55,12 +59,12 @@ export function transformCalculateResults({ 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, + resultFirstPaymentRiskPolicy: preparedValues?.firstPayment, + resultIRRGraphPerc: columns.sumColumn.irr, + resultIRRNominalPerc: columns.cashflowMsfoColumn.nominal, resultInsKasko: preparedValues.insuranceKasko, resultInsOsago: preparedValues.insuranceOsago, - resultLastPayment: preparedValues.lastPaymentSum * (1 + VAT), + resultLastPayment: last(columns?.sumWithVatColumn?.values) || 0, resultParticipationAmount: preparedValues.niAtInception + (preparedValues.ratBonus + preparedValues.nsBonus + preparedValues.nsibBonus) * @@ -80,7 +84,7 @@ export function transformCalculateResults({ preparedValues.plPriceWithVAT - inputValues.supplierDiscountRub - inputValues.importProgramSum, - resultPriceUpPr: postValues.priceUP_Year_PR * 100, + resultPriceUpPr: postValues.priceUP_Year_PR, resultTerm: preparedValues.nmper, resultTotalGraphwithNDS: columns.sumWithVatColumn.values[0] - inputValues.subsidySum, }; diff --git a/apps/web/server/routers/calculate/lib/validation.ts b/apps/web/server/routers/calculate/lib/validation.ts index 77ced81..87c055a 100644 --- a/apps/web/server/routers/calculate/lib/validation.ts +++ b/apps/web/server/routers/calculate/lib/validation.ts @@ -1,6 +1,7 @@ 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 addProduct from '@/process/add-product'; import * as bonuses from '@/process/bonuses'; import * as configurator from '@/process/configurator'; import * as gibdd from '@/process/gibdd'; @@ -20,6 +21,7 @@ const processes = [ leasingObject, gibdd, insuranceProcess, + addProduct, ]; const titles = Object.assign(elementsTitles, { diff --git a/apps/web/stores/validation/index.ts b/apps/web/stores/validation/index.ts index 0154033..afb8e27 100644 --- a/apps/web/stores/validation/index.ts +++ b/apps/web/stores/validation/index.ts @@ -1,7 +1,7 @@ import type RootStore from '../root'; import type { RemoveError, ValidationConfig, ValidationError, ValidationParams } from './types'; import { makeAutoObservable } from 'mobx'; -import notification from 'ui/elements/notification'; +import { notification } from 'ui/elements'; export default class Validation { private root: RootStore; diff --git a/apps/web/utils/currency.ts b/apps/web/utils/currency.ts index 222de25..c4bf647 100644 --- a/apps/web/utils/currency.ts +++ b/apps/web/utils/currency.ts @@ -17,6 +17,19 @@ type Input = { export function createCurrencyUtility({ apolloClient }: Context) { return { async RUB({ currencyid, value }: Input) { + const { + data: { transactioncurrency }, + } = await apolloClient.query({ + query: CRMTypes.GetTransactionCurrencyDocument, + variables: { + currencyid, + }, + }); + + if (transactioncurrency?.isocurrencycode === 'RUB') { + return value; + } + const { data: { evo_currencychanges }, } = await apolloClient.query({ diff --git a/packages/tools/entity.ts b/apps/web/utils/entity.ts similarity index 100% rename from packages/tools/entity.ts rename to apps/web/utils/entity.ts diff --git a/apps/web/utils/mobx.ts b/apps/web/utils/mobx.ts new file mode 100644 index 0000000..0319b68 --- /dev/null +++ b/apps/web/utils/mobx.ts @@ -0,0 +1,51 @@ +import type { IReactionDisposer, IReactionOptions, IReactionPublic } from 'mobx'; +import { reaction } from 'mobx'; +import { debounce, omit } from 'radash'; + +export function disposableReaction( + disposeExpression: () => boolean, + expression: (r: IReactionPublic) => T, + effect: ( + arg: T, + prev: FireImmediately extends true ? T | undefined : T, + r: IReactionPublic + ) => void, + reactionOpts?: IReactionOptions +) { + let disposer: IReactionDisposer | undefined; + + if (!disposeExpression()) { + disposer = reaction(expression, effect, reactionOpts); + } + + function cleanDisposer() { + disposer = undefined; + } + + reaction(disposeExpression, (mustBeDisposed) => { + if (mustBeDisposed) { + if (disposer !== undefined) disposer(); + cleanDisposer(); + } else { + disposer = reaction( + expression, + effect, + reactionOpts ? omit(reactionOpts, ['fireImmediately']) : undefined + ); + } + }); +} + +export function debouncedReaction( + expression: (r: IReactionPublic) => T, + effect: ( + arg: T, + prev: FireImmediately extends true ? T | undefined : T, + r: IReactionPublic + ) => void, + { wait, ...reactionOpts }: IReactionOptions & { wait: number } +): IReactionDisposer { + const debouncedEffect = debounce({ delay: wait }, effect); + + return reaction(expression, debouncedEffect, reactionOpts); +} diff --git a/packages/tools/index.ts b/packages/tools/index.ts index 39c5d2c..abfb192 100644 --- a/packages/tools/index.ts +++ b/packages/tools/index.ts @@ -1,6 +1,4 @@ export * from './array'; export * from './common'; -export * from './entity'; -export * from './mobx'; export * from './number'; export * from './object'; diff --git a/packages/tools/mobx.ts b/packages/tools/mobx.ts deleted file mode 100644 index 2bac7e7..0000000 --- a/packages/tools/mobx.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { IReactionDisposer } from 'mobx'; -import { autorun } from 'mobx'; - -export function makeDisposable( - createReaction: () => IReactionDisposer, - mustBeDisposed: () => boolean -) { - let disposer: IReactionDisposer | undefined; - - function cleanDisposer() { - disposer = undefined; - } - - autorun(() => { - if (mustBeDisposed()) { - if (disposer !== undefined) disposer(); - cleanDisposer(); - } else { - disposer = createReaction(); - } - }); -} diff --git a/packages/tools/package.json b/packages/tools/package.json index 39da084..6afb6f7 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -11,7 +11,5 @@ "eslint": "^8.35.0", "eslint-config-custom": "*" }, - "dependencies": { - "mobx": "^6.8.0" - } + "dependencies": {} } diff --git a/packages/ui/elements/Alert.js b/packages/ui/elements/Alert.js deleted file mode 100644 index 4ad8e33..0000000 --- a/packages/ui/elements/Alert.js +++ /dev/null @@ -1 +0,0 @@ -export { Alert as default } from 'antd'; diff --git a/packages/ui/elements/Result.js b/packages/ui/elements/Result.js deleted file mode 100644 index 031b1ee..0000000 --- a/packages/ui/elements/Result.js +++ /dev/null @@ -1 +0,0 @@ -export { Result as default } from 'antd'; diff --git a/packages/ui/elements/Table.js b/packages/ui/elements/Table.js deleted file mode 100644 index 0d0f490..0000000 --- a/packages/ui/elements/Table.js +++ /dev/null @@ -1 +0,0 @@ -export { Table as default } from 'antd'; diff --git a/packages/ui/elements/Tooltip.js b/packages/ui/elements/Tooltip.js deleted file mode 100644 index 2f579c2..0000000 --- a/packages/ui/elements/Tooltip.js +++ /dev/null @@ -1 +0,0 @@ -export { Tooltip as default } from 'antd'; diff --git a/packages/ui/elements/badge.js b/packages/ui/elements/badge.js deleted file mode 100644 index d4ecff9..0000000 --- a/packages/ui/elements/badge.js +++ /dev/null @@ -1 +0,0 @@ -export { Badge } from 'antd'; diff --git a/packages/ui/elements/index.ts b/packages/ui/elements/index.ts index 7ba3afd..4db5d13 100644 --- a/packages/ui/elements/index.ts +++ b/packages/ui/elements/index.ts @@ -1,19 +1,34 @@ -export * from './badge'; +import { message, notification } from 'antd'; + +message.config({ + maxCount: 3, + top: 70, +}); + +notification.config({ + placement: 'bottomRight', +}); + export { default as Button } from './Button'; export { default as Checkbox } from './Checkbox'; export { default as AntdConfig } from './Config'; export { default as Input } from './Input'; export { default as InputNumber } from './InputNumber'; -export * from './layout'; export { default as Link } from './Link'; -export { default as message } from './message'; -export { default as notification } from './notification'; export { default as Radio } from './Radio'; -export { default as Result } from './Result'; export { default as Segmented } from './Segmented'; export { default as Select } from './Select'; export { default as Switch } from './Switch'; -export { default as Table } from './Table'; -export * from './tag'; export { default as Text } from './Text'; -export { default as Tooltip } from './Tooltip'; +export { + Alert, + Badge, + Divider, + message, + notification, + Result, + Table, + Tabs, + Tag, + Tooltip, +} from 'antd'; diff --git a/packages/ui/elements/layout/Divider.js b/packages/ui/elements/layout/Divider.js deleted file mode 100644 index 343bf7f..0000000 --- a/packages/ui/elements/layout/Divider.js +++ /dev/null @@ -1 +0,0 @@ -export { Divider as default } from 'antd'; diff --git a/packages/ui/elements/layout/Tabs.js b/packages/ui/elements/layout/Tabs.js deleted file mode 100644 index d011b65..0000000 --- a/packages/ui/elements/layout/Tabs.js +++ /dev/null @@ -1 +0,0 @@ -export { Tabs as default } from 'antd'; diff --git a/packages/ui/elements/layout/index.ts b/packages/ui/elements/layout/index.ts deleted file mode 100644 index 1c74c46..0000000 --- a/packages/ui/elements/layout/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default as Divider } from './Divider'; -export { default as Tabs } from './Tabs'; diff --git a/packages/ui/elements/message.js b/packages/ui/elements/message.js deleted file mode 100644 index 2e6876d..0000000 --- a/packages/ui/elements/message.js +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable unicorn/prefer-export-from */ -import { message } from 'antd'; - -message.config({ - maxCount: 3, - top: 70, -}); - -export default message; diff --git a/packages/ui/elements/notification.ts b/packages/ui/elements/notification.ts deleted file mode 100644 index 0e8946f..0000000 --- a/packages/ui/elements/notification.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable unicorn/prefer-export-from */ -import { notification } from 'antd'; - -notification.config({ - placement: 'bottomRight', -}); - -export default notification; diff --git a/packages/ui/elements/tag.js b/packages/ui/elements/tag.js deleted file mode 100644 index 2bfffd1..0000000 --- a/packages/ui/elements/tag.js +++ /dev/null @@ -1 +0,0 @@ -export { Tag } from 'antd'; diff --git a/packages/ui/index.ts b/packages/ui/index.ts deleted file mode 100644 index cf4175b..0000000 --- a/packages/ui/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './elements'; -export * from './grid';