refactor(encounter): streamline navigation logic and reintroduce patient list fetching on mount

This commit is contained in:
riefive
2025-11-09 19:17:13 +07:00
parent df110912b8
commit a8bc3647a1
2 changed files with 11 additions and 13 deletions
+4 -6
View File
@@ -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') {
+7 -7
View File
@@ -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()
})
</script>
<template>