feat(uom): crate form, list and integrate

This commit is contained in:
riefive
2025-09-26 16:04:19 +07:00
parent 867f93af31
commit ca1b0f4cb7
3 changed files with 35 additions and 77 deletions
@@ -6,7 +6,7 @@ import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Tambah User',
title: 'Daftar User',
contentFrame: 'cf-full-width',
})
@@ -18,24 +18,23 @@ useHead({
const roleAccess: PagePermission = PAGE_PERMISSIONS['/doctor']
const { checkRole, hasCreateAccess } = useRBAC()
const { checkRole, hasReadAccess } = useRBAC()
// Check if user has access to this page
const hasAccess = checkRole(roleAccess)
if (!hasAccess) {
throw createError({
statusCode: 403,
statusMessage: 'Access denied',
})
navigateTo('/403')
}
// Define permission-based computed properties
const canCreate = hasCreateAccess(roleAccess)
const canRead = true // hasReadAccess(roleAccess)
</script>
<template>
<div v-if="canCreate">
<ContentDeviceEntry />
<div>
<div v-if="canRead">
<ContentUomList />
</div>
<Error v-else :status-code="403" />
</div>
<Error v-else :status-code="403" />
</template>
@@ -1,41 +0,0 @@
<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/base/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Tambah User',
contentFrame: 'cf-full-width',
})
const route = useRoute()
useHead({
title: () => route.meta.title as string,
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/doctor']
const { checkRole, hasCreateAccess } = useRBAC()
// Check if user has access to this page
const hasAccess = checkRole(roleAccess)
if (!hasAccess) {
throw createError({
statusCode: 403,
statusMessage: 'Access denied',
})
}
// Define permission-based computed properties
const canCreate = hasCreateAccess(roleAccess)
</script>
<template>
<div v-if="canCreate">
<ContentMaterialEntry />
</div>
<Error v-else :status-code="403" />
</template>