feat/role-check: wip

This commit is contained in:
2025-12-10 04:53:27 +07:00
parent ff19c022bb
commit 56e71ea693
13 changed files with 299 additions and 124 deletions
+11 -2
View File
@@ -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"
+7 -2
View File
@@ -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"