From 6036500b18f1c8798d9a64e8791cc04cfb1d7d9b Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Tue, 29 Nov 2022 16:12:39 +0300 Subject: [PATCH 1/3] =?UTF-8?q?WIP=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Notifications/NotificationItem.vue | 4 ++- src/components/base/BaseClientFormCreate.vue | 24 +++++++++++++- .../components/CalendarFormAddEvent.vue | 31 +++++++++++++---- .../components/ClientTablePagination.vue | 33 ++++++++++++------- .../clients/components/ClientsActionPopup.vue | 3 +- src/pages/clients/components/ClientsTable.vue | 20 ++++++++--- .../clients/components/ClientsTableRow.vue | 6 ++++ 7 files changed, 95 insertions(+), 26 deletions(-) diff --git a/src/components/Notifications/NotificationItem.vue b/src/components/Notifications/NotificationItem.vue index ca2f851..37d610b 100644 --- a/src/components/Notifications/NotificationItem.vue +++ b/src/components/Notifications/NotificationItem.vue @@ -1,7 +1,7 @@ diff --git a/src/pages/clients/components/ClientsTable.vue b/src/pages/clients/components/ClientsTable.vue index a855968..ea34078 100644 --- a/src/pages/clients/components/ClientsTable.vue +++ b/src/pages/clients/components/ClientsTable.vue @@ -16,12 +16,12 @@ :check="selectedCheck", :client="client", :fetch-data-clients="fetchDataClients", - :current-year="currentYear" + :current-year="currentYear", + @update-clients="updateDataClient" ) client-table-pagination( - v-if="pageCount > 1" - :length="pageCount", - :current-page="currentTablePage", + v-if="paginationInfo.length > 1" + :pagination-info="paginationInfo" @previous-page="switchPreviousPage", @next-page="switchNextPage", @set-current-page="changeCurrentTablePage" @@ -62,6 +62,10 @@ export default { limit: 4, count: 0, textSearch: "", + paginationInfo: { + currentPage: 0, + length: 0, + }, }; }, computed: { @@ -70,6 +74,10 @@ export default { }, }, methods: { + updateDataClient() { + if (this.dataClients.length === 1) this.currentTablePage -= 1; + else this.fetchDataClients(); + }, saveDataClients(data) { this.dataClients = data.results; this.count = data.count; @@ -98,6 +106,10 @@ export default { ); } this.saveDataClients(response); + this.paginationInfo = { + currentPage: this.currentTablePage, + length: this.pageCount, + }; }, selectedCheck(e) { if (e.target.id === "checkbox") { diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index 814ae6e..081ac04 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -64,6 +64,7 @@ clients-action-popup( v-if="isOpenPopup", :open-change-data="openChangeData" + :delete-client="deleteClient" ) client-detail-info-wrapper( v-if="isOpenDetailInfo" @@ -270,6 +271,11 @@ export default { openChangeData() { this.isOpenChange = true; }, + async deleteClient() { + await fetchWrapper.del(`general/person/${this.dataClient.id}/delete/`); + this.handleUnFocusPopup(); + this.$emit("update-clients"); + }, fetchClientDetail(id) { fetchWrapper .get(`general/person/${id}/detail/`) From b5624ff69cfdc8cbd2bfec898ba21b08a3a99202 Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Tue, 29 Nov 2022 16:41:12 +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=D0=BE=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BE=D0=B1=D1=8B=D1=82?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CalendarDeleteModal.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pages/calendar/components/CalendarDeleteModal.vue b/src/pages/calendar/components/CalendarDeleteModal.vue index 66f82cc..4d149fb 100644 --- a/src/pages/calendar/components/CalendarDeleteModal.vue +++ b/src/pages/calendar/components/CalendarDeleteModal.vue @@ -24,9 +24,15 @@ import { fetchWrapper } from "@/shared/fetchWrapper.js"; import BaseButton from "@/components/base/BaseButton.vue"; import CalendarEventDescriptionCard from "./CalendarEventDescriptionCard.vue"; +import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider"; +import { addNotification } from "@/components/Notifications/notificationContext"; export default { name: "CalendarDeleteModal", - components: { CalendarEventDescriptionCard, BaseButton }, + components: { + CalendarEventDescriptionCard, + BaseButton, + TheNotificationProvider, + }, props: { ownerEvent: Object, eventTypes: { @@ -42,6 +48,16 @@ export default { await fetchWrapper.del(`registry/event/${this.ownerEvent.id}/delete/`); this.$emit("update-events"); this.closeModal(); + this.addSuccessNotification(); + }, + addSuccessNotification() { + addNotification( + new Date().getTime(), + "Событие успешно удалено", + "", + "success", + 3000 + ); }, }, }; From 689bf9b89584600cc643874ad05c415cffa69672 Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Tue, 29 Nov 2022 18:15:26 +0300 Subject: [PATCH 3/3] =?UTF-8?q?WIP=20=D0=A3=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F=20=D1=83?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Notifications/NotificationItem.vue | 3 ++- src/components/base/BaseClientFormCreate.vue | 4 ++-- src/pages/calendar/components/CalendarDeleteModal.vue | 2 +- src/pages/calendar/components/CalendarFormAddEvent.vue | 9 ++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Notifications/NotificationItem.vue b/src/components/Notifications/NotificationItem.vue index 37d610b..a2d8559 100644 --- a/src/components/Notifications/NotificationItem.vue +++ b/src/components/Notifications/NotificationItem.vue @@ -3,7 +3,7 @@ .notification-content.flex.mr-16 .grid(:class="{'grid-rows': message}") .text-white.text-xs.icon.row-span-full.flex.justify-center.items-center(:class="iconClass") - .text-white.text-base(v-if="title") {{ title }} + .text-white.text-base.font-bold(v-if="title") {{ title }} .text-white.text-base(v-if="message") {{ message }} .icon-cancel.cursor-pointer.text-white.opacity-50.text-sm(class="hover:opacity-100 active:opacity-75", @click="delNotification") @@ -85,4 +85,5 @@ export default { grid-column-gap: 8px .grid-rows grid-template-rows: repeat(2, auto) + grid-row-gap: 8px diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index 644903b..b671726 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -298,7 +298,7 @@ export default { "Не заполнено ФИО клиента", "Пожалуйста, заполните ФИО клиента", "error", - 3000 + 5000 ); }, addSuccessNotification() { @@ -307,7 +307,7 @@ export default { "Клиент успешно создан", "", "success", - 3000 + 5000 ); }, }, diff --git a/src/pages/calendar/components/CalendarDeleteModal.vue b/src/pages/calendar/components/CalendarDeleteModal.vue index 4d149fb..1c2c36b 100644 --- a/src/pages/calendar/components/CalendarDeleteModal.vue +++ b/src/pages/calendar/components/CalendarDeleteModal.vue @@ -56,7 +56,7 @@ export default { "Событие успешно удалено", "", "success", - 3000 + 5000 ); }, }, diff --git a/src/pages/calendar/components/CalendarFormAddEvent.vue b/src/pages/calendar/components/CalendarFormAddEvent.vue index 3bd08d6..9a86ff3 100644 --- a/src/pages/calendar/components/CalendarFormAddEvent.vue +++ b/src/pages/calendar/components/CalendarFormAddEvent.vue @@ -365,15 +365,14 @@ export default { addErrrorNotification(error) { addNotification( new Date().getTime(), - error.type, - `error code: ${error.errors[0].code} - error detail: ${error.errors[0].detail}`, + error.errors[0].code, + error.errors[0].detail, "error", - 3000 + 5000 ); }, addSuccessNotification(message) { - addNotification(new Date().getTime(), message, "", "success", 3000); + addNotification(new Date().getTime(), message, "", "success", 5000); }, fetchMembersData() { fetchWrapper