Merge branch 'dev' into feat/general-consent-145

This commit is contained in:
2025-11-21 07:43:08 +07:00
47 changed files with 3469 additions and 5 deletions
@@ -19,6 +19,7 @@ import CpLabOrder from '~/components/content/cp-lab-order/main.vue'
import Radiology from '~/components/content/radiology-order/main.vue'
import Consultation from '~/components/content/consultation/list.vue'
import GeneralConsentList from '~/components/content/general-consent/entry.vue'
import ResumeList from '~/components/content/resume/list.vue'
import ControlLetterList from '~/components/content/control-letter/list.vue'
const route = useRoute()
@@ -73,6 +74,8 @@ const tabs: TabItem[] = [
{ value: 'medical-action', label: 'Order Ruang Tindakan' },
{ value: 'mcu-result', label: 'Hasil Penunjang' },
{ value: 'consultation', label: 'Konsultasi', component: Consultation, props: { encounter: data } },
{ value: 'resume', label: 'Resume', component: ResumeList, props: { encounter: data } },
{ value: 'control', label: 'Surat Kontrol' },
{ value: 'resume', label: 'Resume' },
{ value: 'control', label: 'Surat Kontrol', component: ControlLetterList, props: { encounter: data } },
{ value: 'screening', label: 'Skrinning MPP' },
+200
View File
@@ -0,0 +1,200 @@
<script setup lang="ts">
import type { ExposedForm } from '~/types/form';
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import { ResumeSchema } from '~/schemas/resume.schema';
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date';
import type { DateRange } from 'radix-vue';
import { getPatients } from '~/services/patient.service';
import ActionHistoryDialog from '~/components/app/resume/history-list/action-history-dialog.vue';
import ConsultationHistoryDialog from '~/components/app/resume/history-list/consultation-history-dialog.vue';
import SupportingHistoryDialog from '~/components/app/resume/history-list/supporting-history-dialog.vue';
import FarmacyHistoryDialog from '~/components/app/resume/history-list/farmacy-history-dialog.vue';
import NationalProgramHistoryDialog from '~/components/app/resume/history-list/national-program-history-dialog.vue';
// #region Props & Emits
const props = defineProps<{
callbackUrl?: string
}>()
// form related state
const personPatientForm = ref<ExposedForm<any> | null>(null)
const actionHistoryData = usePaginatedList({
fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'patient',
})
const consultationHistoryData = usePaginatedList({
fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'patient',
})
const supportingHistoryData = usePaginatedList({
fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'patient',
})
const farmacyHistoryData = usePaginatedList({
fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'patient',
})
const nationalProgramServiceHistoryData = usePaginatedList({
fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'patient',
})
// #endregion
// #region State & Computed
const router = useRouter()
const isConfirmationOpen = ref(false)
const isActionHistoryOpen = ref<boolean>(false)
const isConsultationHistoryOpen = ref<boolean>(false)
const isSupportingHistoryOpen = ref<boolean>(false)
const isFarmacyHistoryOpen = ref<boolean>(false)
const isNationalProgramServiceHistoryOpen = ref<boolean>(false)
provide(`isActionHistoryOpen`, isActionHistoryOpen)
provide(`isConsultationHistoryOpen`, isConsultationHistoryOpen)
provide(`isSupportingHistoryOpen`, isSupportingHistoryOpen)
provide(`isFarmacyHistoryOpen`, isFarmacyHistoryOpen)
provide(`isNationalProgramServiceHistoryOpen`, isNationalProgramServiceHistoryOpen)
const defaultDate = {
start: new CalendarDate(2022, 1, 20),
end: new CalendarDate(2022, 1, 20).add({ days: 20 }),
}
const actionHistoryDateValue = ref(defaultDate) as Ref<DateRange>
const consultationHistoryDateValue = ref(defaultDate) as Ref<DateRange>
const supportingHistoryDateValue = ref(defaultDate) as Ref<DateRange>
const farmacyHistoryDateValue = ref(defaultDate) as Ref<DateRange>
const nationalProgramServiceSearch = ref<string>('')
const nationalProgramServiceSelectedStatus = ref<string>('all')
// #endregion
// #region Lifecycle Hooks
onMounted(() => {
})
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
async function handleConfirmAdd() {
// handleActionClick('submit')
console.log(`tersubmit wak`)
}
function handleCancelAdd() {
isConfirmationOpen.value = false
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
isConfirmationOpen.value = true
// const patient: Patient = await composeFormData()
// let createdPatientId = 0
// const response = await handleActionSave(
// patient,
// () => {},
// () => {},
// toast,
// )
// const data = (response?.body?.data ?? null) as PatientBase | null
// if (!data) return
// createdPatientId = data.id
// If has callback provided redirect to callback with patientData
// if (props.callbackUrl) {
// await navigateTo(props.callbackUrl + '?patient-id=' + patient.id)
// return
// }
// Navigate to patient list or show success message
// await navigateTo('/outpatient/encounter')
// return
}
if (eventType === 'back') {
if (props.callbackUrl) {
await navigateTo(props.callbackUrl)
return
}
goBack()
// handleCancelForm()
}
}
// #endregion
// #region Watchers
// #endregion
</script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Tambah Resume</div>
<AppResumeAdd
ref="personPatientForm"
:schema="ResumeSchema"
:resume-arrangement-type="personPatientForm?.values.arrangement"/>
<div class="my-2 flex justify-end py-2">
<Action :enable-draft="false"
@click="handleActionClick"/>
</div>
<Confirmation
v-model:open="isConfirmationOpen"
title="Simpan Data"
message="Apakah Anda yakin ingin menyimpan data ini?"
confirm-text="Simpan"
@confirm="handleConfirmAdd"
@cancel="handleCancelAdd"
/>
<ActionHistoryDialog
v-model:is-modal-open="isActionHistoryOpen"
v-model:date-value="actionHistoryDateValue"
:data="actionHistoryData.data.value"
:pagination-meta="actionHistoryData.paginationMeta"
@page-change="actionHistoryData.handlePageChange"
/>
<p v-if="isConsultationHistoryOpen === true">aaaaaaaaaaaaaaa</p>
<ConsultationHistoryDialog
v-model:is-modal-open="isConsultationHistoryOpen"
v-model:date-value="consultationHistoryDateValue"
:data="consultationHistoryData.data.value"
:pagination-meta="consultationHistoryData.paginationMeta"
@page-change="consultationHistoryData.handlePageChange"
/>
<SupportingHistoryDialog
v-model:is-modal-open="isSupportingHistoryOpen"
v-model:date-value="supportingHistoryDateValue"
:data="supportingHistoryData.data.value"
:pagination-meta="supportingHistoryData.paginationMeta"
@page-change="supportingHistoryData.handlePageChange"
/>
<FarmacyHistoryDialog
v-model:is-modal-open="isFarmacyHistoryOpen"
v-model:date-value="farmacyHistoryDateValue"
:data="farmacyHistoryData.data.value"
:pagination-meta="farmacyHistoryData.paginationMeta"
@page-change="farmacyHistoryData.handlePageChange"
/>
<NationalProgramHistoryDialog
v-model:is-modal-open="isNationalProgramServiceHistoryOpen"
v-model:search-value="nationalProgramServiceSearch"
v-model:status-value="nationalProgramServiceSelectedStatus"
:data="nationalProgramServiceHistoryData.data.value"
:pagination-meta="nationalProgramServiceHistoryData.paginationMeta"
@page-change="nationalProgramServiceHistoryData.handlePageChange"
/>
</template>
+215
View File
@@ -0,0 +1,215 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
import type { Summary } from '~/components/pub/my-ui/summary-card/type'
// #region Imports
import { Calendar, Hospital, UserCheck, UsersRound } from 'lucide-vue-next'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import SummaryCard from '~/components/pub/my-ui/summary-card/summary-card.vue'
import { usePaginatedList } from '~/composables/usePaginatedList'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import { getPatients, removePatient } from '~/services/patient.service'
import DetailRow from '~/components/pub/my-ui/form/view/detail-row.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
import type { ExposedForm } from '~/types/form'
import { VerificationSchema } from '~/schemas/verification.schema'
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
import type { PagePermission } from '~/models/role'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
import { unauthorizedToast } from '~/lib/utils'
// #endregion
// #region Permission
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
const { getPagePermissions } = useRBAC()
const pagePermission = getPagePermissions(roleAccess)
// #region State
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'patient',
})
const refSearchNav: RefSearchNav = {
onClick: () => {
// open filter modal
},
onInput: (val: string) => {
searchInput.value = val
},
onClear: () => {
searchInput.value = ''
},
}
const verificationInputForm = ref<ExposedForm<any> | null>(null)
const isVerifyDialogOpen = ref(false)
const isDocPreviewDialogOpen = ref(false)
const isRecordConfirmationOpen = ref(false)
const summaryLoading = ref(false)
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const isCaptchaValid = ref(false)
provide('isCaptchaValid', isCaptchaValid)
const headerPrep: HeaderPrep = {
title: "Resume",
icon: 'i-lucide-newspaper',
}
if (pagePermission.canCreate) {
headerPrep.addNav = {
label: "Resume",
onClick: () => navigateTo('/resume/add'),
}
}
// #endregion
// #region Lifecycle Hooks
onMounted(() => {
getPatientSummary()
})
// #endregion
// #region Functions
async function getPatientSummary() {
try {
summaryLoading.value = true
await new Promise((resolve) => setTimeout(resolve, 500))
} catch (error) {
console.error('Error fetching patient summary:', error)
} finally {
summaryLoading.value = false
}
}
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
// const patient: Patient = await composeFormData()
// let createdPatientId = 0
// const response = await handleActionSave(
// patient,
// () => {},
// () => {},
// toast,
// )
// const data = (response?.body?.data ?? null) as PatientBase | null
// if (!data) return
// createdPatientId = data.id
// If has callback provided redirect to callback with patientData
// if (props.callbackUrl) {
// await navigateTo(props.callbackUrl + '?patient-id=' + patient.id)
// return
// }
// Navigate to patient list or show success message
// await navigateTo('/outpatient/encounter')
// return
}
if (eventType === 'back') {
isVerifyDialogOpen.value = false
}
}
async function handleConfirmDelete() {
try {
const result = await removePatient(recId.value)
if (result.success) {
console.log('Patient deleted successfully')
// Refresh the list
await fetchData()
} else {
console.error('Failed to delete patient:', result)
// Handle error - show error message to user
}
} catch (error) {
console.error('Error deleting patient:', error)
// Handle error - show error message to user
}
}
function handleCancelConfirmation() {
// Reset record state when cancelled
recId.value = 0
recAction.value = ''
recItem.value = null
}
// #endregion
// #region Provide
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
// #endregion
// #region Watchers
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showVerify:
if(pagePermission.canUpdate) {
isVerifyDialogOpen.value = true
} else {
unauthorizedToast()
}
break
case ActionEvents.showValidate:
if(pagePermission.canUpdate) {
isRecordConfirmationOpen.value = true
} else {
unauthorizedToast()
}
break
case ActionEvents.showPrint:
isDocPreviewDialogOpen.value = true
break
}
})
// #endregion
</script>
<template>
<Header :prep="{ ...headerPrep }" />
<!-- <AppTherapyProtocolList
:data="data"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"/> -->
<AppResumeList
:data="data"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"/>
<Dialog v-model:open="isVerifyDialogOpen" title="Verifikasi">
<AppResumeVerifyDialog
ref="verificationInputForm"
:schema="VerificationSchema" />
<div class="flex justify-end">
<Action v-show="isCaptchaValid" :enable-draft="false" @click="handleActionClick" />
</div>
</Dialog>
<Dialog v-model:open="isDocPreviewDialogOpen" title="Preview Dokumen" size="2xl">
<DocPreviewDialog :link="`https://www.antennahouse.com/hubfs/xsl-fo-sample/pdf/basic-link-1.pdf`" />
</Dialog>
<Confirmation
v-model:open="isRecordConfirmationOpen"
title="Validasi Data"
message="Apakah Anda yakin ingin menvalidasi data ini?"
confirm-text="Validasi"
@confirm="handleConfirmDelete"
@cancel="handleCancelConfirmation"
/>
</template>