feat/things-munaja: fix enc status

This commit is contained in:
2025-12-05 09:26:00 +07:00
parent 786107ddd9
commit dbe8e34d07
15 changed files with 252 additions and 82 deletions
+19 -12
View File
@@ -10,12 +10,13 @@ import ComboBox from '~/components/pub/my-ui/combobox/combobox.vue'
import * as DE from '~/components/pub/my-ui/doc-entry' import * as DE from '~/components/pub/my-ui/doc-entry'
import type { CheckInFormData } from '~/schemas/encounter.schema' import type { CheckInFormData } from '~/schemas/encounter.schema'
import type { Encounter } from '~/models/encounter' import type { Encounter } from '~/models/encounter'
import { now } from '@internationalized/date';
interface Props { interface Props {
schema: z.ZodSchema<any> schema: z.ZodSchema<any>
values: any values: any
doctors: { value: string; label: string }[] doctors: { value: string; label: string }[]
employees: { value: string; label: string }[] // employees: { value: string; label: string }[]
encounter: Encounter encounter: Encounter
isLoading?: boolean isLoading?: boolean
isReadonly?: boolean isReadonly?: boolean
@@ -36,18 +37,23 @@ const { defineField, errors, meta } = useForm({
} as Partial<CheckInFormData>, } as Partial<CheckInFormData>,
}) })
const [responsible_doctor_id, responsible_doctor_idAttrs] = defineField('responsible_doctor_id') const [responsible_doctor_code, responsible_doctor_codeAttrs] = defineField('responsible_doctor_code')
const [adm_employee_id, adm_employee_idAttrs] = defineField('discharge_method_code') // const [adm_employee_id, adm_employee_idAttrs] = defineField('discharge_method_code')
const [registeredAt, registeredAtAttrs] = defineField('registeredAt') const [registeredAt, registeredAtAttrs] = defineField('registeredAt')
function submitForm() { function submitForm() {
const formData: CheckInFormData = { const formData: CheckInFormData = {
responsible_doctor_id: responsible_doctor_id.value, responsible_doctor_code: responsible_doctor_code.value,
adm_employee_id: adm_employee_id.value, // adm_employee_id: adm_employee_id.value,
// registeredAt: registeredAt.value || '', registeredAt: registeredAt.value || '',
} }
emit('submit', formData) emit('submit', formData)
} }
function setTime() {
const today = new Date()
registeredAt.value = today.toISOString().substring(0, 10) + ' ' + today.toLocaleTimeString('id-ID').substring(0, 5).replace('.', ':');
}
</script> </script>
<template> <template>
@@ -57,8 +63,8 @@ function submitForm() {
<DE.Field> <DE.Field>
<ComboBox <ComboBox
id="doctor" id="doctor"
v-model="responsible_doctor_id" v-model="responsible_doctor_code"
v-bind="responsible_doctor_idAttrs" v-bind="responsible_doctor_codeAttrs"
:items="doctors" :items="doctors"
:disabled="isLoading || isReadonly" :disabled="isLoading || isReadonly"
placeholder="Pilih Dokter DPJP" placeholder="Pilih Dokter DPJP"
@@ -67,7 +73,7 @@ function submitForm() {
/> />
</DE.Field> </DE.Field>
</DE.Cell> </DE.Cell>
<DE.Cell> <!-- <DE.Cell>
<DE.Label>PJ Berkas</DE.Label> <DE.Label>PJ Berkas</DE.Label>
<DE.Field> <DE.Field>
<ComboBox <ComboBox
@@ -81,7 +87,7 @@ function submitForm() {
empty-message="Petugas tidak ditemukan" empty-message="Petugas tidak ditemukan"
/> />
</DE.Field> </DE.Field>
</DE.Cell> </DE.Cell> -->
<DE.Cell> <DE.Cell>
<DE.Label>Waktu Masuk</DE.Label> <DE.Label>Waktu Masuk</DE.Label>
<DE.Field> <DE.Field>
@@ -89,7 +95,8 @@ function submitForm() {
id="name" id="name"
v-model="registeredAt" v-model="registeredAt"
v-bind="registeredAtAttrs" v-bind="registeredAtAttrs"
:disabled="isLoading || isReadonly" @click="setTime"
readonly
/> />
</DE.Field> </DE.Field>
</DE.Cell> </DE.Cell>
@@ -104,4 +111,4 @@ function submitForm() {
<style> <style>
</style> </style>
+25 -20
View File
@@ -7,43 +7,48 @@ import type { Encounter } from '~/models/encounter'
interface Props { interface Props {
encounter: Encounter encounter: Encounter
canUpdate?: boolean
isLoading?: boolean
} }
const props = defineProps<Props>() const props = defineProps<Props>()
const doctor = ref('-belum dipilih-') const doctor = computed(() => {
return props.encounter.responsible_doctor?.employee?.person?.name ?? '-belum dipilih-'
})
const adm = ref('-belum dipilih-') const adm = ref('-belum dipilih-')
const emit = defineEmits<{ const emit = defineEmits<{
edit: [] edit: []
}>() }>()
watch(props.encounter, () => {
doctor.value = props.encounter.responsible_doctor?.employee?.person?.name ?? props.encounter.appointment_doctor?.employee?.person?.name ?? '-belum dipilih-'
adm.value = props.encounter.adm_employee?.person?.name ?? '-belum dipilih-'
})
</script> </script>
<template> <template>
<DE.Block :cell-flex="false"> <DE.Block :cell-flex="false">
<DE.Cell>
<DE.Label class="font-semibold">Waktu Masuk</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter?.registeredAt?.substring(0, 15).replace('T', ' ') || '-' }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">PJ Berkas</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter.adm_employee?.person?.name || '-' }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">Perawat</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter.responsible_nurse?.employee?.person?.name || '-' }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell> <DE.Cell>
<DE.Label class="font-semibold">Dokter</DE.Label> <DE.Label class="font-semibold">Dokter</DE.Label>
<DE.Field> <DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ doctor }}</div> <div class="py-2 border-b border-b-slate-300">{{ doctor }}</div>
</DE.Field> </DE.Field>
</DE.Cell> </DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">PJ Berkas</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ adm }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">Waktu Masuk</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter?.registeredAt || '-' }}</div>
</DE.Field>
</DE.Cell>
</DE.Block> </DE.Block>
<div class="text-center"> <div v-if="canUpdate" class="text-center">
<Button @click="() => emit('edit')"> <Button @click="() => emit('edit')">
<LucidePen /> <LucidePen />
Edit Edit
@@ -53,4 +58,4 @@ watch(props.encounter, () => {
<style> <style>
</style> </style>
@@ -12,8 +12,7 @@ import type { Encounter } from '~/models/encounter';
interface Props { interface Props {
encounter: Encounter encounter: Encounter
isLoading?: boolean canUpdate?: boolean
isReadonly?: boolean
} }
const props = defineProps<Props>() const props = defineProps<Props>()
@@ -73,7 +72,7 @@ const emit = defineEmits<{
</DE.Field> </DE.Field>
</DE.Cell> </DE.Cell>
</DE.Block> </DE.Block>
<div class="text-center [&>*]:mx-1"> <div v-if="canUpdate" class="text-center [&>*]:mx-1">
<Button @click="() => emit('edit')"> <Button @click="() => emit('edit')">
<LucidePen /> <LucidePen />
Edit Edit
@@ -87,4 +86,4 @@ const emit = defineEmits<{
<style> <style>
</style> </style>
@@ -31,12 +31,6 @@ function navClick(type: 'cancel' | 'edit' | 'submit', data: Prescription): void
<template> <template>
<div v-if="data.length == 0" class="p-10 text-center"> <div v-if="data.length == 0" class="p-10 text-center">
<div class="mb-4 xl:mb-5">Belum Ada Data</div> <div class="mb-4 xl:mb-5">Belum Ada Data</div>
<div>
<Button>
<Icon name="i-lucide-plus" class="me-2 align-middle" />
Tambah Order
</Button>
</div>
</div> </div>
<Table.Table> <Table.Table>
<Table.TableHeader> <Table.TableHeader>
@@ -32,12 +32,6 @@ function navClick(type: 'cancel' | 'edit' | 'submit', data: Prescription): void
<template> <template>
<div v-if="data.length == 0" class="p-10 text-center"> <div v-if="data.length == 0" class="p-10 text-center">
<div class="mb-4 xl:mb-5">Belum Ada Data</div> <div class="mb-4 xl:mb-5">Belum Ada Data</div>
<div>
<Button>
<Icon name="i-lucide-plus" class="me-2 align-middle" />
Tambah Order
</Button>
</div>
</div> </div>
<template v-for="item, idx in data"> <template v-for="item, idx in data">
<div :class="'text-sm 2xl:text-base font-semibold ' + (item.status_code == 'new' ? 'mb-2' : 'mb-2')"> <div :class="'text-sm 2xl:text-base font-semibold ' + (item.status_code == 'new' ? 'mb-2' : 'mb-2')">
@@ -43,6 +43,10 @@ import EncounterHistoryButtonMenu from '~/components/app/encounter/quick-shortcu
const props = defineProps<{ const props = defineProps<{
classCode: EncounterProps['classCode'] classCode: EncounterProps['classCode']
subClassCode?: EncounterProps['subClassCode'] subClassCode?: EncounterProps['subClassCode']
canCreate?: boolean
canRead?: boolean
canUpdate?: boolean
canDelete?: boolean
}>() }>()
// Common preparations // Common preparations
@@ -198,6 +202,10 @@ async function getData() {
:data="menus" :data="menus"
:initial-active-menu="activeMenu" :initial-active-menu="activeMenu"
@change-menu="activeMenu = $event" @change-menu="activeMenu = $event"
:can-create="canCreate"
:can-read="canRead"
:can-update="canUpdate"
:can-delete="canDelete"
/> />
</div> </div>
</template> </template>
+19 -11
View File
@@ -5,6 +5,7 @@ import { getValueLabelList as getEmployeeValueLabelList } from '~/services/emplo
import { getValueLabelList as getUnitValueLabelList } from '~/services/unit.service' import { getValueLabelList as getUnitValueLabelList } from '~/services/unit.service'
import type { CheckInFormData, CheckOutFormData } from '~/schemas/encounter.schema' import type { CheckInFormData, CheckOutFormData } from '~/schemas/encounter.schema'
import { CheckInSchema, CheckOutSchema } 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' import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
@@ -18,10 +19,12 @@ import { checkIn } from '~/services/encounter.service'
// //
const props = defineProps<{ const props = defineProps<{
encounter: Encounter encounter: Encounter
canUpdate?: boolean
}>() }>()
// doctors // 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 employees = await getEmployeeValueLabelList({'includes': 'person', 'position-code': 'reg'})
const units = await getUnitValueLabelList() const units = await getUnitValueLabelList()
@@ -32,7 +35,7 @@ const checkInValues = ref<any>({
// registeredAt: '', // registeredAt: '',
}) })
const checkInIsLoading = ref(false) const checkInIsLoading = ref(false)
const checkInIsReadonly = ref(false) const checkInIsReadonly = ref(props.canUpdate )
const checkInDialogOpen = ref(false) const checkInDialogOpen = ref(false)
// check out // check out
@@ -49,8 +52,15 @@ function editCheckIn() {
checkInDialogOpen.value = true checkInDialogOpen.value = true
} }
function submitCheckIn(values: CheckInFormData) { async function submitCheckIn(values: CheckInFormData) {
checkIn(props.encounter.id, values) 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() { function editCheckOut() {
@@ -67,9 +77,8 @@ function submitCheckOut(values: CheckOutFormData) {
<div class="border-r lg:pe-4 xl:pe-5 mb-10"> <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> <div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Masuk</div>
<CheckInView <CheckInView
:encounter="encounter" :encounter="localEncounter"
:is-loading="checkInIsLoading" :can-update="canUpdate"
:is-readonly="checkInIsReadonly"
@edit="editCheckIn" @edit="editCheckIn"
/> />
</div> </div>
@@ -77,9 +86,8 @@ function submitCheckOut(values: CheckOutFormData) {
<Separator class="lg:hidden my-4 xl:my-5" /> <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> <div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Keluar</div>
<CheckOutView <CheckOutView
:encounter="encounter" :encounter="localEncounter"
:is-loading="checkOutIsLoading" :can-update="canUpdate"
:is-readonly="checkOutIsReadonly"
@edit="editCheckOut" @edit="editCheckOut"
/> />
</div> </div>
@@ -122,4 +130,4 @@ function submitCheckOut(values: CheckOutFormData) {
@cancel="checkInDialogOpen = false" @cancel="checkInDialogOpen = false"
/> />
</Dialog> </Dialog>
</template> </template>
+10 -1
View File
@@ -4,6 +4,10 @@ import { type EncounterItem } from "~/handlers/encounter-init.handler";
const props = defineProps<{ const props = defineProps<{
initialActiveMenu: string initialActiveMenu: string
data: EncounterItem[] data: EncounterItem[]
canCreate?: boolean
canRead?: boolean
canUpdate?: boolean
canDelete?: boolean
}>() }>()
const activeMenu = ref(props.initialActiveMenu) const activeMenu = ref(props.initialActiveMenu)
@@ -38,7 +42,12 @@ function changeMenu(value: string) {
class="flex-1 rounded-md border bg-white p-4 shadow-sm dark:bg-neutral-950"> class="flex-1 rounded-md border bg-white p-4 shadow-sm dark:bg-neutral-950">
<component <component
:is="data.find((m) => m.id === activeMenu)?.component" :is="data.find((m) => m.id === activeMenu)?.component"
v-bind="data.find((m) => m.id === activeMenu)?.props" /> v-bind="data.find((m) => m.id === activeMenu)?.props"
:can-create="canCreate"
:can-read="canRead"
:can-update="canUpdate"
:can-delete="canDelete"
/>
</div> </div>
</div> </div>
</div> </div>
+127 -7
View File
@@ -39,14 +39,134 @@ export const permissions: Record<string, Record<string, Permission[]>> = {
'emp|reg': ['C', 'R', 'U', 'D'], 'emp|reg': ['C', 'R', 'U', 'D'],
}, },
'/ambulatory/encounter/[id]/process': { '/ambulatory/encounter/[id]/process': {
'emp|doc': ['R', 'U'], 'emp|doc': ['R'],
'emp|nur': ['R', 'U'], 'emp|nur': ['R', 'U'],
'emp|thr': ['R', 'U'], 'emp|thr': ['R'],
'emp|miw': ['R', 'U'], 'emp|miw': ['R'],
'emp|nut': ['R', 'U'], 'emp|nut': ['R'],
'emp|pha': ['R', 'U'], 'emp|pha': ['R'],
'emp|lab': ['R', 'U'], 'emp|lab': ['R'],
'emp|rad': ['R', 'U'], 'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=status': {
'emp|doc': ['R'],
'emp|nur': ['R', 'U'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=early-medical-assessment': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=fkr': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=education-assessment': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=general-consent': {
'emp|doc': ['R'],
'emp|nur': ['R', 'U'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=patient-amb-note': {
'emp|doc': ['R'],
'emp|nur': ['R', 'U'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=prescription': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=device-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=radiology-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=cp-lab-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=micro-lab-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=pa-lab-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
}, },
'/ambulatory/consulation': { '/ambulatory/consulation': {
'emp|doc': ['R'], 'emp|doc': ['R'],
+5 -2
View File
@@ -502,9 +502,12 @@ export function mapResponseToEncounter(result: any): any {
? result.visitDate ? result.visitDate
: result.registeredAt || result.patient?.registeredAt || null, : result.registeredAt || result.patient?.registeredAt || null,
adm_employee_id: result.adm_employee_id || 0, adm_employee_id: result.adm_employee_id || 0,
appointment_doctor_id: result.appointment_doctor_id || null, adm_employee: result.adm_employee || null,
responsible_doctor_id: result.responsible_doctor_id || null, responsible_nurse_code: result.responsible_nurse_code || null,
responsible_nurse: result.responsible_nurse || null,
appointment_doctor_code: result.appointment_doctor_code || null,
appointment_doctor: result.appointment_doctor || null, appointment_doctor: result.appointment_doctor || null,
responsible_doctor_code: result.responsible_doctor_id || null,
responsible_doctor: result.responsible_doctor || null, responsible_doctor: result.responsible_doctor || null,
refSource_name: result.refSource_name || null, refSource_name: result.refSource_name || null,
appointment_id: result.appointment_id || null, appointment_id: result.appointment_id || null,
+6 -2
View File
@@ -9,7 +9,11 @@ export async function getEncounterData(id: string | number) {
try { try {
const dataRes = await getDetail(id, { const dataRes = await getDetail(id, {
includes: includes:
'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', 'patient,patient-person,patient-person-addresses,unit,' +
'Adm_Employee,Adm_Employee,Adm_Employee-Person,' +
'Responsible_Nurse,Responsible_Nurse-Employee,Responsible_Nurse-Employee-Person,' +
'Appointment_Doctor,Appointment_Doctor-employee,Appointment_Doctor-employee-person,' +
'Responsible_Doctor,Responsible_Doctor-employee,Responsible_Doctor-employee-person',
}) })
const dataResBody = dataRes.body ?? null const dataResBody = dataRes.body ?? null
const result = dataResBody?.data ?? null const result = dataResBody?.data ?? null
@@ -29,4 +33,4 @@ export async function getEncounterData(id: string | number) {
data = null data = null
} }
return data return data
} }
+1 -1
View File
@@ -52,7 +52,7 @@ export function genEncounter(): Encounter {
patient: genPatient(), patient: genPatient(),
registeredAt: '', registeredAt: '',
class_code: '', class_code: '',
unit_code: 0, unit_code: '',
unit: genUnit(), unit: genUnit(),
visitDate: '', visitDate: '',
adm_employee_id: 0, adm_employee_id: 0,
+2
View File
@@ -1,7 +1,9 @@
import { type Base, genBase } from "./_base" import { type Base, genBase } from "./_base"
import type { Employee } from "./employee"
export interface Nurse extends Base { export interface Nurse extends Base {
employee_id: number employee_id: number
employee?: Employee
ihs_number?: string ihs_number?: string
unit_id: number unit_id: number
infra_id: number infra_id: number
@@ -12,7 +12,7 @@ import Error from '~/components/pub/my-ui/error/error.vue'
// Apps // Apps
import Content from '~/components/content/encounter/process.vue' import Content from '~/components/content/encounter/process.vue'
const { getRouteTitle, getPageAccess } = usePageChecker() const { getRouteTitle, getPageAccess, hasCreateAccess, hasReadAccess, hasUpdateAccess, hasDeleteAccess } = usePageChecker()
definePageMeta({ definePageMeta({
middleware: ['rbac'], middleware: ['rbac'],
@@ -28,16 +28,32 @@ useHead({
}) })
// Preps role checking // Preps role checking
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/[id]/process'] || {} const route = useRoute()
const hasAccess = getPageAccess(roleAccess, 'read') const menu = computed(() => route.query.menu as string | undefined)
const accessKey = computed(() => `/ambulatory/encounter/[id]/process` + (menu.value ? `?menu=${menu.value}` : ''))
const roleAccess: Record<string, Permission[]> = permissions[accessKey.value] || {}
const hasAccess = getPageAccess(roleAccess, 'read') || true
const canCreate = hasCreateAccess(roleAccess)
const canRead = hasReadAccess(roleAccess)
const canUpdate = hasUpdateAccess(roleAccess)
const canDelete = hasDeleteAccess(roleAccess)
</script> </script>
<template> <template>
<!--
{{ accessKey }}
{{ roleAccess }}
{{ hasAccess }}
{{ canUpdate }}
-->
<div v-if="hasAccess"> <div v-if="hasAccess">
<Content class-code="ambulatory" /> <Content
class-code="ambulatory"
:can-create="canCreate"
:can-read="canRead"
:can-update="canUpdate"
:can-delete="canDelete"
/>
</div> </div>
<Error <Error v-else :status-code="403" />
v-else
:status-code="403"
/>
</template> </template>
+3 -2
View File
@@ -4,8 +4,9 @@ import { InternalReferenceSchema } from './internal-reference.schema'
// Check In // Check In
const CheckInSchema = z.object({ const CheckInSchema = z.object({
// registeredAt: z.string({ required_error: 'Tanggal masuk harus diisi' }), // registeredAt: z.string({ required_error: 'Tanggal masuk harus diisi' }),
responsible_doctor_id: z.number({ required_error: 'Dokter harus diisi' }).gt(0, 'Dokter harus diisi'), responsible_doctor_code: z.string({ required_error: 'Dokter harus diisi' }),
adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'), // adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
registeredAt: z.string({ required_error: 'waktu harus diisi' }),
}) })
type CheckInFormData = z.infer<typeof CheckInSchema> type CheckInFormData = z.infer<typeof CheckInSchema>