diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index fd2647c7..cee0de34 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -142,6 +142,14 @@ async function init() { gridView.value = $q.screen.lt.md ? true : false; + if (route.query.tab === 'customer') { + currentTab.value = 'employer'; + if (route.query.id) openSpecificCustomer(route.query.id as string); + } else if (route.query.tab === 'employee') { + currentTab.value = 'employee'; + if (route.query.id) openSpecificEmployee(route.query.id as string); + } + if (route.name === 'CustomerManagement') await fetchListCustomer(true); if ( @@ -490,6 +498,30 @@ async function fetchImageList( return res; } +async function openSpecificCustomer(id: string) { + await customerFormStore.assignFormData(id); + await fetchImageList( + id, + customerFormData.value.selectedImage || '', + 'customer', + ); + customerFormState.value.branchIndex = -1; + customerFormState.value.drawerModal = true; + customerFormState.value.editCustomerId = id; + customerFormState.value.dialogType = 'info'; +} + +async function openSpecificEmployee(id: string) { + await employeeFormStore.assignFormDataEmployee(id); + await fetchImageList( + id, + currentFromDataEmployee.value.selectedImage || '', + 'employee', + ); + employeeFormState.value.dialogType = 'info'; + employeeFormState.value.drawerModal = true; +} + // TODO: When in employee form, if select address same as customer then auto fill watch( diff --git a/src/pages/08_request-list/RequestListView.vue b/src/pages/08_request-list/RequestListView.vue index 94343725..9327f419 100644 --- a/src/pages/08_request-list/RequestListView.vue +++ b/src/pages/08_request-list/RequestListView.vue @@ -438,6 +438,24 @@ async function submitRejectCancel() { pageState.rejectCancelDialog = false; } } + +function toCustomer(customer: RequestData['quotation']['customerBranch']) { + const url = new URL( + `/customer-management?tab=customer&id=${customer.customerId}`, + window.location.origin, + ); + + window.open(url.toString(), '_blank'); +} + +function toEmployee(employee: RequestData['employee']) { + const url = new URL( + `/customer-management?tab=employee&id=${employee.id}`, + window.location.origin, + ); + + window.open(url.toString(), '_blank'); +}