diff --git a/src/components/Notifications/NotificationItem.vue b/src/components/Notifications/NotificationItem.vue index ca2f851..a2d8559 100644 --- a/src/components/Notifications/NotificationItem.vue +++ b/src/components/Notifications/NotificationItem.vue @@ -1,9 +1,9 @@ @@ -83,4 +83,7 @@ export default { .grid grid-template-columns: 24px 1fr 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 41e5176..063c8c3 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -91,6 +91,8 @@ import BaseButton from "@/components/base/BaseButton"; import BasePopup from "@/components/base/BasePopup"; 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"; export default { name: "BaseClientFormClient", components: { @@ -103,6 +105,7 @@ export default { BasePopup, BaseModal, addImageIcon, + TheNotificationProvider, }, props: { closeForm: Function, @@ -276,6 +279,7 @@ export default { .then((result) => { this.createIdentityDocument(result.id); this.createAddress(result.id); + this.addSuccessNotification(); }); this.$emit("update-client"); }, @@ -358,11 +362,29 @@ export default { }, checkFormFullness() { if (!this.infoClient.basic.full_name) { - alert("Не заполнено ФИО клиента"); + this.addErrrorNotification(); return false; } return true; }, + addErrrorNotification() { + addNotification( + new Date().getTime(), + "Не заполнено ФИО клиента", + "Пожалуйста, заполните ФИО клиента", + "error", + 5000 + ); + }, + addSuccessNotification() { + addNotification( + new Date().getTime(), + "Клиент успешно создан", + "", + "success", + 5000 + ); + }, }, watch: { showModal: function () { diff --git a/src/pages/calendar/components/CalendarDeleteModal.vue b/src/pages/calendar/components/CalendarDeleteModal.vue index 66f82cc..1c2c36b 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", + 5000 + ); }, }, }; diff --git a/src/pages/calendar/components/CalendarFormAddEvent.vue b/src/pages/calendar/components/CalendarFormAddEvent.vue index c836248..9a86ff3 100644 --- a/src/pages/calendar/components/CalendarFormAddEvent.vue +++ b/src/pages/calendar/components/CalendarFormAddEvent.vue @@ -63,6 +63,8 @@ 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 27581f5..ef2cf85 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -65,6 +65,7 @@ clients-action-popup( v-if="isOpenPopup", :open-change-data="openChangeData" + :delete-client="deleteClient" ) client-detail-info-wrapper( v-if="isOpenDetailInfo" @@ -272,6 +273,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/`)