feat/things-munaja: fix enc status
This commit is contained in:
@@ -43,6 +43,10 @@ import EncounterHistoryButtonMenu from '~/components/app/encounter/quick-shortcu
|
||||
const props = defineProps<{
|
||||
classCode: EncounterProps['classCode']
|
||||
subClassCode?: EncounterProps['subClassCode']
|
||||
canCreate?: boolean
|
||||
canRead?: boolean
|
||||
canUpdate?: boolean
|
||||
canDelete?: boolean
|
||||
}>()
|
||||
|
||||
// Common preparations
|
||||
@@ -198,6 +202,10 @@ async function getData() {
|
||||
:data="menus"
|
||||
:initial-active-menu="activeMenu"
|
||||
@change-menu="activeMenu = $event"
|
||||
:can-create="canCreate"
|
||||
:can-read="canRead"
|
||||
:can-update="canUpdate"
|
||||
:can-delete="canDelete"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { getValueLabelList as getEmployeeValueLabelList } from '~/services/emplo
|
||||
import { getValueLabelList as getUnitValueLabelList } from '~/services/unit.service'
|
||||
import type { CheckInFormData, CheckOutFormData } from '~/schemas/encounter.schema'
|
||||
import { CheckInSchema, CheckOutSchema } from '~/schemas/encounter.schema'
|
||||
import { getEncounterData } from '~/handlers/encounter-process.handler'
|
||||
|
||||
//
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
@@ -18,10 +19,12 @@ import { checkIn } from '~/services/encounter.service'
|
||||
//
|
||||
const props = defineProps<{
|
||||
encounter: Encounter
|
||||
canUpdate?: boolean
|
||||
}>()
|
||||
|
||||
// doctors
|
||||
const doctors = await getDoctorValueLabelList({'includes': 'employee,employee-person'})
|
||||
const localEncounter = ref<Encounter>(props.encounter)
|
||||
const doctors = await getDoctorValueLabelList({'includes': 'employee,employee-person'}, true)
|
||||
const employees = await getEmployeeValueLabelList({'includes': 'person', 'position-code': 'reg'})
|
||||
const units = await getUnitValueLabelList()
|
||||
|
||||
@@ -32,7 +35,7 @@ const checkInValues = ref<any>({
|
||||
// registeredAt: '',
|
||||
})
|
||||
const checkInIsLoading = ref(false)
|
||||
const checkInIsReadonly = ref(false)
|
||||
const checkInIsReadonly = ref(props.canUpdate )
|
||||
const checkInDialogOpen = ref(false)
|
||||
|
||||
// check out
|
||||
@@ -49,8 +52,15 @@ function editCheckIn() {
|
||||
checkInDialogOpen.value = true
|
||||
}
|
||||
|
||||
function submitCheckIn(values: CheckInFormData) {
|
||||
checkIn(props.encounter.id, values)
|
||||
async function submitCheckIn(values: CheckInFormData) {
|
||||
const res = await checkIn(props.encounter.id, values)
|
||||
if (res.success) {
|
||||
checkInDialogOpen.value = false
|
||||
const resEnc = await getEncounterData(props.encounter.id)
|
||||
if (resEnc.success) {
|
||||
localEncounter.value = resEnc.body.data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function editCheckOut() {
|
||||
@@ -67,9 +77,8 @@ function submitCheckOut(values: CheckOutFormData) {
|
||||
<div class="border-r lg:pe-4 xl:pe-5 mb-10">
|
||||
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Masuk</div>
|
||||
<CheckInView
|
||||
:encounter="encounter"
|
||||
:is-loading="checkInIsLoading"
|
||||
:is-readonly="checkInIsReadonly"
|
||||
:encounter="localEncounter"
|
||||
:can-update="canUpdate"
|
||||
@edit="editCheckIn"
|
||||
/>
|
||||
</div>
|
||||
@@ -77,9 +86,8 @@ function submitCheckOut(values: CheckOutFormData) {
|
||||
<Separator class="lg:hidden my-4 xl:my-5" />
|
||||
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Keluar</div>
|
||||
<CheckOutView
|
||||
:encounter="encounter"
|
||||
:is-loading="checkOutIsLoading"
|
||||
:is-readonly="checkOutIsReadonly"
|
||||
:encounter="localEncounter"
|
||||
:can-update="canUpdate"
|
||||
@edit="editCheckOut"
|
||||
/>
|
||||
</div>
|
||||
@@ -122,4 +130,4 @@ function submitCheckOut(values: CheckOutFormData) {
|
||||
@cancel="checkInDialogOpen = false"
|
||||
/>
|
||||
</Dialog>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user