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 91e1db6..2a8e108 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -89,6 +89,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: { @@ -101,6 +103,7 @@ export default { BasePopup, BaseModal, addImageIcon, + TheNotificationProvider, }, props: { closeForm: Function, @@ -272,6 +275,7 @@ export default { .then((result) => { this.createIdentityDocument(result.id); this.createAddress(result.id); + this.addSuccessNotification(); }); this.$emit("update-client"); }, @@ -354,11 +358,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 006f292..897c58a 100644 --- a/src/pages/clients/components/ClientsTable.vue +++ b/src/pages/clients/components/ClientsTable.vue @@ -16,11 +16,11 @@ :check="selectedCheck", :client="client", :fetch-data-clients="fetchDataClients", + @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" @@ -60,6 +60,10 @@ export default { limit: 4, count: 0, textSearch: "", + paginationInfo: { + currentPage: 0, + length: 0, + }, }; }, computed: { @@ -68,6 +72,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; @@ -96,6 +104,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 e156300..502a0bb 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" @@ -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/`)