process/payments: add get-kp-data

This commit is contained in:
Chika 2022-11-11 11:54:16 +03:00
parent b0e7624cd9
commit 878ec1d62a
10 changed files with 418 additions and 297 deletions

View File

@ -25,7 +25,14 @@ export const columns: ColumnsType<Payment> = [
render: (_value, payment) => {
const Component = buildValueComponent(payment.num, InputNumber);
return <Component min={0.01} max={100} step={1} precision={2} />;
return (
<Component
min={payment.num === 0 ? 0 : 0.01}
max={100}
step={1}
precision={payment.num === 0 ? 4 : 2}
/>
);
},
},
];

View File

@ -0,0 +1,7 @@
import { z } from 'zod';
const PaymentsSchema = z.object({
values: z.number().array(),
});
export default PaymentsSchema;

View File

@ -599,7 +599,7 @@ type evo_baseproduct {
}
type evo_graph {
createdon: DateTime
createdon: DateTime!
evo_addcontractid: Uuid
evo_contractid: Uuid
evo_cost_equipment_sum: Decimal
@ -611,7 +611,7 @@ type evo_graph {
evo_graphid: Uuid
evo_name: String
evo_nds: Decimal
evo_planpayments: [evo_planpayment]
evo_planpayments: [evo_planpayment!]
evo_quoteid: Uuid
evo_sumpay_withnds: Decimal
evo_sumpay_withoutnds: Decimal
@ -1123,7 +1123,7 @@ type quote {
evo_gender: Int
evo_gps_brandid: Uuid
evo_gps_modelid: Uuid
evo_graphs: [evo_graph]
evo_graphs: [evo_graph!]
evo_graph_irr: Decimal
evo_graph_type: Int
evo_guarantor1_another_peyments: Decimal

View File

@ -129,21 +129,6 @@ export type GetFinGapAddProductTypesQueryVariables = Exact<{
export type GetFinGapAddProductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null, evo_name: string | null, evo_type_calc_cerebellum: number | null, evo_cost_service_provider_withoutnds: number | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_addproduct_typeid: string | null } | null> | null } | null> | null };
export type GetAddproductTypesQueryVariables = Exact<{ [key: string]: never; }>;
export type GetAddproductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, evo_product_type: number | null, label: string | null, value: string | null } | null> | null };
export type GetBrandsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetBrandsQuery = { __typename?: 'Query', selectBrand: Array<{ __typename?: 'evo_brand', label: string | null, value: string | null } | null> | null };
export type GetDealersQueryVariables = Exact<{ [key: string]: never; }>;
export type GetDealersQuery = { __typename?: 'Query', selectDealer: Array<{ __typename?: 'account', label: string | null, value: string | null } | null> | null };
export type GetInsuranceDataQueryVariables = Exact<{
evo_account_type: InputMaybe<Array<Scalars['Int']> | Scalars['Int']>;
}>;
@ -170,6 +155,21 @@ export type GetRegionsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetRegionsQuery = { __typename?: 'Query', evo_regions: Array<{ __typename?: 'evo_region', label: string | null, value: string | null } | null> | null };
export type GetBrandsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetBrandsQuery = { __typename?: 'Query', selectBrand: Array<{ __typename?: 'evo_brand', label: string | null, value: string | null } | null> | null };
export type GetDealersQueryVariables = Exact<{ [key: string]: never; }>;
export type GetDealersQuery = { __typename?: 'Query', selectDealer: Array<{ __typename?: 'account', label: string | null, value: string | null } | null> | null };
export type GetAddproductTypesQueryVariables = Exact<{ [key: string]: never; }>;
export type GetAddproductTypesQuery = { __typename?: 'Query', evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_graph_price: number | null, evo_product_type: number | null, label: string | null, value: string | null } | null> | null };
export type GetOwnerDataQueryVariables = Exact<{
domainname: InputMaybe<Scalars['String']>;
}>;
@ -224,6 +224,13 @@ export type GetQuoteUrlQueryVariables = Exact<{
export type GetQuoteUrlQuery = { __typename?: 'Query', entity: { __typename?: 'quote', link: string | null } | null };
export type GetPaymentsDataFromQuoteQueryVariables = Exact<{
quoteId: Scalars['Uuid'];
}>;
export type GetPaymentsDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_period: number | null, evo_accept_period: number | null, evo_first_payment_perc: number | null, evo_last_payment_perc: number | null, evo_graph_type: number | null, evo_payments_decrease_perc: number | null, evo_seasons_type: number | null, evo_high_season: number | null, evo_graphs: Array<{ __typename?: 'evo_graph', createdon: string, evo_sumpay_withnds: number | null, evo_planpayments: Array<{ __typename?: 'evo_planpayment', evo_payment_ratio: number | null }> | null }> | null } | null };
export type GetCurrencyChangesQueryVariables = Exact<{
currentDate: InputMaybe<Scalars['DateTime']>;
}>;

View File

@ -6,7 +6,7 @@ import { pick } from 'radash';
const key = 'KP_LOADING_INFO';
export default function loadKpReactions({ store, trpcClient }: ReactionsContext) {
const { $calculation, $process } = store;
const { $calculation, $process, $tables } = store;
reaction(
() => $calculation.element('selectQuote').getValue(),
@ -29,13 +29,16 @@ export default function loadKpReactions({ store, trpcClient }: ReactionsContext)
},
};
trpcClient.quote.getValues
trpcClient.quote.getData
.query(payload)
.then(({ values }) => {
.then(({ values, payments }) => {
$calculation.$values.setValues({
values,
exclude: ['lead', 'opportunity', 'quote', 'leadUrl', 'opportunityUrl', 'quoteUrl'],
});
$tables.payments.setValues(payments.values);
message.success({
key,
content: `КП ${quoteName} загружено`,

View File

@ -1,3 +1,4 @@
import PaymentsSchema from 'config/schema/payments';
import ValuesSchema from 'config/schema/values';
import { z } from 'zod';
@ -12,10 +13,12 @@ export type GetQuoteDataInput = z.infer<typeof GetQuoteDataInputSchema>;
export const GetQuoteDataOutputSchema = z.object({
values: ValuesSchema,
payments: PaymentsSchema,
});
export type GetQuoteDataOutput = z.infer<typeof GetQuoteDataOutputSchema>;
export const GetQuoteDataPartOutputSchema = z.object({
export const QuoteProcessDataSchema = z.object({
values: ValuesSchema.partial(),
payments: PaymentsSchema.optional(),
});
export type GetQuoteDataPartOutput = z.infer<typeof GetQuoteDataPartOutputSchema>;
export type QuoteProcessData = z.infer<typeof QuoteProcessDataSchema>;

View File

@ -0,0 +1,75 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import initializeApollo from 'apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import { sort } from 'radash';
import type { GetQuoteDataInput, QuoteProcessData } from '../load-kp/types';
const QUERY_GET_PAYMENTS_DATA_FROM_QUOTE = gql`
query GetPaymentsDataFromQuote($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_period
evo_accept_period
evo_first_payment_perc
evo_last_payment_perc
evo_graph_type
evo_payments_decrease_perc
evo_seasons_type
evo_high_season
evo_graphs {
createdon
evo_sumpay_withnds
evo_planpayments {
evo_payment_ratio
}
}
}
}
`;
export default async function getPaymentsDataFromKP({
values: { quote: quoteId, recalcWithRevision },
}: GetQuoteDataInput): Promise<QuoteProcessData> {
const apolloClient = initializeApollo();
const {
data: { quote },
} = await apolloClient.query<
CRMTypes.GetPaymentsDataFromQuoteQuery,
CRMTypes.GetPaymentsDataFromQuoteQueryVariables
>({
query: QUERY_GET_PAYMENTS_DATA_FROM_QUOTE,
variables: {
quoteId,
},
});
const leasingPeriod = recalcWithRevision
? Math.min(quote?.evo_period ?? 0, quote?.evo_accept_period ?? 0)
: quote?.evo_period ?? 0;
let payments: Array<number> = [];
if (quote?.evo_graphs) {
payments =
sort(quote?.evo_graphs, (evo_graph) => Date.parse(evo_graph?.createdon))
.at(0)
?.evo_planpayments?.slice(1, -1)
.slice(0, leasingPeriod - 2)
.map((payment) => payment?.evo_payment_ratio || 0) || [];
}
return {
values: {
leasingPeriod,
graphType: quote?.evo_graph_type ?? undefined,
parmentsDecreasePercent: quote?.evo_payments_decrease_perc || 0,
highSeasonStart: quote?.evo_high_season,
seasonType: quote?.evo_seasons_type,
firstPaymentPerc: quote?.evo_first_payment_perc || 0,
lastPaymentPerc: quote?.evo_last_payment_perc || 0,
},
payments: {
values: [quote?.evo_first_payment_perc || 0, ...payments, quote?.evo_last_payment_perc || 0],
},
};
}

View File

@ -34,169 +34,175 @@ export default function paymentsReactions({ store }: ReactionsContext) {
/**
* Аннуитет
*/
makeDisposable(
() =>
reaction(
() => {
const graphType = $calculation.element('radioGraphType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
reaction(
() => {
const graphType = $calculation.element('radioGraphType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
return {
graphType,
leasingPeriod,
};
},
({ graphType, leasingPeriod }) => {
if (graphType === 100_000_000) {
const middlePayments: Row[] = Array.from(
{
length: leasingPeriod - 2,
},
() => ({
value: 100,
status: 'Disabled',
})
);
return {
graphType,
leasingPeriod,
};
},
({ graphType, leasingPeriod }) => {
if (graphType === 100_000_000) {
const middlePayments: Row[] = Array.from(
{
length: leasingPeriod - 2,
},
() => ({
value: 100,
status: 'Disabled',
})
);
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
$tables.payments.setRows([
{
value: firstPaymentPerc,
status: 'Disabled',
},
...middlePayments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
]);
}
},
{
fireImmediately: true,
const rows: Row[] = [
{
value: firstPaymentPerc,
status: 'Disabled',
},
...middlePayments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
];
if (!$process.has('LoadKP')) {
$tables.payments.setValues(rows.map((row) => row.value));
}
),
() => $process.has('LoadKP')
$tables.payments.setStatuses(rows.map((row) => row.status));
}
},
{
fireImmediately: true,
}
);
/**
* Равноубывающий
*/
makeDisposable(
() =>
reaction(
() => {
const graphType = $calculation.element('radioGraphType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const parmentsDecreasePercent = $calculation
.element('tbxParmentsDecreasePercent')
.getValue();
return {
graphType,
leasingPeriod,
parmentsDecreasePercent,
};
},
({ graphType, leasingPeriod, parmentsDecreasePercent }) => {
if (graphType === 100_000_002) {
const middlePayments: Row[] = Array.from(
{
length: leasingPeriod - 2,
},
(_, k) => {
const payment = 100 * (parmentsDecreasePercent / 100) ** k;
reaction(
() => {
const graphType = $calculation.element('radioGraphType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const parmentsDecreasePercent = $calculation.element('tbxParmentsDecreasePercent').getValue();
return {
value: Number(payment.toFixed(2)),
status: 'Disabled',
};
}
);
return {
graphType,
leasingPeriod,
parmentsDecreasePercent,
};
},
({ graphType, leasingPeriod, parmentsDecreasePercent }) => {
if (graphType === 100_000_002) {
const middlePayments: Row[] = Array.from(
{
length: leasingPeriod - 2,
},
(_, k) => {
const payment = 100 * (parmentsDecreasePercent / 100) ** k;
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
$tables.payments.setRows([
{
value: firstPaymentPerc,
status: 'Disabled',
},
...middlePayments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
]);
return {
value: Number(payment.toFixed(2)),
status: 'Disabled',
};
}
);
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
const rows: Row[] = [
{
value: firstPaymentPerc,
status: 'Disabled',
},
...middlePayments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
];
if (!$process.has('LoadKP')) {
$tables.payments.setValues(rows.map((row) => row.value));
}
),
() => $process.has('LoadKP')
$tables.payments.setStatuses(rows.map((row) => row.status));
}
}
);
/**
* Легкий старт
*/
makeDisposable(
() =>
reaction(
() => {
const graphType = $calculation.element('radioGraphType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
return {
graphType,
leasingPeriod,
};
},
({ graphType, leasingPeriod }) => {
if (graphType === 100_000_004) {
const editablePayments: Row[] = [
{
value: 25,
status: 'Default',
},
{
value: 50,
status: 'Default',
},
{
value: 75,
status: 'Default',
},
];
reaction(
() => {
const graphType = $calculation.element('radioGraphType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const payments: Row[] = Array.from(
{
length: leasingPeriod - 5,
},
() => ({
value: 100,
status: 'Disabled',
})
);
return {
graphType,
leasingPeriod,
};
},
({ graphType, leasingPeriod }) => {
if (graphType === 100_000_004) {
const editablePayments: Row[] = [
{
value: 25,
status: 'Default',
},
{
value: 50,
status: 'Default',
},
{
value: 75,
status: 'Default',
},
];
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
const payments: Row[] = Array.from(
{
length: leasingPeriod - 5,
},
() => ({
value: 100,
status: 'Disabled',
})
);
$tables.payments.setRows([
{
value: firstPaymentPerc,
status: 'Disabled',
},
...editablePayments,
...payments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
]);
}
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
const rows: Row[] = [
{
value: firstPaymentPerc,
status: 'Disabled',
},
...editablePayments,
...payments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
];
if (!$process.has('LoadKP')) {
$tables.payments.setValues(rows.map((row) => row.value));
}
),
() => $process.has('LoadKP')
$tables.payments.setStatuses(rows.map((row) => row.status));
}
}
);
/**
@ -237,99 +243,101 @@ export default function paymentsReactions({ store }: ReactionsContext) {
100_000_006: [100, 7, 3],
};
makeDisposable(
() =>
reaction(
() => {
const degressionType = $calculation.element('selectSeasonType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const graphType = $calculation.element('radioGraphType').getValue();
reaction(
() => {
const degressionType = $calculation.element('selectSeasonType').getValue();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
const graphType = $calculation.element('radioGraphType').getValue();
return {
degressionType,
leasingPeriod,
graphType,
};
},
({ degressionType, leasingPeriod, graphType }) => {
if (graphType === 100_000_001) {
let payments: Row[] = [];
return {
degressionType,
leasingPeriod,
graphType,
};
},
({ degressionType, leasingPeriod, graphType }) => {
if (graphType === 100_000_001) {
let middlePayments: Row[] = [];
switch (degressionType) {
case 100_000_007: {
const editablePayments: Row[] = Array.from(
{
length: leasingPeriod - 3,
},
() => ({
value: 100,
status: 'Default',
})
);
payments = [
{
value: 100,
status: 'Disabled',
},
...editablePayments,
];
break;
}
case 100_000_003:
case 100_000_004:
case 100_000_005:
case 100_000_006: {
const [step1, step2, step3] = degressionSteps[degressionType];
const paymentsInStep = Math.ceil((leasingPeriod - 2) / 3);
payments = Array.from(
{
length: leasingPeriod - 2,
},
(_v, i) => {
let value = step3;
if (i <= paymentsInStep * 2 - 1) {
value = step2;
}
if (i <= paymentsInStep - 1) {
value = step1;
}
return {
value,
status: 'Disabled',
};
}
);
break;
}
default: {
break;
}
}
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
$tables.payments.setRows([
switch (degressionType) {
case 100_000_007: {
const editablePayments: Row[] = Array.from(
{
value: firstPaymentPerc,
length: leasingPeriod - 3,
},
() => ({
value: 100,
status: 'Default',
})
);
middlePayments = [
{
value: 100,
status: 'Disabled',
},
...payments,
...editablePayments,
];
break;
}
case 100_000_003:
case 100_000_004:
case 100_000_005:
case 100_000_006: {
const [step1, step2, step3] = degressionSteps[degressionType];
const paymentsInStep = Math.ceil((leasingPeriod - 2) / 3);
middlePayments = Array.from(
{
value: lastPaymentPerc,
status: 'Disabled',
length: leasingPeriod - 2,
},
]);
(_v, i) => {
let value = step3;
if (i <= paymentsInStep * 2 - 1) {
value = step2;
}
if (i <= paymentsInStep - 1) {
value = step1;
}
return {
value,
status: 'Disabled',
};
}
);
break;
}
default: {
break;
}
}
),
() => $process.has('LoadKP')
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
const rows: Row[] = [
{
value: firstPaymentPerc,
status: 'Disabled',
},
...middlePayments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
];
if (!$process.has('LoadKP')) {
$tables.payments.setValues(rows.map((row) => row.value));
}
$tables.payments.setStatuses(rows.map((row) => row.status));
}
}
);
makeDisposable(
@ -436,57 +444,59 @@ export default function paymentsReactions({ store }: ReactionsContext) {
return rows;
}
makeDisposable(
() =>
reaction(
() => {
const seasonType = $calculation.element('selectSeasonType').getValue();
const highSeasonStartOption = $calculation.element('selectHighSeasonStart').getOption();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
reaction(
() => {
const seasonType = $calculation.element('selectSeasonType').getValue();
const highSeasonStartOption = $calculation.element('selectHighSeasonStart').getOption();
const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue();
return {
seasonType,
highSeasonStartOption,
leasingPeriod,
};
return {
seasonType,
highSeasonStartOption,
leasingPeriod,
};
},
({ seasonType, highSeasonStartOption, leasingPeriod }) => {
const graphType = $calculation.element('radioGraphType').getValue();
if (graphType !== 100_000_003) return;
if (!seasonType || !highSeasonStartOption) {
$tables.payments.setValues([]);
return;
}
const seasons = seasonsTools.generateSeasons(
seasonType,
seasonsConstants.DEFAULT_SEASONS_VALUES
);
const shiftNumber = Number.parseInt(highSeasonStartOption.label, 10) - 2;
const payments = seasonsTools.generateSeasonsPayments(
leasingPeriod,
shift(seasons, shiftNumber)
);
const middlePayments: Row[] = generateSeasonPaymentsRows(seasonType, shiftNumber, payments);
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
const rows: Row[] = [
{
value: firstPaymentPerc,
status: 'Disabled',
},
({ seasonType, highSeasonStartOption, leasingPeriod }) => {
const graphType = $calculation.element('radioGraphType').getValue();
if (graphType !== 100_000_003) return;
...middlePayments,
{
value: lastPaymentPerc,
status: 'Disabled',
},
];
if (!seasonType || !highSeasonStartOption) {
$tables.payments.setValues([]);
if (!$process.has('LoadKP')) {
$tables.payments.setValues(rows.map((row) => row.value));
}
return;
}
const seasons = seasonsTools.generateSeasons(
seasonType,
seasonsConstants.DEFAULT_SEASONS_VALUES
);
const shiftNumber = Number.parseInt(highSeasonStartOption.label, 10) - 2;
const payments = seasonsTools.generateSeasonsPayments(
leasingPeriod,
shift(seasons, shiftNumber)
);
const rows: Row[] = generateSeasonPaymentsRows(seasonType, shiftNumber, payments);
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
$tables.payments.setRows([
{
value: firstPaymentPerc,
status: 'Disabled',
},
...rows,
{
value: lastPaymentPerc,
status: 'Disabled',
},
]);
}
),
() => $process.has('LoadKP')
$tables.payments.setStatuses(rows.map((row) => row.status));
}
);
makeDisposable(

View File

@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
import initializeApollo from 'apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import type { GetQuoteDataInput, GetQuoteDataPartOutput } from '../../load-kp/types';
import type { GetQuoteDataInput, QuoteProcessData } from '../../load-kp/types';
import getSums from './get-sums';
const QUERY_GET_AGENTS_DATA_FROM_QUOTE = gql`
@ -40,7 +40,7 @@ export type Quote = NonNullable<CRMTypes.GetAgentsDataFromQuoteQuery['quote']>;
export default async function getSupplierAgentsDataFromKP({
values: { quote: quoteId },
}: GetQuoteDataInput): Promise<GetQuoteDataPartOutput> {
}: GetQuoteDataInput): Promise<QuoteProcessData> {
const apolloClient = initializeApollo();
const {

View File

@ -1,20 +1,29 @@
import defaultValues from 'config/default-values';
import { GetQuoteDataInputSchema, GetQuoteDataOutputSchema } from 'process/load-kp/types';
import getPaymentsDataFromKP from 'process/payments/get-kp-data';
import getSupplierAgentsDataFromKP from 'process/supplier-agent/get-kp-values';
import { t } from '../server';
const quoteRouter = t.router({
getValues: t.procedure
getData: t.procedure
.input(GetQuoteDataInputSchema)
.output(GetQuoteDataOutputSchema)
.query(async ({ input }) => {
const { values: supplierAgentsValues } = await getSupplierAgentsDataFromKP(input);
const {
values: paymentsValues,
payments = {
values: [],
},
} = await getPaymentsDataFromKP(input);
return {
values: {
...defaultValues,
...supplierAgentsValues,
...paymentsValues,
},
payments,
};
}),
});