Files
simrsx-fe/app/components/content/encounter/list.vue
T
Hasyim Kai 75b9618a26 Squashed commit of the following:
commit 9f5ede3aea
Merge: 16858dc dbe8e34
Author: Munawwirul Jamal <57973347+munaja@users.noreply.github.com>
Date:   Fri Dec 5 09:26:33 2025 +0700

    Merge pull request #213 from dikstub-rssa/feat/things-munaja

    Feat/things munaja

commit dbe8e34d07
Author: Munawwirul Jamal <munawwirul.jamal@gmail.com>
Date:   Fri Dec 5 09:26:00 2025 +0700

    feat/things-munaja: fix enc status

commit 786107ddd9
Author: Munawwirul Jamal <munawwirul.jamal@gmail.com>
Date:   Thu Dec 4 22:57:33 2025 +0700

    feat/things-munaja: content switcher

commit 4450cb943e
Merge: 9136093 16858dc
Author: Munawwirul Jamal <munawwirul.jamal@gmail.com>
Date:   Thu Dec 4 19:31:30 2025 +0700

    Merge branch 'dev' into feat/things-munaja

commit 9136093fd6
Author: Munawwirul Jamal <munawwirul.jamal@gmail.com>
Date:   Thu Dec 4 18:02:14 2025 +0700

    feat/things-munaja: cleaning

commit 16858dc2a0
Merge: 82e33c6 67a5154
Author: Munawwirul Jamal <57973347+munaja@users.noreply.github.com>
Date:   Thu Dec 4 14:30:35 2025 +0700

    Merge pull request #212 from dikstub-rssa/feat/encounter-adjustment-163

    Enhancement SEP

commit 67a515478c
Author: riefive <rie.five@gmail.com>
Date:   Thu Dec 4 13:39:36 2025 +0700

    fix: save sep

commit 82e33c6dbf
Merge: f96cbdb eba740a
Author: Munawwirul Jamal <57973347+munaja@users.noreply.github.com>
Date:   Thu Dec 4 13:21:37 2025 +0700

    Merge pull request #209 from dikstub-rssa/feat/move-kai-ui-to-sidebar-195

    Feat/move kai UI to sidebar 195

commit e6b74a4949
Author: riefive <rie.five@gmail.com>
Date:   Thu Dec 4 12:36:53 2025 +0700

    fix: encounter update form

commit 434f8471ce
Author: riefive <rie.five@gmail.com>
Date:   Thu Dec 4 12:20:07 2025 +0700

    fix: update save again

commit bae087aa6d
Author: riefive <rie.five@gmail.com>
Date:   Thu Dec 4 12:19:37 2025 +0700

    fix: update save

commit f96cbdb173
Merge: 5de0057 62556a5
Author: Munawwirul Jamal <57973347+munaja@users.noreply.github.com>
Date:   Thu Dec 4 12:07:25 2025 +0700

    Merge pull request #210 from dikstub-rssa/feat/procedure-room-order

    Feat/procedure room order

commit 62556a5c7d
Merge: 93a294d 5de0057
Author: Munawwirul Jamal <57973347+munaja@users.noreply.github.com>
Date:   Thu Dec 4 12:07:18 2025 +0700

    Merge branch 'dev' into feat/procedure-room-order

commit 5da439720f
Author: riefive <rie.five@gmail.com>
Date:   Thu Dec 4 11:59:37 2025 +0700

    feat: implement encounter entry form for patient, doctor, payment, and SEP management

commit 5de0057278
Merge: 71ca7f9 782034c
Author: Andsky <andrianovsky95@gmail.com>
Date:   Thu Dec 4 11:56:31 2025 +0700

    Merge pull request #211 from dikstub-rssa/feat/micro-lab-order-50

    Feat/micro lab order 50

commit 93a294d8d0
Merge: 6c26367 26365bb
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Thu Dec 4 11:18:49 2025 +0700

    Merge branch 'dev' into feat/procedure-room-order

commit 26365bbd2e
Merge: b6b56d1 e7cab6c
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Thu Dec 4 11:18:33 2025 +0700

    Merge branch 'dev' of github.com:dikstub-rssa/simrs-fe into dev

commit 6c26367c1d
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Thu Dec 4 10:51:40 2025 +0700

    feat/procedure-room-order: added item

commit d2ceda37bf
Author: riefive <rie.five@gmail.com>
Date:   Thu Dec 4 10:58:16 2025 +0700

    feat: Implement encounter list management with search, date range filtering, and record actions.

commit a0dfd214e5
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Thu Dec 4 10:25:50 2025 +0700

    feat/procedure-room-order: finishing

commit acb573e279
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Thu Dec 4 10:25:35 2025 +0700

    feat/procedure-room-order: adjust procedure-room-order

commit 9adb77d10b
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Thu Dec 4 10:24:52 2025 +0700

    feat/procedure-room-order: adjust material-package

commit 52454a019e
Merge: 0a0fb73 b6b56d1
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Thu Dec 4 10:23:14 2025 +0700

    Merge branch 'dev' into feat/procedure-room-order

commit b6b56d186d
Author: Munawwirul Jamal <munawwirul.jamal@gmail.com>
Date:   Thu Dec 4 10:17:16 2025 +0700

    dev: hotfix, cleaning some pubs

commit acc45b205f
Author: riefive <rie.five@gmail.com>
Date:   Wed Dec 3 16:25:15 2025 +0700

    fix: upload sep + sipp file

commit 0a0fb73483
Author: Munawwirul Jamal <munawwirul.jamal@gmail.com>
Date:   Wed Dec 3 14:33:13 2025 +0700

    feat/procedure-room-order: flow for procedure room

commit 7b4b4eecf9
Merge: 9f72e1d b172125
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Wed Dec 3 10:18:15 2025 +0700

    Merge branch 'feat/mcu-order' into feat/procedure-room-order

commit 782034c2b1
Merge: bae0a22 b80ee5a
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Wed Dec 3 10:16:45 2025 +0700

    Merge branch 'dev' into feat/micro-lab-order-50

commit 9f72e1df47
Merge: fa0ae98 b80ee5a
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Wed Dec 3 10:02:57 2025 +0700

    Merge branch 'dev' into feat/procedure-room-order

commit fa0ae9866e
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Wed Dec 3 09:44:33 2025 +0700

    feat/procedure-room-order: wip #3

commit ce93f996d9
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Wed Dec 3 09:43:36 2025 +0700

    feat/procedure-room-order: wip #2
    + procedure-room

commit 4444e87cb3
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Wed Dec 3 09:42:31 2025 +0700

    feat/procedure-room-order: wip #1

    + material-package
    + material-package-item

commit b172125d99
Merge: b2d3c14 9b7a719
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Mon Dec 1 20:41:58 2025 +0700

    Merge branch 'feat/page-cleaning' into feat/mcu-order

commit bae0a222b8
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Mon Dec 1 01:51:04 2025 +0700

    feat/micro-lab-order-50: adjust for antibiotic

commit 1ee0f39e7d
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Mon Dec 1 01:50:39 2025 +0700

    feat/micro-lab-order-50: added antibiotic

commit 95e27a8b6f
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Sun Nov 30 13:00:04 2025 +0700

    feat/micro-lab-order-50: wip

commit a002ef6c6e
Merge: fb2f01b b2d3c14
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Sun Nov 30 12:50:31 2025 +0700

    Merge branch 'feat/mcu-order' into feat/micro-lab-order-50

commit b2d3c14ddc
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Sun Nov 30 12:48:11 2025 +0700

    feat/mcu-order: adjustment

commit fb2f01bd36
Merge: 9a481fe 5c92f8b
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Sun Nov 30 12:43:11 2025 +0700

    Merge branch 'feat/mcu-order' into feat/micro-lab-order-50

commit 5c92f8b946
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Sun Nov 30 12:30:19 2025 +0700

    feat/mcu-order: added the components

commit 9a481fec14
Merge: 4251239 78fc289
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Fri Nov 28 21:18:10 2025 +0700

    Merge branch 'dev' into feat/micro-lab-order-50

commit 4251239f7c
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Fri Nov 28 21:17:18 2025 +0700

    feat/micro-lab-order-50: wip

commit cf5789549e
Author: Munawwirul Jamal <munawwirul.jamal@gmail.com>
Date:   Sun Nov 23 15:56:31 2025 +0700

    feat/mcu: improved wip

commit a40eac35f8
Merge: 3211972 baf6ab1
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Wed Nov 19 22:23:18 2025 +0700

    Merge branch 'dev' into feat/radiology-order-54

commit 3211972a84
Merge: e3fc1e4 ccabe01
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Sat Nov 15 20:15:07 2025 +0700

    Merge branch 'dev' into feat/radiology-order-54

commit e3fc1e4ab9
Author: Andrian Roshandy <andrianovsky95@gmail.com>
Date:   Sat Nov 15 20:14:38 2025 +0700

    feat/radiology-order-54: adjust wip
2025-12-05 14:16:05 +07:00

344 lines
9.1 KiB
Vue

<script setup lang="ts">
///// Imports
// Pub components
import type { DataTableLoader } from '~/components/pub/my-ui/data-table/type'
import { toast } from '~/components/pub/ui/toast'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import * as CH from '~/components/pub/my-ui/content-header'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { useSidebar } from '~/components/pub/ui/sidebar/utils'
// App libs
import { getServicePosition } from '~/lib/roles' // previously getPositionAs
// Services
import {
getList as getEncounterList,
remove as removeEncounter,
cancel as cancelEncounter,
} from '~/services/encounter.service'
// Apps
import Content from '~/components/app/encounter/list.vue'
import FilterNav from '~/components/app/encounter/filter-nav.vue'
import FilterForm from '~/components/app/encounter/filter-form.vue'
// Props
const props = defineProps<{
classCode?: 'ambulatory' | 'emergency' | 'inpatient'
subClassCode?: 'reg' | 'rehab' | 'chemo' | 'emg' | 'eon' | 'op' | 'icu' | 'hcu' | 'vk'
canCreate?: boolean
canUpdate?: boolean
canDelete?: boolean
}>()
///// Declarations and Flows
// Sidebar automation
const { setOpen } = useSidebar()
setOpen(true)
// Role reactivities
const { getActiveRole } = useUserStore()
// Main data
const data = ref([])
const dataFiltered = ref([])
const filterParams = ref<any>({})
const activeServicePosition = ref(getServicePosition(getActiveRole()))
const isLoading = reactive<DataTableLoader>({
summary: false,
isTableLoading: false,
})
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const isFilterFormDialogOpen = ref(false)
const isRecordConfirmationOpen = ref(false)
const isRecordCancelOpen = ref(false)
// Headers
const hreaderPrep: CH.Config = {
title: 'Kunjungan',
icon: 'i-lucide-users',
addNav: {
label: 'Tambah',
onClick: () => {
navigateTo(`/${props.classCode}/encounter/add`)
},
},
}
if (!props.canCreate) {
delete hreaderPrep.addNav
}
// Filters
const filter = ref<{
installation: {
msg: {
placeholder: string
}
items: {
value: string
label: string
code: string
}[]
}
schema: any
initialValues?: Partial<any>
errors?: any
}>({
installation: {
msg: {
placeholder: 'Pilih',
},
items: [],
},
schema: {},
})
// Recrod reactivities
provide('activeServicePosition', activeServicePosition)
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
watch(getActiveRole, (role?: string) => {
activeServicePosition.value = getServicePosition(role)
})
watch(
() => recAction.value,
() => {
const basePath = `/${props.classCode}/encounter`
if (recAction.value === ActionEvents.showConfirmDelete) {
isRecordConfirmationOpen.value = true
} else if (recAction.value === ActionEvents.showCancel) {
isRecordCancelOpen.value = true
} else if (recAction.value === ActionEvents.showDetail) {
navigateTo(`${basePath}/${recId.value}/detail`)
} else if (recAction.value === ActionEvents.showEdit) {
navigateTo(`${basePath}/${recId.value}/edit`)
} else if (recAction.value === ActionEvents.showProcess) {
navigateTo(`${basePath}/${recId.value}/process`)
} else if (recAction.value === ActionEvents.showConfirmDelete) {
isRecordConfirmationOpen.value = true
}
recAction.value = '' // reset
},
)
onMounted(() => {
getPatientList()
})
/////// Functions
async function getPatientList() {
isLoading.isTableLoading = true
const includesParams =
'patient,patient-person,patient-person-addresses,unit,Appointment_Doctor,Appointment_Doctor-employee,Appointment_Doctor-employee-person,Responsible_Doctor,Responsible_Doctor-employee,Responsible_Doctor-employee-person'
data.value = []
try {
const params: any = { includes: includesParams, ...filterParams.value }
if (props.classCode) {
params.class_code = props.classCode
}
if (props.subClassCode) {
params.sub_class_code = props.subClassCode
}
const result = await getEncounterList(params)
if (result.success) {
data.value = result.body?.data || []
dataFiltered.value = [...data.value]
}
} catch (error) {
console.error('Error fetching encounter list:', error)
} finally {
isLoading.isTableLoading = false
}
}
function handleFilterApply(filters: { personName: string; startDate: string; endDate: string }) {
filterParams.value = {
'person-name': filters.personName,
'start-date': filters.startDate,
'end-date': filters.endDate,
}
getPatientList()
}
// Handle confirmation result
async function handleConfirmCancel(record: any, action: string) {
if (action === 'deactivate' && record?.id) {
try {
const result = await cancelEncounter(record.id)
if (result.success) {
toast({
title: 'Berhasil',
description: 'Kunjungan berhasil dibatalkan',
variant: 'default',
})
await getPatientList() // Refresh list
} else {
const errorMessage = result.body?.message || 'Gagal membatalkan kunjungan'
toast({
title: 'Gagal',
description: errorMessage,
variant: 'destructive',
})
}
} catch (error: any) {
console.error('Error cancellation encounter:', error)
toast({
title: 'Gagal',
description: error?.message || 'Gagal membatalkan kunjungan',
variant: 'destructive',
})
} finally {
// Reset state
recId.value = 0
recAction.value = ''
recItem.value = null
isRecordCancelOpen.value = false
}
}
}
// Handle confirmation result
async function handleConfirmDelete(record: any, action: string) {
if (action === 'delete' && record?.id) {
try {
const result = await removeEncounter(record.id)
if (result.success) {
toast({
title: 'Berhasil',
description: 'Kunjungan berhasil dihapus',
variant: 'default',
})
await getPatientList() // Refresh list
} else {
const errorMessage = result.body?.message || 'Gagal menghapus kunjungan'
toast({
title: 'Gagal',
description: errorMessage,
variant: 'destructive',
})
}
} catch (error: any) {
console.error('Error deleting encounter:', error)
toast({
title: 'Gagal',
description: error?.message || 'Gagal menghapus kunjungan',
variant: 'destructive',
})
} finally {
// Reset state
recId.value = 0
recAction.value = ''
recItem.value = null
isRecordConfirmationOpen.value = false
}
}
}
function handleCancelConfirmation() {
// Reset record state when cancelled
recId.value = 0
recAction.value = ''
recItem.value = null
isRecordCancelOpen.value = false
}
function handleRemoveConfirmation() {
// Reset record state when cancelled
recId.value = 0
recAction.value = ''
recItem.value = null
isRecordConfirmationOpen.value = false
}
</script>
<template>
<CH.ContentHeader v-bind="hreaderPrep">
<FilterNav
:active-positon="activeServicePosition"
@apply="handleFilterApply"
@onExportPdf="() => {}"
@onExportExcel="() => {}"
@nExportCsv="() => {}"
/>
</CH.ContentHeader>
<Content :data="data" />
<!-- Filter -->
<Dialog
v-model:open="isFilterFormDialogOpen"
title="Filter"
size="lg"
prevent-outside
>
<FilterForm v-bind="filter" />
</Dialog>
<!-- Batal -->
<RecordConfirmation
v-if="canDelete"
v-model:open="isRecordCancelOpen"
custom-title="Batalkan Kunjungan"
custom-message="Apakah anda yakin ingin membatalkan kunjungan pasien berikut?"
action="deactivate"
:record="recItem"
@confirm="handleConfirmCancel"
@cancel="handleCancelConfirmation"
>
<template #default="{ record }">
<div class="text-sm">
<p v-if="record?.patient?.person?.name">
<strong>Nama:</strong>
{{ record.patient.person.name }}
</p>
<p v-if="record?.medical_record_number">
<strong>No RM:</strong>
{{ record.medical_record_number }}
</p>
</div>
</template>
</RecordConfirmation>
<!-- Hapus -->
<RecordConfirmation
v-if="canDelete"
v-model:open="isRecordConfirmationOpen"
action="delete"
:record="recItem"
@confirm="handleConfirmDelete"
@cancel="handleRemoveConfirmation"
>
<template #default="{ record }">
<div class="text-sm">
<p>
<strong>ID:</strong>
{{ record?.id }}
</p>
<p v-if="record?.patient?.person?.name">
<strong>Pasien:</strong>
{{ record.patient.person.name }}
</p>
<p v-if="record?.class_code">
<strong>Kelas:</strong>
{{ record.class_code }}
</p>
</div>
</template>
</RecordConfirmation>
<Dialog
title="Hapus data"
size="md"
v-model:open="isRecordConfirmationOpen"
>
Hak akses tidak memenuhi kriteria untuk proses ini.
</Dialog>
</template>