diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index e5dd0af1..116555f1 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -397,7 +397,11 @@ async function fetchListEmployee(opt?: { employeeStats.value = await employeeStore.getStatsEmployee(); } -async function triggerChangeStatus(id: string, status: string) { +async function triggerChangeStatus( + id: string, + status: string, + employeeName?: string, +) { return await new Promise((resolve, reject) => { dialog({ color: status !== 'INACTIVE' ? 'warning' : 'info', @@ -412,7 +416,11 @@ async function triggerChangeStatus(id: string, status: string) { : t('dialog.message.confirmChangeStatusOn'), action: async () => { if (currentTab.value === 'employee') { - await toggleStatusEmployee(id, status === 'INACTIVE' ? false : true) + await toggleStatusEmployee( + id, + status === 'INACTIVE' ? false : true, + employeeName, + ) .then(resolve) .catch(reject); } else { @@ -426,9 +434,14 @@ async function triggerChangeStatus(id: string, status: string) { }); } -async function toggleStatusEmployee(id: string, status: boolean) { +async function toggleStatusEmployee( + id: string, + status: boolean, + employeeName: string, +) { const res = await employeeStore.editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE', + firstNameEN: employeeName, }); if (res && employeeFormState.value.drawerModal) currentFromDataEmployee.value.status = res.status; @@ -1831,7 +1844,11 @@ const emptyCreateDialog = ref(false); " @toggle-status=" async (item: any) => { - triggerChangeStatus(item.id, item.status); + triggerChangeStatus( + item.id, + item.status, + item.firstNameEN, + ); } " /> @@ -4585,7 +4602,11 @@ const emptyCreateDialog = ref(false); @update:toggle-status=" (v) => { if (currentFromDataEmployee.id !== undefined) - triggerChangeStatus(currentFromDataEmployee.id, v); + triggerChangeStatus( + currentFromDataEmployee.id, + v, + currentFromDataEmployee.firstNameEN, + ); } " :active="currentFromDataEmployee.status !== 'INACTIVE'"