feat: Implement encounter list views with new configurations, vclaim SEP/SIPP document handling, and initial encounter entry forms.
This commit is contained in:
@@ -7,6 +7,7 @@ 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 FileUpload from '~/components/pub/my-ui/form/file-field.vue'
|
||||
import { useSidebar } from '~/components/pub/ui/sidebar/utils'
|
||||
|
||||
// App libs
|
||||
@@ -19,6 +20,9 @@ import {
|
||||
cancel as cancelEncounter,
|
||||
} from '~/services/encounter.service'
|
||||
|
||||
// Handlers
|
||||
import { uploadAttachmentCustom } from '~/handlers/supporting-document.handler'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/app/encounter/list.vue'
|
||||
import FilterNav from '~/components/app/encounter/filter-nav.vue'
|
||||
@@ -53,9 +57,13 @@ const isLoading = reactive<DataTableLoader>({
|
||||
const recId = ref<number>(0)
|
||||
const recAction = ref<string>('')
|
||||
const recItem = ref<any>(null)
|
||||
const recSepId = ref<number>(0)
|
||||
const recSepMenu = ref<string>('')
|
||||
const recSepSubMenu = ref<string>('')
|
||||
const isFilterFormDialogOpen = ref(false)
|
||||
const isRecordConfirmationOpen = ref(false)
|
||||
const isRecordCancelOpen = ref(false)
|
||||
const uploadFile = ref<any>(null)
|
||||
|
||||
// Headers
|
||||
const hreaderPrep: CH.Config = {
|
||||
@@ -102,6 +110,9 @@ provide('activeServicePosition', activeServicePosition)
|
||||
provide('rec_id', recId)
|
||||
provide('rec_action', recAction)
|
||||
provide('rec_item', recItem)
|
||||
provide('rec_sep_id', recSepId)
|
||||
provide('rec_sep_menu', recSepMenu)
|
||||
provide('rec_sep_sub_menu', recSepSubMenu)
|
||||
provide('table_data_loader', isLoading)
|
||||
|
||||
watch(getActiveRole, (role?: string) => {
|
||||
@@ -129,6 +140,19 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
watch([recSepId, recSepMenu, recSepSubMenu], (value) => {
|
||||
const id = value[0]
|
||||
const menu = value[1]
|
||||
const subMenu = value[2]
|
||||
if (!id) return
|
||||
if (subMenu === 'view') {
|
||||
handleViewFile(id, menu, subMenu)
|
||||
}
|
||||
if (subMenu === 'edit') {
|
||||
handleUploadFile(id, menu)
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getPatientList()
|
||||
})
|
||||
@@ -172,6 +196,55 @@ async function getPatientList() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleUploadFile(id: number, menu: string) {
|
||||
uploadFile.value = null
|
||||
document.getElementById('uploadFile')?.click()
|
||||
}
|
||||
|
||||
async function handleUploadFileSubmit() {
|
||||
if (!uploadFile.value) return
|
||||
const result = await uploadAttachmentCustom({
|
||||
file: uploadFile.value,
|
||||
refId: recSepId.value,
|
||||
entityTypeCode: 'encounter',
|
||||
type: recSepMenu.value === 'sep' ? 'vclaim-sep' : 'vclaim-sipp',
|
||||
})
|
||||
if (result.success) {
|
||||
toast({
|
||||
title: 'Berhasil',
|
||||
description: 'File berhasil diunggah',
|
||||
variant: 'default',
|
||||
})
|
||||
await getPatientList()
|
||||
} else {
|
||||
toast({
|
||||
title: 'Gagal',
|
||||
description: 'File gagal diunggah',
|
||||
variant: 'destructive',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function handleViewFile(id: number, menu: string, subMenu: string) {
|
||||
const currentData: any = data.value.find((item: any) => item.id === id)
|
||||
if (!currentData) return
|
||||
let fileReviewSep: any = null
|
||||
let fileReviewSipp: any = null
|
||||
for (const doc of currentData.encounterDocuments) {
|
||||
if (doc.type_code === 'vclaim-sep') {
|
||||
fileReviewSep = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
|
||||
} else if (doc.type_code === 'vclaim-sipp') {
|
||||
fileReviewSipp = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
|
||||
}
|
||||
}
|
||||
if (fileReviewSep && menu === 'sep' && subMenu === 'view') {
|
||||
window.open(fileReviewSep.filePath, '_blank')
|
||||
}
|
||||
if (fileReviewSipp && menu === 'sipp' && subMenu === 'view') {
|
||||
window.open(fileReviewSipp.filePath, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
function handleFilterApply(filters: { personName: string; startDate: string; endDate: string }) {
|
||||
filterParams.value = {
|
||||
'person-name': filters.personName,
|
||||
@@ -356,4 +429,16 @@ function handleRemoveConfirmation() {
|
||||
>
|
||||
Hak akses tidak memenuhi kriteria untuk proses ini.
|
||||
</Dialog>
|
||||
|
||||
<FileUpload
|
||||
id="uploadFile"
|
||||
class="hidden"
|
||||
field-name="uploadFile"
|
||||
label="Dokumen"
|
||||
placeholder="Pilih file"
|
||||
:accept="['pdf', 'jpg', 'png']"
|
||||
:max-size-mb="1"
|
||||
v-model="uploadFile"
|
||||
@file-selected="handleUploadFileSubmit"
|
||||
/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user