feat(encounter): update ui cancellation + integration
This commit is contained in:
No files matched your search
@@ -39,6 +39,13 @@ const linkItems: LinkItem[] = [
|
|||||||
},
|
},
|
||||||
icon: 'i-lucide-circle-x',
|
icon: 'i-lucide-circle-x',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Hapus',
|
||||||
|
onClick: () => {
|
||||||
|
remove()
|
||||||
|
},
|
||||||
|
icon: 'i-lucide-trash',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
function detail() {
|
function detail() {
|
||||||
@@ -64,6 +71,12 @@ function cancel() {
|
|||||||
recAction.value = ActionEvents.showCancel
|
recAction.value = ActionEvents.showCancel
|
||||||
recItem.value = props.rec
|
recItem.value = props.rec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove() {
|
||||||
|
recId.value = props.rec.id || 0
|
||||||
|
recAction.value = ActionEvents.showConfirmDelete
|
||||||
|
recItem.value = props.rec
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ async function getPatientList() {
|
|||||||
|
|
||||||
// Handle confirmation result
|
// Handle confirmation result
|
||||||
async function handleConfirmCancel(record: any, action: string) {
|
async function handleConfirmCancel(record: any, action: string) {
|
||||||
if (action === 'delete' && record?.id) {
|
if (action === 'deactivate' && record?.id) {
|
||||||
try {
|
try {
|
||||||
const result = await cancelEncounter(record.id)
|
const result = await cancelEncounter(record.id)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
@@ -287,14 +287,15 @@ onMounted(() => {
|
|||||||
<!-- Record Confirmation Modal -->
|
<!-- Record Confirmation Modal -->
|
||||||
<RecordConfirmation
|
<RecordConfirmation
|
||||||
v-model:open="isRecordCancelOpen"
|
v-model:open="isRecordCancelOpen"
|
||||||
action="delete"
|
custom-title="Batalkan Kunjungan"
|
||||||
|
custom-message="Apakah anda yakin ingin membatalkan kunjungan pasien berikut?"
|
||||||
|
action="deactivate"
|
||||||
:record="recItem"
|
:record="recItem"
|
||||||
@confirm="handleConfirmCancel"
|
@confirm="handleConfirmCancel"
|
||||||
@cancel="handleCancelConfirmation"
|
@cancel="handleCancelConfirmation"
|
||||||
>
|
>
|
||||||
<template #default="{ record }">
|
<template #default="{ record }">
|
||||||
<div class="text-sm">
|
<div class="text-sm">
|
||||||
<p>Apakah anda yakin ingin membatalkan kunjungan pasien berikut?</p>
|
|
||||||
<p v-if="record?.patient?.person?.name">
|
<p v-if="record?.patient?.person?.name">
|
||||||
<strong>Nama:</strong>
|
<strong>Nama:</strong>
|
||||||
{{ record.patient.person.name }}
|
{{ record.patient.person.name }}
|
||||||
|
|||||||
@@ -86,3 +86,16 @@ export async function remove(path: string, id: number | string, name: string = '
|
|||||||
throw new Error(`Failed to delete ${name}`)
|
throw new Error(`Failed to delete ${name}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function custom(path: string, data: any, name: string = 'item') {
|
||||||
|
try {
|
||||||
|
const resp = await xfetch(`${path}`, 'PATCH', data)
|
||||||
|
const result: any = {}
|
||||||
|
result.success = resp.success
|
||||||
|
result.body = (resp.body as Record<string, any>) || {}
|
||||||
|
return result
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error putting ${name}:`, error)
|
||||||
|
throw new Error(`Failed to put ${name}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ export function remove(id: number | string) {
|
|||||||
|
|
||||||
export function cancel(id: number | string) {
|
export function cancel(id: number | string) {
|
||||||
let url = `${path}/${id}/cancel`
|
let url = `${path}/${id}/cancel`
|
||||||
return base.update(url, id, {}, name)
|
return base.custom(url, null, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user