✨ feat (appsidebar): load menu from json file
This commit is contained in:
No files matched your search
@@ -1,98 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const navMenu: any[] = [
|
const navMenu: {
|
||||||
{
|
heading: string
|
||||||
heading: 'Menu Utama',
|
items: Array<any>
|
||||||
items: [
|
} = ref({
|
||||||
{
|
heading: 'Menu Utama',
|
||||||
title: 'Dashboard',
|
items: [],
|
||||||
icon: 'i-lucide-home',
|
})
|
||||||
link: '/',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Rawat Jalan',
|
|
||||||
icon: 'i-lucide-stethoscope',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: 'Antrian Pendaftaran',
|
|
||||||
icon: 'i-lucide-stethoscope',
|
|
||||||
link: '/outpatient/registration-queue',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Pendaftaran',
|
|
||||||
icon: 'i-lucide-building-2',
|
|
||||||
link: '/outpatient/registration',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Antrian Pemeriksaan',
|
|
||||||
icon: 'i-lucide-stethoscope',
|
|
||||||
link: '/outpatient/examination-queue',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Pendaftaran',
|
|
||||||
icon: 'i-lucide-building-2',
|
|
||||||
link: '/outpatient/examination',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Pasien',
|
|
||||||
icon: 'i-lucide-users',
|
|
||||||
link: '/patient',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Rehabilitasi Medik',
|
|
||||||
icon: 'i-lucide-heart',
|
|
||||||
link: '/rehabilitasi',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Rawat Inap',
|
|
||||||
icon: 'i-lucide-building-2',
|
|
||||||
link: '/rawat-inap',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'VClaim BPJS',
|
|
||||||
icon: 'i-lucide-refresh-cw',
|
|
||||||
link: '/vclaim',
|
|
||||||
badge: 'Live',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'SATUSEHAT',
|
|
||||||
icon: 'i-lucide-database',
|
|
||||||
link: '/satusehat',
|
|
||||||
badge: 'FHIR',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Medical Records',
|
|
||||||
icon: 'i-lucide-file-text',
|
|
||||||
link: '/medical-records',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Laporan',
|
|
||||||
icon: 'i-lucide-clipboard-list',
|
|
||||||
link: '/laporan',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Monitoring',
|
|
||||||
icon: 'i-lucide-bar-chart-3',
|
|
||||||
link: '/monitoring',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const navMenuBottom: any[] = [
|
|
||||||
{
|
|
||||||
title: 'Help & Support',
|
|
||||||
icon: 'i-lucide-circle-help',
|
|
||||||
link: 'https://github.com/simrs/simrs-fe',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
function resolveNavItemComponent(item: any): any {
|
|
||||||
if ('children' in item) return resolveComponent('LayoutSidebarNavGroup')
|
|
||||||
|
|
||||||
return resolveComponent('LayoutSidebarNavLink')
|
|
||||||
}
|
|
||||||
|
|
||||||
const teams: {
|
const teams: {
|
||||||
name: string
|
name: string
|
||||||
@@ -105,44 +18,60 @@ const teams: {
|
|||||||
plan: 'Saiful Anwar Hospital',
|
plan: 'Saiful Anwar Hospital',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// const user: {
|
|
||||||
// name: string
|
|
||||||
// email: string
|
|
||||||
// avatar: string
|
|
||||||
// } = {
|
|
||||||
// name: '',
|
|
||||||
// email: '',
|
|
||||||
// avatar: '/',
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const { sidebar } = useAppSettings()
|
|
||||||
const sidebar = {
|
const sidebar = {
|
||||||
collapsible: 'offcanvas', // 'offcanvas' | 'icon' | 'none'
|
collapsible: 'offcanvas', // 'offcanvas' | 'icon' | 'none'
|
||||||
side: 'left', // 'left' | 'right'
|
side: 'left', // 'left' | 'right'
|
||||||
variant: 'sidebar', // 'sidebar' | 'floating' | 'inset'
|
variant: 'sidebar', // 'sidebar' | 'floating' | 'inset'
|
||||||
}
|
}
|
||||||
|
const navMenuBottom: any[] = [
|
||||||
|
{
|
||||||
|
title: 'Help & Support',
|
||||||
|
icon: 'i-lucide-circle-help',
|
||||||
|
link: 'https://github.com/simrs/simrs-fe',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await setMenu()
|
||||||
|
})
|
||||||
|
|
||||||
|
function resolveNavItemComponent(item: any): any {
|
||||||
|
if ('children' in item) return resolveComponent('LayoutSidebarNavGroup')
|
||||||
|
|
||||||
|
return resolveComponent('LayoutSidebarNavLink')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setMenu() {
|
||||||
|
const position_code = 'sys'
|
||||||
|
const res = await fetch(`/side-menu-items/${position_code}.json`)
|
||||||
|
const rawMenu = await res.text()
|
||||||
|
navMenu.value.items = JSON.parse(rawMenu)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Sidebar :collapsible="sidebar.collapsible" :side="sidebar.side" :variant="sidebar.variant">
|
<Sidebar :collapsible="sidebar.collapsible" :side="sidebar.side" :variant="sidebar.variant">
|
||||||
<SidebarHeader>
|
<SidebarHeader>
|
||||||
<LayoutSidebarNavHeader :teams="teams" />
|
<LayoutSidebarNavHeader :teams="teams" />
|
||||||
<!-- <Search /> -->
|
|
||||||
</SidebarHeader>
|
</SidebarHeader>
|
||||||
<SidebarContent>
|
<SidebarContent>
|
||||||
<SidebarGroup v-for="(nav, indexGroup) in navMenu" :key="indexGroup">
|
<SidebarGroup v-if="navMenu.items.length > 0">
|
||||||
<SidebarGroupLabel v-if="nav.heading">
|
<SidebarGroupLabel>
|
||||||
{{ nav.heading }}
|
{{ navMenu.heading }}
|
||||||
</SidebarGroupLabel>
|
</SidebarGroupLabel>
|
||||||
<component
|
<component
|
||||||
:is="resolveNavItemComponent(item)"
|
:is="resolveNavItemComponent(item)"
|
||||||
v-for="(item, index) in nav.items"
|
v-for="(item, index) in navMenu.items"
|
||||||
:key="index"
|
:key="index"
|
||||||
:item="item"
|
:item="item"
|
||||||
class="my-2 mb-2"
|
class="my-2 mb-2"
|
||||||
/>
|
/>
|
||||||
</SidebarGroup>
|
</SidebarGroup>
|
||||||
|
<template v-else>
|
||||||
|
<div class="p-5">
|
||||||
|
<div v-for="n in 10" :key="n" class="my-4 h-8 animate-pulse rounded bg-gray-200 py-2"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<SidebarGroup class="mt-auto">
|
<SidebarGroup class="mt-auto">
|
||||||
<component
|
<component
|
||||||
:is="resolveNavItemComponent(item)"
|
:is="resolveNavItemComponent(item)"
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "Dashboard",
|
||||||
|
"icon": "i-lucide-home",
|
||||||
|
"link": "/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rawat Jalan",
|
||||||
|
"icon": "i-lucide-stethoscope",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"title": "Antrian Pendaftaran",
|
||||||
|
"icon": "i-lucide-stethoscope",
|
||||||
|
"link": "/outpatient/registration-queue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Pendaftaran",
|
||||||
|
"icon": "i-lucide-building-2",
|
||||||
|
"link": "/outpatient/registration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Antrian Pemeriksaan",
|
||||||
|
"icon": "i-lucide-stethoscope",
|
||||||
|
"link": "/outpatient/examination-queue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Pendaftaran",
|
||||||
|
"icon": "i-lucide-building-2",
|
||||||
|
"link": "/outpatient/examination"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Pasien",
|
||||||
|
"icon": "i-lucide-users",
|
||||||
|
"link": "/patient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rehabilitasi Medik",
|
||||||
|
"icon": "i-lucide-heart",
|
||||||
|
"link": "/rehabilitasi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rawat Inap",
|
||||||
|
"icon": "i-lucide-building-2",
|
||||||
|
"link": "/rawat-inap"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "VClaim BPJS",
|
||||||
|
"icon": "i-lucide-refresh-cw",
|
||||||
|
"link": "/vclaim",
|
||||||
|
"badge": "Live"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "SATUSEHAT",
|
||||||
|
"icon": "i-lucide-database",
|
||||||
|
"link": "/satusehat",
|
||||||
|
"badge": "FHIR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Medical Records",
|
||||||
|
"icon": "i-lucide-file-text",
|
||||||
|
"link": "/medical-records"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Laporan",
|
||||||
|
"icon": "i-lucide-clipboard-list",
|
||||||
|
"link": "/laporan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Monitoring",
|
||||||
|
"icon": "i-lucide-bar-chart-3",
|
||||||
|
"link": "/monitoring"
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user