Compare commits
33 Commits
dev
...
release/dy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbf4cfb848 | ||
|
|
8341f79d9c | ||
|
|
3446ac8502 | ||
|
|
681fe6139a | ||
|
|
72ec742b39 | ||
|
|
d1774f803f | ||
|
|
c6f0474f66 | ||
|
|
cd0b53f7d6 | ||
|
|
d4effe2210 | ||
|
|
d9bf1790e7 | ||
|
|
27c3308f09 | ||
|
|
26aa09a5e4 | ||
|
|
7dcae62f5f | ||
|
|
5954a64941 | ||
|
|
66cc33b899 | ||
|
|
3f7798154e | ||
|
|
572bfc8239 | ||
|
|
bcb9815738 | ||
|
|
d76040bb95 | ||
|
|
9447bba00e | ||
|
|
c87ab861ee | ||
|
|
5e6b17f9c1 | ||
|
|
ce099a73e5 | ||
|
|
eb56559adb | ||
|
|
c67e7a21b5 | ||
|
|
25ad87b7b2 | ||
|
|
f6cc9927c9 | ||
|
|
045472dfb5 | ||
|
|
3e2af34fe6 | ||
|
|
06bd31da20 | ||
|
|
6edd4e0156 | ||
|
|
48a527a6c5 | ||
|
|
76f1174ec6 |
@ -47,8 +47,6 @@ 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,12 +1,11 @@
|
|||||||
export type RequestTransTax = {
|
export type RequestTransTax = {
|
||||||
CalcDate: string;
|
|
||||||
CarCategory: string;
|
|
||||||
OKTMO: string;
|
OKTMO: string;
|
||||||
Power: number;
|
calcDate: Date;
|
||||||
Year: number;
|
carCategory: string;
|
||||||
|
power: number;
|
||||||
|
year: number;
|
||||||
};
|
};
|
||||||
export type ResponseTransTax = {
|
export type ResponseTransTax = {
|
||||||
Error: string;
|
error: string;
|
||||||
Tax: number;
|
tax: number;
|
||||||
TaxRate: number;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,10 +9,6 @@ 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();
|
||||||
|
|
||||||
@ -48,15 +44,7 @@ export function createLink(headers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (operation.operationName === 'GetInsuranceCompanies') {
|
if (operation.operationName === 'GetInsuranceCompanies') {
|
||||||
response.data.accounts = response.data.accounts
|
response.data.accounts = response.data.accounts.map((account) => {
|
||||||
.sort((a, b) => {
|
|
||||||
if (isSovkom(a)) return -1;
|
|
||||||
|
|
||||||
if (isSovkom(b)) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
})
|
|
||||||
.map((account) => {
|
|
||||||
const substring = account.label.match(/"(.+)"/u);
|
const substring = account.label.match(/"(.+)"/u);
|
||||||
if (substring)
|
if (substring)
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -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: 4,
|
countSeats: 0,
|
||||||
creditRate: RATE,
|
creditRate: RATE,
|
||||||
dealer: null,
|
dealer: null,
|
||||||
dealerBroker: null,
|
dealerBroker: null,
|
||||||
|
|||||||
@ -2,8 +2,6 @@ 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(),
|
||||||
@ -13,6 +11,7 @@ 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(),
|
||||||
@ -23,7 +22,6 @@ 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,7 +11,6 @@ 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,
|
||||||
@ -28,7 +27,6 @@ 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,5 +12,3 @@ 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(orderby: { fieldName: "evo_plandate", sortingType: ASC }) {
|
evo_planpayments {
|
||||||
evo_payment_ratio
|
evo_payment_ratio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -718,8 +718,6 @@ 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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,7 +725,6 @@ 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,23 +39,20 @@ 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) =>
|
rest.post(URL_ELT_OSAGO, async (req, res, ctx) => res(
|
||||||
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(),
|
||||||
@ -70,8 +67,7 @@ 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,
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
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,17 +10,8 @@ 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,5 +1,4 @@
|
|||||||
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';
|
||||||
@ -32,8 +31,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
|||||||
|
|
||||||
const { getIrr } = helper({ apolloClient });
|
const { getIrr } = helper({ apolloClient });
|
||||||
|
|
||||||
disposableReaction(
|
reaction(
|
||||||
() => $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);
|
||||||
@ -42,19 +40,6 @@ 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,10 +39,14 @@ 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,26 +618,10 @@ export async function makeEltKaskoRequest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let classification = '11606';
|
const classification =
|
||||||
|
leaseObjectCategory && [100_000_002, 100_000_003, 100_000_004].includes(leaseObjectCategory)
|
||||||
switch (evo_leasingobject_type?.evo_id) {
|
? '11635'
|
||||||
case '7': {
|
: '0';
|
||||||
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,8 +259,6 @@ 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 },
|
||||||
@ -270,7 +268,6 @@ 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) {
|
||||||
@ -305,14 +302,6 @@ 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,6 +9,7 @@ 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) {
|
||||||
@ -185,16 +186,18 @@ 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, OKTMO],
|
['1c', 'trans-tax', carCategory, leaseObjectMotorPower, leaseObjectYear],
|
||||||
(context) =>
|
(context) =>
|
||||||
getTransTax(
|
getTransTax(
|
||||||
{
|
{
|
||||||
CalcDate: getCurrentDateString(),
|
|
||||||
CarCategory: carCategory,
|
|
||||||
OKTMO,
|
OKTMO,
|
||||||
Power: leaseObjectMotorPower,
|
calcDate: currentDate,
|
||||||
Year: leaseObjectYear,
|
carCategory,
|
||||||
|
power: leaseObjectMotorPower,
|
||||||
|
year: leaseObjectYear,
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
),
|
),
|
||||||
@ -203,8 +206,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,7 +207,6 @@ 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 }) => {
|
||||||
@ -305,7 +304,6 @@ 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 }) => {
|
||||||
@ -332,11 +330,7 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
query: CRMTypes.GetInsuranceCompaniesDocument,
|
query: CRMTypes.GetInsuranceCompaniesDocument,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (evo_leasingobject_type?.evo_id === '9' && maxSpeed < 20) {
|
||||||
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('ПРОЧИЕ')
|
||||||
);
|
);
|
||||||
@ -353,16 +347,7 @@ 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 {
|
||||||
const defaultOsagoOptions = accounts?.filter((x) =>
|
$tables.insurance.row('osago').column('insuranceCompany').unblock();
|
||||||
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', '6', '10'].includes(evo_leasingobject_type?.evo_id) &&
|
['9'].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 <= 0 || countSeats > 9)) {
|
if (evo_leasingobject_type?.evo_id === '1' && countSeats >= 9) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Количество мест должно быть от 0 до 9',
|
message: 'Количество мест должно быть меньше 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 <= 9
|
countSeats <= 8
|
||||||
) {
|
) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Количество мест должно быть не меньше 9',
|
message: 'Количество мест должно быть больше 8',
|
||||||
path: ['tbxCountSeats'],
|
path: ['tbxCountSeats'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,53 +167,4 @@ 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: dealerPersonId,
|
dealerPerson,
|
||||||
dealerRewardCondition,
|
dealerRewardCondition,
|
||||||
dealerRewardSumm,
|
dealerRewardSumm,
|
||||||
finDepartmentRewardCondtion,
|
finDepartmentRewardCondtion,
|
||||||
@ -248,12 +248,12 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
dealerRewardSumm > 0 &&
|
dealerRewardSumm > 0 &&
|
||||||
Boolean(dealerPersonId) &&
|
Boolean(dealerPerson) &&
|
||||||
((dealerPersonId === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
((dealerPerson === dealerBroker && dealerBrokerRewardSumm > 0) ||
|
||||||
(dealerPersonId === indAgent && indAgentRewardSumm > 0) ||
|
(dealerPerson === indAgent && indAgentRewardSumm > 0) ||
|
||||||
(dealerPersonId === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
(dealerPerson === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) ||
|
||||||
(dealerPersonId === calcBroker && calcBrokerRewardSum > 0) ||
|
(dealerPerson === calcBroker && calcBrokerRewardSum > 0) ||
|
||||||
(dealerPersonId === calcFinDepartment && finDepartmentRewardSumm > 0))
|
(dealerPerson === 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 === dealerPersonId && dealerRewardSumm > 0) ||
|
((dealerBroker === dealerPerson && 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 === dealerPersonId && dealerRewardSumm > 0) ||
|
((indAgent === dealerPerson && 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 === dealerPersonId && dealerRewardSumm > 0) ||
|
((calcDoubleAgent === dealerPerson && 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 === dealerPersonId && dealerRewardSumm > 0) ||
|
((calcBroker === dealerPerson && 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 === dealerPersonId && dealerRewardSumm > 0) ||
|
((calcFinDepartment === dealerPerson && 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 (!dealerPersonId && !dealer?.evo_return_leasing_dealer)
|
if (!dealerPerson && !dealer?.evo_return_leasing_dealer)
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Не заполнено поле',
|
message: 'Не заполнено поле',
|
||||||
@ -377,29 +377,14 @@ export function createValidationSchema(context: ValidationContext) {
|
|||||||
const { validateRewardSum, validateRewardWithoutOtherAgent } = helper({ ...context, ctx });
|
const { validateRewardSum, validateRewardWithoutOtherAgent } = helper({ ...context, ctx });
|
||||||
|
|
||||||
await validateRewardSum({
|
await validateRewardSum({
|
||||||
agentid: dealerPersonId,
|
agentid: dealerPerson,
|
||||||
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 || evo_broker_accountid,
|
agentid: dealerBroker,
|
||||||
conditionId: dealerBrokerRewardCondition,
|
conditionId: dealerBrokerRewardCondition,
|
||||||
sum: dealerBrokerRewardSumm,
|
sum: dealerBrokerRewardSumm,
|
||||||
sumFieldName: 'tbxDealerBrokerRewardSumm',
|
sumFieldName: 'tbxDealerBrokerRewardSumm',
|
||||||
@ -482,46 +467,6 @@ 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,17 +4,10 @@ import type { AxiosError } from 'axios';
|
|||||||
import { isAxiosError } from 'axios';
|
import { isAxiosError } from 'axios';
|
||||||
import { pick } from 'radash';
|
import { pick } from 'radash';
|
||||||
|
|
||||||
type ResponseError = {
|
function getErrorMessage<
|
||||||
Error?: string;
|
T extends { error?: string; errors?: string[]; fullMessage?: string; message?: string }
|
||||||
error?: string;
|
>(error: AxiosError<T>) {
|
||||||
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,8 +16,6 @@ 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:
|
||||||
@ -36,8 +34,6 @@ 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