feat: add shift management functionality

This commit is contained in:
2026-08-26 18:53:15 +03:30
parent 2d96978c38
commit aeef95339d
34 changed files with 1953 additions and 15 deletions
@@ -18,6 +18,7 @@ interface SidebarItem extends MenuItem {
expanded?: boolean;
items?: SidebarItem[];
permission?: string | null;
level?: string | null;
}
const globalStore = useGlobalStore();
@@ -31,9 +32,14 @@ function hasPermission(permission) {
return userPermissions.value.includes(permission);
}
function hasLevel(level) {
if (!level) return true;
return currentUser.value?.level === level;
}
function filterSidebarItems(items) {
return items
.filter(item => hasPermission(item.permission))
.filter(item => hasPermission(item.permission) && hasLevel(item.level))
.map(item => {
if (item.items) {
const filteredChildren = filterSidebarItems(item.items);
@@ -87,6 +93,7 @@ const items: Ref<SidebarItem[]> = ref([
to: "/dashboard/shifts",
key: 'shifts',
permission: null,
level: "پزشک",
},
// {
// label: "خروج از سامانه",