feat/role-check: wip

This commit is contained in:
2025-12-10 04:53:27 +07:00
parent ff19c022bb
commit 56e71ea693
13 changed files with 299 additions and 124 deletions
+19 -2
View File
@@ -15,6 +15,8 @@ import CheckOutView from '~/components/app/encounter/check-out-view.vue'
import CheckOutEntry from '~/components/app/encounter/check-out-entry.vue'
import type { Encounter } from '~/models/encounter'
import { checkIn } from '~/services/encounter.service'
import { getServicePosition } from '~/lib/roles'
import type { Item } from '~/components/pub/my-ui/combobox'
//
const props = defineProps<{
@@ -22,11 +24,24 @@ const props = defineProps<{
canUpdate?: boolean
}>()
//
const { user } = useUserStore()
const servicePosition = user.user_contractPosition_code == 'emp' ? getServicePosition('emp|'+user.employee_position_code) : null
// const subClassCode = servicePosition == 'chemo' ? 'chemo' : null
// doctors
const localEncounter = ref<Encounter>(props.encounter)
const doctors = await getDoctorValueLabelList({'includes': 'employee,employee-person'}, true)
const doctors = ref<Item[]>([])
const employees = await getEmployeeValueLabelList({'includes': 'person', 'position-code': 'reg'})
const units = await getUnitValueLabelList()
const canUpdate = ref(true)
if (props.encounter.status_code == 'done') {
canUpdate.value = false
}
if (canUpdate.value) {
doctors.value = await getDoctorValueLabelList({'includes': 'employee,employee-person', 'unit-code': user.unit_code}, true)
}
// check in
const checkInValues = ref<any>({
@@ -94,6 +109,7 @@ function submitCheckOut(values: CheckOutFormData) {
</div>
<Dialog
v-if="canUpdate"
v-model:open="checkInDialogOpen"
title="Ubah Informasi Masuk"
size="md"
@@ -103,7 +119,7 @@ function submitCheckOut(values: CheckOutFormData) {
:schema="CheckInSchema"
:values="checkInValues"
:encounter="encounter"
:doctors="doctors"
:doctors="doctors || []"
:employees="employees"
:is-loading="checkInIsLoading"
:is-readonly="checkInIsReadonly"
@@ -113,6 +129,7 @@ function submitCheckOut(values: CheckOutFormData) {
</Dialog>
<Dialog
v-if="canUpdate"
v-model:open="checkOutDialogOpen"
title="Ubah Informasi Keluar"
size="lg"