diff --git a/src/client/services/CalculationService.ts b/src/client/services/CalculationService.ts index fe4a19a..b395c30 100644 --- a/src/client/services/CalculationService.ts +++ b/src/client/services/CalculationService.ts @@ -143,7 +143,6 @@ class CalculationService { variables, }: IMutateToCRMGQL): Promise => new Promise(async (resolve, reject) => { - console.log(mutation); await client .mutate({ mutation, diff --git a/src/client/services/prepareData.ts b/src/client/services/prepareData.ts index 8af0a22..75f46b0 100644 --- a/src/client/services/prepareData.ts +++ b/src/client/services/prepareData.ts @@ -585,7 +585,7 @@ export const prepareCalculationData = ({ const tarif = options.selectTarif?.find(x => x.evo_tarifid === values.tarif); if (tarif) { - preparedValues.iRR_MSFO_Plan = (tarif.evo_irr_plan || 0) / 100; + preparedValues.irr_MSFO_Plan = (tarif.evo_irr_plan || 0) / 100; } const evo_coefficient_risk = calculationStore @@ -735,7 +735,7 @@ export const prepareCalculationData = ({ firstPaymentSum; return { - preparedPayments: { Rows: preparedPaymentsRows }, + preparedPayments: { rows: preparedPaymentsRows }, preparedValues, }; }; diff --git a/src/client/stores/CalculationStore/Effects/action.ts b/src/client/stores/CalculationStore/Effects/action.ts index 1e39473..160e923 100644 --- a/src/client/stores/CalculationStore/Effects/action.ts +++ b/src/client/stores/CalculationStore/Effects/action.ts @@ -9,6 +9,7 @@ import { getUser } from 'client/tools/user'; import { TAction } from 'core/types/Calculation/Store/effect'; import { ITableCell } from 'core/types/Calculation/Store/tables'; import { TableProps } from './../../../../core/types/Calculation/Store/tables'; +import { Status } from 'core/types/statuses'; const actions: TAction = { createLead: () => { @@ -157,7 +158,7 @@ const actions: TAction = { createKP: async () => { const { values } = CalculationStore; - console.log(actions); + console.log('values', values); const calculationRes = await actions.calculate(); console.log('calculationRes', calculationRes); @@ -174,11 +175,11 @@ const actions: TAction = { CalculationService.crmgqlmutaion({ mutation: gql` mutation CreateOffer( - $postValues: PostValuesInput! - $columns: CalculationColumnsInput! - $preparedValues: PreparedValuesInput! - $preparedPayments: PreparedPaymentsInput! - $values: CalculationValuesInput! + $postValues: PostValuesInput + $columns: CalculationColumnsInput + $preparedValues: PreparedValuesInput + $preparedPayments: PreparedPaymentsInput + $values: CalculationValuesInput $domainName: String ) { createBy(domainName: $domainName) { @@ -214,8 +215,15 @@ const actions: TAction = { }, calculate: async () => { - // TODO: block button for time // TODO: collect errors + CalculationStore.setStatus('btnCreateKP', Status.Loading); + setTimeout(() => { + CalculationStore.setStatus('btnCreateKP', Status.Default); + }, 3500); + CalculationStore.setStatus('btnCalculate', Status.Loading); + setTimeout(() => { + CalculationStore.setStatus('btnCalculate', Status.Default); + }, 3500); const { rows } = CalculationStore.tables.tableInsurance; const kaskoRow = rows[1]; @@ -279,6 +287,11 @@ const actions: TAction = { console.log(preparedData); + CalculationStore.setStatus('btnCalculate', Status.Loading); + setTimeout(() => { + CalculationStore.setStatus('btnCalculate', Status.Default); + }, 3500); + CalculationStore.cleanTable('tableResults'); return CalculationService.calculate(preparedData) diff --git a/src/core/types/Calculation/Prepare.ts b/src/core/types/Calculation/Prepare.ts index 68a160a..c20ce0d 100644 --- a/src/core/types/Calculation/Prepare.ts +++ b/src/core/types/Calculation/Prepare.ts @@ -84,7 +84,7 @@ export interface PreparedValues { acquisitionExpenses?: number; npvBase?: number; tLMCost?: number; - iRR_MSFO_Plan?: number; + irr_MSFO_Plan?: number; extraBonus?: number; directorBonus?: number; dogCredit?: number; @@ -101,4 +101,4 @@ export interface PaymentRow { tlmCostPayment?: number; } -export type PreparedPayments = { Rows: PaymentRow[] }; +export type PreparedPayments = { rows: PaymentRow[] };