WIP Анимация пагинации и загрузки клиентов

This commit is contained in:
Daria Golova
2022-12-13 18:28:43 +03:00
parent c0bb78beb9
commit 36f02aa573
7 changed files with 82 additions and 47 deletions

View File

@@ -1,6 +1,6 @@
<template lang="pug"> <template lang="pug">
.header-inputs-wrapper.flex.items-center.font-medium.text-base(:class="{ open: isOpen }") .header-inputs-wrapper.flex.items-center.font-medium.text-base(:class="{ open: isOpen }")
.select-container(@click="changeState") .select-container(@click="changeState", v-click-outside="closeOptions")
.select-wrapper.flex.items-center.cursor-pointer.mx-4.my-2 .select-wrapper.flex.items-center.cursor-pointer.mx-4.my-2
.icon-wrapper.icon-search.flex.text-lg.justify-center.items-center .icon-wrapper.icon-search.flex.text-lg.justify-center.items-center
span.custom-input.select-input.inline-block.box-border.align-middle.pl-2.pr-1 {{ selectedFilter }} span.custom-input.select-input.inline-block.box-border.align-middle.pl-2.pr-1 {{ selectedFilter }}
@@ -30,6 +30,9 @@ export default {
selectFilter(filter) { selectFilter(filter) {
this.selectedFilter = filter; this.selectedFilter = filter;
}, },
closeOptions() {
this.isOpen = false;
},
}, },
}; };
</script> </script>

View File

@@ -86,8 +86,8 @@ export default {
box-shadow: 1px 1px 8px rgba(37, 40, 80, 0.15) box-shadow: 1px 1px 8px rgba(37, 40, 80, 0.15)
border-radius: 4px border-radius: 4px
background-color: white background-color: white
max-height: 140px
overflow-y: auto overflow-y: auto
height: 140px
.placeholder .placeholder
color: #090A15 color: #090A15
opacity: 0.5 opacity: 0.5

View File

@@ -1,6 +1,6 @@
<template lang="pug"> <template lang="pug">
a(:href="path") a(:href="path")
button.button.cursor-pointer.text-4xl.py-3.pr-4.pl-3(:id="id" :class="{active:active}" @click="(e) => changeStylePage(e)") button.button.cursor-pointer.text-4xl.py-3.pr-4.pl-3.transition(:id="id" :class="{active:active}" @click="(e) => changeStylePage(e)")
slot slot
</template> </template>

View File

@@ -75,7 +75,7 @@ export default {
showModal: false, showModal: false,
timeInformation: { timeInformation: {
dayStartTime: "08:00", dayStartTime: "08:00",
dayEndTime: "24:00", dayEndTime: "20:00",
}, },
eventsData: [], eventsData: [],
employeesData: [], employeesData: [],

View File

@@ -5,7 +5,7 @@
:disabled="disabledPreviousButton" :disabled="disabledPreviousButton"
) )
.icon-down-arrow.arrow-left .icon-down-arrow.arrow-left
button.item.flex.items-center.justify-center( button.item.flex.items-center.justify-center.transition.duration-100.ease-linear(
v-for="page, index in pageCount", v-for="page, index in pageCount",
:key="index", :key="index",
:id="page", :id="page",

View File

@@ -1,45 +1,52 @@
<template lang="pug"> <template lang="pug">
.wrapper-table.relative.flex.flex-col.px-6.py-6.h-full.w-full .wrapper-table.relative.flex.px-6.py-6.h-full.w-full
clients-table-hat( transition(name="table", mode="out-in")
:is-open-actions="marked.length", .flex.justify-center.items-center.w-full(v-if="dataClientsPresence")
:open-form="openForm", base-loader(
:clearing-text-search="clearingTextSearch", :width="60",
:change-clearing-text-search="changeClearingTextSearch", :height="60"
@search="filterDataClients",
)
.flex.flex-col.h-full.table-container.w-full.mt-8.mb-3
clients-table-header(:check="selectedCheck" :is-check="selectAll")
.flex.flex-col
clients-table-row(
v-for="client in dataClients",
:key="client.id",
:id="client.id",
:url="url",
:is-check="marked.includes(client.id)",
:check="selectedCheck",
:client="client",
:deleted-client-id="deletedRowId",
:update-data-client="updateDataClient",
:fetch-data-clients="fetchDataClients",
@delete-client="deleteClientHandler",
@recover-client="clearDeletedRowId",
) )
client-table-pagination( .relative.flex.flex-col.h-full.w-full(v-else)
v-if="paginationInfo.length > 1" clients-table-hat(
:pagination-info="paginationInfo" :is-open-actions="marked.length",
@previous-page="switchPreviousPage", :open-form="openForm",
@next-page="switchNextPage", :clearing-text-search="clearingTextSearch",
@set-current-page="changeCurrentTablePage" :change-clearing-text-search="changeClearingTextSearch",
) @search="filterDataClients",
base-modal( )
v-model="showModal", .flex.flex-col.h-full.table-container.w-full.mt-8.mb-3
title="Удалить клиента" clients-table-header(:check="selectedCheck" :is-check="selectAll")
) .flex.flex-col
client-table-delete-modal( clients-table-row(
:close-modal="closeModal", v-for="client in dataClients",
:deleted-client-id="deletedClientId", :key="client.id",
@delete-client="writeDeletedRowId" :id="client.id",
) :url="url",
:is-check="marked.includes(client.id)",
:check="selectedCheck",
:client="client",
:deleted-client-id="deletedRowId",
:update-data-client="updateDataClient",
:fetch-data-clients="fetchDataClients",
@delete-client="deleteClientHandler",
@recover-client="clearDeletedRowId",
)
client-table-pagination(
v-if="paginationInfo.length > 1"
:pagination-info="paginationInfo"
@previous-page="switchPreviousPage",
@next-page="switchNextPage",
@set-current-page="changeCurrentTablePage"
)
base-modal(
v-model="showModal",
title="Удалить клиента"
)
client-table-delete-modal(
:close-modal="closeModal",
:deleted-client-id="deletedClientId",
@delete-client="writeDeletedRowId"
)
</template> </template>
<script> <script>
@@ -52,6 +59,7 @@ import BaseClientFormCreate from "@/components/base/BaseClientFormCreate";
import ClientTablePagination from "./ClientTablePagination.vue"; import ClientTablePagination from "./ClientTablePagination.vue";
import BaseModal from "@/components/base/BaseModal.vue"; import BaseModal from "@/components/base/BaseModal.vue";
import ClientTableDeleteModal from "./ClientTableDeleteModal.vue"; import ClientTableDeleteModal from "./ClientTableDeleteModal.vue";
import BaseLoader from "@/components/Loader/BaseLoader.vue";
export default { export default {
name: "ClientsTable", name: "ClientsTable",
components: { components: {
@@ -63,6 +71,7 @@ export default {
ClientTablePagination, ClientTablePagination,
BaseModal, BaseModal,
ClientTableDeleteModal, ClientTableDeleteModal,
BaseLoader,
}, },
props: { props: {
openForm: Function, openForm: Function,
@@ -75,7 +84,11 @@ export default {
return { return {
selectAll: false, selectAll: false,
marked: [], marked: [],
dataClients: [], dataClients: [
{
initialization: true,
},
],
currentTablePage: 1, currentTablePage: 1,
limit: 14, limit: 14,
clientsCount: 0, clientsCount: 0,
@@ -91,6 +104,11 @@ export default {
clearingTextSearch: false, clearingTextSearch: false,
}; };
}, },
computed: {
dataClientsPresence() {
return this.dataClients[0]?.initialization;
},
},
methods: { methods: {
updateDataClient() { updateDataClient() {
if (this.textSearch) this.filteredClientsCount -= 1; if (this.textSearch) this.filteredClientsCount -= 1;
@@ -243,4 +261,18 @@ export default {
&::-webkit-scrollbar-thumb &::-webkit-scrollbar-thumb
border-radius: 8px border-radius: 8px
background-color: var(--btn-blue-color) background-color: var(--btn-blue-color)
.table-enter-from
opacity: 0
transform: translateY(0px)
pointer-events: none
.table-enter-active
transition: 0.3s ease
.table-leave-to
opacity: 0
transform: translateY(0px)
pointer-events: none
.table-leave-active
transition: 0.3s ease
.table-move
transition: 0.3s ease
</style> </style>

View File

@@ -350,7 +350,7 @@ export default {
}, },
async deleteClient() { async deleteClient() {
await fetchWrapper.del(`general/person/${this.client.id}/delete/`); await fetchWrapper.del(`general/person/${this.client.id}/delete/`);
this.addSuccessNotification("Клиент Успешно удален", ""); this.addSuccessNotification("Клиент успешно удален", "");
this.handleUnFocusPopup(); this.handleUnFocusPopup();
}, },
addSuccessNotification(title, message) { addSuccessNotification(title, message) {