feat(encounter): add outpatient class and implement record deletion confirmation
This commit is contained in:
No files matched your search
@@ -38,7 +38,7 @@ import { useUserStore } from '~/stores/user'
|
||||
|
||||
const props = defineProps<{
|
||||
id: number
|
||||
classCode?: 'ambulatory' | 'emergency' | 'inpatient'
|
||||
classCode?: 'ambulatory' | 'emergency' | 'inpatient' | 'outpatient'
|
||||
subClassCode?: 'reg' | 'rehab' | 'chemo' | 'emg' | 'eon' | 'op' | 'icu' | 'hcu' | 'vk'
|
||||
formType: string
|
||||
}>()
|
||||
@@ -64,6 +64,22 @@ const isSaveDisabled = computed(() => {
|
||||
return !selectedPatient.value || !selectedPatientObject.value || isSaving.value
|
||||
})
|
||||
|
||||
function getListPath(): string {
|
||||
if (props.classCode === 'ambulatory' && props.subClassCode === 'rehab') {
|
||||
return '/rehab/encounter'
|
||||
}
|
||||
if (props.classCode === 'emergency') {
|
||||
return '/emergency/encounter'
|
||||
}
|
||||
if (props.classCode === 'outpatient') {
|
||||
return '/outpatient/encounter'
|
||||
}
|
||||
if (props.classCode === 'inpatient') {
|
||||
return '/inpatient/encounter'
|
||||
}
|
||||
return '/encounter' // fallback
|
||||
}
|
||||
|
||||
function handleSavePatient() {
|
||||
selectedPatientObject.value = null
|
||||
setTimeout(() => {
|
||||
@@ -148,10 +164,19 @@ async function handleSaveEncounter(formValues: any) {
|
||||
}
|
||||
if (subspecialist_id) {
|
||||
payload.subspecialist_id = subspecialist_id
|
||||
}
|
||||
|
||||
let paymentMethod = 'cash'
|
||||
if (formValues.paymentType === 'jkn' || formValues.paymentType === 'jkmm') {
|
||||
paymentMethod = 'insurance'
|
||||
} else if (formValues.paymentType === 'spm') {
|
||||
paymentMethod = 'cash'
|
||||
} else if (formValues.paymentType === 'pks') {
|
||||
paymentMethod = 'membership'
|
||||
}
|
||||
|
||||
if (formValues.paymentType === 'jkn') {
|
||||
payload.paymentMethod_code = 'insurance'
|
||||
if (paymentMethod === 'insurance') {
|
||||
payload.paymentMethod_code = paymentMethod
|
||||
payload.insuranceCompany_id = null
|
||||
payload.member_number = formValues.cardNumber
|
||||
payload.ref_number = formValues.sepNumber
|
||||
@@ -172,8 +197,8 @@ async function handleSaveEncounter(formValues: any) {
|
||||
description: 'Kunjungan berhasil dibuat',
|
||||
variant: 'default',
|
||||
})
|
||||
// Optionally navigate or reset form
|
||||
// navigateTo(`/encounter/${result.body?.data?.id}`)
|
||||
// Redirect to list page
|
||||
await navigateTo(getListPath())
|
||||
} else {
|
||||
const errorMessage = result.body?.message || 'Gagal membuat kunjungan'
|
||||
toast({
|
||||
|
||||
Reference in New Issue
Block a user