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

This commit is contained in:
Khafid Prayoga
2025-12-05 08:35:15 +07:00
210 changed files with 9091 additions and 950 deletions
@@ -143,7 +143,7 @@ watch([recId, recAction, timestamp], () => {
break
case ActionEvents.showEdit:
if(pagePermission.canUpdate){
if(pagePermission.canUpdate){
navigateTo({
name: 'rehab-encounter-id-control-letter-control_letter_id-edit',
params: { id: encounterId, "control_letter_id": recId.value },
@@ -186,7 +186,7 @@ watch([recId, recAction, timestamp], () => {
@click="isHistoryDialogOpen = true">
<Icon name="i-lucide-history" class="h-4 w-4" /> Riwayat Program Nasional</Button>
</div>
<AppControlLetterList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
<Dialog v-model:open="isDocPreviewDialogOpen" title="Preview Dokumen" size="2xl">
@@ -212,7 +212,7 @@ watch([recId, recAction, timestamp], () => {
</div>
</template>
</RecordConfirmation>
<HistoryDialog
v-model:is-modal-open="isHistoryDialogOpen"
:data="historyData.data.value"
+2 -2
View File
@@ -21,7 +21,7 @@ import {
// Apps
import { getList, getDetail } from '~/services/mcu-order.service'
import List from '~/components/app/mcu-order/list.vue'
import List from '~/components/app/mcu-order/micro-list.vue'
import type { McuOrder } from '~/models/mcu-order'
const route = useRoute()
@@ -55,7 +55,7 @@ const {
})
const headerPrep: HeaderPrep = {
title: 'Order Lab PK',
title: 'Order Lab Mikro',
icon: 'i-lucide-box',
refSearchNav: {
placeholder: 'Cari (min. 3 karakter)...',
+1 -1
View File
@@ -63,7 +63,7 @@ const {
fetchFn: async ({ page, search }) => {
const result = await getList({
'encounter-id': id,
typeCode: 'dev-record',
'type-code': 'dev-record',
includes: 'encounter',
search,
page,
+66 -40
View File
@@ -3,14 +3,14 @@
import { Button } from '~/components/pub/ui/button'
import AppEncounterEntryForm from '~/components/app/encounter/entry-form.vue'
import AppViewPatient from '~/components/app/patient/view-patient.vue'
import AppViewHistory from '~/components/app/sep/view-history.vue'
// Helpers
import { refDebounced } from '@vueuse/core'
// Handlers
import { getDetail as getDoctorDetail } from '~/services/doctor.service'
import { useEncounterEntry } from '~/handlers/encounter-entry.handler'
import { genDoctor, type Doctor } from '~/models/doctor'
import { useIntegrationSepEntry } from '~/handlers/integration-sep-entry.handler'
// Props
const props = defineProps<{
@@ -34,54 +34,33 @@ const {
isLoadingDetail,
formObjects,
openPatient,
isMemberValid,
isSepValid,
isCheckingSep,
isSaveDisabled,
isSaving,
isLoading,
patients,
selectedDoctor,
selectedPatient,
selectedPatientObject,
paginationMeta,
toNavigateSep,
getListPath,
handleInit,
loadEncounterDetail,
getFetchEncounterDetail,
handleSaveEncounter,
getPatientsList,
getPatientCurrent,
getPatientByIdentifierSearch,
getIsSubspecialist,
// getIsSubspecialist,
getDoctorInfo,
getValidateMember,
getValidateSepNumber,
handleFetchDoctors,
} = useEncounterEntry(props)
const { recSepId, openHistory, histories, getMonitoringHistoryMappers } = useIntegrationSepEntry()
const debouncedSepNumber = refDebounced(sepNumber, 500)
const selectedDoctor = ref<Doctor>(genDoctor())
provide('rec_select_id', recSelectId)
provide('table_data_loader', isLoading)
watch(debouncedSepNumber, async (newValue) => {
await getValidateSepNumber(newValue)
})
watch(
() => formObjects.value?.paymentType,
(newValue) => {
isSepValid.value = false
if (newValue !== 'jkn') {
sepNumber.value = ''
}
},
)
onMounted(async () => {
await handleInit()
if (props.id > 0) {
await loadEncounterDetail()
}
})
///// Functions
function handleSavePatient() {
@@ -116,12 +95,28 @@ async function handleEvent(menu: string, value?: any) {
}
toNavigateSep({
isService: 'false',
encounterId: props.id || null,
sourcePath: route.path,
resource: `${props.classCode}-${props.subClassCode}`,
...value,
})
} else if (menu === 'sep-number-changed') {
await getValidateSepNumber(String(value || ''))
const sepNumberText = String(value || '').trim()
if (sepNumberText.length > 5) {
await getValidateSepNumber(sepNumberText)
}
} else if (menu === 'member-changed') {
const memberText = String(value || '').trim()
if (memberText.length > 5) {
await getValidateMember(memberText)
}
} else if (menu === 'search-sep') {
const memberText = String(value?.cardNumber || '').trim()
if (memberText.length < 5) return
getMonitoringHistoryMappers(memberText).then(() => {
openHistory.value = true
})
return
} else if (menu === 'save') {
await handleSaveEncounter(value)
} else if (menu === 'cancel') {
@@ -129,13 +124,39 @@ async function handleEvent(menu: string, value?: any) {
}
}
async function getDoctorInfo(value: string) {
const resp = await getDoctorDetail(value, { includes: 'unit,specialist,subspecialist'})
if (resp.success) {
selectedDoctor.value = resp.body.data
// console.log(selectedDoctor.value)
provide('rec_select_id', recSelectId)
provide('rec_sep_id', recSepId)
provide('table_data_loader', isLoading)
watch(debouncedSepNumber, async (newValue) => {
await getValidateSepNumber(newValue)
})
watch(
() => formObjects.value?.paymentType,
(newValue) => {
isSepValid.value = false
if (newValue !== 'jkn') {
sepNumber.value = ''
}
},
)
watch(
() => props.id,
async (newId) => {
if (props.formType === 'edit' && newId > 0) {
await getFetchEncounterDetail()
}
},
)
onMounted(async () => {
await handleInit()
if (props.formType === 'edit' && props.id > 0) {
await getFetchEncounterDetail()
}
}
})
</script>
<template>
@@ -144,13 +165,15 @@ async function getDoctorInfo(value: string) {
name="i-lucide-user"
class="me-2"
/>
<span class="font-semibold">{{ props.formType }}</span>
<span class="font-semibold">{{ props.formType === 'add' ? 'Tambah' : 'Ubah' }}</span>
Kunjungan
</div>
<AppEncounterEntryForm
ref="formRef"
:mode="props.formType"
:is-loading="isLoadingDetail"
:is-member-valid="isMemberValid"
:is-sep-valid="isSepValid"
:is-checking-sep="isCheckingSep"
:payments="paymentsList"
@@ -165,7 +188,6 @@ async function getDoctorInfo(value: string) {
@event="handleEvent"
@fetch="handleFetch"
/>
<AppViewPatient
v-model:open="openPatient"
v-model:selected="selectedPatient"
@@ -184,7 +206,11 @@ async function getDoctorInfo(value: string) {
"
@save="handleSavePatient"
/>
<AppViewHistory
v-model:open="openHistory"
:is-action="true"
:histories="histories"
/>
<!-- Footer Actions -->
<div class="mt-6 flex justify-end gap-2 border-t border-t-slate-300 pt-4">
<Button
+56 -32
View File
@@ -13,7 +13,11 @@ import { useSidebar } from '~/components/pub/ui/sidebar/utils'
import { getServicePosition } from '~/lib/roles' // previously getPositionAs
// Services
import { getList as getEncounterList, remove as removeEncounter, cancel as cancelEncounter } from '~/services/encounter.service'
import {
getList as getEncounterList,
remove as removeEncounter,
cancel as cancelEncounter,
} from '~/services/encounter.service'
// Apps
import Content from '~/components/app/encounter/list.vue'
@@ -34,8 +38,14 @@ const props = defineProps<{
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,
@@ -87,39 +97,38 @@ const filter = ref<{
schema: {},
})
// Role reactivities
const { getActiveRole } = useUserStore()
const activeServicePosition = ref(getServicePosition(getActiveRole()))
provide('activeServicePosition', activeServicePosition)
watch(getActiveRole, (role? : string) => {
activeServicePosition.value = getServicePosition(role)
})
// Recrod reactivities
provide('activeServicePosition', activeServicePosition)
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
watch(() => recAction.value, () => {
const basePath = `/${props.classCode}/encounter`
// console.log(`${basePath}/${recId.value}`, recAction.value)
// return
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}`)
} 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
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()
})
@@ -127,17 +136,21 @@ onMounted(() => {
/////// 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: 'patient,patient-person' }
const params: any = { includes: includesParams, ...filterParams.value }
if (props.classCode) {
params['class-code'] = props.classCode
params.class_code = props.classCode
}
if (props.subClassCode) {
params['sub-class-code'] = 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)
@@ -146,6 +159,15 @@ async function getPatientList() {
}
}
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) {
@@ -240,7 +262,8 @@ function handleRemoveConfirmation() {
<template>
<CH.ContentHeader v-bind="hreaderPrep">
<FilterNav
@onFilterClick="() => isFilterFormDialogOpen = true"
:active-positon="activeServicePosition"
@apply="handleFilterApply"
@onExportPdf="() => {}"
@onExportExcel="() => {}"
@nExportCsv="() => {}"
@@ -256,11 +279,12 @@ function handleRemoveConfirmation() {
size="lg"
prevent-outside
>
<FilterForm v-bind="filter" />
<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?"
@@ -26,6 +26,7 @@ import DocUploadList from '~/components/content/document-upload/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'
import VaccineDataList from '~/components/content/vaccine-data/list.vue'
const route = useRoute()
const router = useRouter()
@@ -96,6 +97,7 @@ const tabs: TabItem[] = [
component: DocUploadList,
props: { encounter: data },
},
{ value: 'vaccine-data', label: 'Data Vaksin', component: VaccineDataList, props: { encounter: data } },
]
</script>
+9 -2
View File
@@ -34,6 +34,7 @@ import DocUploadList from '~/components/content/document-upload/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'
import InitialNursingStudy from '~/components/content/initial-nursing/entry.vue'
// App Components
import EncounterPatientInfo from '~/components/app/encounter/quick-info.vue'
import EncounterHistoryButtonMenu from '~/components/app/encounter/quick-shortcut.vue'
@@ -98,11 +99,17 @@ const protocolRows = [
{ value: 'education-assessment', label: 'Asesmen Kebutuhan Edukasi' },
{ value: 'patient-note', label: 'CPRJ', component: Cprj, props: { encounter: data } },
{ value: 'consent', label: 'General Consent', component: GeneralConsentList, props: { encounter: data } },
{
value: 'initial-nursing-study',
label: 'Kajian Awal Keperawatan',
component: InitialNursingStudy,
props: { encounter: data },
},
{ value: 'prescription', label: 'Order Obat', component: Prescription, props: { encounter_id: data.value.id } },
{ value: 'device-order', label: 'Order Alkes', component: DeviceOrder, props: { encounter_id: data.value.id } },
{ value: 'device', label: 'Order Alkes' },
{ value: 'mcu-radiology', label: 'Order Radiologi', component: Radiology, props: { encounter_id: data.id } },
{ value: 'mcu-lab-cp', label: 'Order Lab PK', component: CpLabOrder, props: { encounter_id: data.id } },
{ value: 'mcu-radiology', label: 'Order Radiologi', component: Radiology, props: { encounter_id: data.value.id } },
{ value: 'mcu-lab-cp', label: 'Order Lab PK', component: CpLabOrder, props: { encounter_id: data.value.id } },
{ value: 'mcu-lab-micro', label: 'Order Lab Mikro' },
{ value: 'mcu-lab-pa', label: 'Order Lab PA' },
{ value: 'medical-action', label: 'Order Ruang Tindakan' },
@@ -0,0 +1,36 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { useQueryMode } from '@/composables/useQueryMode'
import List from './list.vue'
import Form from './form.vue'
// Models
import type { Encounter } from '~/models/encounter'
// Props
interface Props {
encounter: Encounter
}
const props = defineProps<Props>()
const route = useRoute()
const { mode, goToEntry, backToList } = useQueryCRUDMode('mode')
</script>
<template>
<div>
<List
v-if="mode === 'list'"
:encounter="props.encounter"
@add="goToEntry"
@edit="goToEntry"
/>
<Form
v-else
@back="backToList"
/>
</div>
</template>
@@ -0,0 +1,138 @@
<script setup lang="ts">
import { z } from 'zod'
import Entry from '~/components/app/initial-nursing/entry-form.vue'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import ActionDialog from '~/components/pub/my-ui/nav-footer/ba-su.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import { InitialNursingSchema } from '~/schemas/soapi.schema'
import { toast } from '~/components/pub/ui/toast'
import { handleActionSave, handleActionEdit } from '~/handlers/soapi-early.handler'
const { backToList } = useQueryMode('mode')
const route = useRoute()
const isOpenProcedure = ref(false)
const isOpenDiagnose = ref(false)
const procedures = ref([])
const diagnoses = ref([])
const selectedProcedure = ref<any>(null)
const selectedDiagnose = ref<any>(null)
const schema = InitialNursingSchema
const payload = ref({
encounter_id: 0,
time: '',
typeCode: 'early-nursery',
value: '',
})
const listProblem = ref([])
const model = ref({
'pri-complain': '',
'med-type': '',
'med-name': '',
'med-reaction': '',
'food-type': '',
'food-name': '',
'food-reaction': '',
'other-type': '',
'other-name': '',
'other-reaction': '',
'pain-asst': '',
'pain-scale': '',
'pain-time': '',
'pain-duration': '',
'pain-freq': '',
'pain-loc': '',
'nut-screening': '',
'spiritual-asst': '',
'general-condition': '',
'support-exam': '',
'risk-fall': '',
bracelet: '',
'bracelet-alg': '',
})
const isLoading = reactive<DataTableLoader>({
isTableLoading: false,
})
function handleOpen(event: any) {
console.log('handleOpen', event.type)
const type = event.type
if (type === 'add-problem') {
listProblem.value = event.data
}
}
const entryRehabRef = ref()
async function actionHandler(type: string) {
if (type === 'back') {
backToList()
return
}
const result = await entryRehabRef.value?.validate()
if (result?.valid) {
if (listProblem.value?.length > 0) {
result.data.listProblem = listProblem.value || []
}
console.log('data', result.data)
handleActionSave(
{
...payload.value,
value: JSON.stringify(result.data),
encounter_id: +route.params.id,
time: new Date().toISOString(),
},
() => {},
() => {},
toast,
)
backToList()
} else {
console.log('Ada error di form', result)
}
}
const icdPreview = ref({
procedures: [],
diagnoses: [],
})
function actionDialogHandler(type: string) {
if (type === 'submit') {
icdPreview.value.procedures = selectedProcedure.value || []
icdPreview.value.diagnoses = selectedDiagnose.value || []
}
isOpenProcedure.value = false
isOpenDiagnose.value = false
}
provide('table_data_loader', isLoading)
provide('icdPreview', icdPreview)
</script>
<template>
<Entry
ref="entryRehabRef"
v-model="model"
:schema="schema"
type="early-rehab"
@click="handleOpen"
/>
<div class="my-2 flex justify-end py-2">
<Action @click="actionHandler" />
</div>
<Dialog
v-model:open="isOpenDiagnose"
title="Pilih Fungsional"
size="xl"
prevent-outside
>
<AppIcdMultiselectPicker
v-model:model-value="selectedDiagnose"
:data="diagnoses"
/>
<div class="my-2 flex justify-end py-2">
<ActionDialog @click="actionDialogHandler" />
</div>
</Dialog>
</template>
@@ -0,0 +1,210 @@
<script setup lang="ts">
// Components
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import List from '~/components/app/initial-nursing/list.vue'
import Preview from '~/components/app/initial-nursing/preview.vue'
// Helpers
import { usePaginatedList } from '~/composables/usePaginatedList'
import { toast } from '~/components/pub/ui/toast'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
// Handlers
import {
recId,
recAction,
recItem,
isReadonly,
isProcessing,
isFormEntryDialogOpen,
isRecordConfirmationOpen,
onResetState,
handleActionSave,
handleActionEdit,
handleActionRemove,
handleCancelForm,
} from '~/handlers/soapi-early.handler'
// Services
import { getList, getDetail } from '~/services/soapi-early.service'
// Models
import type { Encounter } from '~/models/encounter'
// Props
interface Props {
encounter: Encounter
}
const props = defineProps<Props>()
const emits = defineEmits(['add', 'edit'])
const route = useRoute()
const { recordId } = useQueryCRUDRecordId()
const { goToEntry, backToList } = useQueryCRUDMode('mode')
let units = ref<{ value: string; label: string }[]>([])
const encounterId = ref<number>(props?.encounter?.id || 0)
const title = ref('')
const id = route.params.id
const descData = ref({})
const {
data,
isLoading,
paginationMeta,
searchInput,
handlePageChange,
handleSearch,
fetchData: getMyList,
} = usePaginatedList({
fetchFn: async ({ page, search }) => {
const result = await getList({
'encounter-id': id,
'type-code': 'early-nursery',
includes: 'encounter',
search,
page,
})
console.log('masukkk', result)
if (result.success) {
data.value = result.body.data
}
return { success: result.success || false, body: result.body || {} }
},
entityName: 'initial-nursing',
})
const headerPrep: HeaderPrep = {
title: 'Kajian Awal Keperawatan',
icon: 'i-lucide-box',
refSearchNav: {
placeholder: 'Cari (min. 3 karakter)...',
minLength: 3,
debounceMs: 500,
showValidationFeedback: true,
onInput: (value: string) => {
searchInput.value = value
},
onClick: () => {},
onClear: () => {},
},
addNav: {
label: 'Tambah',
icon: 'i-lucide-plus',
onClick: () => {
goToEntry()
emits('add')
},
},
}
const today = new Date()
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
const getMyDetail = async (id: number | string) => {
const result = await getDetail(id)
if (result.success) {
const currentValue = result.body?.data || {}
recItem.value = currentValue
isFormEntryDialogOpen.value = true
}
}
const mappedData = computed(() => {
if (!data.value || data.value.length === 0) return []
const raw = data.value[0]
// Pastikan raw.value adalah string JSON
let parsed: any = {}
try {
parsed = JSON.parse(raw.value || '{}')
} catch (err) {
console.error('JSON parse error:', err)
return []
}
// Ambil listProblem
const list = parsed.listProblem || []
const textData = parsed
// Untuk keamanan: pastikan selalu array
if (!Array.isArray(list)) return []
return { list, textData }
})
// Watch for row actions when recId or recAction changes
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
getMyDetail(recId.value)
title.value = 'Detail Konsultasi'
isReadonly.value = true
break
case ActionEvents.showEdit:
emits('edit')
recordId.value = recId.value
console.log('recordId', recId.value)
break
case ActionEvents.showConfirmDelete:
isRecordConfirmationOpen.value = true
break
}
})
onMounted(async () => {
await getMyList()
})
</script>
<template>
<Header
v-model="searchInput"
:prep="headerPrep"
:ref-search-nav="headerPrep.refSearchNav"
@search="handleSearch"
class="mb-4 xl:mb-5"
/>
<Preview :preview="mappedData.textData" />
<h2 class="my-3 p-1 font-semibold">C. Daftar Masalah Keperawatan</h2>
<List :data="mappedData.list || []" />
<!-- :pagination-meta="paginationMeta" -->
<!-- @page-change="handlePageChange" -->
<!-- Record Confirmation Modal -->
<RecordConfirmation
v-model:open="isRecordConfirmationOpen"
action="delete"
:record="recItem"
@confirm="() => handleActionRemove(recId, getMyList, toast)"
@cancel=""
>
<template #default="{ record }">
<div class="text-sm">
<p>
<strong>ID:</strong>
{{ record?.id }}
</p>
<p v-if="record?.name">
<strong>Nama:</strong>
{{ record.name }}
</p>
<p v-if="record?.code">
<strong>Kode:</strong>
{{ record.code }}
</p>
</div>
</template>
</RecordConfirmation>
</template>
+154
View File
@@ -0,0 +1,154 @@
<script setup lang="ts">
import Nav from '~/components/pub/my-ui/nav-footer/ba-de-su.vue'
import NavOk from '~/components/pub/my-ui/nav-footer/ok.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
import { type HeaderPrep } from '~/components/pub/my-ui/data/types'
// mcu src category
import ScrCategorySwitcher from '~/components/app/mcu-src-category/switcher.vue'
import { getList as getMcuCategoryList } from '~/services/mcu-src-category.service'
// mcu src
import { type McuSrc } from '~/models/mcu-src'
import { getList as getMcuSrcList } from '~/services/mcu-src.service'
import McuSrcPicker from '~/components/app/mcu-src/picker-accordion.vue'
// mcu order
import { getDetail } from '~/services/mcu-order.service'
import Detail from '~/components/app/mcu-order/detail.vue'
// mcu order item, manually not using composable
import {
getList as getMcuOrderItemList,
create as createMcuOrderItem,
remove as removeMcuOrderItem,
} from '~/services/mcu-order-item.service'
import { type McuOrderItem } from '~/models/mcu-order-item'
import ItemListEntry from '~/components/app/mcu-order-item/list-entry.vue'
// props
const props = defineProps<{
encounter_id: number
scopeCode: string
}>()
// declaration & flows
// MCU Order
const { backToList, crudQueryParams } = useQueryCRUD()
const id = crudQueryParams.value.recordId
const dataRes = await getDetail(
typeof id === 'string' ? parseInt(id) : 0,
{ includes: 'encounter,doctor,doctor-employee,doctor-employee-person' }
)
const data = dataRes.body?.data
// MCU items
const items = ref<McuOrderItem[]>([])
// MCU Categories
const mcuSrcCategoryRes = await getMcuCategoryList({ 'scope-code': props.scopeCode })
const mcuSrcCategories = mcuSrcCategoryRes.body?.data
const selectedMcuSrcCategory_code = ref('')
// MCU Sources
const mcuSrcs = ref<McuSrc[]>([])
// const {
// data: items,
// fetchData: getItems,
// } = usePaginatedList<McuOrderItem> ({
// fetchFn: async ({ page, search }) => {
// const result = await getMcuOrderItemList({ 'mcu-order-id': id, search, page })
// if (result.success) {
// items.value = result.body.data
// }
// return { success: result.success || false, body: result.body || {} }
// },
// entityName: 'mcu-order-item',
// })
const headerPrep: HeaderPrep = {
title: 'Detail dan List Item Order Radiologi ',
icon: 'i-lucide-box',
}
const pickerDialogOpen = ref(false)
onMounted(async () => {
await getItems()
})
watch(selectedMcuSrcCategory_code, async () => {
const res = await getMcuSrcList({ 'mcu-src-category-code': selectedMcuSrcCategory_code.value })
mcuSrcs.value = res.body?.data
})
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
if (type === 'back') {
backToList()
}
}
function requestItem() {
pickerDialogOpen.value = true
}
async function pickItem(item: McuSrc) {
const exItem = items.value.find(e => e.mcuSrc_code === item.code)
if (exItem) {
await removeMcuOrderItem(exItem.id)
await getItems()
} else {
const intId = parseInt(id?.toString() || '0')
await createMcuOrderItem({
mcuOrder_id: intId,
mcuSrc_code: item.code,
})
await getItems()
}
}
async function getItems() {
const itemsRes = await getMcuOrderItemList({ 'mcu-order-id': id, includes: 'mcuSrc,mcuSrc-mcuSrcCategory' })
if (itemsRes.success) {
items.value = itemsRes.body.data
} else {
items.value = []
}
}
</script>
<template>
<Header
:prep="headerPrep"
:ref-search-nav="headerPrep.refSearchNav"
class="mb-4 xl:mb-5"
/>
<Detail :data="data" />
<ItemListEntry
:data="items"
@requestItem="requestItem"/>
<Separator class="my-5" />
<div class="w-full flex justify-center">
<Nav @click="navClick" />
</div>
<Dialog
v-model:open="pickerDialogOpen"
title="Pilih Item"
size="2xl"
prevent-outside
>
<ScrCategorySwitcher :data="mcuSrcCategories" v-model="selectedMcuSrcCategory_code" />
<McuSrcPicker v-model="items" :data-source="mcuSrcs" @pick="pickItem" />
<Separator />
<NavOk @click="() => pickerDialogOpen = false" class="justify-center" />
</Dialog>
</template>
+198
View File
@@ -0,0 +1,198 @@
<script setup lang="ts">
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import { usePaginatedList } from '~/composables/usePaginatedList'
import { toast } from '~/components/pub/ui/toast'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
// Handlers
import type { ToastFn } from '~/handlers/_handler'
// Apps
import {
recId,
recAction,
recItem,
isReadonly,
isFormEntryDialogOpen,
isRecordConfirmationOpen,
handleActionSave,
handleActionRemove,
} from '~/handlers/mcu-order.handler'
import { getList, getDetail, submit } from '~/services/mcu-order.service'
import type { McuOrder } from '~/models/mcu-order'
// import List from '~/components/app/mcu-order/micro-list.vue'
import ConfirmationInfo from '~/components/app/mcu-order/confirmation-info.vue'
// Props
const props = defineProps<{
scopeCode: string
}>()
// Common preparations
const route = useRoute()
const { crudQueryParams } = useQueryCRUD()
const title = ref('')
const plainEid = route.params.id
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0 // here the
const isSubmitConfirmationOpen = ref(false)
// Data
const {
data,
isLoading,
paginationMeta,
searchInput,
fetchData: getMyList,
} = usePaginatedList<McuOrder>({
fetchFn: async ({ page, search }) => {
const result = await getList({
search,
page,
'scope-code': props.scopeCode,
'encounter-id': encounter_id,
includes: 'doctor,doctor-employee,doctor-employee-person,items,items-mcuSrc',
})
return { success: result.success || false, body: result.body || {} }
},
entityName: 'mcu-order'
})
// Header
const headerPrep: HeaderPrep = {
title: 'Order Lab Mikro',
icon: 'i-lucide-box',
refSearchNav: {
placeholder: 'Cari (min. 3 karakter)...',
minLength: 3,
debounceMs: 500,
showValidationFeedback: true,
onInput: (value: string) => {
searchInput.value = value
},
onClick: () => {},
onClear: () => {},
},
addNav: {
label: 'Tambah',
icon: 'i-lucide-plus',
onClick: async () => {
const saveResp = await handleActionSave({ encounter_id, scope_code: props.scopeCode }, () => {}, () =>{}, toast)
if (saveResp.success) {
crudQueryParams.value = { mode: 'entry', recordId: saveResp.body?.data?.id.toString() }
}
},
},
}
// List component
let List: Component
if(props.scopeCode == 'radiology') {
List = defineAsyncComponent(() => import('~/components/content/encounter/status.vue'))
} else if(props.scopeCode == 'cp-lab') {
List = defineAsyncComponent(() => import('~/components/content/encounter/status.vue'))
} else if (props.scopeCode == 'micro-lab') {
List = defineAsyncComponent(() => import('~/components/app/mcu-order/micro-list.vue'))
} else {
List = defineAsyncComponent(() => import('~/components/content/encounter/status.vue'))
}
// Reactivities
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
getMyDetail(recId.value)
title.value = 'Detail Order Lab PK'
isReadonly.value = true
break
case ActionEvents.showEdit:
getMyDetail(recId.value)
title.value = 'Edit Order Lab PK'
isReadonly.value = false
break
case ActionEvents.showConfirmDelete:
isRecordConfirmationOpen.value = true
break
}
})
///// Functions
async function getMyDetail (id: number | string) {
const result = await getDetail(id)
if (result.success) {
const currentValue = result.body?.data || {}
recItem.value = currentValue
isFormEntryDialogOpen.value = true
}
}
function cancel(data: McuOrder) {
recId.value = data.id
recItem.value = data
isRecordConfirmationOpen.value = true
}
function edit(data: McuOrder) {
crudQueryParams.value = { mode: 'entry', recordId: data.id.toString() }
}
function confirmSubmit(data: McuOrder) {
recId.value = data.id
recItem.value = data
isSubmitConfirmationOpen.value = true
}
async function handleActionSubmit(id: number, refresh: () => void, toast: ToastFn) {
const result = await submit(id)
if (result.success) {
toast({ title: 'Berhasil', description: 'Resep telah di ajukan', variant: 'default' })
setTimeout(refresh, 300)
} else {
toast({ title: 'Gagal', description: 'Gagal menjalankan perintah', variant: 'destructive' })
}
}
</script>
<template>
<Header :prep="{ ...headerPrep }" />
<List
v-if="!isLoading.dataListLoading"
:data="data"
:pagination-meta="paginationMeta"
@cancel="cancel"
@edit="edit"
@submit="confirmSubmit"
/>
<RecordConfirmation
v-model:open="isRecordConfirmationOpen"
action="delete"
:record="recItem"
@confirm="() => handleActionRemove(recId, getMyList, toast)"
@cancel=""
>
<ConfirmationInfo :rec-item="recItem" />
</RecordConfirmation>
<RecordConfirmation
v-model:open="isSubmitConfirmationOpen"
action="delete"
customTitle="Ajukan Resep"
customMessage="Proses akan mengajukan resep ini untuk diproses lebih lanjut. Lanjutkan?"
customConfirmText="Ajukan"
:record="recItem"
@confirm="() => handleActionSubmit(recId, getMyList, toast)"
@cancel=""
>
<ConfirmationInfo :rec-item="recItem" />
</RecordConfirmation>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
//
import List from './list.vue'
import Entry from './entry.vue'
const props = defineProps<{
encounter_id: number
}>()
const { mode } = useQueryCRUDMode()
</script>
<template>
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
<Entry v-else :encounter_id="encounter_id" />
</template>
@@ -0,0 +1,11 @@
<script setup lang="ts">
import Entry from '~/components/content/mcu-order/entry.vue'
defineProps<{
encounter_id: number
}>()
</script>
<template>
<Entry :encounter_id="encounter_id" scope-code="micro-lab" />
</template>
@@ -0,0 +1,8 @@
<script setup lang="ts">
import List from '~/components/content/mcu-order/list.vue'
</script>
<template>
<List scope-code="micro-lab" />
</template>
@@ -0,0 +1,16 @@
<script setup lang="ts">
//
import List from './list.vue'
import Entry from './entry.vue'
const props = defineProps<{
encounter_id: number
}>()
const { mode } = useQueryCRUDMode()
</script>
<template>
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
<Entry v-else :encounter_id="encounter_id" />
</template>
+225
View File
@@ -0,0 +1,225 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
// #region Imports
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Filter from '~/components/pub/my-ui/nav-header/filter.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import { usePaginatedList } from '~/composables/usePaginatedList'
import { getList, remove } from '~/services/prb.service'
import { toast } from '~/components/pub/ui/toast'
import type { Encounter } from '~/models/encounter'
import WarningAlert from '~/components/pub/my-ui/alert/warning-alert.vue'
import type { Prb } from '~/models/prb'
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
// #endregion
// #region State
const props = withDefaults(defineProps<{
encounter?: Encounter
isBpjs?: boolean
}>(), {
isBpjs: false,
})
const route = useRoute()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getList({ ...params, includes: '', }),
entityName: 'prb',
})
const prbHistory = usePaginatedList({
fetchFn: (params) => getList({ ...params }),
entityName: 'prb-history',
})
const dummy = [
{
"id": 1,
"date": new Date().toISOString(),
"name1": "Dr. Smith",
"name2": "Maria S.",
"name3": "Project Alpha",
"name4": "Completed",
"name5": 95.5
},
]
const isHistoryDialogOpen = ref(false)
const isDocPreviewDialogOpen = ref(false)
const isFilterDialogOpen = ref(false)
const isRecordConfirmationOpen = ref(false)
const summaryLoading = ref(false)
const isRequirementsMet = ref(true)
const Prb = ref<Prb | null>(null)
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const timestamp = ref<any>(null)
const headerPrep: HeaderPrep = {
title: "Program Rujuk Balik",
icon: 'i-lucide-history',
}
if(true){
headerPrep.addNav = {
label: "Program Rujuk Balik",
onClick: () => navigateTo({
name: 'integration-bpjs-prb-add',
}),
};
}
headerPrep.components = [
{
component: defineAsyncComponent(() => import('~/components/app/prb/_common/btn-history.vue')),
props: { }
},
];
const refSearchNav: RefSearchNav = {
onClick: () => {
isFilterDialogOpen.value = true
},
onInput: (val: string) => {
searchInput.value = val
},
onClear: () => {
searchInput.value = ''
},
}
// #endregion
// #region Lifecycle Hooks
onMounted(() => {
getListData()
})
// #endregion
// #region Functions
async function getListData() {
try {
summaryLoading.value = true
await new Promise((resolve) => setTimeout(resolve, 500))
} catch (error) {
console.error('Error fetching Data:', error)
} finally {
summaryLoading.value = false
}
}
async function handleConfirmDelete(record: any, action: string) {
if (action === 'delete' && record?.id) {
try {
const result = await remove(record.id)
if (result.success) {
toast({ title: 'Berhasil', description: 'Data berhasil dihapus', variant: 'default' })
await fetchData()
} else {
toast({ title: 'Gagal', description: `Data gagal dihapus`, variant: 'destructive' })
}
} catch (error) {
toast({ title: 'Gagal', description: `Something went wrong`, variant: 'destructive' })
}
}
}
function handleCancelConfirmation() {
// Reset record state when cancelled
recId.value = 0
recAction.value = ''
recItem.value = null
}
function handleFiltering() {
isFilterDialogOpen.value = false
}
// #endregion
// #region Provide
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('timestamp', timestamp)
provide('table_data_loader', isLoading)
provide('isHistoryDialogOpen', isHistoryDialogOpen)
// #endregion
// #region Watchers
watch([recId, recAction, timestamp], () => {
switch (recAction.value) {
case ActionEvents.showEdit:
navigateTo({
name: 'integration-bpjs-prb-prb_id-edit',
params: { id: encounterId, "prb_id": recId.value },
})
break
case ActionEvents.showPrint:
isDocPreviewDialogOpen.value = true
break
case ActionEvents.showConfirmDelete:
isRecordConfirmationOpen.value = true
break
}
})
// #endregion
</script>
<template>
<WarningAlert v-if="!isRequirementsMet"
class="mb-5"
text="Syarat pembuatan PRB belum terpenuhi"
:description="[
'Lanjutan Penatalaksanaan Pasien harus terisi Dirujuk Eksternal',
'Jenis Pembayaran pasien harus JKN'
]" />
<div v-else>
<Header :prep="headerPrep" />
<Filter
:prep="headerPrep"
:ref-search-nav="refSearchNav"
:enable-export="false"
/>
<AppPrbList :is-bpjs="true" :data="dummy" />
<Dialog v-model:open="isHistoryDialogOpen" title="History" size="full">
<AppPrbHistoryList
:data="dummy"
:pagination-meta="prbHistory.paginationMeta"
@page-change="prbHistory.handlePageChange" />
</Dialog>
<Dialog v-model:open="isFilterDialogOpen" title="Filter" size="lg">
<AppPrbCommonFilter @submit="handleFiltering" />
</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>
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
<template #default="{ record }">
<div class="text-sm">
<p>
<strong>ID:</strong>
{{ record?.id }}
</p>
<p v-if="record?.firstName">
<strong>Nama:</strong>
{{ record.firstName }}
</p>
<p v-if="record?.code">
<strong>Kode:</strong>
{{ record.cellphone }}
</p>
</div>
</template>
</RecordConfirmation>
</div>
</template>
+65
View File
@@ -0,0 +1,65 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import { withBase } from '~/models/_base'
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
import type { Patient } from '~/models/patient'
import type { Person } from '~/models/person'
import { getDetail } from '~/services/prb.service'
// Components
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import type { Prb } from '~/models/prb'
// #region Props & Emits
const props = defineProps<{
}>()
// #endregion
// #region State & Computed
const route = useRoute()
const router = useRouter()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const PrbId = typeof route.params.surgery_report_id == 'string' ? parseInt(route.params.surgery_report_id) : 0
const Prb = ref<Prb | null>(null)
const headerPrep: HeaderPrep = {
title: 'Detail Program Rujuk Balik',
icon: 'i-lucide-newspaper',
}
// #endregion
// #region Lifecycle Hooks
// onMounted(async () => {
// const result = await getDetail(controlLetterId, {
// includes: "unit,specialist,subspecialist,doctor-employee-person",
// })
// if (result.success) {
// controlLetter.value = result.body?.data
// }
// })
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
// #endregion region
// #region Utilities & event handlers
function handleAction() {
goBack()
}
// #endregion
// #region Watchers
// #endregion
</script>
<template>
<Header :prep="headerPrep" :ref-search-nav="headerPrep.refSearchNav" />
<AppPrbDetail :instance="Prb" @click="handleAction" />
</template>
+160
View File
@@ -0,0 +1,160 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import type { Patient, genPatientProps } from '~/models/patient'
import type { ExposedForm } from '~/types/form'
import type { PatientBase } from '~/models/patient'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import { genPatient } from '~/models/patient'
import { PatientSchema } from '~/schemas/patient.schema'
import { PersonAddressRelativeSchema } from '~/schemas/person-address-relative.schema'
import { PersonAddressSchema } from '~/schemas/person-address.schema'
import { PersonContactListSchema } from '~/schemas/person-contact.schema'
import { PersonFamiliesSchema } from '~/schemas/person-family.schema'
import { ResponsiblePersonSchema } from '~/schemas/person-relative.schema'
import { uploadAttachment } from '~/services/patient.service'
import { getDetail, update } from '~/services/prb.service'
import type { Prb } from '~/models/prb'
import ActionDialog from '~/components/pub/my-ui/nav-footer/ba-su.vue'
import { toast } from '~/components/pub/ui/toast'
import { withBase } from '~/models/_base'
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
import { PrbSchema } from '~/schemas/prb.schema'
import { formatDateYyyyMmDd } from '~/lib/date'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import { getList, remove } from '~/services/prb.service'
import { handleActionEdit } from '~/handlers/prb.handler'
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
import { formatDateToDatetimeLocal } from '~/lib/utils'
// #region Props & Emits
const props = withDefaults(defineProps<{
callbackUrl?: string
isBpjs?: boolean
}>(), {
isBpjs: false,
})
// form related state
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }),
entityName: 'prb',
})
// #endregion
// #region State & Computed
const route = useRoute()
const router = useRouter()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const PrbId = typeof route.params.surgery_report_id == 'string' ? parseInt(route.params.surgery_report_id) : 0
const inputForm = ref<ExposedForm<any> | null>(null)
const Prb = ref({})
const isConfirmationOpen = ref(false)
const selectedOperativeAction = ref<any>(null)
const isSepDialogOpen = ref(false)
provide("isSepDialogOpen", isSepDialogOpen);
// #endregion
// #region Lifecycle Hooks
onMounted(async () => {
const result = await getDetail(PrbId)
if (result.success) {
const responseData = {...result.body.data, date: formatDateYyyyMmDd(result.body.data.date)}
Prb.value = responseData
inputForm.value?.setValues(responseData)
}
})
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
async function handleConfirmAdd() {
const response = await handleActionEdit(
PrbId,
await composeFormData(),
() => { },
() => { },
toast,
)
goBack()
}
async function composeFormData(): Promise<Prb> {
const [input,] = await Promise.all([
inputForm.value?.validate(),
])
const results = [input]
const allValid = results.every((r) => r?.valid)
// exit, if form errors happend during validation
if (!allValid) return Promise.reject('Form validation failed')
const formData = input?.values
formData.encounter_id = encounterId
return new Promise((resolve) => resolve(formData))
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
isConfirmationOpen.value = true
}
if (eventType === 'back') {
if (props.callbackUrl) {
await navigateTo(props.callbackUrl)
return
}
goBack()
}
}
function handleCancelAdd() {
isConfirmationOpen.value = false
}
// #endregion
// #region Watchers
// #endregion
const initialValues = {
a1: "",
a2: formatDateToDatetimeLocal(new Date()),
}
</script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Update Program Rujuk Balik</div>
<AppPrbEntry
ref="inputForm"
:schema="PrbSchema"
:initial-values="initialValues"
:is-bpjs="isBpjs"
/>
<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"
/>
</template>
<style scoped>
/* component style */
</style>
+202
View File
@@ -0,0 +1,202 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
// #region Imports
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Filter from '~/components/pub/my-ui/nav-header/filter.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import { usePaginatedList } from '~/composables/usePaginatedList'
import { getList, remove } from '~/services/prb.service'
import { toast } from '~/components/pub/ui/toast'
import type { Encounter } from '~/models/encounter'
import WarningAlert from '~/components/pub/my-ui/alert/warning-alert.vue'
import type { Prb } from '~/models/prb'
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
// #endregion
// #region State
const props = withDefaults(defineProps<{
encounter?: Encounter
isBpjs?: boolean
}>(), {
isBpjs: false,
})
const route = useRoute()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getList({ ...params, includes: '', }),
entityName: 'prb',
})
const prbHistory = usePaginatedList({
fetchFn: (params) => getList({ ...params }),
entityName: 'prb-history',
})
const dummy = [
{
"id": 1,
"date": new Date().toISOString(),
"name1": "Dr. Smith",
"name2": "Maria S.",
"name3": "Project Alpha",
"name4": "Completed",
"name5": 95.5
},
]
const isHistoryDialogOpen = ref(false)
const isDocPreviewDialogOpen = ref(false)
const isRecordConfirmationOpen = ref(false)
const summaryLoading = ref(false)
const isRequirementsMet = ref(true)
const Prb = ref<Prb | null>(null)
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const timestamp = ref<any>(null)
const headerPrep: HeaderPrep = {
title: "Program Rujuk Balik",
icon: 'i-lucide-history',
}
if(true){
headerPrep.addNav = {
label: "Program Rujuk Balik",
onClick: () => navigateTo({
name: 'rehab-encounter-id-prb-add',
params: { id: encounterId },
}),
};
}
headerPrep.components = [
{
component: defineAsyncComponent(() => import('~/components/app/prb/_common/btn-history.vue')),
props: { }
},
];
// #endregion
// #region Lifecycle Hooks
onMounted(() => {
getListData()
})
// #endregion
// #region Functions
async function getListData() {
try {
summaryLoading.value = true
await new Promise((resolve) => setTimeout(resolve, 500))
} catch (error) {
console.error('Error fetching Data:', error)
} finally {
summaryLoading.value = false
}
}
async function handleConfirmDelete(record: any, action: string) {
if (action === 'delete' && record?.id) {
try {
const result = await remove(record.id)
if (result.success) {
toast({ title: 'Berhasil', description: 'Data berhasil dihapus', variant: 'default' })
await fetchData()
} else {
toast({ title: 'Gagal', description: `Data gagal dihapus`, variant: 'destructive' })
}
} catch (error) {
toast({ title: 'Gagal', description: `Something went wrong`, variant: 'destructive' })
}
}
}
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('timestamp', timestamp)
provide('table_data_loader', isLoading)
provide('isHistoryDialogOpen', isHistoryDialogOpen)
// #endregion
// #region Watchers
watch([recId, recAction, timestamp], () => {
switch (recAction.value) {
case ActionEvents.showEdit:
navigateTo({
name: 'rehab-encounter-id-prb-prb_id-edit',
params: { id: encounterId, "prb_id": recId.value },
})
break
case ActionEvents.showPrint:
isDocPreviewDialogOpen.value = true
break
case ActionEvents.showConfirmDelete:
isRecordConfirmationOpen.value = true
break
}
})
// #endregion
</script>
<template>
<WarningAlert v-if="!isRequirementsMet"
class="mb-5"
text="Syarat pembuatan PRB belum terpenuhi"
:description="[
'Lanjutan Penatalaksanaan Pasien harus terisi Dirujuk Eksternal',
'Jenis Pembayaran pasien harus JKN'
]" />
<div v-else>
<Header :prep="headerPrep" />
<AppPrbDetail :instance="Prb" />
<h1 class="font-semibold text-lg mb-2">Obat</h1>
<AppPrbList :is-bpjs="isBpjs" :data="dummy" />
<Dialog v-model:open="isHistoryDialogOpen" title="History" size="full">
<AppPrbHistoryList
:data="dummy"
:pagination-meta="prbHistory.paginationMeta"
@page-change="prbHistory.handlePageChange" />
</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>
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
<template #default="{ record }">
<div class="text-sm">
<p>
<strong>ID:</strong>
{{ record?.id }}
</p>
<p v-if="record?.firstName">
<strong>Nama:</strong>
{{ record.firstName }}
</p>
<p v-if="record?.code">
<strong>Kode:</strong>
{{ record.cellphone }}
</p>
</div>
</template>
</RecordConfirmation>
</div>
</template>
@@ -0,0 +1,173 @@
<script setup lang="ts">
//
import * as CH from '~/components/pub/my-ui/content-header'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import NavEntry from '~/components/pub/my-ui/nav-footer/ba-de-dr-su.vue'
import NavDetail from '~/components/pub/my-ui/nav-footer/ba.vue'
import NavOk from '~/components/pub/my-ui/nav-footer/ok.vue'
// Procedure Room
import type { ProcedureRoom } from '~/models/procedure-room'
import { getList as getProcedureRoomList } from '~/services/procedure-room.service'
import PRSwitcher from '~/components/app/procedure-room/switcher.vue'
import PRMultiOptPicker from '~/components/app/procedure-room/multi-opt-picker.vue'
import PRPicker from '~/components/app/procedure-room/picker.vue'
// Material Package
import type { MaterialPackage } from '~/models/material-package'
import { getList as getMaterialPackageList } from '~/services/material-package.service'
// Material Package Item
import type { MaterialPackageItem } from '~/models/material-package-item'
import { getList as getmaterialPackageItems } from '~/services/material-package-item.service'
import MPSwitcher from '~/components/app/material-package/switcher.vue'
import MPIQuickList from '~/components/app/material-package-item/quick-list.vue'
// Main data
import { getDetail } from '~/services/procedure-room-order.service'
import Detail from '~/components/app/procedure-room-order/detail.vue'
// Items data
import type { ProcedureRoomOrderItem } from '~/models/procedure-room-order-item'
import {
getList as getOrderItemList,
create as createOrderItem,
remove as removeOrderItem,
} from '~/services/procedure-room-order-item.service'
import ItemListEntry from '~/components/app/procedure-room-order-item/list-entry.vue'
import ItemListDetail from '~/components/app/procedure-room-order-item/list-detail.vue'
// data
const { backToList, crudQueryParams } = useQueryCRUD()
const id = crudQueryParams.value.recordId
const dataRes = await getDetail(
typeof id === 'string' ? parseInt(id) : 0,
{ includes: 'encounter,doctor,doctor-employee,doctor-employee-person' }
)
const data = dataRes.body?.data
const items = ref<ProcedureRoomOrderItem[]>([])
// Header
const headerConfig: CH.Config = {
title: 'Order Ruang Tindakan',
icon: 'i-lucide-box',
}
//
const pickerDialogOpen = ref(false)
const procedureRooms = ref<ProcedureRoom[]>([])
const procedureRoomType = ref('procedure')
getProcedureRooms(procedureRoomType.value)
watch(procedureRoomType, async (newValue) => {
getProcedureRooms(newValue)
})
//
const materialPackages = ref<MaterialPackage[]>([])
const selectedMaterialPackage = ref('')
const res = await getMaterialPackageList()
if (res.success) {
materialPackages.value = res.body.data
}
//
const materialPackageItems = ref<MaterialPackageItem[]>([])
watch(selectedMaterialPackage, async (newValue) => {
const res = await getmaterialPackageItems({
'material-package-code': selectedMaterialPackage.value,
includes: 'material'
})
if (res.success) {
materialPackageItems.value = res.body.data
}
})
// last flow
onMounted(async () => {
await getItems()
})
///// functions
async function getProcedureRooms(typeCode: string) {
const res = await getProcedureRoomList({ 'type-code': typeCode, includes: 'infra' })
if (res.success) {
procedureRooms.value = res.body.data
}
}
async function getItems() {
const res = await getOrderItemList({
'procedure-room-order-id': crudQueryParams.value.recordId,
includes: 'procedureRoom,procedureRoom-infra',
})
if (res.success) {
items.value = res.body.data
}
}
async function pickItem(item: ProcedureRoom) {
const exItem = items.value.find(e => e.procedureRoom_code === item.code)
if (exItem) {
await removeOrderItem(exItem.id)
await getItems()
} else {
const intId = parseInt(id?.toString() || '0')
await createOrderItem({
procedureRoomOrder_id: intId,
procedureRoom_code: item.code,
})
await getItems()
}
}
function requestItem() {
pickerDialogOpen.value = true
}
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
if (type === 'back') {
backToList()
}
}
</script>
<template>
<CH.ContentHeader v-bind="headerConfig" />
<Separator class="mb-4" />
<Detail :data="data" />
<template v-if="data.status_code == 'new'">
<ItemListEntry :data="items" @requestItem="requestItem" />
<MPSwitcher :data="materialPackages" v-model="selectedMaterialPackage" />
</template>
<template v-else>
<ItemListDetail :data="items" @requestItem="requestItem" />
</template>
<MPIQuickList :data="materialPackageItems" />
<div class="w-full flex justify-center">
<NavEntry v-if="data.status_code == 'new'" @click="navClick" />
<NavDetail v-else @click="navClick" />
</div>
<Dialog
v-model:open="pickerDialogOpen"
title="Pilih Item"
size="2xl"
prevent-outside
>
<PRSwitcher v-model="procedureRoomType" />
<PRPicker
:data="procedureRooms"
:pick-mode="procedureRoomType == 'procedure' ? 'multi' : 'single'"
v-model="items"
@pick="pickItem"
/>
<Separator />
<NavOk @click="() => pickerDialogOpen = false" class="justify-center" />
</Dialog>
</template>
@@ -0,0 +1,191 @@
<script setup lang="ts">
// Composables
import { usePaginatedList } from '~/composables/usePaginatedList'
// Handlers
import type { ToastFn } from '~/handlers/_handler'
// Pubs component
import { toast } from '~/components/pub/ui/toast'
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
// Order
import {
recId,
recAction,
recItem,
isRecordConfirmationOpen,
handleActionRemove,
} from '~/handlers/procedure-room-order.handler'
import { getList, create, submit } from '~/services/procedure-room-order.service'
import type { ProcedureRoomOrder } from '~/models/procedure-room-order'
import List from '~/components/app/procedure-room-order/list.vue'
// Common prep
const route = useRoute()
const { setQueryParams } = useQueryParam()
const { crudQueryParams } = useQueryCRUD()
const plainEid = route.params.id
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0
const isSubmitConfirmationOpen = ref(false)
// Main data
const {
data,
isLoading,
paginationMeta,
searchInput,
fetchData: getMyList,
} = usePaginatedList<ProcedureRoomOrder>({
fetchFn: async (params: any) => {
const result = await getList({
'encounter-id': encounter_id,
includes: 'items',
search: params.search,
page: params.page,
'page-number': params['page-number'] || 0,
'page-size': params['page-size'] || 10,
})
return { success: result.success || false, body: result.body || {} }
},
entityName: 'prescription'
})
// Header things
const headerPrep: HeaderPrep = {
title: 'Order Ruang Tindakan',
icon: 'i-lucide-box',
refSearchNav: {
placeholder: 'Cari (min. 3 karakter)...',
minLength: 3,
debounceMs: 500,
showValidationFeedback: true,
onInput: (value: string) => {
searchInput.value = value
},
onClick: () => {},
onClear: () => {},
},
addNav: {
label: 'Tambah',
icon: 'i-lucide-plus',
onClick: async () => {
recItem.value = null
recId.value = 0
const res = await create({ encounter_id })
if (res.success) {
crudQueryParams.value = { mode: 'entry', recordId: res.body?.data.id.toString() || '0' }
}
},
},
}
// list actions
const timestamp = ref<any>({})
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
provide('timestamp', timestamp)
watch(recAction, () => {
if (!recAction.value) {
return
} else if (recAction.value === ActionEvents.showDetail) {
crudQueryParams.value = { mode: 'entry', recordId: recId.value || '0' }
} else if (recAction.value === ActionEvents.showConfirmSubmit) {
isSubmitConfirmationOpen.value = true
} else if (recAction.value === ActionEvents.showConfirmDelete) {
isRecordConfirmationOpen.value = true
}
recAction.value = ''
})
///// functions
function confirmCancel(data: ProcedureRoomOrder) {
recId.value = data.id
recItem.value = data
isRecordConfirmationOpen.value = true
}
function goToEdit(data: ProcedureRoomOrder) {
setQueryParams({
'mode': 'entry',
'id': data.id.toString()
})
recItem.value = data
}
function confirmSubmit(data: ProcedureRoomOrder) {
recId.value = data.id
recItem.value = data
isSubmitConfirmationOpen.value = true
}
async function handleActionSubmit(id: number, refresh: () => void, toast: ToastFn) {
const result = await submit(id)
if (result.success) {
toast({ title: 'Berhasil', description: 'Resep telah di ajukan', variant: 'default' })
setTimeout(refresh, 300)
} else {
toast({ title: 'Gagal', description: 'Gagal menjalankan perintah', variant: 'destructive' })
}
}
</script>
<template>
<Header :prep="{ ...headerPrep }" />
<List
v-if="!isLoading.dataListLoading"
:data="data"
:pagination-meta="paginationMeta"
@cancel="confirmCancel"
@edit="goToEdit"
@submit="confirmSubmit"
/>
<RecordConfirmation
v-model:open="isRecordConfirmationOpen"
action="delete"
:record="recItem"
@confirm="() => handleActionRemove(recId, getMyList, toast)"
@cancel=""
>
<div class="flex mb-2">
<div class="w-20">Tanggal</div>
<div class="w-4">:</div>
<div class="">{{ recItem.createdAt?.substring(0, 10) }}</div>
</div>
<div class="flex">
<div class="w-20">DPJP</div>
<div class="w-4">:</div>
<div class="">{{ recItem.doctor?.employee?.person?.name }}</div>
</div>
</RecordConfirmation>
<RecordConfirmation
v-model:open="isSubmitConfirmationOpen"
action="delete"
customTitle="Ajukan Resep"
customMessage="Proses akan mengajukan resep ini untuk diproses lebih lanjut. Lanjutkan?"
customConfirmText="Ajukan"
:record="recItem"
@confirm="() => handleActionSubmit(recId, getMyList, toast)"
@cancel=""
>
<div class="flex mb-2">
<div class="w-20">Tanggal</div>
<div class="w-4">:</div>
<div class="">{{ recItem.createdAt.substring(0, 10) }}</div>
</div>
<div class="flex">
<div class="w-20">DPJP</div>
<div class="w-4">:</div>
<div class="">{{ recItem.doctor?.employee?.person?.name }}</div>
</div>
</RecordConfirmation>
</template>
@@ -0,0 +1,17 @@
<script setup lang="ts">
//
import List from './list.vue'
import Entry from './entry.vue'
const props = defineProps<{
encounter_id: number
}>()
const { crudQueryParams } = useQueryCRUD()
</script>
<template>
<List v-if="crudQueryParams.mode === 'list'" :encounter_id="encounter_id" />
<Entry v-else :encounter_id="encounter_id" />
<div class="hidden">{{ crudQueryParams.mode }}</div>
</template>
@@ -13,7 +13,6 @@ import {
recAction,
recItem,
isReadonly,
isFormEntryDialogOpen,
isRecordConfirmationOpen,
handleActionSave,
handleActionRemove,
@@ -28,6 +27,7 @@ const route = useRoute()
const { setQueryParams } = useQueryParam()
const title = ref('')
const addTrigger = ref(false)
const plainEid = route.params.id
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0 // here the
@@ -74,7 +74,7 @@ const headerPrep: HeaderPrep = {
onClick: () => {
recItem.value = null
recId.value = 0
isFormEntryDialogOpen.value = true
addTrigger.value = true
isReadonly.value = false
},
},
@@ -90,7 +90,7 @@ const getMyDetail = async (id: number | string) => {
if (result.success) {
const currentValue = result.body?.data || {}
recItem.value = currentValue
isFormEntryDialogOpen.value = true
addTrigger.value = true
}
}
@@ -113,10 +113,10 @@ watch([recId, recAction], () => {
}
})
watch([isFormEntryDialogOpen], async () => {
if (isFormEntryDialogOpen.value) {
isFormEntryDialogOpen.value = false;
const saveResp = await handleActionSave({ encounter_id }, getMyList, () =>{}, toast)
watch([addTrigger], async () => {
if (addTrigger.value) {
addTrigger.value = false;
const saveResp = await handleActionSave({ encounter_id, "scope_code": "rad" }, getMyList, () =>{}, toast)
if (saveResp.success) {
setQueryParams({
'mode': 'entry',
+15 -3
View File
@@ -8,7 +8,8 @@ import AppViewHistory from '~/components/app/sep/view-history.vue'
import AppViewLetter from '~/components/app/sep/view-letter.vue'
// Handler
import useIntegrationSepEntry from '~/handlers/integration-sep-entry.handler'
import { useIntegrationSepEntry } from '~/handlers/integration-sep-entry.handler'
import { useIntegrationSepDetail } from '~/handlers/integration-sep-detail.handler'
const {
histories,
@@ -55,8 +56,18 @@ const {
handleInit,
} = useIntegrationSepEntry()
const { valueObjects, getSepDetail } = useIntegrationSepDetail()
const props = defineProps<{
mode: 'add' | 'edit' | 'detail' | 'link'
}>()
onMounted(async () => {
await handleInit()
if (['detail', 'link'].includes(props.mode)) {
await getSepDetail()
selectedObjects.value = { ...selectedObjects.value, ...valueObjects.value }
}
})
</script>
@@ -66,12 +77,13 @@ onMounted(async () => {
name="i-lucide-panel-bottom"
class="me-2"
/>
<span class="font-semibold">Tambah</span>
SEP
<span class="font-semibold">{{ ['detail', 'link'].includes(props.mode) ? 'Detail' : 'Tambah' }} SEP</span>
</div>
<AppSepEntryForm
:mode="props.mode"
:is-save-loading="isSaveLoading"
:is-service="isServiceHidden"
:is-readonly="['detail', 'link'].includes(props.mode)"
:doctors="doctors"
:diagnoses="diagnoses"
:facilities-from="facilitiesFrom"
+98 -32
View File
@@ -13,8 +13,11 @@ import RangeCalendar from '~/components/pub/ui/range-calendar/RangeCalendar.vue'
// Icons
import { X, Check } from 'lucide-vue-next'
// Libraries
import useIntegrationSepList from '~/handlers/integration-sep-list.handler'
// Handlers
import { useIntegrationSepList } from '~/handlers/integration-sep-list.handler'
// Helpers
import { refDebounced } from '@vueuse/core'
// use handler to provide state and functions
const {
@@ -42,26 +45,42 @@ const {
handleRemove,
} = useIntegrationSepList()
const dataFiltered = ref<any>([])
const debouncedSearch = refDebounced(search, 500)
// expose provides so component can also use provide/inject if needed
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
watch(
[recId, recAction],
() => {
if (recAction.value === 'showConfirmDel') {
open.value = true
}
},
)
watch([recId, recAction], () => {
if (recAction.value === 'showConfirmDel') {
open.value = true
}
if (recAction.value === 'showDetail') {
navigateTo(`/integration/bpjs-vclaim/sep/${recItem.value?.letterNumber}/detail`)
}
})
watch(debouncedSearch, (newValue) => {
if (newValue && newValue !== '-' && newValue.length >= 3) {
dataFiltered.value = data.value.filter(
(item: any) =>
item.patientName.toLowerCase().includes(newValue.toLowerCase()) ||
item.letterNumber.toLowerCase().includes(newValue.toLowerCase()) ||
item.cardNumber.toLowerCase().includes(newValue.toLowerCase()),
)
}
})
watch(
() => dateSelection.value,
(val) => {
async (val) => {
if (!val) return
setDateRange()
await getSepList()
dataFiltered.value = [...data.value]
},
{ deep: true },
)
@@ -73,9 +92,10 @@ watch(
},
)
onMounted(() => {
onMounted(async () => {
setServiceTypes()
getSepList()
await getSepList()
dataFiltered.value = [...data.value]
})
</script>
@@ -85,20 +105,35 @@ onMounted(() => {
<!-- Filter Bar -->
<div class="my-2 flex flex-wrap items-center gap-2">
<!-- Search -->
<Input v-model="search" placeholder="Cari No. SEP / No. Kartu BPJS..." class="w-72" />
<Input
v-model="search"
placeholder="Cari No. SEP / No. Kartu BPJS..."
class="w-72"
/>
<!-- Filter -->
<div class="w-72">
<Select id="serviceType" icon-name="i-lucide-chevron-down" v-model="serviceType" :items="serviceTypesList"
placeholder="Pilih Pelayanan" />
<Select
id="serviceType"
icon-name="i-lucide-chevron-down"
v-model="serviceType"
:items="serviceTypesList"
placeholder="Pilih Pelayanan"
/>
</div>
<!-- Date Range -->
<Popover>
<PopoverTrigger as-child>
<Button variant="outline" class="h-[40px] w-72 border-gray-400 bg-white text-right font-normal">
<Button
variant="outline"
class="h-[40px] w-72 border-gray-400 bg-white text-right font-normal"
>
{{ dateRange }}
<Icon name="i-lucide-calendar" class="h-5 w-5" />
<Icon
name="i-lucide-calendar"
class="h-5 w-5"
/>
</Button>
</PopoverTrigger>
<PopoverContent class="p-2">
@@ -109,9 +144,14 @@ onMounted(() => {
<!-- Export -->
<DropdownMenu>
<DropdownMenuTrigger as-child>
<Button variant="outline"
class="ml-auto h-[40px] w-[120px] rounded-md border-green-600 text-green-600 hover:bg-green-50">
<Icon name="i-lucide-download" class="h-5 w-5" />
<Button
variant="outline"
class="ml-auto h-[40px] w-[120px] rounded-md border-green-600 text-green-600 hover:bg-green-50"
>
<Icon
name="i-lucide-download"
class="h-5 w-5"
/>
Ekspor
</Button>
</DropdownMenuTrigger>
@@ -123,13 +163,20 @@ onMounted(() => {
</div>
<div class="mt-4">
<AppSepList v-if="!isLoading.dataListLoading" :data="data" @update:modelValue="handleRowSelected" />
<AppSepList
v-if="!isLoading.dataListLoading"
:data="dataFiltered"
@update:modelValue="handleRowSelected"
/>
</div>
<!-- Pagination -->
<template v-if="paginationMeta">
<div v-if="paginationMeta.totalPage > 1">
<PubMyUiPagination :pagination-meta="paginationMeta" @page-change="handlePageChange" />
<PubMyUiPagination
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</div>
</template>
@@ -142,20 +189,39 @@ onMounted(() => {
</DialogHeader>
<DialogDescription class="text-gray-700">Apakah anda yakin ingin menghapus SEP dengan data:</DialogDescription>
<div class="mt-4 space-y-2 text-sm">
<p><strong>No. SEP:</strong> {{ sepData.sepNumber }}</p>
<p><strong>No. Kartu BPJS:</strong> {{ sepData.cardNumber }}</p>
<p><strong>Nama Pasien:</strong> {{ sepData.patientName }}</p>
<p>
<strong>No. SEP:</strong>
{{ sepData.sepNumber }}
</p>
<p>
<strong>No. Kartu BPJS:</strong>
{{ sepData.cardNumber }}
</p>
<p>
<strong>Nama Pasien:</strong>
{{ sepData.patientName }}
</p>
</div>
<DialogFooter class="mt-6 flex justify-end gap-3">
<Button variant="outline" class="border-green-600 text-green-600 hover:bg-green-50" @click="() => {
recId = 0
recAction = ''
open = false
}">
<Button
variant="outline"
class="border-green-600 text-green-600 hover:bg-green-50"
@click="
() => {
recId = 0
recAction = ''
open = false
}
"
>
<X class="mr-1 h-4 w-4" />
Tidak
</Button>
<Button variant="destructive" class="bg-red-600 hover:bg-red-700" @click="handleRemove">
<Button
variant="destructive"
class="bg-red-600 hover:bg-red-700"
@click="handleRemove"
>
<Check class="mr-1 h-4 w-4" />
Ya
</Button>
+1 -1
View File
@@ -71,7 +71,7 @@ onMounted(async () => {
})
async function getMyList() {
const url = `/api/v1/soapi?typeCode=${typeCode.value}&includes=encounter,employee&encounter-id=${route.params.id}`
const url = `/api/v1/soapi?type-code=${typeCode.value}&includes=encounter,employee&encounter-id=${route.params.id}`
const resp = await xfetch(url)
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
@@ -0,0 +1,65 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import { withBase } from '~/models/_base'
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
import type { Patient } from '~/models/patient'
import type { Person } from '~/models/person'
import { getDetail } from '~/services/vaccine-data.service'
// Components
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import type { VaccineData } from '~/models/vaccine-data'
// #region Props & Emits
const props = defineProps<{
}>()
// #endregion
// #region State & Computed
const route = useRoute()
const router = useRouter()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const VaccineDataId = typeof route.params.surgery_report_id == 'string' ? parseInt(route.params.surgery_report_id) : 0
const VaccineData = ref<VaccineData | null>(null)
const headerPrep: HeaderPrep = {
title: 'Detail Data Vaksin',
icon: 'i-lucide-newspaper',
}
// #endregion
// #region Lifecycle Hooks
// onMounted(async () => {
// const result = await getDetail(controlLetterId, {
// includes: "unit,specialist,subspecialist,doctor-employee-person",
// })
// if (result.success) {
// controlLetter.value = result.body?.data
// }
// })
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
// #endregion region
// #region Utilities & event handlers
function handleAction() {
goBack()
}
// #endregion
// #region Watchers
// #endregion
</script>
<template>
<Header :prep="headerPrep" :ref-search-nav="headerPrep.refSearchNav" />
<AppVaccineDataDetail :instance="VaccineData" @click="handleAction" />
</template>
@@ -0,0 +1,159 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import type { Patient, genPatientProps } from '~/models/patient'
import type { ExposedForm } from '~/types/form'
import type { PatientBase } from '~/models/patient'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import { genPatient } from '~/models/patient'
import { PatientSchema } from '~/schemas/patient.schema'
import { PersonAddressRelativeSchema } from '~/schemas/person-address-relative.schema'
import { PersonAddressSchema } from '~/schemas/person-address.schema'
import { PersonContactListSchema } from '~/schemas/person-contact.schema'
import { PersonFamiliesSchema } from '~/schemas/person-family.schema'
import { ResponsiblePersonSchema } from '~/schemas/person-relative.schema'
import { uploadAttachment } from '~/services/patient.service'
import { getDetail, update } from '~/services/vaccine-data.service'
import type { VaccineData } from '~/models/vaccine-data'
import ActionDialog from '~/components/pub/my-ui/nav-footer/ba-su.vue'
import { toast } from '~/components/pub/ui/toast'
import { withBase } from '~/models/_base'
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
import { VaccineDataSchema } from '~/schemas/vaccine-data.schema'
import { formatDateYyyyMmDd } from '~/lib/date'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import { getList, remove } from '~/services/vaccine-data.service'
import { handleActionEdit, handleActionSave } from '~/handlers/vaccine-data.handler'
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
import { formatDateToDatetimeLocal } from '~/lib/utils'
// #region Props & Emits
const props = withDefaults(defineProps<{
callbackUrl?: string
isBpjs?: boolean
}>(), {
isBpjs: false,
})
// form related state
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }),
entityName: 'vaccine-data',
})
// #endregion
// #region State & Computed
const route = useRoute()
const router = useRouter()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const VaccineDataId = typeof route.params.surgery_report_id == 'string' ? parseInt(route.params.surgery_report_id) : 0
const inputForm = ref<ExposedForm<any> | null>(null)
const VaccineData = ref({})
const isConfirmationOpen = ref(false)
const selectedOperativeAction = ref<any>(null)
const isSepDialogOpen = ref(false)
provide("isSepDialogOpen", isSepDialogOpen);
// #endregion
// #region Lifecycle Hooks
onMounted(async () => {
const result = await getDetail(VaccineDataId)
if (result.success) {
const responseData = {...result.body.data, date: formatDateYyyyMmDd(result.body.data.date)}
VaccineData.value = responseData
inputForm.value?.setValues(responseData)
}
})
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
async function handleConfirmAdd() {
const response = await handleActionSave(
await composeFormData(),
() => { },
() => { },
toast,
)
goBack()
}
async function composeFormData(): Promise<VaccineData> {
const [input,] = await Promise.all([
inputForm.value?.validate(),
])
const results = [input]
const allValid = results.every((r) => r?.valid)
// exit, if form errors happend during validation
if (!allValid) return Promise.reject('Form validation failed')
const formData = input?.values
formData.encounter_id = encounterId
return new Promise((resolve) => resolve(formData))
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
isConfirmationOpen.value = true
}
if (eventType === 'back') {
if (props.callbackUrl) {
await navigateTo(props.callbackUrl)
return
}
goBack()
}
}
function handleCancelAdd() {
isConfirmationOpen.value = false
}
// #endregion
// #region Watchers
// #endregion
const initialValues = {
a1: "",
a2: formatDateToDatetimeLocal(new Date()),
}
</script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Update Data Vaksin</div>
<AppVaccineDataEntry
ref="inputForm"
:schema="VaccineDataSchema"
:initial-values="initialValues"
:is-bpjs="isBpjs"
/>
<div class="my-2 flex justify-end py-2">
<Action @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"
/>
</template>
<style scoped>
/* component style */
</style>
@@ -0,0 +1,165 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
// #region Imports
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Filter from '~/components/pub/my-ui/nav-header/filter.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import { usePaginatedList } from '~/composables/usePaginatedList'
import { getList, remove } from '~/services/vaccine-data.service'
import { toast } from '~/components/pub/ui/toast'
import type { Encounter } from '~/models/encounter'
import WarningAlert from '~/components/pub/my-ui/alert/warning-alert.vue'
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import type { VaccineData } from '~/models/vaccine-data'
import { medicalRoles } from '~/const/common/role'
// #endregion
// #region State
const props = withDefaults(defineProps<{
encounter?: Encounter
isBpjs?: boolean
}>(), {
isBpjs: false,
})
const route = useRoute()
const {user} = useUserStore()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getList({ ...params, includes: '', }),
entityName: 'vaccine-data',
})
const dummy = [
{
"id": 1,
"date": new Date().toISOString(),
"name1": "Dr. Smith",
"name2": 1,
},
]
const isHistoryDialogOpen = ref(false)
const isDocPreviewDialogOpen = ref(false)
const isRecordConfirmationOpen = ref(false)
const summaryLoading = ref(false)
const isRequirementsMet = ref(true)
const vaccineData = ref<VaccineData | null>(null)
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const timestamp = ref<any>(null)
const headerPrep: HeaderPrep = {
title: "Data Vaksin",
icon: 'i-lucide-syringe',
}
if(user.activeRole === 'emp|doc' || user.activeRole === 'system') {
headerPrep.addNav = {
label: "Data Vaksin",
onClick: () => navigateTo({
name: 'rehab-encounter-id-vaccine-data-add',
params: { id: encounterId },
}),
};
}
// #endregion
// #region Lifecycle Hooks
onMounted(() => {
getListData()
})
// #endregion
// #region Functions
async function getListData() {
try {
summaryLoading.value = true
await new Promise((resolve) => setTimeout(resolve, 500))
} catch (error) {
console.error('Error fetching Data:', error)
} finally {
summaryLoading.value = false
}
}
async function handleConfirmDelete(record: any, action: string) {
if (action === 'delete' && record?.id) {
try {
const result = await remove(record.id)
if (result.success) {
toast({ title: 'Berhasil', description: 'Data berhasil dihapus', variant: 'default' })
await fetchData()
} else {
toast({ title: 'Gagal', description: `Data gagal dihapus`, variant: 'destructive' })
}
} catch (error) {
toast({ title: 'Gagal', description: `Something went wrong`, variant: 'destructive' })
}
}
}
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('timestamp', timestamp)
provide('table_data_loader', isLoading)
provide('isHistoryDialogOpen', isHistoryDialogOpen)
// #endregion
// #region Watchers
watch([recId, recAction, timestamp], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
navigateTo({
name: 'rehab-encounter-id-vaccine-data-vaccine_data_id',
params: { id: encounterId, "vaccine_data_id": recId.value },
})
break
case ActionEvents.showConfirmDelete:
isRecordConfirmationOpen.value = true
break
}
})
// #endregion
</script>
<template>
<div>
<Header :prep="headerPrep" />
<AppVaccineDataList
:data="dummy"
:pagination-meta="paginationMeta"
@page-change="handlePageChange" />
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
<template #default="{ record }">
<div class="text-sm">
<p>
<strong>ID:</strong>
{{ record?.id }}
</p>
<p v-if="record?.name">
<strong>Nama:</strong>
{{ record.name }}
</p>
</div>
</template>
</RecordConfirmation>
</div>
</template>