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

This commit is contained in:
Abizrh
2025-11-21 14:14:17 +07:00
436 changed files with 27168 additions and 2469 deletions
-1
View File
@@ -25,7 +25,6 @@ const ActiveForm = computed(() => formMap[type.value] || EarlyForm)
<template>
<div>
<SoapiList v-if="mode === 'list'" />
<component
v-else
:is="ActiveForm"
+100 -14
View File
@@ -2,14 +2,23 @@
import { z } from 'zod'
import Entry from '~/components/app/soapi/entry.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 { FunctionSoapiSchema } 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 isOpen = ref(false)
const data = ref([])
const isOpenProcedure = ref(false)
const isOpenDiagnose = ref(false)
const isOpenFungsional = ref(false)
const procedures = ref([])
const diagnoses = ref([])
const fungsional = ref([])
const selectedProcedure = ref<any>(null)
const selectedDiagnose = ref<any>(null)
const selectedFungsional = ref<any>(null)
const schema = FunctionSoapiSchema
const payload = ref({
encounter_id: 0,
@@ -60,29 +69,55 @@ const isLoading = reactive<DataTableLoader>({
isTableLoading: false,
})
async function getPatientList() {
async function getDiagnoses() {
isLoading.isTableLoading = true
const resp = await xfetch('/api/v1/patient')
const resp = await xfetch('/api/v1/diagnose-src')
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
diagnoses.value = (resp.body as Record<string, any>).data
}
isLoading.isTableLoading = false
}
async function getProcedures() {
isLoading.isTableLoading = true
const resp = await xfetch('/api/v1/procedure-src')
if (resp.success) {
procedures.value = (resp.body as Record<string, any>).data
}
isLoading.isTableLoading = false
}
onMounted(() => {
getPatientList()
getProcedures()
getDiagnoses()
})
function handleOpen(type: string) {
console.log(type)
isOpen.value = true
function handleClick(type: string) {
if (type === 'prosedur') {
isOpenProcedure.value = true
} else if (type === 'diagnosa') {
isOpenDiagnose.value = true
} else if (type === 'fungsional') {
isOpenDiagnose.value = true
}
}
const entryRehabRef = ref()
async function actionHandler(type: string) {
console.log(type)
if (type === 'back') {
backToList()
return
}
const result = await entryRehabRef.value?.validate()
if (result?.valid) {
if (
selectedProcedure.value?.length > 0 ||
selectedDiagnose.value?.length > 0 ||
selectedFungsional.value?.length > 0
) {
result.data.procedure = selectedProcedure.value || []
result.data.diagnose = selectedDiagnose.value || []
result.data.fungsional = selectedFungsional.value || []
}
console.log('data', result.data)
handleActionSave(
{
@@ -99,7 +134,23 @@ async function actionHandler(type: string) {
}
}
const icdPreview = ref({
procedures: [],
diagnoses: [],
})
function actionDialogHandler(type: string) {
if (type === 'submit') {
icdPreview.value.procedures = selectedProcedure.value || []
icdPreview.value.diagnoses = selectedDiagnose.value || []
icdPreview.value.fungsional = selectedFungsional.value || []
}
isOpenProcedure.value = false
isOpenDiagnose.value = false
}
provide('table_data_loader', isLoading)
provide('icdPreview', icdPreview)
</script>
<template>
<Entry
@@ -107,17 +158,52 @@ provide('table_data_loader', isLoading)
v-model="model"
:schema="schema"
type="function"
@modal="handleOpen"
@click="handleClick"
/>
<div class="my-2 flex justify-end py-2">
<Action @click="actionHandler" />
</div>
<Dialog
v-model:open="isOpen"
v-model:open="isOpenProcedure"
title="Pilih Prosedur"
size="xl"
prevent-outside
>
<AppIcdMultiselectPicker :data="data" />
<AppIcdMultiselectPicker
v-model:model-value="selectedProcedure"
:data="procedures"
/>
<div class="my-2 flex justify-end py-2">
<ActionDialog @click="actionDialogHandler" />
</div>
</Dialog>
<Dialog
v-model:open="isOpenDiagnose"
title="Pilih Diagnosa"
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>
<Dialog
v-model:open="isOpenFungsional"
title="Pilih Fungsional"
size="xl"
prevent-outside
>
<AppIcdMultiselectPicker
v-model:model-value="selectedFungsional"
:data="diagnoses"
/>
<div class="my-2 flex justify-end py-2">
<ActionDialog @click="actionDialogHandler" />
</div>
</Dialog>
</template>
+57 -13
View File
@@ -2,14 +2,20 @@
import { z } from 'zod'
import Entry from '~/components/app/soapi/entry.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 { EarlyRehabSchema } 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 isOpen = ref(false)
const data = ref([])
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 = EarlyRehabSchema
const payload = ref({
encounter_id: 0,
@@ -65,29 +71,46 @@ const isLoading = reactive<DataTableLoader>({
isTableLoading: false,
})
async function getPatientList() {
async function getDiagnoses() {
isLoading.isTableLoading = true
const resp = await xfetch('/api/v1/patient')
const resp = await xfetch('/api/v1/diagnose-src')
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
diagnoses.value = (resp.body as Record<string, any>).data
}
isLoading.isTableLoading = false
}
async function getProcedures() {
isLoading.isTableLoading = true
const resp = await xfetch('/api/v1/procedure-src')
if (resp.success) {
procedures.value = (resp.body as Record<string, any>).data
}
isLoading.isTableLoading = false
}
onMounted(() => {
getPatientList()
getProcedures()
getDiagnoses()
})
function handleOpen(type: string) {
console.log(type)
isOpen.value = true
if (type === 'fungsional') {
isOpenDiagnose.value = true
}
}
const entryRehabRef = ref()
async function actionHandler(type: string) {
console.log(type)
if (type === 'back') {
backToList()
return
}
const result = await entryRehabRef.value?.validate()
if (result?.valid) {
if (selectedDiagnose.value?.length > 0) {
result.data.diagnose = selectedDiagnose.value || []
}
console.log('data', result.data)
handleActionSave(
{
@@ -104,7 +127,22 @@ async function actionHandler(type: string) {
}
}
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
@@ -112,17 +150,23 @@ provide('table_data_loader', isLoading)
v-model="model"
:schema="schema"
type="early-rehab"
@modal="handleOpen"
@click="handleOpen"
/>
<div class="my-2 flex justify-end py-2">
<Action @click="actionHandler" />
</div>
<Dialog
v-model:open="isOpen"
title="Pilih Prosedur"
v-model:open="isOpenDiagnose"
title="Pilih Fungsional"
size="xl"
prevent-outside
>
<AppIcdMultiselectPicker :data="data" />
<AppIcdMultiselectPicker
v-model:model-value="selectedDiagnose"
:data="diagnoses"
/>
<div class="my-2 flex justify-end py-2">
<ActionDialog @click="actionDialogHandler" />
</div>
</Dialog>
</template>
+68 -11
View File
@@ -2,6 +2,7 @@
import { z } from 'zod'
import Entry from '~/components/app/soapi/entry.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 { EarlySchema } from '~/schemas/soapi.schema'
import { toast } from '~/components/pub/ui/toast'
@@ -10,8 +11,12 @@ import { handleActionSave, handleActionEdit } from '~/handlers/soapi-early.handl
const { goToEntry, backToList } = useQueryCRUDMode('mode')
const { recordId } = useQueryCRUDMode('record-id')
const route = useRoute()
const isOpen = ref(false)
const data = ref([])
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 = EarlySchema
const payload = ref({
encounter_id: 0,
@@ -40,34 +45,50 @@ const isLoading = reactive<DataTableLoader>({
isTableLoading: false,
})
async function getPatientList() {
isLoading.isTableLoading = true
async function getDiagnoses() {
const resp = await xfetch(`/api/v1/soapi/${recordId}`)
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
diagnoses.value = (resp.body as Record<string, any>).data
}
isLoading.isTableLoading = false
}
async function getProcedures() {
isLoading.isTableLoading = true
const resp = await xfetch('/api/v1/procedure-src')
if (resp.success) {
procedures.value = (resp.body as Record<string, any>).data
}
isLoading.isTableLoading = false
}
onMounted(() => {
getPatientList()
getProcedures()
getDiagnoses()
})
function handleOpen(type: string) {
console.log(type)
isOpen.value = true
if (type === 'prosedur') {
isOpenProcedure.value = true
} else if (type === 'diagnosa') {
isOpenDiagnose.value = true
}
}
const entryRef = ref()
async function actionHandler(type: string) {
console.log(type)
// if(type === ''
if (type === 'back') {
backToList()
return
}
const result = await entryRef.value?.validate()
if (result?.valid) {
if (selectedProcedure.value?.length > 0 || selectedDiagnose.value?.length > 0) {
result.data.procedure = selectedProcedure.value || []
result.data.diagnose = selectedDiagnose.value || []
}
console.log('data', result.data)
handleActionSave(
{
@@ -84,7 +105,22 @@ async function actionHandler(type: string) {
}
}
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
@@ -98,11 +134,32 @@ provide('table_data_loader', isLoading)
<Action @click="actionHandler" />
</div>
<Dialog
v-model:open="isOpen"
v-model:open="isOpenProcedure"
title="Pilih Prosedur"
size="xl"
prevent-outside
>
<AppIcdMultiselectPicker :data="data" />
<AppIcdMultiselectPicker
v-model:model-value="selectedProcedure"
:data="procedures"
/>
<div class="my-2 flex justify-end py-2">
<ActionDialog @click="actionDialogHandler" />
</div>
</Dialog>
<Dialog
v-model:open="isOpenDiagnose"
title="Pilih Diagnosa"
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>
+141 -23
View File
@@ -1,18 +1,45 @@
<script setup lang="ts">
import type { DataTableLoader } from '~/components/pub/my-ui/data-table/type'
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import { ActionEvents, type HeaderPrep, type RefSearchNav } from '~/components/pub/my-ui/data/types'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import List from '~/components/app/soapi/list.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
const props = defineProps<{
label: string
}>()
// Helpers
import { usePaginatedList } from '~/composables/usePaginatedList'
import { toast } from '~/components/pub/ui/toast'
const { goToEntry } = useQueryCRUDMode('mode')
import { handleActionRemove } 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
label: string
}
const props = defineProps<Props>()
const emits = defineEmits(['add', 'edit'])
const { recordId } = useQueryCRUDRecordId()
const { goToEntry, backToList } = useQueryCRUDMode('mode')
const router = useRouter()
const route = useRoute()
const data = ref([])
const encounterId = ref<number>(props?.encounter?.id || 0)
const title = ref('')
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const isLoading = ref(false)
const isReadonly = ref(false)
const isRecordConfirmationOpen = ref(false)
const paginationMeta = ref<PaginationMeta>(null)
const refSearchNav: RefSearchNav = {
onClick: () => {
@@ -26,13 +53,7 @@ const refSearchNav: RefSearchNav = {
},
}
// Loading state management
const isLoading = reactive<DataTableLoader>({
isTableLoading: false,
})
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const typeCode = ref('')
const hreaderPrep: HeaderPrep = {
title: props.label,
@@ -43,8 +64,15 @@ const hreaderPrep: HeaderPrep = {
},
}
async function getPatientList() {
const resp = await xfetch(`/api/v1/soapi?encounter_id=${route.params.id}?include=encounter`)
const type = computed(() => (route.query.tab as string) || 'early-medical-assessment')
onMounted(async () => {
await getMyList()
})
async function getMyList() {
const url = `/api/v1/soapi?type-code=${typeCode.value}?includes=encounter`
const resp = await xfetch(url)
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
}
@@ -61,18 +89,79 @@ const goEdit = (id: string) => {
})
}
onMounted(() => {
getPatientList()
})
function handlePageChange(page: number) {
emits('pageChange', page)
}
watch(recId, () => {
console.log('recId', recId.value)
console.log('recIdaacin', recAction.value)
if (recAction.value === 'showEdit') {
goEdit(recId.value)
function handleBack() {
recordId.value = ''
backToList()
}
watch(
() => type.value,
(val) => {
if (val) {
if (val === 'early-medical-assessment') {
typeCode.value = 'early-medic'
} else if (val === 'rehab-medical-assessment') {
typeCode.value = 'early-rehab'
} else if (val === 'function-assessment') {
typeCode.value = 'function'
}
getMyList()
}
},
)
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showEdit:
emits('edit')
isReadonly.value = false
router.replace({
path: route.path,
query: {
...route.query,
mode: 'entry',
'record-id': recId.value,
},
})
break
case ActionEvents.showDetail:
emits('edit')
isReadonly.value = true
router.replace({
path: route.path,
query: {
...route.query,
mode: 'entry',
'record-id': recId.value,
},
})
break
case ActionEvents.showConfirmDelete:
isRecordConfirmationOpen.value = true
break
case ActionEvents.showAdd:
recordId.value = ''
goToEntry()
emits('add')
break
}
})
// watch(recId, () => {
// console.log('recId', recId.value)
// console.log('recIdaacin', recAction.value)
// if (recAction.value === 'showEdit') {
// goEdit(recId.value)
// }
// })
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
@@ -84,6 +173,35 @@ provide('table_data_loader', isLoading)
:prep="{ ...hreaderPrep }"
:ref-search-nav="refSearchNav"
/>
<List :data="data" />
<PaginationView
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
<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>