From 9cba7503fd27c959dda4090c419d8b626541e9e5 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Tue, 6 Dec 2022 17:59:40 +0300 Subject: [PATCH 1/2] =?UTF-8?q?[WIP]=20=D0=98=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20update=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0,=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D0=BF=D1=80=D0=BE=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BB=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D1=85=D0=BE=D0=B2=D0=B5=D1=80=20=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D1=83=D1=89=D0=B5=D0=B3=D0=BE=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clients/components/ClientsTableRow.vue | 43 ++++++++++++++++--- .../components/cells/TableCellBodyAge.vue | 17 ++++++-- .../components/cells/TableCellBodyEmail.vue | 8 +++- .../components/cells/TableCellBodyName.vue | 8 +++- .../cells/TableCellBodyNetworks.vue | 34 ++++++++++++--- .../components/cells/TableCellBodyPhone.vue | 1 + .../cells/TableCellBodyPriority.vue | 2 +- src/pages/clients/utils/tableConfig.js | 10 ++--- 8 files changed, 98 insertions(+), 25 deletions(-) diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index e24b6a7..dd09730 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -84,7 +84,7 @@ :disabled-delete="!!deletedClientId && !rowOverlay", @delete-client="transmitDeleteClient" ) - client-detail-info-wrapper( + client-detail-info-wrapper.detail( v-if="isOpenDetailInfo", :data-address="dataAddress" :data-detail="dataDetail" @@ -122,6 +122,7 @@ import { fetchWrapper } from "@/shared/fetchWrapper"; import { column } from "@/pages/clients/utils/tableConfig"; import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider"; import { addNotification } from "@/components/Notifications/notificationContext"; +import * as moment from "moment"; export default { name: "ClientsTableRow", @@ -211,15 +212,31 @@ export default { (el) => el.text === this.dataClient.priority ); let data = {}; - if (this.dataClient.age) { + if ( + this.dataClient.age !== this.client.birth_date && + this.dataClient.age + ) { data.birth_date = this.dataClient.age; } if ( - this.dataClient.priority !== this.client.priority && - this.dataClient.priority + foundElement.id !== this.client.priority && + foundElement.text !== "-" ) { data.priority = foundElement.priority; + } else if (foundElement.text === "-") { + data.priority = 4; } + if ( + data.birth_date && + moment(data.birth_date).isAfter(moment().format("YYYY-MM-DD")) + ) { + this.addErrorNotification(); + this.dataClient.age = this.client.birth_date; + } else + fetchWrapper.post(`general/person/${this.client.id}/update/`, { + full_name: this.dataClient.fullName, + ...data, + }); }, postContactsClient() { let contacts = [...this.dataClient.contacts]; @@ -319,6 +336,15 @@ export default { 5000 ); }, + addErrorNotification() { + addNotification( + "Некорректная дата рождения", + "Некорректная дата рождения", + "Дата рождения позже текущего дня", + "error", + 5000 + ); + }, fetchClientDetail(id) { fetchWrapper .get(`general/person/${id}/detail/`) @@ -489,7 +515,8 @@ export default { } ${this.client.patronymic || ""}`, age: this.client.birth_date || "", priority: this.prioritySettings.settings.find( - (el) => el.priority === this.client.priority + (el) => + el.priority === this.client.priority || this.client.priority === el.id ).text, phone: { id: this.client.contacts.find((el) => el.kind === "PHONE")?.id || "", @@ -524,11 +551,13 @@ export default { .row-wrapper border-bottom: 1px solid var(--border-light-grey-color) min-width: 1556px +.row-wrapper:hover .detail + background-color: var(--bg-hover-row-table) +.row-wrapper:hover .row-body + background-color: var(--bg-hover-row-table) .row-body color: var(--font-dark-blue-color) min-height: 56px - &:hover - background-color: var(--bg-hover-row-table) .check-box min-width: 36px .dots diff --git a/src/pages/clients/components/cells/TableCellBodyAge.vue b/src/pages/clients/components/cells/TableCellBodyAge.vue index 28992d7..076cb58 100644 --- a/src/pages/clients/components/cells/TableCellBodyAge.vue +++ b/src/pages/clients/components/cells/TableCellBodyAge.vue @@ -1,14 +1,19 @@ + diff --git a/src/pages/clients/components/cells/TableCellBodyEmail.vue b/src/pages/clients/components/cells/TableCellBodyEmail.vue index e04796c..fbc33ea 100644 --- a/src/pages/clients/components/cells/TableCellBodyEmail.vue +++ b/src/pages/clients/components/cells/TableCellBodyEmail.vue @@ -1,7 +1,13 @@