Compare commits
18 Commits
release/dy
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c25ba30d0 | ||
|
|
ba36eb502b | ||
|
|
2c9a2bd30c | ||
|
|
f35acee64b | ||
|
|
a4c02a747f | ||
|
|
66b1e2cdcb | ||
|
|
81eca1c6e0 | ||
|
|
89f2b3b68c | ||
|
|
549bd901da | ||
|
|
6aad2d3aa2 | ||
|
|
09959e3ac3 | ||
|
|
7014462d42 | ||
|
|
62417b88ba | ||
|
|
bf0b5c9907 | ||
|
|
5347c3ef6c | ||
|
|
194292c083 | ||
|
|
7d023dba1e | ||
|
|
9c63cadf29 |
@ -47,6 +47,8 @@ ARG URL_CORE_CALCULATE_DIRECT
|
|||||||
ARG URL_1C_TRANSTAX_DIRECT
|
ARG URL_1C_TRANSTAX_DIRECT
|
||||||
ARG URL_ELT_OSAGO_DIRECT
|
ARG URL_ELT_OSAGO_DIRECT
|
||||||
ARG URL_ELT_KASKO_DIRECT
|
ARG URL_ELT_KASKO_DIRECT
|
||||||
|
ARG USERNAME_1C_TRANSTAX
|
||||||
|
ARG PASSWORD_1C_TRANSTAX
|
||||||
RUN pnpm dotenv -v NODE_ENV=production -e .env turbo run prebuild --filter=web...
|
RUN pnpm dotenv -v NODE_ENV=production -e .env turbo run prebuild --filter=web...
|
||||||
RUN pnpm dotenv -e .env turbo run build --filter=web...
|
RUN pnpm dotenv -e .env turbo run build --filter=web...
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
export type RequestTransTax = {
|
export type RequestTransTax = {
|
||||||
|
CalcDate: string;
|
||||||
|
CarCategory: string;
|
||||||
OKTMO: string;
|
OKTMO: string;
|
||||||
calcDate: Date;
|
Power: number;
|
||||||
carCategory: string;
|
Year: number;
|
||||||
power: number;
|
|
||||||
year: number;
|
|
||||||
};
|
};
|
||||||
export type ResponseTransTax = {
|
export type ResponseTransTax = {
|
||||||
error: string;
|
Error: string;
|
||||||
tax: number;
|
Tax: number;
|
||||||
|
TaxRate: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,6 +9,10 @@ import { getCurrentScope } from '@sentry/nextjs';
|
|||||||
import getConfig from 'next/config';
|
import getConfig from 'next/config';
|
||||||
import { isServer } from 'tools';
|
import { isServer } from 'tools';
|
||||||
|
|
||||||
|
function isSovkom(account) {
|
||||||
|
return account.label.toLowerCase().includes('совком');
|
||||||
|
}
|
||||||
|
|
||||||
export function createLink(headers) {
|
export function createLink(headers) {
|
||||||
const { URL_CRM_GRAPHQL } = getUrls();
|
const { URL_CRM_GRAPHQL } = getUrls();
|
||||||
|
|
||||||
@ -44,16 +48,24 @@ export function createLink(headers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (operation.operationName === 'GetInsuranceCompanies') {
|
if (operation.operationName === 'GetInsuranceCompanies') {
|
||||||
response.data.accounts = response.data.accounts.map((account) => {
|
response.data.accounts = response.data.accounts
|
||||||
const substring = account.label.match(/"(.+)"/u);
|
.sort((a, b) => {
|
||||||
if (substring)
|
if (isSovkom(a)) return -1;
|
||||||
return {
|
|
||||||
...account,
|
|
||||||
label: substring ? substring[1].replaceAll('"', '').trim() : account.label,
|
|
||||||
};
|
|
||||||
|
|
||||||
return account;
|
if (isSovkom(b)) return 1;
|
||||||
});
|
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
.map((account) => {
|
||||||
|
const substring = account.label.match(/"(.+)"/u);
|
||||||
|
if (substring)
|
||||||
|
return {
|
||||||
|
...account,
|
||||||
|
label: substring ? substring[1].replaceAll('"', '').trim() : account.label,
|
||||||
|
};
|
||||||
|
|
||||||
|
return account;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ export const selectObjectCategoryTax = [
|
|||||||
export const selectLeaseObjectUseFor = alphabetical(
|
export const selectLeaseObjectUseFor = alphabetical(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
label: 'Для представительских целей',
|
label: 'Для представительских целей / перевозки сотрудников ЛП',
|
||||||
value: 100_000_000,
|
value: 100_000_000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -151,10 +151,10 @@ export const selectLeaseObjectUseFor = alphabetical(
|
|||||||
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
|
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
|
||||||
value: 100_000_011,
|
value: 100_000_011,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: 'Для перевозки сотрудников ЛП',
|
// label: 'Для перевозки сотрудников ЛП',
|
||||||
value: 100_000_012,
|
// value: 100_000_012,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
|
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
|
||||||
value: 100_000_013,
|
value: 100_000_013,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ const defaultValues: CalculationValues = {
|
|||||||
comissionRub: 0,
|
comissionRub: 0,
|
||||||
configuration: null,
|
configuration: null,
|
||||||
costIncrease: true,
|
costIncrease: true,
|
||||||
countSeats: 0,
|
countSeats: 4,
|
||||||
creditRate: RATE,
|
creditRate: RATE,
|
||||||
dealer: null,
|
dealer: null,
|
||||||
dealerBroker: null,
|
dealerBroker: null,
|
||||||
|
|||||||
@ -2,6 +2,8 @@ const { z } = require('zod');
|
|||||||
|
|
||||||
const envSchema = z.object({
|
const envSchema = z.object({
|
||||||
BASE_PATH: z.string().optional().default(''),
|
BASE_PATH: z.string().optional().default(''),
|
||||||
|
DEV_AUTH_TOKEN: z.string().optional(),
|
||||||
|
PASSWORD_1C_TRANSTAX: z.string(),
|
||||||
PORT: z.string().optional(),
|
PORT: z.string().optional(),
|
||||||
SENTRY_AUTH_TOKEN: z.string(),
|
SENTRY_AUTH_TOKEN: z.string(),
|
||||||
SENTRY_DSN: z.string(),
|
SENTRY_DSN: z.string(),
|
||||||
@ -11,7 +13,6 @@ const envSchema = z.object({
|
|||||||
URL_CACHE_GET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/get-queries'),
|
URL_CACHE_GET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/get-queries'),
|
||||||
URL_CACHE_GET_QUERY_DIRECT: z.string().default('http://api:3001/proxy/get-query'),
|
URL_CACHE_GET_QUERY_DIRECT: z.string().default('http://api:3001/proxy/get-query'),
|
||||||
URL_CACHE_RESET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/reset'),
|
URL_CACHE_RESET_QUERIES_DIRECT: z.string().default('http://api:3001/proxy/reset'),
|
||||||
DEV_AUTH_TOKEN: z.string().optional(),
|
|
||||||
URL_CORE_CALCULATE_DIRECT: z.string(),
|
URL_CORE_CALCULATE_DIRECT: z.string(),
|
||||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||||
URL_CRM_CREATEKP_DIRECT: z.string(),
|
URL_CRM_CREATEKP_DIRECT: z.string(),
|
||||||
@ -22,6 +23,7 @@ const envSchema = z.object({
|
|||||||
URL_ELT_OSAGO_DIRECT: z.string(),
|
URL_ELT_OSAGO_DIRECT: z.string(),
|
||||||
URL_GET_USER_DIRECT: z.string(),
|
URL_GET_USER_DIRECT: z.string(),
|
||||||
USE_DEV_COLORS: z.unknown().optional().transform(Boolean),
|
USE_DEV_COLORS: z.unknown().optional().transform(Boolean),
|
||||||
|
USERNAME_1C_TRANSTAX: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = envSchema;
|
module.exports = envSchema;
|
||||||
|
|||||||
@ -11,6 +11,7 @@ const publicRuntimeConfigSchema = envSchema.pick({
|
|||||||
const serverRuntimeConfigSchema = envSchema.pick({
|
const serverRuntimeConfigSchema = envSchema.pick({
|
||||||
BASE_PATH: true,
|
BASE_PATH: true,
|
||||||
DEV_AUTH_TOKEN: true,
|
DEV_AUTH_TOKEN: true,
|
||||||
|
PASSWORD_1C_TRANSTAX: true,
|
||||||
PORT: true,
|
PORT: true,
|
||||||
SENTRY_DSN: true,
|
SENTRY_DSN: true,
|
||||||
SENTRY_ENVIRONMENT: true,
|
SENTRY_ENVIRONMENT: true,
|
||||||
@ -27,6 +28,7 @@ const serverRuntimeConfigSchema = envSchema.pick({
|
|||||||
URL_ELT_KASKO_DIRECT: true,
|
URL_ELT_KASKO_DIRECT: true,
|
||||||
URL_ELT_OSAGO_DIRECT: true,
|
URL_ELT_OSAGO_DIRECT: true,
|
||||||
URL_GET_USER_DIRECT: true,
|
URL_GET_USER_DIRECT: true,
|
||||||
|
USERNAME_1C_TRANSTAX: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@ -12,3 +12,5 @@ export const VEHICLE_SEATS = 20;
|
|||||||
export const ESN = 1.3;
|
export const ESN = 1.3;
|
||||||
export const NSIB_MAX = 5_000_000;
|
export const NSIB_MAX = 5_000_000;
|
||||||
export const NDFL = 0.13;
|
export const NDFL = 0.13;
|
||||||
|
|
||||||
|
export const IRR_THRESHOLD = 0.001;
|
||||||
|
|||||||
@ -255,7 +255,7 @@ query GetQuoteData($quoteId: UUID!) {
|
|||||||
evo_graphs {
|
evo_graphs {
|
||||||
createdon
|
createdon
|
||||||
evo_sumpay_withnds
|
evo_sumpay_withnds
|
||||||
evo_planpayments {
|
evo_planpayments(orderby: { fieldName: "evo_plandate", sortingType: ASC }) {
|
||||||
evo_payment_ratio
|
evo_payment_ratio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -718,6 +718,8 @@ query GetDealerPerson($dealerPersonId: UUID!) {
|
|||||||
evo_return_leasing_dealer
|
evo_return_leasing_dealer
|
||||||
evo_broker_accountid
|
evo_broker_accountid
|
||||||
evo_supplier_financing_accept
|
evo_supplier_financing_accept
|
||||||
|
evo_legal_form
|
||||||
|
evo_inn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,6 +727,7 @@ query GetAgent($agentid: UUID!) {
|
|||||||
agent(accountid: $agentid) {
|
agent(accountid: $agentid) {
|
||||||
label: name
|
label: name
|
||||||
value: accountid
|
value: accountid
|
||||||
|
evo_inn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -39,20 +39,23 @@ export const handlers = [
|
|||||||
rest.post(URL_1C_TRANSTAX, (req, res, ctx) =>
|
rest.post(URL_1C_TRANSTAX, (req, res, ctx) =>
|
||||||
res(
|
res(
|
||||||
ctx.json({
|
ctx.json({
|
||||||
error: null,
|
Error: null,
|
||||||
tax: _.random(100000, 200000),
|
Tax: _.random(100000, 200000),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
rest.post(URL_ELT_OSAGO, async (req, res, ctx) => res(
|
rest.post(URL_ELT_OSAGO, async (req, res, ctx) =>
|
||||||
|
res(
|
||||||
ctx.json({
|
ctx.json({
|
||||||
numCalc: _.random(1000000, 3000000),
|
numCalc: _.random(1000000, 3000000),
|
||||||
skCalcId: _.random(50000000, 60000000).toString(),
|
skCalcId: _.random(50000000, 60000000).toString(),
|
||||||
premiumSum: _.random(10000, 20000),
|
premiumSum: _.random(10000, 20000),
|
||||||
message: 'OSAGO Message',
|
message: 'OSAGO Message',
|
||||||
})
|
})
|
||||||
)),
|
)
|
||||||
rest.post(URL_ELT_KASKO, async (req, res, ctx) => res(
|
),
|
||||||
|
rest.post(URL_ELT_KASKO, async (req, res, ctx) =>
|
||||||
|
res(
|
||||||
ctx.json({
|
ctx.json({
|
||||||
requestId: _.random(3000000, 4000000).toString(),
|
requestId: _.random(3000000, 4000000).toString(),
|
||||||
skCalcId: _.random(50000000, 60000000).toString(),
|
skCalcId: _.random(50000000, 60000000).toString(),
|
||||||
@ -67,7 +70,8 @@ export const handlers = [
|
|||||||
],
|
],
|
||||||
totalFranchise: _.random(20000, 40000),
|
totalFranchise: _.random(20000, 40000),
|
||||||
})
|
})
|
||||||
)),
|
)
|
||||||
|
),
|
||||||
|
|
||||||
// rest.post(URL_CRM_GRAPHQL, (req, res, ctx) => {
|
// rest.post(URL_CRM_GRAPHQL, (req, res, ctx) => {
|
||||||
// return res(ctx.status(503));
|
// return res(ctx.status(503));
|
||||||
|
|||||||
@ -66,10 +66,10 @@ module.exports = withSentryConfig(
|
|||||||
destination: env.URL_CORE_FINGAP_DIRECT,
|
destination: env.URL_CORE_FINGAP_DIRECT,
|
||||||
source: urls.URL_CORE_FINGAP_PROXY,
|
source: urls.URL_CORE_FINGAP_PROXY,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
destination: env.URL_1C_TRANSTAX_DIRECT,
|
// destination: env.URL_1C_TRANSTAX_DIRECT,
|
||||||
source: urls.URL_1C_TRANSTAX_PROXY,
|
// source: urls.URL_1C_TRANSTAX_PROXY,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
destination: env.URL_ELT_KASKO_DIRECT,
|
destination: env.URL_ELT_KASKO_DIRECT,
|
||||||
source: urls.URL_ELT_KASKO_PROXY,
|
source: urls.URL_ELT_KASKO_PROXY,
|
||||||
|
|||||||
38
apps/web/pages/api/1c/transtax.ts
Normal file
38
apps/web/pages/api/1c/transtax.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import type { ResponseTransTax } from '@/api/1c/types';
|
||||||
|
import { serverRuntimeConfigSchema } from '@/config/schema/runtime-config';
|
||||||
|
import { withHandleError } from '@/utils/axios';
|
||||||
|
import type { HttpError } from '@/utils/error';
|
||||||
|
import axios from 'axios';
|
||||||
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||||
|
import getConfig from 'next/config';
|
||||||
|
|
||||||
|
const { serverRuntimeConfig } = getConfig();
|
||||||
|
const { USERNAME_1C_TRANSTAX, PASSWORD_1C_TRANSTAX, URL_1C_TRANSTAX_DIRECT } =
|
||||||
|
serverRuntimeConfigSchema.parse(serverRuntimeConfig);
|
||||||
|
|
||||||
|
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const abortController = new AbortController();
|
||||||
|
|
||||||
|
req.on('close', () => {
|
||||||
|
abortController.abort();
|
||||||
|
});
|
||||||
|
|
||||||
|
const params = req.body as ResponseTransTax;
|
||||||
|
|
||||||
|
withHandleError(
|
||||||
|
axios.get<ResponseTransTax>(URL_1C_TRANSTAX_DIRECT, {
|
||||||
|
auth: {
|
||||||
|
password: PASSWORD_1C_TRANSTAX,
|
||||||
|
username: USERNAME_1C_TRANSTAX,
|
||||||
|
},
|
||||||
|
params,
|
||||||
|
signal: abortController.signal,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.then(({ data }) => res.json(data))
|
||||||
|
.catch((error) => {
|
||||||
|
const _err = error as HttpError;
|
||||||
|
|
||||||
|
return res.json({ message: _err.message });
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -10,8 +10,17 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
return ValuesSchema.pick({ product: true, saleBonus: true }).superRefine(
|
return ValuesSchema.pick({ product: true, saleBonus: true }).superRefine(
|
||||||
async ({ product, saleBonus }, ctx) => {
|
async ({ product, saleBonus }, ctx) => {
|
||||||
const coefficient = await getCoefficient(product);
|
const coefficient = await getCoefficient(product);
|
||||||
|
const minBonus = (coefficient?.evo_correction_coefficient || 0) * 100;
|
||||||
const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100;
|
const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100;
|
||||||
|
|
||||||
|
if (round(saleBonus, 2) < round(minBonus, 2)) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'Бонус не может быть ниже установленного по СОТ',
|
||||||
|
path: ['tbxSaleBonus'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (round(saleBonus, 2) > round(maxBonus, 2)) {
|
if (round(saleBonus, 2) > round(maxBonus, 2)) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import helper from '../lib/helper';
|
import helper from '../lib/helper';
|
||||||
|
import { IRR_THRESHOLD } from '@/constants/values';
|
||||||
import type { ProcessContext } from '@/process/types';
|
import type { ProcessContext } from '@/process/types';
|
||||||
import { disposableReaction } from '@/utils/mobx';
|
import { disposableReaction } from '@/utils/mobx';
|
||||||
import { comparer, reaction } from 'mobx';
|
import { comparer, reaction } from 'mobx';
|
||||||
@ -31,7 +32,8 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
|||||||
|
|
||||||
const { getIrr } = helper({ apolloClient });
|
const { getIrr } = helper({ apolloClient });
|
||||||
|
|
||||||
reaction(
|
disposableReaction(
|
||||||
|
() => $process.has('LoadKP'),
|
||||||
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
|
() => $calculation.$values.getValues(['product', 'tarif', 'bonusCoefficient']),
|
||||||
async (values) => {
|
async (values) => {
|
||||||
const { min, max } = await getIrr(values);
|
const { min, max } = await getIrr(values);
|
||||||
@ -40,6 +42,19 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// костыль
|
||||||
|
disposableReaction(
|
||||||
|
() =>
|
||||||
|
$process.has('LoadKP') ||
|
||||||
|
$calculation.element('radioLastPaymentRule').getValue() === 100_000_002,
|
||||||
|
() => $calculation.element('labelIrrInfo').getValue(),
|
||||||
|
({ min }) => {
|
||||||
|
if ($calculation.element('radioLastPaymentRule').getValue() === 100_000_002) return;
|
||||||
|
|
||||||
|
$calculation.element('tbxIRR_Perc').setValue(min + IRR_THRESHOLD);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
disposableReaction(
|
disposableReaction(
|
||||||
() => $process.has('Calculate') || $process.has('CreateKP'),
|
() => $process.has('Calculate') || $process.has('CreateKP'),
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -39,14 +39,10 @@ export default function helper({
|
|||||||
x?.evo_type_ins_policy?.includes(100_000_000) &&
|
x?.evo_type_ins_policy?.includes(100_000_000) &&
|
||||||
// leaseObjectCategory &&
|
// leaseObjectCategory &&
|
||||||
// x.evo_kasko_category?.includes(leaseObjectCategory) &&
|
// x.evo_kasko_category?.includes(leaseObjectCategory) &&
|
||||||
evo_leasingobject_type?.evo_id
|
|
||||||
)
|
|
||||||
.filter(
|
|
||||||
(x) =>
|
|
||||||
(evo_leasingobject_type?.evo_id &&
|
(evo_leasingobject_type?.evo_id &&
|
||||||
['6', '9', '10'].includes(evo_leasingobject_type.evo_id) &&
|
['6', '9', '10'].includes(evo_leasingobject_type.evo_id)
|
||||||
x?.evo_id_elt_smr) ||
|
? x?.evo_id_elt_smr
|
||||||
x?.evo_id_elt
|
: x?.evo_id_elt)
|
||||||
)
|
)
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
...defaultRow,
|
...defaultRow,
|
||||||
|
|||||||
@ -618,10 +618,26 @@ export async function makeEltKaskoRequest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const classification =
|
let classification = '11606';
|
||||||
leaseObjectCategory && [100_000_002, 100_000_003, 100_000_004].includes(leaseObjectCategory)
|
|
||||||
? '11635'
|
switch (evo_leasingobject_type?.evo_id) {
|
||||||
: '0';
|
case '7': {
|
||||||
|
classification = '11611';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '3': {
|
||||||
|
classification = '11607';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '8': {
|
||||||
|
classification = '11650';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
classification = '11606';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let INN = '';
|
let INN = '';
|
||||||
const leadid = $calculation.element('selectLead').getValue();
|
const leadid = $calculation.element('selectLead').getValue();
|
||||||
|
|||||||
@ -178,7 +178,7 @@ export async function convertEltKaskoResponse(input: ConvertEltKaskoResponseInpu
|
|||||||
skCalcId = defaultRow.skCalcId;
|
skCalcId = defaultRow.skCalcId;
|
||||||
sum = defaultRow.sum;
|
sum = defaultRow.sum;
|
||||||
totalFranchise = defaultRow.totalFranchise;
|
totalFranchise = defaultRow.totalFranchise;
|
||||||
error = 'Расчет возможен только через отдел страхования ЛК';
|
error = 'Расчет закрыт';
|
||||||
}
|
}
|
||||||
|
|
||||||
const cost =
|
const cost =
|
||||||
|
|||||||
@ -259,6 +259,8 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let okved: string | null | undefined;
|
let okved: string | null | undefined;
|
||||||
|
let evo_inn: string | null | undefined;
|
||||||
|
|
||||||
if (leadid) {
|
if (leadid) {
|
||||||
const {
|
const {
|
||||||
data: { lead },
|
data: { lead },
|
||||||
@ -268,6 +270,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
okved = lead?.accountidData?.evo_okved;
|
okved = lead?.accountidData?.evo_okved;
|
||||||
|
evo_inn = lead?.evo_inn;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!okved && opportunityid) {
|
if (!okved && opportunityid) {
|
||||||
@ -302,6 +305,14 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
|||||||
path: ['eltKasko', 'eltOsago'],
|
path: ['eltKasko', 'eltOsago'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!evo_inn) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'ИНН в интересе не заполнен',
|
||||||
|
path: ['eltKasko', 'eltOsago'],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import * as CRMTypes from '@/graphql/crm.types';
|
|||||||
import { getCurrentDateString } from '@/utils/date';
|
import { getCurrentDateString } from '@/utils/date';
|
||||||
import { normalizeOptions } from '@/utils/entity';
|
import { normalizeOptions } from '@/utils/entity';
|
||||||
import { disposableReaction } from '@/utils/mobx';
|
import { disposableReaction } from '@/utils/mobx';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import { reaction } from 'mobx';
|
import { reaction } from 'mobx';
|
||||||
|
|
||||||
export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||||
@ -186,18 +185,16 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
|||||||
const carCategory = getCarCategory(objectTypeTax);
|
const carCategory = getCarCategory(objectTypeTax);
|
||||||
|
|
||||||
if (OKTMO) {
|
if (OKTMO) {
|
||||||
const currentDate = dayjs().utc(false).toDate();
|
|
||||||
|
|
||||||
const response = await queryClient.fetchQuery(
|
const response = await queryClient.fetchQuery(
|
||||||
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear],
|
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear, OKTMO],
|
||||||
(context) =>
|
(context) =>
|
||||||
getTransTax(
|
getTransTax(
|
||||||
{
|
{
|
||||||
|
CalcDate: getCurrentDateString(),
|
||||||
|
CarCategory: carCategory,
|
||||||
OKTMO,
|
OKTMO,
|
||||||
calcDate: currentDate,
|
Power: leaseObjectMotorPower,
|
||||||
carCategory,
|
Year: leaseObjectYear,
|
||||||
power: leaseObjectMotorPower,
|
|
||||||
year: leaseObjectYear,
|
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
),
|
),
|
||||||
@ -206,8 +203,8 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response?.tax) {
|
if (response?.Tax) {
|
||||||
$calculation.element('tbxVehicleTaxInYear').setValue(response.tax);
|
$calculation.element('tbxVehicleTaxInYear').setValue(response.Tax);
|
||||||
} else {
|
} else {
|
||||||
$calculation.element('tbxVehicleTaxInYear').resetValue();
|
$calculation.element('tbxVehicleTaxInYear').resetValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -207,6 +207,7 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// объединить со строчкой 308
|
||||||
debouncedReaction(
|
debouncedReaction(
|
||||||
() => $calculation.$values.getValues(['leaseObjectCategory', 'leasingWithoutKasko']),
|
() => $calculation.$values.getValues(['leaseObjectCategory', 'leasingWithoutKasko']),
|
||||||
async ({ leaseObjectCategory, leasingWithoutKasko }) => {
|
async ({ leaseObjectCategory, leasingWithoutKasko }) => {
|
||||||
@ -304,6 +305,7 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// объединить со строчкой 210
|
||||||
reaction(
|
reaction(
|
||||||
() => $calculation.$values.getValues(['leaseObjectType', 'maxSpeed']),
|
() => $calculation.$values.getValues(['leaseObjectType', 'maxSpeed']),
|
||||||
async ({ leaseObjectType: leaseObjectTypeId, maxSpeed }) => {
|
async ({ leaseObjectType: leaseObjectTypeId, maxSpeed }) => {
|
||||||
@ -330,7 +332,11 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
query: CRMTypes.GetInsuranceCompaniesDocument,
|
query: CRMTypes.GetInsuranceCompaniesDocument,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (evo_leasingobject_type?.evo_id === '9' && maxSpeed < 20) {
|
if (
|
||||||
|
evo_leasingobject_type?.evo_id &&
|
||||||
|
['9', '6', '10'].includes(evo_leasingobject_type.evo_id) &&
|
||||||
|
maxSpeed < 20
|
||||||
|
) {
|
||||||
const otherInsuranceCompany = accounts?.find(
|
const otherInsuranceCompany = accounts?.find(
|
||||||
(x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ')
|
(x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ')
|
||||||
);
|
);
|
||||||
@ -347,7 +353,16 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
$tables.insurance.row('osago').column('insured').setValue(100_000_000).block();
|
$tables.insurance.row('osago').column('insured').setValue(100_000_000).block();
|
||||||
$tables.insurance.row('osago').column('insCost').setValue(0).block();
|
$tables.insurance.row('osago').column('insCost').setValue(0).block();
|
||||||
} else {
|
} else {
|
||||||
$tables.insurance.row('osago').column('insuranceCompany').unblock();
|
const defaultOsagoOptions = accounts?.filter((x) =>
|
||||||
|
x?.evo_type_ins_policy?.includes(100_000_001)
|
||||||
|
);
|
||||||
|
|
||||||
|
$tables.insurance
|
||||||
|
.row('osago')
|
||||||
|
.column('insuranceCompany')
|
||||||
|
.setOptions(normalizeOptions(defaultOsagoOptions))
|
||||||
|
.unblock();
|
||||||
|
|
||||||
$tables.insurance.row('osago').column('insured').unblock();
|
$tables.insurance.row('osago').column('insured').unblock();
|
||||||
$tables.insurance.row('osago').column('insCost').unblock();
|
$tables.insurance.row('osago').column('insCost').unblock();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -256,7 +256,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
evo_leasingobject_type?.evo_id &&
|
evo_leasingobject_type?.evo_id &&
|
||||||
['9'].includes(evo_leasingobject_type?.evo_id) &&
|
['9', '6', '10'].includes(evo_leasingobject_type?.evo_id) &&
|
||||||
maxSpeed < 20 &&
|
maxSpeed < 20 &&
|
||||||
insurance.values.osago.insured === 100_000_001
|
insurance.values.osago.insured === 100_000_001
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -136,21 +136,21 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evo_leasingobject_type?.evo_id === '1' && countSeats >= 9) {
|
if (evo_leasingobject_type?.evo_id === '1' && (countSeats <= 0 || countSeats > 9)) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Количество мест должно быть меньше 9',
|
message: 'Количество мест должно быть от 0 до 9',
|
||||||
path: ['tbxCountSeats'],
|
path: ['tbxCountSeats'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(evo_leasingobject_type?.evo_id === '4' || evo_leasingobject_type?.evo_id === '5') &&
|
(evo_leasingobject_type?.evo_id === '4' || evo_leasingobject_type?.evo_id === '5') &&
|
||||||
countSeats <= 8
|
countSeats <= 9
|
||||||
) {
|
) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Количество мест должно быть больше 8',
|
message: 'Количество мест должно быть не меньше 9',
|
||||||
path: ['tbxCountSeats'],
|
path: ['tbxCountSeats'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,4 +167,53 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
.setValue(Boolean(evo_baseproduct?.evo_supplier_financing_accept));
|
.setValue(Boolean(evo_baseproduct?.evo_supplier_financing_accept));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
{
|
||||||
|
// eslint-disable-next-line no-inner-declarations
|
||||||
|
function unblock() {
|
||||||
|
const cbxPartialVAT = $calculation.element('cbxPartialVAT');
|
||||||
|
cbxPartialVAT.unblock();
|
||||||
|
if (cbxPartialVAT.getValue()) $calculation.element('tbxVATInLeaseObjectPrice').unblock();
|
||||||
|
|
||||||
|
$calculation.element('cbxInsDecentral').unblock();
|
||||||
|
$calculation.element('selectDealerPerson').unblock();
|
||||||
|
$calculation.element('selectDealerRewardCondition').unblock();
|
||||||
|
$calculation.element('selectDealerBroker').unblock();
|
||||||
|
$calculation.element('selectDealerBrokerRewardCondition').unblock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see 'apps/web/process/used-pl/reactions.ts:common (40)'
|
||||||
|
*/
|
||||||
|
reaction(
|
||||||
|
() => $calculation.$values.getValues(['dealerPerson', 'partialVAT']),
|
||||||
|
async ({ dealerPerson: dealerPersonId }) => {
|
||||||
|
if (!dealerPersonId) {
|
||||||
|
unblock();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data } = await apolloClient.query({
|
||||||
|
query: CRMTypes.GetDealerPersonDocument,
|
||||||
|
variables: {
|
||||||
|
dealerPersonId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data?.dealer_person?.evo_legal_form === 100_000_004) {
|
||||||
|
$calculation.element('cbxPartialVAT').setValue(true).block();
|
||||||
|
$calculation.element('tbxVATInLeaseObjectPrice').resetValue().block();
|
||||||
|
$calculation.element('cbxInsDecentral').setValue(false).block();
|
||||||
|
$calculation.element('selectDealerRewardCondition').block();
|
||||||
|
$calculation.element('tbxDealerRewardSumm').resetValue().block();
|
||||||
|
$calculation.element('selectDealerBroker').resetValue().block();
|
||||||
|
$calculation.element('selectDealerBrokerRewardCondition').resetValue().block();
|
||||||
|
$calculation.element('tbxDealerBrokerRewardSumm').resetValue().block();
|
||||||
|
} else {
|
||||||
|
unblock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -190,7 +190,7 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
dealerBroker,
|
dealerBroker,
|
||||||
dealerBrokerRewardCondition,
|
dealerBrokerRewardCondition,
|
||||||
dealerBrokerRewardSumm,
|
dealerBrokerRewardSumm,
|
||||||
dealerPerson,
|
dealerPerson: dealerPersonId,
|
||||||
dealerRewardCondition,
|
dealerRewardCondition,
|
||||||
dealerRewardSumm,
|
dealerRewardSumm,
|
||||||
finDepartmentRewardCondtion,
|
finDepartmentRewardCondtion,
|
||||||
@ -248,12 +248,12 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
dealerRewardSumm > 0 &&
|
dealerRewardSumm > 0 &&
|
||||||
Boolean(dealerPerson) &&
|
Boolean(dealerPersonId) &&
|
||||||
((dealerPerson === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
((dealerPersonId === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||||
(dealerPerson === indAgent && indAgentRewardSumm > 0) ||
|
(dealerPersonId === indAgent && indAgentRewardSumm > 0) ||
|
||||||
(dealerPerson === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
(dealerPersonId === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||||
(dealerPerson === calcBroker && calcBrokerRewardSum > 0) ||
|
(dealerPersonId === calcBroker && calcBrokerRewardSum > 0) ||
|
||||||
(dealerPerson === calcFinDepartment && finDepartmentRewardSumm > 0))
|
(dealerPersonId === calcFinDepartment && finDepartmentRewardSumm > 0))
|
||||||
) {
|
) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
@ -265,7 +265,7 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
if (
|
if (
|
||||||
dealerBrokerRewardSumm > 0 &&
|
dealerBrokerRewardSumm > 0 &&
|
||||||
Boolean(dealerBroker) &&
|
Boolean(dealerBroker) &&
|
||||||
((dealerBroker === dealerPerson && dealerRewardSumm > 0) ||
|
((dealerBroker === dealerPersonId && dealerRewardSumm > 0) ||
|
||||||
(dealerBroker === indAgent && indAgentRewardSumm > 0) ||
|
(dealerBroker === indAgent && indAgentRewardSumm > 0) ||
|
||||||
(dealerBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
(dealerBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||||
(dealerBroker === calcBroker && calcBrokerRewardSum > 0) ||
|
(dealerBroker === calcBroker && calcBrokerRewardSum > 0) ||
|
||||||
@ -281,7 +281,7 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
if (
|
if (
|
||||||
indAgentRewardSumm > 0 &&
|
indAgentRewardSumm > 0 &&
|
||||||
Boolean(indAgent) &&
|
Boolean(indAgent) &&
|
||||||
((indAgent === dealerPerson && dealerRewardSumm > 0) ||
|
((indAgent === dealerPersonId && dealerRewardSumm > 0) ||
|
||||||
(indAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
(indAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||||
(indAgent === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
(indAgent === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||||
(indAgent === calcBroker && calcBrokerRewardSum > 0) ||
|
(indAgent === calcBroker && calcBrokerRewardSum > 0) ||
|
||||||
@ -297,7 +297,7 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
if (
|
if (
|
||||||
calcDoubleAgentRewardSumm > 0 &&
|
calcDoubleAgentRewardSumm > 0 &&
|
||||||
Boolean(calcDoubleAgent) &&
|
Boolean(calcDoubleAgent) &&
|
||||||
((calcDoubleAgent === dealerPerson && dealerRewardSumm > 0) ||
|
((calcDoubleAgent === dealerPersonId && dealerRewardSumm > 0) ||
|
||||||
(calcDoubleAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
(calcDoubleAgent === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||||
(calcDoubleAgent === indAgent && indAgentRewardSumm > 0) ||
|
(calcDoubleAgent === indAgent && indAgentRewardSumm > 0) ||
|
||||||
(calcDoubleAgent === calcBroker && calcBrokerRewardSum > 0) ||
|
(calcDoubleAgent === calcBroker && calcBrokerRewardSum > 0) ||
|
||||||
@ -313,7 +313,7 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
if (
|
if (
|
||||||
calcBrokerRewardSum > 0 &&
|
calcBrokerRewardSum > 0 &&
|
||||||
Boolean(calcBroker) &&
|
Boolean(calcBroker) &&
|
||||||
((calcBroker === dealerPerson && dealerRewardSumm > 0) ||
|
((calcBroker === dealerPersonId && dealerRewardSumm > 0) ||
|
||||||
(calcBroker === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
(calcBroker === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||||
(calcBroker === indAgent && indAgentRewardSumm > 0) ||
|
(calcBroker === indAgent && indAgentRewardSumm > 0) ||
|
||||||
(calcBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
(calcBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||||
@ -329,7 +329,7 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
if (
|
if (
|
||||||
finDepartmentRewardSumm > 0 &&
|
finDepartmentRewardSumm > 0 &&
|
||||||
Boolean(calcFinDepartment) &&
|
Boolean(calcFinDepartment) &&
|
||||||
((calcFinDepartment === dealerPerson && dealerRewardSumm > 0) ||
|
((calcFinDepartment === dealerPersonId && dealerRewardSumm > 0) ||
|
||||||
(calcFinDepartment === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
(calcFinDepartment === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||||
(calcFinDepartment === indAgent && indAgentRewardSumm > 0) ||
|
(calcFinDepartment === indAgent && indAgentRewardSumm > 0) ||
|
||||||
(calcFinDepartment === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
(calcFinDepartment === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||||
@ -360,7 +360,7 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!dealerPerson && !dealer?.evo_return_leasing_dealer)
|
if (!dealerPersonId && !dealer?.evo_return_leasing_dealer)
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Не заполнено поле',
|
message: 'Не заполнено поле',
|
||||||
@ -377,14 +377,29 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
const { validateRewardSum, validateRewardWithoutOtherAgent } = helper({ ...context, ctx });
|
const { validateRewardSum, validateRewardWithoutOtherAgent } = helper({ ...context, ctx });
|
||||||
|
|
||||||
await validateRewardSum({
|
await validateRewardSum({
|
||||||
agentid: dealerPerson,
|
agentid: dealerPersonId,
|
||||||
conditionId: dealerRewardCondition,
|
conditionId: dealerRewardCondition,
|
||||||
sum: dealerRewardSumm,
|
sum: dealerRewardSumm,
|
||||||
sumFieldName: 'tbxDealerRewardSumm',
|
sumFieldName: 'tbxDealerRewardSumm',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let evo_broker_accountid: string | null = null;
|
||||||
|
|
||||||
|
if (dealerPersonId) {
|
||||||
|
const {
|
||||||
|
data: { dealer_person },
|
||||||
|
} = await apolloClient.query({
|
||||||
|
query: CRMTypes.GetDealerPersonDocument,
|
||||||
|
variables: {
|
||||||
|
dealerPersonId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
evo_broker_accountid = dealer_person?.evo_broker_accountid || null;
|
||||||
|
}
|
||||||
|
|
||||||
await validateRewardSum({
|
await validateRewardSum({
|
||||||
agentid: dealerBroker,
|
agentid: dealerBroker || evo_broker_accountid,
|
||||||
conditionId: dealerBrokerRewardCondition,
|
conditionId: dealerBrokerRewardCondition,
|
||||||
sum: dealerBrokerRewardSumm,
|
sum: dealerBrokerRewardSumm,
|
||||||
sumFieldName: 'tbxDealerBrokerRewardSumm',
|
sumFieldName: 'tbxDealerBrokerRewardSumm',
|
||||||
@ -467,6 +482,46 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dealerPersonId) {
|
||||||
|
const {
|
||||||
|
data: { dealer_person },
|
||||||
|
} = await apolloClient.query({
|
||||||
|
query: CRMTypes.GetDealerPersonDocument,
|
||||||
|
variables: {
|
||||||
|
dealerPersonId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-inner-declarations
|
||||||
|
async function isAgentEqualsToDealerPerson(agentid: string | null) {
|
||||||
|
if (!agentid) return false;
|
||||||
|
if (agentid === dealerPersonId) return true;
|
||||||
|
|
||||||
|
const { data } = await apolloClient.query({
|
||||||
|
query: CRMTypes.GetAgentDocument,
|
||||||
|
variables: {
|
||||||
|
agentid,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data?.agent?.evo_inn === dealer_person?.evo_inn;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
dealer_person?.evo_legal_form === 100_000_004 &&
|
||||||
|
((await isAgentEqualsToDealerPerson(indAgent)) ||
|
||||||
|
(await isAgentEqualsToDealerPerson(calcDoubleAgent)) ||
|
||||||
|
(await isAgentEqualsToDealerPerson(calcBroker)) ||
|
||||||
|
(await isAgentEqualsToDealerPerson(calcFinDepartment)))
|
||||||
|
) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'Нельзя закладывать АВ поставщику-ФЛ',
|
||||||
|
path: ['selectDealerPerson'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (brandId) {
|
if (brandId) {
|
||||||
const {
|
const {
|
||||||
data: { evo_brand },
|
data: { evo_brand },
|
||||||
|
|||||||
@ -90,13 +90,13 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
$calculation.element('selectImportProgram').resetValue();
|
$calculation.element('selectImportProgram').resetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
// if (
|
||||||
productId &&
|
// productId &&
|
||||||
partialVAT &&
|
// partialVAT &&
|
||||||
$calculation.element('cbxRecalcWithRevision').getValue() === false
|
// $calculation.element('cbxRecalcWithRevision').getValue() === false
|
||||||
) {
|
// ) {
|
||||||
$calculation.element('cbxLeaseObjectUsed').setValue(true);
|
// $calculation.element('cbxLeaseObjectUsed').setValue(true);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,17 @@ import type { AxiosError } from 'axios';
|
|||||||
import { isAxiosError } from 'axios';
|
import { isAxiosError } from 'axios';
|
||||||
import { pick } from 'radash';
|
import { pick } from 'radash';
|
||||||
|
|
||||||
function getErrorMessage<
|
type ResponseError = {
|
||||||
T extends { error?: string; errors?: string[]; fullMessage?: string; message?: string }
|
Error?: string;
|
||||||
>(error: AxiosError<T>) {
|
error?: string;
|
||||||
|
errors?: string[];
|
||||||
|
fullMessage?: string;
|
||||||
|
message?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
function getErrorMessage<T extends ResponseError>(error: AxiosError<T>) {
|
||||||
return (
|
return (
|
||||||
|
error.response?.data?.Error ||
|
||||||
error.response?.data?.error ||
|
error.response?.data?.error ||
|
||||||
error.response?.data?.errors?.[0] ||
|
error.response?.data?.errors?.[0] ||
|
||||||
error.response?.data.fullMessage ||
|
error.response?.data.fullMessage ||
|
||||||
|
|||||||
@ -16,6 +16,8 @@ services:
|
|||||||
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
|
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
|
||||||
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
|
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
|
||||||
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
|
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
|
||||||
|
- USERNAME_1C_TRANSTAX=${USERNAME_1C_TRANSTAX}
|
||||||
|
- PASSWORD_1C_TRANSTAX=${PASSWORD_1C_TRANSTAX}
|
||||||
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
|
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
|
||||||
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
|
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
|
||||||
build:
|
build:
|
||||||
@ -34,6 +36,8 @@ services:
|
|||||||
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
|
- URL_CORE_FINGAP_DIRECT=${URL_CORE_FINGAP_DIRECT}
|
||||||
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
|
- URL_CORE_CALCULATE_DIRECT=${URL_CORE_CALCULATE_DIRECT}
|
||||||
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
|
- URL_1C_TRANSTAX_DIRECT=${URL_1C_TRANSTAX_DIRECT}
|
||||||
|
- USERNAME_1C_TRANSTAX=${USERNAME_1C_TRANSTAX}
|
||||||
|
- PASSWORD_1C_TRANSTAX=${PASSWORD_1C_TRANSTAX}
|
||||||
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
|
- URL_ELT_OSAGO_DIRECT=${URL_ELT_OSAGO_DIRECT}
|
||||||
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
|
- URL_ELT_KASKO_DIRECT=${URL_ELT_KASKO_DIRECT}
|
||||||
context: .
|
context: .
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user