From f322e7fc276681d29d28166eb1b0caaa26dad02a Mon Sep 17 00:00:00 2001 From: Net Date: Thu, 15 Aug 2024 16:36:04 +0700 Subject: [PATCH] refactor: get employee of Branch --- src/pages/03_customer-management/BranchPage.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pages/03_customer-management/BranchPage.vue b/src/pages/03_customer-management/BranchPage.vue index 40d89496..2fc0093f 100644 --- a/src/pages/03_customer-management/BranchPage.vue +++ b/src/pages/03_customer-management/BranchPage.vue @@ -43,7 +43,7 @@ const employeeFormStore = useEmployeeForm(); const customerBranchFormStore = useCustomerBranchForm(); const { t } = useI18n(); -const { fetchListCustomeBranch } = customerStore; +const { fetchListCustomeBranch, fetchBranchEmployee } = customerStore; const { currentFormData: customerBranchFormData, state: customerBranchFormState, @@ -59,8 +59,7 @@ const currentCustomerUrlImage = defineModel( 'currentCustomerUrlImage', ); -const { state: employeeFormState, currentFromDataEmployee } = - storeToRefs(employeeFormStore); +const { state: employeeFormState } = storeToRefs(employeeFormStore); const currentStatus = ref('All'); const currentBtnOpen = ref([]); @@ -494,9 +493,14 @@ watch([customerId, inputSearch, currentStatus], async () => { round flat @click=" - () => { - currentBtnOpen[props.rowIndex] = - !currentBtnOpen[props.rowIndex]; + async () => { + const res = await fetchBranchEmployee(props.row.id); + + if (res) { + listEmployee = res.data.result; + currentBtnOpen[props.rowIndex] = + !currentBtnOpen[props.rowIndex]; + } } " />