From 84a95f6ddc8afd0adf6d987e5c40664c7e2ce096 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 17 Jan 2022 13:05:54 +0300 Subject: [PATCH] actions: remove unused createLead action --- .../Effects/actions/createLead.ts | 139 ------------------ 1 file changed, 139 deletions(-) delete mode 100644 src/client/stores/CalculationStore/Effects/actions/createLead.ts diff --git a/src/client/stores/CalculationStore/Effects/actions/createLead.ts b/src/client/stores/CalculationStore/Effects/actions/createLead.ts deleted file mode 100644 index fcc6d72..0000000 --- a/src/client/stores/CalculationStore/Effects/actions/createLead.ts +++ /dev/null @@ -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; - } - } - } -}