Files
simrsx-fe/app/pages/(features)/client/patient/add.vue
T
Khafid Prayoga bd4a269fad feat(patient): add callback url support for patient creation
Add callback URL parameter to redirect after successful patient creation. The URL can be passed via 'return-path' query parameter and will include the created patient's ID. This enables seamless integration with external systems that need to handle post-creation flows.
2025-10-09 20:21:06 +07:00

45 lines
1.0 KiB
Vue

<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/my-ui/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Tambah Pasien',
contentFrame: 'cf-container-2xl',
})
const route = useRoute()
useHead({
title: () => route.meta.title as string,
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/patient']
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)
const callbackUrl = route.query['return-path'] as string | undefined
</script>
<template>
<div>
<div v-if="canRead">
<ContentPatientEntry :callback-url="callbackUrl" />
</div>
<Error
v-else
:status-code="403"
/>
</div>
</template>