From 05a6bed15b92490c241768f5488e1f4f06036a75 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:35:47 +0700 Subject: [PATCH] feat: toggle status and filter text --- .../02_personnel-management/MainPage.vue | 121 ++++++++++++++---- 1 file changed, 98 insertions(+), 23 deletions(-) diff --git a/src/pages/02_personnel-management/MainPage.vue b/src/pages/02_personnel-management/MainPage.vue index ba4ec963..20be3248 100644 --- a/src/pages/02_personnel-management/MainPage.vue +++ b/src/pages/02_personnel-management/MainPage.vue @@ -63,6 +63,8 @@ const urlProfile = ref(); const isEdit = ref(false); const modal = ref(false); const status = ref(false); +const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all'); +const inputSearch = ref(''); const userId = ref(''); const selectorLabel = ref(''); const hqId = ref(''); @@ -287,6 +289,17 @@ function mapUserType(label: string) { formData.value.userType = userTypeMap[label]; } +async function toggleStatus(id: string) { + const record = userData.value?.result.find((v) => v.id === id); + + if (!record) return; + + const res = await userStore.editById(record.id, { + status: record.status !== 'INACTIVE' ? 'INACTIVE' : 'ACTIVE', + }); + if (res) record.status = res.status; +} + onMounted(async () => { await userStore.fetchList({ includeBranch: true }); userStore.userOption.roleOpts.length === 0 @@ -370,32 +383,94 @@ watch( +
+ + + + + {{ $t('all') }} + + + {{ $t('statusACTIVE') }} + + + {{ $t('statusINACTIVE') }} + + + + + +