add insurances to createKp query
This commit is contained in:
parent
d27a02e1a3
commit
b1484bbf8b
@ -1,5 +1,4 @@
|
||||
// @ts-nocheck
|
||||
import { toJS } from 'mobx';
|
||||
import { gql } from '@apollo/client';
|
||||
import { message } from 'antd';
|
||||
import { openNotification } from 'client/Elements/Notification';
|
||||
@ -9,8 +8,8 @@ import CalculationStore from 'client/stores/CalculationStore';
|
||||
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';
|
||||
import { TableProps } from './../../../../core/types/Calculation/Store/tables';
|
||||
|
||||
const actions: TAction = {
|
||||
createLead: () => {
|
||||
@ -158,9 +157,16 @@ const actions: TAction = {
|
||||
},
|
||||
|
||||
createKP: async () => {
|
||||
const { values } = CalculationStore;
|
||||
const { values, tables } = CalculationStore;
|
||||
const calculationRes = await actions.calculate();
|
||||
|
||||
const insurances = tables.tableInsurance.rows.map(insuranceRow =>
|
||||
Object.keys(insuranceRow).map(prop => ({
|
||||
[prop]: insuranceRow[prop].value,
|
||||
})),
|
||||
);
|
||||
|
||||
console.log('insurances', insurances);
|
||||
const {
|
||||
columns,
|
||||
postValues,
|
||||
@ -168,7 +174,7 @@ const actions: TAction = {
|
||||
preparedPayments,
|
||||
} = calculationRes;
|
||||
|
||||
const domainName = (await getUser()).FullName;
|
||||
const domainName = (await getUser()).FullName || '';
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
console.log('values', values);
|
||||
console.log('domainName', domainName);
|
||||
@ -177,6 +183,7 @@ const actions: TAction = {
|
||||
CalculationService.createKp({
|
||||
domainName,
|
||||
calculation: {
|
||||
insurances,
|
||||
preparedValues,
|
||||
preparedPayments,
|
||||
calculationColumns: columns,
|
||||
@ -205,6 +212,7 @@ const actions: TAction = {
|
||||
marginTop: '7vh',
|
||||
},
|
||||
});
|
||||
|
||||
if (quote.offerprintform) window.open(quote.offerprintform, '_blank');
|
||||
});
|
||||
})
|
||||
|
||||
@ -6,6 +6,7 @@ import { CRMEntityNames } from 'core/types/Entities/crmEntityNames';
|
||||
import { TEntityQuery } from '../Entities/query';
|
||||
import { ColumnsNames, IColumn, PostValues } from 'core/types/Calculation/Core';
|
||||
import { TValues } from 'core/types/Calculation/Store/values';
|
||||
import { TableProps } from 'core/types/Calculation/Store/tables';
|
||||
|
||||
export interface IGetEntitiesRequest {
|
||||
queries: TEntityQuery[];
|
||||
@ -30,6 +31,7 @@ export interface IGetCalculationRequest {
|
||||
export interface ICreateKpRequest {
|
||||
domainName: string;
|
||||
calculation: {
|
||||
insurances: TableProps<any>[];
|
||||
preparedValues: PreparedValues;
|
||||
preparedPayments: PreparedPayments;
|
||||
calculationColumns: { [column in ColumnsNames]?: IColumn };
|
||||
|
||||
Reference in New Issue
Block a user