refactor: split actions into files
This commit is contained in:
parent
0b30619b38
commit
5e6149e704
@ -26,7 +26,7 @@ export function buildElement(elementName) {
|
||||
...tables[elementName].props,
|
||||
});
|
||||
}
|
||||
case ElementType.Button: {
|
||||
case ElementType.Action: {
|
||||
return withButton(Component)({
|
||||
name: elementName,
|
||||
actionName: elementsActions[elementName],
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
import { TElements } from 'core/types/Calculation/Store/elements';
|
||||
import { StoreTables } from 'core/types/Calculation/Store/tables';
|
||||
|
||||
|
||||
|
||||
|
||||
const elementsTitles: TElements<string> = {
|
||||
selectLead: 'Интерес',
|
||||
selectOpportunity: 'Лизинговая сделка',
|
||||
|
||||
@ -3,12 +3,12 @@ import { TElements, ElementType } from 'core/types/Calculation/Store/elements';
|
||||
|
||||
const elementsTypes: TElements<ElementType> = {
|
||||
labelLeaseObjectRisk: ElementType.Computed,
|
||||
btnInsCalculation: ElementType.Button,
|
||||
btnFranschise: ElementType.Button,
|
||||
btnDriversApplication: ElementType.Button,
|
||||
btnInsCalculation: ElementType.Action,
|
||||
btnFranschise: ElementType.Action,
|
||||
btnDriversApplication: ElementType.Action,
|
||||
tbxInsKaskoPriceLeasePeriod: ElementType.Computed,
|
||||
btnCreateKP: ElementType.Button,
|
||||
btnCalculate: ElementType.Button,
|
||||
btnCreateKP: ElementType.Action,
|
||||
btnCalculate: ElementType.Action,
|
||||
labelIrrInfo: ElementType.Computed,
|
||||
};
|
||||
|
||||
|
||||
@ -1,347 +1,11 @@
|
||||
// @ts-nocheck
|
||||
import { gql } from '@apollo/client';
|
||||
import { message } from 'antd';
|
||||
import { openNotification } from 'client/Elements/Notification';
|
||||
import CalculationService from 'client/services/CalculationService';
|
||||
import CrmService from 'client/services/CrmService';
|
||||
import CalculationStore from 'client/stores/CalculationStore';
|
||||
import { getUser } from 'client/tools/user';
|
||||
import { TAction } from 'core/types/Calculation/Store/effect';
|
||||
import { resultsValues } from 'core/types/Calculation/Store/values';
|
||||
import { Status } from 'core/types/statuses';
|
||||
import getAdditionalData from './lib/additionalData';
|
||||
import checkValidation from './lib/checkValidation';
|
||||
import customValues from './lib/customValues';
|
||||
import prepareCalculationData from './lib/prepareData';
|
||||
import results from './lib/results';
|
||||
import validate from './lib/validate';
|
||||
import calculate from './actions/calculate';
|
||||
import createKP from './actions/createKP';
|
||||
import createLead from './actions/createLead';
|
||||
|
||||
const cleanResults = () => {
|
||||
for (let resultValue of resultsValues) {
|
||||
CalculationStore.setValue(resultValue, '');
|
||||
}
|
||||
};
|
||||
|
||||
const BUTTONS_TIMEOUT = 500;
|
||||
|
||||
function blockButtons() {
|
||||
CalculationStore.setStatus('btnCreateKP', Status.Loading);
|
||||
CalculationStore.setStatus('btnCalculate', Status.Loading);
|
||||
}
|
||||
|
||||
function unlockButtons() {
|
||||
setTimeout(() => {
|
||||
CalculationStore.setStatus('btnCreateKP', Status.Default);
|
||||
}, BUTTONS_TIMEOUT);
|
||||
setTimeout(() => {
|
||||
CalculationStore.setStatus('btnCalculate', Status.Default);
|
||||
}, BUTTONS_TIMEOUT);
|
||||
}
|
||||
|
||||
const actions: TAction = {
|
||||
createLead: () => {
|
||||
// TODO: block button for time
|
||||
// TODO: collect errors
|
||||
const {
|
||||
contactClient,
|
||||
contact,
|
||||
newClient,
|
||||
account,
|
||||
commentLead,
|
||||
phoneNumber,
|
||||
} = CalculationStore.values;
|
||||
if (!contactClient && !contact) {
|
||||
CalculationStore.setValidation('selectContactClient', false);
|
||||
CalculationStore.setValidation('tbxContact', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан контакт клиента',
|
||||
})();
|
||||
}
|
||||
if (!newClient && !account) {
|
||||
CalculationStore.setValidation('tbxNewClient', false);
|
||||
CalculationStore.setValidation('selectAccount', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан клиент',
|
||||
})();
|
||||
}
|
||||
if (!commentLead) {
|
||||
CalculationStore.setValidation('tbxCommentLead', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан комментарий к интересу',
|
||||
})();
|
||||
}
|
||||
if (contact && !phoneNumber) {
|
||||
CalculationStore.setValidation('tbxPhoneNumber', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан телефон контактного лица',
|
||||
})();
|
||||
}
|
||||
|
||||
const { channel } = CalculationStore.values;
|
||||
if (!channel) {
|
||||
CalculationStore.setValidation('selectChannel', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан канал привлечения',
|
||||
})();
|
||||
} else {
|
||||
const {
|
||||
supplier,
|
||||
agent,
|
||||
finDepartment,
|
||||
broker,
|
||||
} = CalculationStore.values;
|
||||
switch (channel) {
|
||||
case 100000000: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
if (!supplier) {
|
||||
CalculationStore.setValidation('selectSupplier', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан поставщик',
|
||||
})();
|
||||
}
|
||||
if (!agent) {
|
||||
CalculationStore.setValidation('selectAgent', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан агент',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000001: {
|
||||
CalculationStore.setValidation('selectAgent', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
if (!supplier) {
|
||||
CalculationStore.setValidation('selectSupplier', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан поставщик',
|
||||
})();
|
||||
}
|
||||
if (!finDepartment) {
|
||||
CalculationStore.setValidation('selectFinDepartment', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан финотдел',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000002: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectSupplier', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
if (!agent) {
|
||||
CalculationStore.setValidation('selectAgent', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан агент',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000003: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectSupplier', true);
|
||||
CalculationStore.setValidation('selectAgent', true);
|
||||
if (!broker) {
|
||||
CalculationStore.setValidation('selectBroker', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан брокер',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000004:
|
||||
default: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectSupplier', true);
|
||||
CalculationStore.setValidation('selectAgent', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
createKP: async () => {
|
||||
const { values, tables } = CalculationStore;
|
||||
const calculationRes = await actions.calculate();
|
||||
|
||||
const insurances = tables.tableInsurance.rows.map(insuranceRow => {
|
||||
const resObj = {};
|
||||
Object.keys(insuranceRow).map(prop => {
|
||||
resObj[prop] = insuranceRow[prop].value;
|
||||
});
|
||||
return resObj;
|
||||
});
|
||||
|
||||
console.log('insurances', insurances);
|
||||
const {
|
||||
columns,
|
||||
postValues,
|
||||
preparedValues,
|
||||
preparedPayments,
|
||||
} = calculationRes;
|
||||
|
||||
const domainName = (await getUser()).FullName || '';
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
console.log('domainName', domainName);
|
||||
console.log('values', values);
|
||||
console.log(
|
||||
'insKaskoPriceLeasePeriod',
|
||||
CalculationStore.insKaskoPriceLeasePeriod(),
|
||||
);
|
||||
// }
|
||||
|
||||
CrmService.createKp({
|
||||
domainName,
|
||||
calculation: {
|
||||
insurances,
|
||||
preparedValues,
|
||||
preparedPayments,
|
||||
columns,
|
||||
postValues,
|
||||
calculationValues: {
|
||||
...values,
|
||||
insKaskoPriceLeasePeriod: customValues.insKaskoPriceLeasePeriod.call(
|
||||
CalculationStore,
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(({ quoteid }) => {
|
||||
CrmService.crmgqlquery({
|
||||
query: gql`
|
||||
query($quoteid: Uuid!) {
|
||||
quote(quoteId: $quoteid) {
|
||||
offerprintform
|
||||
evo_quotename
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
quoteid,
|
||||
},
|
||||
}).then(({ entities: { quote } }) => {
|
||||
console.log('quote', quote);
|
||||
if (!Array.isArray(quote)) {
|
||||
message.success({
|
||||
content: `КП ${quote?.evo_quotename || ''} создано!`,
|
||||
duration: 5,
|
||||
style: {
|
||||
marginTop: '7vh',
|
||||
},
|
||||
});
|
||||
|
||||
if (quote?.offerprintform) {
|
||||
Object.assign(document.createElement('a'), {
|
||||
target: '_blank',
|
||||
href: quote.offerprintform,
|
||||
}).click();
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
},
|
||||
|
||||
calculate: async () => {
|
||||
validate();
|
||||
const { invalidElements, invalidTables } = checkValidation();
|
||||
if (invalidElements.length > 0 || invalidTables.length > 0) {
|
||||
if (invalidElements.length > 0)
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время расчета графика',
|
||||
description:
|
||||
'Некорректно заполнены поля: ' + invalidElements.join(', '),
|
||||
})();
|
||||
|
||||
if (invalidTables.length > 0)
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время расчета графика',
|
||||
description:
|
||||
'Некорректно заполнены таблицы: ' + invalidTables.join(', '),
|
||||
})();
|
||||
return;
|
||||
}
|
||||
|
||||
blockButtons();
|
||||
|
||||
var preparedData = prepareCalculationData({
|
||||
calculationStore: CalculationStore,
|
||||
});
|
||||
console.log('preparedData', preparedData);
|
||||
|
||||
var additionalData = getAdditionalData({
|
||||
calculationStore: CalculationStore,
|
||||
});
|
||||
console.log('additionalData', additionalData);
|
||||
|
||||
CalculationStore.cleanTable('tableResults');
|
||||
cleanResults();
|
||||
|
||||
return CalculationService.calculate(
|
||||
Object.assign(preparedData, { additionalData }),
|
||||
)
|
||||
.then(res => {
|
||||
console.log('calculation res', res);
|
||||
|
||||
message.success({
|
||||
content: 'Расчет завершен успешно!',
|
||||
duration: 5,
|
||||
style: {
|
||||
marginTop: '7vh',
|
||||
},
|
||||
});
|
||||
|
||||
results.showResultsTable(preparedData, res);
|
||||
results.showResults(preparedData, res);
|
||||
|
||||
unlockButtons();
|
||||
|
||||
return { ...res, ...preparedData };
|
||||
})
|
||||
.catch(err => {
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время расчета!',
|
||||
description:
|
||||
err.response &&
|
||||
err.response.data &&
|
||||
((err.response.data.errors &&
|
||||
err.response.data.errors.join(', ')) ||
|
||||
err.response.data),
|
||||
})();
|
||||
|
||||
unlockButtons();
|
||||
|
||||
throw err;
|
||||
});
|
||||
export default {
|
||||
actions: {
|
||||
calculate,
|
||||
createKP,
|
||||
createLead,
|
||||
},
|
||||
};
|
||||
|
||||
export default { actions };
|
||||
|
||||
108
src/client/stores/CalculationStore/Effects/actions/calculate.js
Normal file
108
src/client/stores/CalculationStore/Effects/actions/calculate.js
Normal file
@ -0,0 +1,108 @@
|
||||
import { message } from 'antd';
|
||||
import { openNotification } from 'client/Elements/Notification';
|
||||
import CalculationService from 'client/services/CalculationService';
|
||||
import { resultsValues } from 'core/types/Calculation/Store/values';
|
||||
import { Status } from 'core/types/statuses';
|
||||
import CalculationStore from '../..';
|
||||
import getAdditionalData from '../lib/additionalData';
|
||||
import checkValidation from '../lib/checkValidation';
|
||||
import prepareCalculationData from '../lib/prepareData';
|
||||
import results from '../lib/results';
|
||||
import validate from '../lib/validate';
|
||||
|
||||
const cleanResults = () => {
|
||||
for (let resultValue of resultsValues) {
|
||||
CalculationStore.setValue(resultValue, '');
|
||||
}
|
||||
};
|
||||
|
||||
const BUTTONS_TIMEOUT = 500;
|
||||
|
||||
function blockButtons() {
|
||||
CalculationStore.setStatus('btnCreateKP', Status.Loading);
|
||||
CalculationStore.setStatus('btnCalculate', Status.Loading);
|
||||
}
|
||||
|
||||
function unlockButtons() {
|
||||
setTimeout(() => {
|
||||
CalculationStore.setStatus('btnCreateKP', Status.Default);
|
||||
}, BUTTONS_TIMEOUT);
|
||||
setTimeout(() => {
|
||||
CalculationStore.setStatus('btnCalculate', Status.Default);
|
||||
}, BUTTONS_TIMEOUT);
|
||||
}
|
||||
|
||||
export default () => {
|
||||
validate();
|
||||
const { invalidElements, invalidTables } = checkValidation();
|
||||
if (invalidElements.length > 0 || invalidTables.length > 0) {
|
||||
if (invalidElements.length > 0)
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время расчета графика',
|
||||
description:
|
||||
'Некорректно заполнены поля: ' + invalidElements.join(', '),
|
||||
})();
|
||||
|
||||
if (invalidTables.length > 0)
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время расчета графика',
|
||||
description:
|
||||
'Некорректно заполнены таблицы: ' + invalidTables.join(', '),
|
||||
})();
|
||||
return;
|
||||
}
|
||||
|
||||
blockButtons();
|
||||
|
||||
var preparedData = prepareCalculationData({
|
||||
calculationStore: CalculationStore,
|
||||
});
|
||||
console.log('preparedData', preparedData);
|
||||
|
||||
var additionalData = getAdditionalData({
|
||||
calculationStore: CalculationStore,
|
||||
});
|
||||
console.log('additionalData', additionalData);
|
||||
|
||||
CalculationStore.cleanTable('tableResults');
|
||||
cleanResults();
|
||||
|
||||
return CalculationService.calculate(
|
||||
Object.assign(preparedData, { additionalData }),
|
||||
)
|
||||
.then(res => {
|
||||
console.log('calculation res', res);
|
||||
|
||||
message.success({
|
||||
content: 'Расчет завершен успешно!',
|
||||
duration: 5,
|
||||
style: {
|
||||
marginTop: '7vh',
|
||||
},
|
||||
});
|
||||
|
||||
results.showResultsTable(preparedData, res);
|
||||
results.showResults(preparedData, res);
|
||||
|
||||
unlockButtons();
|
||||
|
||||
return { ...res, ...preparedData };
|
||||
})
|
||||
.catch(err => {
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время расчета!',
|
||||
description:
|
||||
err.response &&
|
||||
err.response.data &&
|
||||
((err.response.data.errors && err.response.data.errors.join(', ')) ||
|
||||
err.response.data),
|
||||
})();
|
||||
|
||||
unlockButtons();
|
||||
|
||||
throw err;
|
||||
});
|
||||
};
|
||||
@ -0,0 +1,91 @@
|
||||
import { gql } from '@apollo/client';
|
||||
import { message } from 'antd';
|
||||
import CrmService from 'client/services/CrmService';
|
||||
import { getUser } from 'client/tools/user';
|
||||
import CalculationStore from '../..';
|
||||
import customValues from '../lib/customValues';
|
||||
import calculate from './calculate';
|
||||
|
||||
export default async () => {
|
||||
const { values, tables } = CalculationStore;
|
||||
const calculationRes = await calculate();
|
||||
|
||||
const insurances = tables.tableInsurance.rows.map(insuranceRow => {
|
||||
const resObj = {};
|
||||
Object.keys(insuranceRow).forEach(prop => {
|
||||
resObj[prop] = insuranceRow[prop].value;
|
||||
});
|
||||
return resObj;
|
||||
});
|
||||
|
||||
console.log('insurances', insurances);
|
||||
const {
|
||||
columns,
|
||||
postValues,
|
||||
preparedValues,
|
||||
preparedPayments,
|
||||
} = calculationRes;
|
||||
|
||||
const domainName = (await getUser()).FullName || '';
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
console.log('domainName', domainName);
|
||||
console.log('values', values);
|
||||
console.log(
|
||||
'insKaskoPriceLeasePeriod',
|
||||
CalculationStore.insKaskoPriceLeasePeriod(),
|
||||
);
|
||||
// }
|
||||
|
||||
CrmService.createKp({
|
||||
domainName,
|
||||
calculation: {
|
||||
insurances,
|
||||
preparedValues,
|
||||
preparedPayments,
|
||||
columns,
|
||||
postValues,
|
||||
calculationValues: {
|
||||
...values,
|
||||
insKaskoPriceLeasePeriod: customValues.insKaskoPriceLeasePeriod.call(
|
||||
CalculationStore,
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(({ quoteid }) => {
|
||||
CrmService.crmgqlquery({
|
||||
query: gql`
|
||||
query($quoteid: Uuid!) {
|
||||
quote(quoteId: $quoteid) {
|
||||
offerprintform
|
||||
evo_quotename
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
quoteid,
|
||||
},
|
||||
}).then(({ entities: { quote } }) => {
|
||||
console.log('quote', quote);
|
||||
if (!Array.isArray(quote)) {
|
||||
message.success({
|
||||
content: `КП ${quote?.evo_quotename || ''} создано!`,
|
||||
duration: 5,
|
||||
style: {
|
||||
marginTop: '7vh',
|
||||
},
|
||||
});
|
||||
|
||||
if (quote?.offerprintform) {
|
||||
Object.assign(document.createElement('a'), {
|
||||
target: '_blank',
|
||||
href: quote.offerprintform,
|
||||
}).click();
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
};
|
||||
139
src/client/stores/CalculationStore/Effects/actions/createLead.js
Normal file
139
src/client/stores/CalculationStore/Effects/actions/createLead.js
Normal file
@ -0,0 +1,139 @@
|
||||
import { openNotification } from 'client/Elements/Notification';
|
||||
import CalculationStore from '../..';
|
||||
|
||||
export default () => {
|
||||
const {
|
||||
contactClient,
|
||||
contact,
|
||||
newClient,
|
||||
account,
|
||||
commentLead,
|
||||
phoneNumber,
|
||||
} = CalculationStore.values;
|
||||
if (!contactClient && !contact) {
|
||||
CalculationStore.setValidation('selectContactClient', false);
|
||||
CalculationStore.setValidation('tbxContact', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан контакт клиента',
|
||||
})();
|
||||
}
|
||||
if (!newClient && !account) {
|
||||
CalculationStore.setValidation('tbxNewClient', false);
|
||||
CalculationStore.setValidation('selectAccount', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан клиент',
|
||||
})();
|
||||
}
|
||||
if (!commentLead) {
|
||||
CalculationStore.setValidation('tbxCommentLead', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан комментарий к интересу',
|
||||
})();
|
||||
}
|
||||
if (contact && !phoneNumber) {
|
||||
CalculationStore.setValidation('tbxPhoneNumber', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан телефон контактного лица',
|
||||
})();
|
||||
}
|
||||
|
||||
const { channel } = CalculationStore.values;
|
||||
if (!channel) {
|
||||
CalculationStore.setValidation('selectChannel', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан канал привлечения',
|
||||
})();
|
||||
} else {
|
||||
const { supplier, agent, finDepartment, broker } = CalculationStore.values;
|
||||
switch (channel) {
|
||||
case 100000000: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
if (!supplier) {
|
||||
CalculationStore.setValidation('selectSupplier', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан поставщик',
|
||||
})();
|
||||
}
|
||||
if (!agent) {
|
||||
CalculationStore.setValidation('selectAgent', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан агент',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000001: {
|
||||
CalculationStore.setValidation('selectAgent', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
if (!supplier) {
|
||||
CalculationStore.setValidation('selectSupplier', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан поставщик',
|
||||
})();
|
||||
}
|
||||
if (!finDepartment) {
|
||||
CalculationStore.setValidation('selectFinDepartment', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан финотдел',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000002: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectSupplier', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
if (!agent) {
|
||||
CalculationStore.setValidation('selectAgent', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан агент',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000003: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectSupplier', true);
|
||||
CalculationStore.setValidation('selectAgent', true);
|
||||
if (!broker) {
|
||||
CalculationStore.setValidation('selectBroker', false);
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время создания интереса',
|
||||
description: 'Не указан брокер',
|
||||
})();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100000004:
|
||||
default: {
|
||||
CalculationStore.setValidation('selectFinDepartment', true);
|
||||
CalculationStore.setValidation('selectSupplier', true);
|
||||
CalculationStore.setValidation('selectAgent', true);
|
||||
CalculationStore.setValidation('selectBroker', true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -155,7 +155,7 @@ export enum ElementType {
|
||||
Default,
|
||||
Computed,
|
||||
Table,
|
||||
Button,
|
||||
Action,
|
||||
}
|
||||
|
||||
export type TElements<T> = {
|
||||
|
||||
Reference in New Issue
Block a user