From bc95fbcfb751079b82a47589c0ff2a4fb7f59700 Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Mon, 5 Dec 2022 18:18:04 +0300 Subject: [PATCH 1/3] =?UTF-8?q?WIP=20=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BA=D1=83=D1=89=D0=B5=D0=B9=20=D0=B4=D0=B0=D1=82?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base/BaseClientFormCreate.vue | 37 ++++++++++++++++++- src/pages/clients/components/ClientsTable.vue | 6 ++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index df58b62..d83bf3d 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -91,6 +91,7 @@ import BaseModal from "@/components/base/BaseModal"; import addImageIcon from "@/assets/icons/photo.svg"; import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider"; import { addNotification } from "@/components/Notifications/notificationContext"; +import * as moment from "moment"; export default { name: "BaseClientFormClient", components: { @@ -246,7 +247,39 @@ export default { !this.showModal ? this.closeForm() : null; }, createIdentityDocument(id) { - Object.keys( + let filteredData = Object.keys( + this.filterDataEmptyProperty(this.infoClient.identity_document.pass) + ); + console.log( + moment(this.infoClient.identity_document.pass.issued_by_date).isAfter( + moment().format("YYYY-MM-DD") + ) + ); + if (filteredData.length > 0) { + if (filteredData.length !== 4) + this.addErrorNotification( + "Паспортные данные заполнены не полностью", + "Паспортные данные не будут записаны в профиль клиента" + ); + else if ( + moment(this.infoClient.identity_document.pass.issued_by_date).isAfter( + moment().format("YYYY-MM-DD") + ) + ) { + this.addErrorNotification( + "Некорректная дата выдачи паспорта", + "Паспортные данные не будут записаны в профиль клиента" + ); + } else + fetchWrapper.post("general/identity_document/create/", { + ...this.filterDataEmptyProperty( + this.infoClient.identity_document.pass + ), + person_id: id, + kind: "Паспорт", + }); + } + /*bject.keys( this.filterDataEmptyProperty(this.infoClient.identity_document.pass) ).length > 0 && fetchWrapper.post("general/identity_document/create/", { @@ -255,7 +288,7 @@ export default { ), person_id: id, kind: "Паспорт", - }); + });*/ }, createAddress(id) { Object.keys(this.filterDataEmptyProperty(this.infoClient.addresses)) diff --git a/src/pages/clients/components/ClientsTable.vue b/src/pages/clients/components/ClientsTable.vue index fde1ffe..edc6cd2 100644 --- a/src/pages/clients/components/ClientsTable.vue +++ b/src/pages/clients/components/ClientsTable.vue @@ -206,7 +206,11 @@ export default { this.textSearch = ""; this.clearingTextSearch = true; this.clientsCount += 1; - this.currentTablePage = this.calculatePageCount(this.clientsCount); + if ( + this.currentTablePage !== this.calculatePageCount(this.clientsCount) + ) + this.currentTablePage = this.calculatePageCount(this.clientsCount); + else this.fetchDataClients(); this.$emit("reset-updated-clients"); } }, From 4b4a4917e4314dfc9990dfb6edfa7256c6d50746 Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Tue, 6 Dec 2022 18:17:00 +0300 Subject: [PATCH 2/3] =?UTF-8?q?WIP=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D0=BE=D0=BC=20?= =?UTF-8?q?=D0=94=D0=A3=D0=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base/BaseClientFormCreate.vue | 52 ++++++++----------- .../clients/components/ClientsTableRow.vue | 2 +- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index d83bf3d..b1572b2 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -250,18 +250,15 @@ export default { let filteredData = Object.keys( this.filterDataEmptyProperty(this.infoClient.identity_document.pass) ); - console.log( - moment(this.infoClient.identity_document.pass.issued_by_date).isAfter( - moment().format("YYYY-MM-DD") - ) - ); + console.log(filteredData.length); if (filteredData.length > 0) { - if (filteredData.length !== 4) + if (filteredData.length < 4) { this.addErrorNotification( "Паспортные данные заполнены не полностью", "Паспортные данные не будут записаны в профиль клиента" ); - else if ( + console.log("запрос отлетел из-за нехватки данных"); + } else if ( moment(this.infoClient.identity_document.pass.issued_by_date).isAfter( moment().format("YYYY-MM-DD") ) @@ -270,6 +267,7 @@ export default { "Некорректная дата выдачи паспорта", "Паспортные данные не будут записаны в профиль клиента" ); + console.log("запрос отлетел из-за времени"); } else fetchWrapper.post("general/identity_document/create/", { ...this.filterDataEmptyProperty( @@ -279,16 +277,6 @@ export default { kind: "Паспорт", }); } - /*bject.keys( - this.filterDataEmptyProperty(this.infoClient.identity_document.pass) - ).length > 0 && - fetchWrapper.post("general/identity_document/create/", { - ...this.filterDataEmptyProperty( - this.infoClient.identity_document.pass - ), - person_id: id, - kind: "Паспорт", - });*/ }, createAddress(id) { Object.keys(this.filterDataEmptyProperty(this.infoClient.addresses)) @@ -331,14 +319,23 @@ export default { ); if (foundElement.priority) formData.append("priority", foundElement.priority); + console.log(formData); fetchWrapper .post("general/person/create/", formData, "formData") .then((result) => { - this.createIdentityDocument(result.id); - this.createAddress(result.id); - this.createContacts(result.id); - this.setUpdatedClients(); - this.addSuccessNotification(); + if (result.id) { + this.createIdentityDocument(result.id); + this.createAddress(result.id); + this.createContacts(result.id); + this.setUpdatedClients(); + this.addSuccessNotification(); + } else { + this.addErrorNotification( + "Клиент не создан", + "Произошла ошибка сервера" + ); + console.log(result); + } }); }, filterDataEmptyProperty(data) { @@ -426,21 +423,14 @@ export default { ); return false; } - if (this.infoClient.basic.full_name.split(" ").length < 3) { - this.addErrorNotification( - "Некорректное ФИО клиента", - "Пожалуйста, введите ФИО клиента правильно" - ); - return false; - } return true; }, addErrorNotification(title, message) { - addNotification(new Date().getTime(), title, message, "error", 5000); + addNotification(title, title, message, "error", 5000); }, addSuccessNotification() { addNotification( - new Date().getTime(), + "Клиент успешно создан", "Клиент успешно создан", "", "success", diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index 3069491..4f887f8 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -192,7 +192,7 @@ export default { this.timer = null; }, startTimer() { - this.countdown = 10; + this.countdown = 30; this.timer = setInterval(() => { this.changeCountdown(); }, 1000); From 6e21c5d59b930017e5dc799cf3b0c3137cd4188f Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Tue, 6 Dec 2022 18:25:40 +0300 Subject: [PATCH 3/3] =?UTF-8?q?WIP=20=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BB=D0=B8=D1=88=D0=BD=D0=B5=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Notifications/TheNotificationProvider.vue | 6 ------ src/components/base/BaseClientFormCreate.vue | 5 ----- 2 files changed, 11 deletions(-) diff --git a/src/components/Notifications/TheNotificationProvider.vue b/src/components/Notifications/TheNotificationProvider.vue index 99cdde6..59bbef0 100644 --- a/src/components/Notifications/TheNotificationProvider.vue +++ b/src/components/Notifications/TheNotificationProvider.vue @@ -38,12 +38,6 @@ export default { return Object.entries(notifications); }, }, - - watch: { - notificationsList(val) { - console.log(val); - }, - }, }; diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index b1572b2..b225f9e 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -250,14 +250,12 @@ export default { let filteredData = Object.keys( this.filterDataEmptyProperty(this.infoClient.identity_document.pass) ); - console.log(filteredData.length); if (filteredData.length > 0) { if (filteredData.length < 4) { this.addErrorNotification( "Паспортные данные заполнены не полностью", "Паспортные данные не будут записаны в профиль клиента" ); - console.log("запрос отлетел из-за нехватки данных"); } else if ( moment(this.infoClient.identity_document.pass.issued_by_date).isAfter( moment().format("YYYY-MM-DD") @@ -267,7 +265,6 @@ export default { "Некорректная дата выдачи паспорта", "Паспортные данные не будут записаны в профиль клиента" ); - console.log("запрос отлетел из-за времени"); } else fetchWrapper.post("general/identity_document/create/", { ...this.filterDataEmptyProperty( @@ -319,7 +316,6 @@ export default { ); if (foundElement.priority) formData.append("priority", foundElement.priority); - console.log(formData); fetchWrapper .post("general/person/create/", formData, "formData") .then((result) => { @@ -334,7 +330,6 @@ export default { "Клиент не создан", "Произошла ошибка сервера" ); - console.log(result); } }); },