From a8e2583cb891470024c5bacba46b94c2eff10e5f Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Thu, 8 Dec 2022 18:33:06 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86?= =?UTF-8?q?=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BD=D0=B0,=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BF=D0=BE=D0=BF=D0=B0=D0=BF?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B7=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F,=20=D1=84=D0=B8=D0=BA=D1=81=20=D0=B0?= =?UTF-8?q?=D0=BF=D0=B4=D0=B5=D0=B9=D1=82=D0=B0=20=D0=B4=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TheHeader.vue | 26 +++++++-- .../clients/components/ClientsTableRow.vue | 56 ++++++++----------- .../cells/TableCellBodyNetworks.vue | 10 +++- src/pages/login/TheLogin.vue | 2 +- 4 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/components/TheHeader.vue b/src/components/TheHeader.vue index 93036aa..e473d08 100644 --- a/src/components/TheHeader.vue +++ b/src/components/TheHeader.vue @@ -19,13 +19,15 @@ :icon-right-size="18", @click="openForm" ) - button.header-buttons.flex.justify-center.items-center.mr-8.p-0(@click="logout") + button.header-buttons.flex.justify-center.items-center.mr-8.p-0 .icon-bell.text-xxl - .flex.justify-centflexer.items-center + .flex.justify-centflexer.items-center.relative base-avatar.mr-2(:size="32") img(:src="avatarSrc", alt="Avatar") - button.header-buttons + button.header-buttons(@click="openPopup") .icon-down-arrow.text-xxs.flex.justify-center.items-center.p-0 + base-popup.right-2.top-10(v-if="showPopup", :width="160", v-click-outside="openPopup") + .text-popup.flex.cursor-pointer.pl-2(@click="logout") Выйти @@ -91,4 +104,9 @@ export default { .charge-person-container position: absolute + +.text-popup + color: var(--btn-blue-color) + &:hover + opacity: 0.8 diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index f023a7d..1a3c8fc 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -220,9 +220,10 @@ export default { if (!this.dataClient.fullName) this.dataClient.fullName = clientName; else if (this.dataClient.fullName !== clientName) data.full_name = this.dataClient.fullName; + if (this.dataClient.age !== this.client.birth_date && this.dataClient.age) data.birth_date = this.dataClient.age; - else if (!this.dataClient.age) { + else if (!this.dataClient.age && this.client.birth_date) { this.addErrorNotification( "Некорректная дата рождения", "Пожалуйста, введите дату рождения корректно" @@ -252,56 +253,46 @@ export default { if ( this.dataClient.email.username && !contacts.find((el) => el.kind === "EMAIL") - ) { + ) contacts.push(this.dataClient.email); - } if ( this.dataClient.phone.username && !contacts.find((el) => el.kind === "PHONE") - ) { + ) contacts.push(this.dataClient.phone); - } let mapCreateContacts = this.client.contacts.map((el) => el.kind); - // let mapDeleteContacts = contacts.map((el) => el.kind); + let mapDeleteContacts = contacts.map((el) => el.kind); let createContacts = contacts.filter( (el) => !mapCreateContacts.includes(el.kind) ); - // let deleteContacts = this.client.contacts.filter( - // (el) => !mapDeleteContacts.includes(el.kind) - // ); + let deleteContacts = this.client.contacts.filter( + (el) => !mapDeleteContacts.includes(el.kind) + ); let updateContacts = []; this.client.contacts.forEach((el) => { if ( el.kind === "PHONE" && - this.dataClient.phone.username.length === 18 && el.username !== this.dataClient.phone.username - ) { + ) updateContacts.push(this.dataClient.phone); - } else - this.dataClient.phone.username = - this.client.contacts.find((el) => el.kind === "PHONE")?.username || - ""; if ( el.kind === "EMAIL" && - this.dataClient.email.username && el.username !== this.dataClient.email.username - ) { + ) updateContacts.push(this.dataClient.email); - } else - this.dataClient.email.username = - this.client.contacts.find((el) => el.kind === "EMAIL")?.username || - ""; }); createContacts.forEach((el) => this.postCreateContact(el)); - // deleteContacts.forEach((el) => this.postDeleteContact(el)); + deleteContacts.forEach((el) => this.postDeleteContact(el)); updateContacts.forEach((el) => this.postUpdateContact(el)); }, postCreateContact(contact) { - fetchWrapper.post("general/contact/create/", { - kind: contact.kind, - username: contact.username, - person_id: this.client.id, - }); + fetchWrapper + .post("general/contact/create/", { + kind: contact.kind, + username: contact.username, + person_id: this.client.id, + }) + .then(() => this.fetchDataClients()); }, postUpdateContact(contact) { fetchWrapper.post(`general/contact/${contact.id}/update/`, { @@ -557,11 +548,6 @@ export default { }); }, }, - watch: { - rowOverlay() { - if (this.rowOverlay) this.startTimer(); - }, - }, created() { this.dataClient = { id: this.client.id, @@ -595,6 +581,12 @@ export default { photo: this.client.photo, }; }, + watch: { + rowOverlay() { + if (this.rowOverlay) this.startTimer(); + }, + }, + beforeUnmount() { if (this.timer) { this.deleteClient(); diff --git a/src/pages/clients/components/cells/TableCellBodyNetworks.vue b/src/pages/clients/components/cells/TableCellBodyNetworks.vue index caf6151..469a01c 100644 --- a/src/pages/clients/components/cells/TableCellBodyNetworks.vue +++ b/src/pages/clients/components/cells/TableCellBodyNetworks.vue @@ -20,7 +20,12 @@ :size="24" ) .icon-plus(class="pt-[2px]") - base-popup.right-3.top-6(v-if="isOpenPopupAdding", v-click-outside="closePopup" :width="485") + base-popup.right-3.top-6( + v-if="isOpenPopupAdding", + @click.stop, + v-click-outside="closePopup", + :width="485" + ) base-adding-network( :value="network", :selected-option="getSelectedIcon", @@ -71,7 +76,8 @@ export default { computed: { getNetworks() { return this.networks.filter( - (el) => el.kind !== "EMAIL" && el.kind !== "PHONE" + (el) => + el.kind !== "EMAIL" && el.kind !== "PHONE" && el.deleted_flg !== true ); }, getSelectedIcon() { diff --git a/src/pages/login/TheLogin.vue b/src/pages/login/TheLogin.vue index 0c4570b..d0f82d1 100644 --- a/src/pages/login/TheLogin.vue +++ b/src/pages/login/TheLogin.vue @@ -7,7 +7,7 @@ .flex.flex-col.gap-y-2 .text-welcome.flex.not-italic.font-bold.text-5xl Добро пожаловать! .text-under.flex.not-italic.font-medium.text-base( - :style="{color: this.underTextColor}") Очень рады вас видеть. Войдите в аккаунт, чтобы начать пользоваться сервисом «Астра». + :style="{color: this.underTextColor}") Войдите в аккаунт, чтобы начать пользоваться сервисом «Астра». .flex.flex-col.gap-y-5 .flex.flex-col.gap-y-6px .flex.non-italic.font-semibold.text-xss Логин