From 0bd2c0b3a05d64cc2ec7b4d25fc1ce8b815cf017 Mon Sep 17 00:00:00 2001 From: Net Date: Wed, 24 Jul 2024 14:32:14 +0700 Subject: [PATCH] refacrot: (03) edit path --- src/pages/03_customer-management/MainPage.vue | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index 8aad0666..cedb4faf 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -1413,7 +1413,16 @@ async function fetchListStatsEmployeeGender() { onMounted(async () => { utilsStore.currentTitle.title = 'customerManagement'; - utilsStore.currentTitle.path = [{ text: 'customerManagementCaption' }]; + utilsStore.currentTitle.path = [ + { + text: 'customerManagementCaption', + handler: () => { + isMainPage.value = true; + currentCustomerUrlImage.value = null; + clearForm(); + }, + }, + ]; modeView.value = $q.screen.lt.md ? true : false; const resultStats = await getStatsCustomer(); @@ -1560,6 +1569,27 @@ watch( if (v) modeView.value = true; }, ); + +watch(isMainPage, () => { + const tmp: typeof utilsStore.currentTitle.path = [ + { + text: 'customerManagementCaption', + handler: () => { + isMainPage.value = true; + currentCustomerUrlImage.value = null; + clearForm(); + }, + }, + ]; + + if (isMainPage.value === false) { + tmp.push({ + text: currentCustomerName.value || '', + }); + } + + utilsStore.currentTitle.path = tmp; +});