From eef6e53c6da79247c7ac2b0748bafe252e5224a8 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 13 Jun 2024 11:58:51 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E0=B8=97=E0=B8=B3=E0=B9=81=E0=B8=9A?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=82?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=20=20=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88?= =?UTF-8?q?=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/03_customer-management/MainPage.vue | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index 2f893b97..eb7c467b 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -6,6 +6,7 @@ import { Pagination } from 'src/stores/types'; import useCustomerStore from 'src/stores/customer'; import useEmployeeStore from 'src/stores/employee'; +import AddCardCompoent from 'src/components/AddCardCompoent.vue'; import PersonCard from 'components/home/PersonCard.vue'; import UsersDetailCardComponent from 'src/components/UsersDetailCardComponent.vue'; import SelectorList from 'components/SelectorList.vue'; @@ -225,6 +226,10 @@ const currentPageCustomer = ref(1); const maxPageCustomer = ref(1); const pageSizeCustomer = ref(30); +const currentPageEmployee = ref(1); +const maxPageEmployee = ref(1); +const pageSizeEmployee = ref(30); + const currentBranchId = ref(''); const currentCustomerName = ref(''); const currentCustomerUrlImage = ref(null); @@ -677,6 +682,17 @@ async function fetchListCustomer() { } } +async function fetchListEmployee() { + const resultListEmployee = await employeeStore.fetchList(); + if (resultListEmployee) { + currentPageEmployee.value = resultListEmployee.page; + maxPageEmployee.value = Math.ceil( + resultListEmployee.total / pageSizeEmployee.value, + ); + listEmployee.value = resultListEmployee.result; + } +} + async function onSubmitEdit(id: string) { if (selectorLabel.value === 'EMPLOYER') { if (!formData.value) return; @@ -990,8 +1006,17 @@ onMounted(async () => { const resultStatsEmployee = await employeeStore.getStatsEmployee(); if (resultStatsEmployee) statsEmployee.value = resultStatsEmployee; - const resultListEmployee = await employeeStore.fetchList(); - if (resultListEmployee) listEmployee.value = resultListEmployee.result; + const resultListEmployee = await employeeStore.fetchList({ + page: 1, + pageSize: pageSizeEmployee.value, + }); + + if (resultListEmployee) { + maxPageEmployee.value = Math.ceil( + resultListEmployee.total / pageSizeEmployee.value, + ); + listEmployee.value = resultListEmployee.result; + } const resultOption = await fetch('/option/option.json'); employeeStore.globalOption = await resultOption.json(); @@ -1012,7 +1037,11 @@ watch(locale, () => { }); watch(currentPageCustomer, async () => { - fetchListCustomer(); + await fetchListCustomer(); +}); + +watch(currentPageEmployee, async () => { + await fetchListEmployee(); }); watch(fieldSelectedCustomer, async () => { @@ -1190,9 +1219,15 @@ watch(fieldSelectedCustomer, async () => { >
+ + {
@@ -1308,6 +1345,17 @@ watch(fieldSelectedCustomer, async () => { @delete-card="onDelete" /> + +
+ +