feat/role-check: wip
This commit is contained in:
@@ -28,6 +28,7 @@ import ConfirmationInfo from '~/components/app/device-order/confirmation-info.vu
|
||||
// Props
|
||||
const props = defineProps<{
|
||||
encounter_id: number
|
||||
canUpdate?: boolean
|
||||
}>()
|
||||
|
||||
const encounter_id = props.encounter_id
|
||||
@@ -153,7 +154,7 @@ function pickItem(): DeviceOrder | null {
|
||||
:pagination-meta="paginationMeta"
|
||||
@page-change="handlePageChange"
|
||||
/>
|
||||
<!--
|
||||
<!--
|
||||
@cancel="cancel"
|
||||
@edit="edit"
|
||||
@submit="submit"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -7,9 +7,17 @@ import SoapiList from './list.vue'
|
||||
import EarlyForm from './form.vue'
|
||||
import RehabForm from './form-rehab.vue'
|
||||
import FunctionForm from './form-function.vue'
|
||||
import type { Encounter } from '~/models/encounter'
|
||||
|
||||
interface Props {
|
||||
encounter: Encounter
|
||||
label: string
|
||||
canUpdate?: boolean
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const route = useRoute()
|
||||
const type = computed(() => (route.query.tab as string) || 'early-medical-assessment')
|
||||
const type = computed(() => (route.query.menu as string) || 'early-medical-assessment')
|
||||
|
||||
const { mode, goToEntry, backToList } = useQueryCRUDMode('mode')
|
||||
|
||||
@@ -23,8 +31,9 @@ const ActiveForm = computed(() => formMap[type.value] || EarlyForm)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- {{ type }} -->
|
||||
<div>
|
||||
<SoapiList v-if="mode === 'list'" />
|
||||
<SoapiList v-if="mode === 'list'" :label="label" :canUpdate="canUpdate" />
|
||||
<component
|
||||
v-else
|
||||
:is="ActiveForm"
|
||||
|
||||
@@ -21,6 +21,7 @@ import type { Encounter } from '~/models/encounter'
|
||||
interface Props {
|
||||
encounter: Encounter
|
||||
label: string
|
||||
canUpdate?: boolean
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const emits = defineEmits(['add', 'edit'])
|
||||
@@ -58,10 +59,12 @@ const typeCode = ref('')
|
||||
const hreaderPrep: HeaderPrep = {
|
||||
title: props.label,
|
||||
icon: 'i-lucide-users',
|
||||
addNav: {
|
||||
}
|
||||
if(props.canUpdate) {
|
||||
hreaderPrep['addNav'] = {
|
||||
label: 'Tambah',
|
||||
onClick: () => goToEntry(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const type = computed(() => (route.query.tab as string) || 'early-medical-assessment')
|
||||
@@ -169,6 +172,8 @@ provide('table_data_loader', isLoading)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- {{ canUpdate }}
|
||||
{{ hreaderPrep }} -->
|
||||
<Header
|
||||
:prep="{ ...hreaderPrep }"
|
||||
:ref-search-nav="refSearchNav"
|
||||
|
||||
Reference in New Issue
Block a user