fix: update page ambulatory, inpatient + emergency
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import type { Permission } from "~/models/role"
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const { checkRole, hasCreateAccess, hasReadAccess, hasUpdateAccess, hasDeleteAccess } = useRBAC()
|
||||
|
||||
export function getRouteTitle() {
|
||||
return route.meta.title as string
|
||||
}
|
||||
|
||||
export function getParamsId() {
|
||||
const id = route.params.id
|
||||
return typeof id === 'string' ? parseInt(id) : 0
|
||||
}
|
||||
|
||||
export function checkPageAccess(roleAccess: Record<string, Permission[]>, type: 'create' | 'read' | 'update' | 'delete') {
|
||||
// Check if user has access to this page, need to use try - catch for proper handling
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canCreate = hasCreateAccess(roleAccess)
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
const canUpdate = hasUpdateAccess(roleAccess)
|
||||
const canDelete = hasDeleteAccess(roleAccess)
|
||||
|
||||
switch (type) {
|
||||
case 'create':
|
||||
return canCreate
|
||||
case 'read':
|
||||
return canRead
|
||||
case 'update':
|
||||
return canUpdate
|
||||
case 'delete':
|
||||
return canDelete
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
+14
-17
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/detail.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,28 +19,17 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/outpatient/encounter'] || {}
|
||||
const { checkRole, hasReadAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => `${route.meta.title}`,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/[id]'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'read')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canRead">
|
||||
<div v-if="hasAccess">
|
||||
<Content />
|
||||
</div>
|
||||
<Error v-else :status-code="403" />
|
||||
@@ -1,15 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Models & Consts
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
|
||||
// Helpers
|
||||
import { getParamsId, getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/entry.vue'
|
||||
|
||||
// Page meta
|
||||
definePageMeta({
|
||||
middleware: ['rbac'],
|
||||
roles: ['emp|reg'],
|
||||
@@ -17,43 +19,26 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
useHead({
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/[id]/edit'] || {}
|
||||
const { checkRole, hasUpdateAccess } = useRBAC()
|
||||
const hasAccess = checkPageAccess(roleAccess, 'update')
|
||||
|
||||
// Check if user has access to this page, need to use try - catch for proper handling
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => route.meta.title as string,
|
||||
})
|
||||
|
||||
// Get encounter ID from route params
|
||||
const encounter_id = computed(() => {
|
||||
const id = route.params.id
|
||||
return typeof id === 'string' ? parseInt(id) : 0
|
||||
})
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canUpdate = hasUpdateAccess(roleAccess)
|
||||
|
||||
// User info
|
||||
const { user } = useUserStore()
|
||||
const encounterId = getParamsId()
|
||||
const subClassCode = user.unit_code == 'rehab' ? 'rehab' : 'reg'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canUpdate">
|
||||
<div v-if="hasAccess">
|
||||
<Content
|
||||
:id="encounter_id"
|
||||
:id="encounterId"
|
||||
class-code="ambulatory"
|
||||
:sub-class-code="subClassCode"
|
||||
form-type="Edit"
|
||||
form-type="edit"
|
||||
/>
|
||||
</div>
|
||||
<Error
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Models & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
import { medicalRoles } from '~/const/common/role'
|
||||
|
||||
// Page meta
|
||||
definePageMeta({
|
||||
middleware: ['rbac'],
|
||||
roles: medicalRoles,
|
||||
title: 'Detail Kunjungan',
|
||||
contentFrame: 'cf-container-md',
|
||||
})
|
||||
|
||||
// Define common things
|
||||
const route = useRoute()
|
||||
|
||||
// Prep role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/[id]'] || {}
|
||||
const { checkRole, hasReadAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
|
||||
// Page needs
|
||||
useHead({
|
||||
title: () => route.meta.title as string,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="canRead">
|
||||
<ContentOutpatientEncounterDetail :patient-id="Number(route.params.id)" />
|
||||
</div>
|
||||
<Error v-else :status-code="403" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,10 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from '~/lib/page-checker'
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// AppS
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/process.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -13,33 +18,24 @@ definePageMeta({
|
||||
title: 'Proses Kunjungan',
|
||||
contentFrame: 'cf-full-width',
|
||||
contentPadding: 'p-0',
|
||||
contentUseCard: false
|
||||
contentUseCard: false,
|
||||
})
|
||||
|
||||
useHead({
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/[id]/process'] || {}
|
||||
const { checkRole, hasReadAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => `${route.meta.title}`,
|
||||
})
|
||||
|
||||
const hasAccess = checkPageAccess(roleAccess, 'read')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canRead">
|
||||
<div v-if="hasAccess">
|
||||
<Content class-code="ambulatory" />
|
||||
</div>
|
||||
<Error v-else :status-code="403" />
|
||||
<Error
|
||||
v-else
|
||||
:status-code="403"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/entry.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,28 +19,17 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/add'] || {}
|
||||
const { checkRole, hasReadAccess, hasCreateAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => route.meta.title as string,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canCreate = hasCreateAccess(roleAccess)
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/add'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'create')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canCreate">
|
||||
<div v-if="hasAccess">
|
||||
<Content
|
||||
:id="0"
|
||||
class-code="ambulatory"
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/emergency'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/detail.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,28 +19,17 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/emergency/encounter'] || {}
|
||||
const { checkRole, hasReadAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => `${route.meta.title}`,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/emergency/encounter/[id]'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'read')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canRead">
|
||||
<div v-if="hasAccess">
|
||||
<Content />
|
||||
</div>
|
||||
<Error v-else :status-code="403" />
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/emergency'
|
||||
|
||||
// Helpers
|
||||
import { getParamsId, getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/entry.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,34 +19,19 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/emergency/encounter'] || {}
|
||||
const { checkRole, hasUpdateAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => route.meta.title as string,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Get encounter ID from route params
|
||||
const encounterId = computed(() => {
|
||||
const id = route.params.id
|
||||
return typeof id === 'string' ? parseInt(id) : 0
|
||||
})
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/emergency/encounter/[id]/edit'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'update')
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canUpdate = hasUpdateAccess(roleAccess)
|
||||
const encounterId = getParamsId()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canUpdate">
|
||||
<div v-if="hasAccess">
|
||||
<Content
|
||||
:id="encounterId"
|
||||
class-code="emergency"
|
||||
|
||||
@@ -1,39 +1,41 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/emergency'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from '~/lib/page-checker'
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/process.vue'
|
||||
|
||||
definePageMeta({
|
||||
middleware: ['rbac'],
|
||||
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
||||
title: 'Kunjungan',
|
||||
roles: ['emp|doc', 'emp|nur', 'emp|miw', 'emp|nut', 'emp|lab', 'emp|pha', 'emp|thr'],
|
||||
title: 'Proses Kunjungan',
|
||||
contentFrame: 'cf-full-width',
|
||||
contentPadding: 'p-0',
|
||||
contentUseCard: false,
|
||||
})
|
||||
|
||||
useHead({
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/emergency/encounter'] || {}
|
||||
const { checkRole, hasReadAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => `${route.meta.title}`,
|
||||
})
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/emergency/encounter/[id]/process'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'read')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canRead">
|
||||
<Content class-code="emergency" sub-class-code="emg" />
|
||||
<div v-if="hasAccess">
|
||||
<Content class-code="emergency" />
|
||||
</div>
|
||||
<Error v-else :status-code="403" />
|
||||
<Error
|
||||
v-else
|
||||
:status-code="403"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
import { permissions } from '~/const/page-permission/emergency'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/entry.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,28 +19,17 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/outpatient/encounter'] || {}
|
||||
const { checkRole, hasCreateAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => route.meta.title as string,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canCreate = hasCreateAccess(roleAccess)
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/emergency/encounter/add'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'create')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canCreate">
|
||||
<div v-if="hasAccess">
|
||||
<Content
|
||||
:id="0"
|
||||
class-code="emergency"
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/inpatient'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/detail.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,28 +19,17 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/inpatient/encounter'] || {}
|
||||
const { checkRole, hasReadAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => `${route.meta.title}`,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/inpatient/encounter/[id]'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'read')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canRead">
|
||||
<div v-if="hasAccess">
|
||||
<Content />
|
||||
</div>
|
||||
<Error v-else :status-code="403" />
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/inpatient'
|
||||
|
||||
// Helpers
|
||||
import { getParamsId, getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/entry.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,38 +19,23 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/inpatient/encounter'] || {}
|
||||
const { checkRole, hasUpdateAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => route.meta.title as string,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Get encounter ID from route params
|
||||
const encounterId = computed(() => {
|
||||
const id = route.params.id
|
||||
return typeof id === 'string' ? parseInt(id) : 0
|
||||
})
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/inpatient/encounter/[id]/edit'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'update')
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canUpdate = hasUpdateAccess(roleAccess)
|
||||
const encounterId = getParamsId()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canUpdate">
|
||||
<div v-if="hasAccess">
|
||||
<Content
|
||||
:id="encounterId"
|
||||
class-code="inpatient"
|
||||
sub-class-code="icu"
|
||||
sub-class-code="vk"
|
||||
form-type="edit"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,39 +1,41 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/inpatient'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from '~/lib/page-checker'
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/process.vue'
|
||||
|
||||
definePageMeta({
|
||||
middleware: ['rbac'],
|
||||
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
||||
title: 'Kunjungan',
|
||||
roles: ['emp|doc', 'emp|nur', 'emp|miw', 'emp|nut', 'emp|lab', 'emp|pha', 'emp|thr'],
|
||||
title: 'Proses Kunjungan',
|
||||
contentFrame: 'cf-full-width',
|
||||
contentPadding: 'p-0',
|
||||
contentUseCard: false,
|
||||
})
|
||||
|
||||
useHead({
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/inpatient/encounter'] || {}
|
||||
const { checkRole, hasReadAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canRead = hasReadAccess(roleAccess)
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => `${route.meta.title}`,
|
||||
})
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/inpatient/encounter/[id]/process'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'read')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canRead">
|
||||
<Content class-code="inpatient" sub-class-code="vk" />
|
||||
<div v-if="hasAccess">
|
||||
<Content class-code="inpatient" />
|
||||
</div>
|
||||
<Error v-else :status-code="403" />
|
||||
<Error
|
||||
v-else
|
||||
:status-code="403"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// Types & Consts
|
||||
import type { Permission } from '~/models/role'
|
||||
import { permissions } from '~/const/page-permission/ambulatory'
|
||||
import { permissions } from '~/const/page-permission/inpatient'
|
||||
|
||||
// Helpers
|
||||
import { getRouteTitle, checkPageAccess } from "~/lib/page-checker"
|
||||
|
||||
// Pubs
|
||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/content/encounter/entry.vue'
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,32 +19,21 @@ definePageMeta({
|
||||
contentFrame: 'cf-full-width',
|
||||
})
|
||||
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/outpatient/encounter'] || {}
|
||||
const { checkRole, hasCreateAccess } = useRBAC()
|
||||
|
||||
// Check if user has access to this page
|
||||
const hasAccess = checkRole(roleAccess)
|
||||
if (!hasAccess) {
|
||||
navigateTo('/403')
|
||||
}
|
||||
|
||||
// Page needs
|
||||
const route = useRoute()
|
||||
useHead({
|
||||
title: () => route.meta.title as string,
|
||||
title: () => `${getRouteTitle()}`,
|
||||
})
|
||||
|
||||
// Define permission-based computed properties
|
||||
const canCreate = hasCreateAccess(roleAccess)
|
||||
// Preps role checking
|
||||
const roleAccess: Record<string, Permission[]> = permissions['/inpatient/encounter/add'] || {}
|
||||
const hasAccess = checkPageAccess(roleAccess, 'create')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="canCreate">
|
||||
<div v-if="hasAccess">
|
||||
<Content
|
||||
:id="0"
|
||||
class-code="ambulatory"
|
||||
sub-class-code="reg"
|
||||
class-code="inpatient"
|
||||
sub-class-code="vk"
|
||||
form-type="add"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user