From a8bc3647a1f9d108c23318e41ceba0ae5930cfd5 Mon Sep 17 00:00:00 2001 From: riefive Date: Sun, 9 Nov 2025 19:17:13 +0700 Subject: [PATCH] refactor(encounter): streamline navigation logic and reintroduce patient list fetching on mount --- app/components/content/encounter/entry.vue | 10 ++++------ app/components/content/encounter/list.vue | 14 +++++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/components/content/encounter/entry.vue b/app/components/content/encounter/entry.vue index adc04195..75f958be 100644 --- a/app/components/content/encounter/entry.vue +++ b/app/components/content/encounter/entry.vue @@ -34,8 +34,6 @@ import { // Stores import { useUserStore } from '~/stores/user' - - const props = defineProps<{ id: number classCode?: 'ambulatory' | 'emergency' | 'inpatient' | 'outpatient' @@ -68,12 +66,12 @@ function getListPath(): string { if (props.classCode === 'ambulatory' && props.subClassCode === 'rehab') { return '/rehab/encounter' } + if (props.classCode === 'ambulatory' && props.subClassCode === 'reg') { + return '/outpatient/encounter' + } if (props.classCode === 'emergency') { return '/emergency/encounter' } - if (props.classCode === 'outpatient') { - return '/outpatient/encounter' - } if (props.classCode === 'inpatient') { return '/inpatient/encounter' } @@ -164,7 +162,7 @@ async function handleSaveEncounter(formValues: any) { } if (subspecialist_id) { payload.subspecialist_id = subspecialist_id - } + } let paymentMethod = 'cash' if (formValues.paymentType === 'jkn' || formValues.paymentType === 'jkmm') { diff --git a/app/components/content/encounter/list.vue b/app/components/content/encounter/list.vue index 8524a0f1..0dd9a3bd 100644 --- a/app/components/content/encounter/list.vue +++ b/app/components/content/encounter/list.vue @@ -45,12 +45,12 @@ const hreaderPrep: HeaderPrep = { if (props.classCode === 'ambulatory' && props.subClassCode === 'rehab') { navigateTo('/rehab/encounter/add') } + if (props.classCode === 'ambulatory' && props.subClassCode === 'reg') { + navigateTo('/outpatient/encounter/add') + } if (props.classCode === 'emergency') { navigateTo('/emergency/encounter/add') } - if (props.classCode === 'outpatient') { - navigateTo('/outpatient/encounter/add') - } if (props.classCode === 'inpatient') { navigateTo('/inpatient/encounter/add') } @@ -92,10 +92,6 @@ async function getPatientList() { } } -onMounted(() => { - getPatientList() -}) - // Handle confirmation result async function handleConfirmDelete(record: any, action: string) { if (action === 'delete' && record?.id) { @@ -176,6 +172,10 @@ provide('rec_id', recId) provide('rec_action', recAction) provide('rec_item', recItem) provide('table_data_loader', isLoading) + +onMounted(() => { + getPatientList() +})