eslint fixes: pt.1
This commit is contained in:
parent
9360eb848c
commit
754e8c6c39
@ -20,6 +20,8 @@
|
||||
"rules": {
|
||||
"no-console": "warn",
|
||||
"react/display-name": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off"
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"react/prop-types": "off",
|
||||
"no-unused-vars": "warn"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,13 @@
|
||||
import { ElementProps } from 'core/types/Calculation/components';
|
||||
import {
|
||||
TElements,
|
||||
ResultElementsNames,
|
||||
} from 'core/types/Calculation/Store/elements';
|
||||
import { round } from 'lodash';
|
||||
|
||||
import { DownloadOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
validateEmail,
|
||||
validateInn,
|
||||
validateKpp,
|
||||
validatePhone,
|
||||
} from 'core/tools/validate';
|
||||
|
||||
import { DownloadOutlined } from '@ant-design/icons';
|
||||
import { ElementProps } from 'core/types/Calculation/components';
|
||||
import { TElements } from 'core/types/Calculation/Store/elements';
|
||||
import { round } from 'lodash';
|
||||
|
||||
const elementsProps: TElements<ElementProps> = {
|
||||
selectChannel: {
|
||||
@ -135,8 +130,7 @@ const elementsProps: TElements<ElementProps> = {
|
||||
min: '50',
|
||||
max: '99',
|
||||
},
|
||||
selectSeasonType: {
|
||||
},
|
||||
selectSeasonType: {},
|
||||
tbxComissionPerc: {
|
||||
min: '0',
|
||||
max: '100',
|
||||
|
||||
@ -45,7 +45,7 @@ const elementsTables: StoreTables<ITableElement> = {
|
||||
Component: Select,
|
||||
props: {
|
||||
nameMiddleware: name => {
|
||||
const targetName = name.match(/\"(.+)\"/);
|
||||
const targetName = name.match(/"(.+)"/);
|
||||
if (targetName) {
|
||||
return targetName[1]
|
||||
.replaceAll('"', String.fromCharCode(160))
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable no-undef */
|
||||
const createColorProxy = require('./lib/createColorProxy');
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-undef */
|
||||
/* eslint-disable indent */
|
||||
const createColorProxy =
|
||||
process.env.NODE_ENV === 'development' && typeof Proxy !== 'undefined'
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
|
||||
import { ValidateStatus } from 'antd/lib/form/FormItem';
|
||||
import { INVALID_INPUT as INVALID_INPUT_MESSAGE } from 'core/constants/errorMessages';
|
||||
import { ElementsNames } from 'core/types/Calculation/Store/elements';
|
||||
@ -10,7 +8,10 @@ import {
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useStores } from '../useStores';
|
||||
|
||||
type TValidation = { errorMessage: string; validator: Function };
|
||||
type TValidation = {
|
||||
errorMessage: string;
|
||||
validator: ((_: any) => boolean) | undefined;
|
||||
};
|
||||
interface IUseValidationArgs {
|
||||
elementName: ElementsNames;
|
||||
value: any;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import { DEFAULT_DEBOUNCE_DELAY } from 'core/constants/debounce';
|
||||
import { Process } from 'core/types/Calculation/Store/process';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
@ -15,7 +15,6 @@ export default ({
|
||||
|
||||
const { values, options, tables } = calculationStore;
|
||||
|
||||
//@ts-ignore
|
||||
const preparedPaymentsRows: PaymentRow[] = Array.from(
|
||||
{ length: values.leasingPeriod },
|
||||
() => ({
|
||||
|
||||
@ -126,8 +126,8 @@ const validatePaymentsTable = () => {
|
||||
|
||||
if (isValidRows()) {
|
||||
const target_payments = payments.slice(1, 4);
|
||||
const min = Math.min.apply(Math, target_payments);
|
||||
const max = Math.max.apply(Math, target_payments);
|
||||
const min = Math.min(...target_payments);
|
||||
const max = Math.max(...target_payments);
|
||||
const areInvalidRows = max - min > 10;
|
||||
|
||||
CalculationStore.setTableRows(
|
||||
@ -207,10 +207,9 @@ const validatePaymentsTable = () => {
|
||||
const startPositions =
|
||||
seasonTypeOptions && seasonTypeOptions.startPositions;
|
||||
|
||||
const stepsValues = [];
|
||||
const stepsValues: any[] = [];
|
||||
for (let i = 0; i < startPositions.length; i++) {
|
||||
const targetIndex = startPositions[i];
|
||||
//@ts-ignore
|
||||
stepsValues.push(unshiftedMiddleRows[targetIndex]);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
//@ts-nocheck
|
||||
|
||||
import { IEvoGraph } from './../../../../../../core/types/Entities/crmEntities';
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import { IGetCRMEntitiesResponse } from 'core/types/Calculation/Responses';
|
||||
import { TElements } from 'core/types/Calculation/Store/elements';
|
||||
import { message } from 'antd';
|
||||
import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
|
||||
import { openNotification } from 'client/Elements/Notification';
|
||||
@ -76,6 +78,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
const newValues = Object.assign(
|
||||
{},
|
||||
...Object.values(elementsValues).map(valueName => ({
|
||||
//@ts-ignore
|
||||
[valueName]: quote[mapKPtoValues[valueName]],
|
||||
})),
|
||||
);
|
||||
@ -85,9 +88,10 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
|
||||
let accountidData;
|
||||
if (lead) {
|
||||
const selected_lead = calculationStore.getOptions('selectLead', {
|
||||
const selected_lead = calculationStore.getOption('selectLead', {
|
||||
value: lead,
|
||||
});
|
||||
|
||||
if (selected_lead && selected_lead.accountidData) {
|
||||
accountidData = selected_lead.accountidData;
|
||||
}
|
||||
@ -124,7 +128,11 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
}
|
||||
}
|
||||
|
||||
const { entities: options } = await CrmService.crmgqlquery({
|
||||
const {
|
||||
entities: options,
|
||||
}: IGetCRMEntitiesResponse & {
|
||||
entities: TElements<any>;
|
||||
} = await CrmService.crmgqlquery({
|
||||
query: optionsQuery,
|
||||
variables: {
|
||||
statecode: 0,
|
||||
@ -210,38 +218,44 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
}
|
||||
}
|
||||
|
||||
const evo_graph = quote.evo_graphs.sort(
|
||||
(a, b) => b.createdon - a.createdon,
|
||||
)[0];
|
||||
const payments = evo_graph.evo_planpayments
|
||||
.slice(1, evo_graph.evo_planpayments.length - 1)
|
||||
.map((evo_planpayment, i) => ({
|
||||
paymentRelation: {
|
||||
validation: undefined,
|
||||
value: evo_planpayment.evo_payment_ratio,
|
||||
status: tablePaymentsStatuses(
|
||||
quote.evo_graph_type,
|
||||
quote.evo_period,
|
||||
)?.includes(i + 1)
|
||||
? ElementStatus.Default
|
||||
: ElementStatus.Disabled,
|
||||
},
|
||||
}));
|
||||
calculationStore.replaceTableRows('tablePayments')([
|
||||
{
|
||||
paymentRelation: {
|
||||
value: quote.evo_first_payment_perc,
|
||||
status: ElementStatus.Disabled,
|
||||
},
|
||||
},
|
||||
...payments,
|
||||
{
|
||||
paymentRelation: {
|
||||
value: quote.evo_last_payment_perc,
|
||||
status: ElementStatus.Disabled,
|
||||
},
|
||||
},
|
||||
]);
|
||||
let evo_graph: IEvoGraph = {};
|
||||
if (quote.evo_graphs) {
|
||||
evo_graph = quote.evo_graphs.sort(
|
||||
//@ts-ignore
|
||||
(a, b) => b.createdon - a.createdon,
|
||||
)[0];
|
||||
if (evo_graph.evo_planpayments) {
|
||||
const payments = evo_graph.evo_planpayments
|
||||
.slice(1, evo_graph.evo_planpayments.length - 1)
|
||||
.map((evo_planpayment, i) => ({
|
||||
paymentRelation: {
|
||||
validation: undefined,
|
||||
value: evo_planpayment.evo_payment_ratio,
|
||||
status: tablePaymentsStatuses(
|
||||
quote.evo_graph_type,
|
||||
quote.evo_period,
|
||||
)?.includes(i + 1)
|
||||
? ElementStatus.Default
|
||||
: ElementStatus.Disabled,
|
||||
},
|
||||
}));
|
||||
calculationStore.replaceTableRows('tablePayments')([
|
||||
{
|
||||
paymentRelation: {
|
||||
value: quote.evo_first_payment_perc,
|
||||
status: ElementStatus.Disabled,
|
||||
},
|
||||
},
|
||||
...payments,
|
||||
{
|
||||
paymentRelation: {
|
||||
value: quote.evo_last_payment_perc,
|
||||
status: ElementStatus.Disabled,
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
const base_product = calculationStore.getOption('selectProduct', {
|
||||
evo_baseproductid: newValues.product,
|
||||
@ -264,30 +278,41 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
}),
|
||||
);
|
||||
|
||||
const rate = calculationStore.getOptions('selectRate');
|
||||
const target_rate = rate.find(x => x.evo_rateid === quote.evo_rateid);
|
||||
const rate = calculationStore.getOption('selectRate', {
|
||||
evo_rateid: quote.evo_rateid,
|
||||
});
|
||||
|
||||
let clientRisk = quote.evo_client_riskid;
|
||||
if (opportunity) {
|
||||
const {
|
||||
evo_programsolution,
|
||||
evo_client_riskid,
|
||||
} = calculationStore.getOption('selectOpportunity', {
|
||||
value: opportunity,
|
||||
});
|
||||
const current_opportunity = calculationStore.getOption(
|
||||
'selectOpportunity',
|
||||
{
|
||||
value: opportunity,
|
||||
},
|
||||
);
|
||||
|
||||
if (evo_programsolution === 100000000) {
|
||||
const midClientRisk = calculationStore.getOption(
|
||||
'selectClientRisk',
|
||||
{
|
||||
evo_id: '2',
|
||||
},
|
||||
);
|
||||
if (midClientRisk) {
|
||||
clientRisk = midClientRisk.evo_client_riskid;
|
||||
if (current_opportunity) {
|
||||
const {
|
||||
evo_programsolution,
|
||||
evo_client_riskid,
|
||||
} = current_opportunity;
|
||||
|
||||
if (evo_programsolution === 100000000) {
|
||||
const midClientRisk = calculationStore.getOption(
|
||||
'selectClientRisk',
|
||||
{
|
||||
evo_id: '2',
|
||||
},
|
||||
);
|
||||
if (midClientRisk) {
|
||||
clientRisk = midClientRisk.evo_client_riskid;
|
||||
}
|
||||
} else if (
|
||||
evo_programsolution !== 100000000 &&
|
||||
evo_client_riskid
|
||||
) {
|
||||
clientRisk = evo_client_riskid;
|
||||
}
|
||||
} else if (evo_programsolution !== 100000000 && evo_client_riskid) {
|
||||
clientRisk = evo_client_riskid;
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,7 +323,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
...newValues,
|
||||
product: base_product?.evo_id,
|
||||
...addProducts,
|
||||
rate: target_rate?.evo_id,
|
||||
rate: rate?.evo_id,
|
||||
lead,
|
||||
opportunity,
|
||||
quote: quoteId,
|
||||
|
||||
@ -86,10 +86,10 @@ export interface IQuote {
|
||||
evo_townid?: string;
|
||||
}
|
||||
|
||||
interface IEvoGraph {
|
||||
export interface IEvoGraph {
|
||||
createdon?: Date;
|
||||
evo_sumpay_withnds?: number;
|
||||
evo_planpayment?: IEvoPlanPayment[];
|
||||
evo_planpayments?: IEvoPlanPayment[];
|
||||
}
|
||||
|
||||
export interface ITransactionCurrency {
|
||||
|
||||
Reference in New Issue
Block a user