refactor: get employee of Branch

This commit is contained in:
Net 2024-08-15 16:36:04 +07:00
parent 11388681cd
commit f322e7fc27

View file

@ -43,7 +43,7 @@ const employeeFormStore = useEmployeeForm();
const customerBranchFormStore = useCustomerBranchForm(); const customerBranchFormStore = useCustomerBranchForm();
const { t } = useI18n(); const { t } = useI18n();
const { fetchListCustomeBranch } = customerStore; const { fetchListCustomeBranch, fetchBranchEmployee } = customerStore;
const { const {
currentFormData: customerBranchFormData, currentFormData: customerBranchFormData,
state: customerBranchFormState, state: customerBranchFormState,
@ -59,8 +59,7 @@ const currentCustomerUrlImage = defineModel<string | null>(
'currentCustomerUrlImage', 'currentCustomerUrlImage',
); );
const { state: employeeFormState, currentFromDataEmployee } = const { state: employeeFormState } = storeToRefs(employeeFormStore);
storeToRefs(employeeFormStore);
const currentStatus = ref<Status | 'All'>('All'); const currentStatus = ref<Status | 'All'>('All');
const currentBtnOpen = ref<boolean[]>([]); const currentBtnOpen = ref<boolean[]>([]);
@ -494,9 +493,14 @@ watch([customerId, inputSearch, currentStatus], async () => {
round round
flat flat
@click=" @click="
() => { async () => {
currentBtnOpen[props.rowIndex] = const res = await fetchBranchEmployee(props.row.id);
!currentBtnOpen[props.rowIndex];
if (res) {
listEmployee = res.data.result;
currentBtnOpen[props.rowIndex] =
!currentBtnOpen[props.rowIndex];
}
} }
" "
/> />