actions: remove unused createLead action

This commit is contained in:
Chika 2022-01-17 13:05:54 +03:00
parent 60adb72e26
commit 84a95f6ddc

View File

@ -1,139 +0,0 @@
import { openNotification } from 'client/Elements/Notification';
import { ICalculationStore } from 'core/types/Calculation/Store';
export default function (this: ICalculationStore) {
const {
contactClient,
contact,
newClient,
account,
commentLead,
phoneNumber,
} = this.values;
if (!contactClient && !contact) {
this.setValidation('selectContactClient', false);
this.setValidation('tbxContact', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан контакт клиента',
})();
}
if (!newClient && !account) {
this.setValidation('tbxNewClient', false);
this.setValidation('selectAccount', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан клиент',
})();
}
if (!commentLead) {
this.setValidation('tbxCommentLead', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан комментарий к интересу',
})();
}
if (contact && !phoneNumber) {
this.setValidation('tbxPhoneNumber', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан телефон контактного лица',
})();
}
const { channel } = this.values;
if (!channel) {
this.setValidation('selectChannel', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан канал привлечения',
})();
} else {
const { supplier, agent, finDepartment, broker } = this.values;
switch (channel) {
case 100000000: {
this.setValidation('selectFinDepartment', true);
this.setValidation('selectBroker', true);
if (!supplier) {
this.setValidation('selectSupplier', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан поставщик',
})();
}
if (!agent) {
this.setValidation('selectAgent', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан агент',
})();
}
break;
}
case 100000001: {
this.setValidation('selectAgent', true);
this.setValidation('selectBroker', true);
if (!supplier) {
this.setValidation('selectSupplier', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан поставщик',
})();
}
if (!finDepartment) {
this.setValidation('selectFinDepartment', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан финотдел',
})();
}
break;
}
case 100000002: {
this.setValidation('selectFinDepartment', true);
this.setValidation('selectSupplier', true);
this.setValidation('selectBroker', true);
if (!agent) {
this.setValidation('selectAgent', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан агент',
})();
}
break;
}
case 100000003: {
this.setValidation('selectFinDepartment', true);
this.setValidation('selectSupplier', true);
this.setValidation('selectAgent', true);
if (!broker) {
this.setValidation('selectBroker', false);
openNotification({
type: 'error',
title: 'Ошибка во время создания интереса',
description: 'Не указан брокер',
})();
}
break;
}
case 100000004:
default: {
this.setValidation('selectFinDepartment', true);
this.setValidation('selectSupplier', true);
this.setValidation('selectAgent', true);
this.setValidation('selectBroker', true);
break;
}
}
}
}