refactor: Reorganize sidebar menu structure

- Core features at top: Dashboard, Aufträge, Mitarbeiter, Verfügbarkeit, Stundenzettel, Objekte
- Premium modules in collapsible 'Module' section
- Settings and Help at bottom
- Clean visual separation with dividers
This commit is contained in:
2026-03-13 10:39:00 +00:00
parent a4d759e6fd
commit bd1d6ba765

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue' import { ref, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useAuthStore } from '@/stores/auth' import { useAuthStore } from '@/stores/auth'
@@ -15,42 +15,59 @@ defineEmits<{
const route = useRoute() const route = useRoute()
const { t } = useI18n() const { t } = useI18n()
const authStore = useAuthStore() const authStore = useAuthStore()
const modulesExpanded = ref(true)
const navigation = computed(() => { // Core navigation - always visible
const coreNavigation = computed(() => {
const items = [ const items = [
{ name: t('nav.dashboard'), href: '/', icon: '📊' }, { name: t('nav.dashboard'), href: '/', icon: '📊' },
{ name: t('nav.orders'), href: '/orders', icon: '📋' }, { name: t('nav.orders'), href: '/orders', icon: '📋' },
] ]
if (authStore.canManageUsers) { if (authStore.canManageUsers) {
items.push( items.push({ name: t('nav.users'), href: '/users', icon: '👥' })
{ name: t('nav.users'), href: '/users', icon: '👥' },
{ name: t('nav.shifts'), href: '/shifts', icon: '📅' }
)
} }
items.push( items.push(
{ name: t('nav.availability'), href: '/availability', icon: '🗓️' }, { name: t('nav.availability'), href: '/availability', icon: '🗓️' },
{ name: t('nav.timesheets'), href: '/timesheets', icon: '⏱️' }, { name: t('nav.timesheets'), href: '/timesheets', icon: '⏱️' },
{ name: t('nav.objects'), href: '/objects', icon: '🏢' }
)
return items
})
// Premium modules - shown under "Module" section
const moduleNavigation = computed(() => {
const items = [
{ name: t('nav.qualifications'), href: '/qualifications', icon: '🎓' }, { name: t('nav.qualifications'), href: '/qualifications', icon: '🎓' },
{ name: t('nav.objects'), href: '/objects', icon: '🏢' }, { name: t('nav.shifts'), href: '/shifts', icon: '📅' },
{ name: t('nav.patrols'), href: '/patrols', icon: '📍' }, { name: t('nav.patrols'), href: '/patrols', icon: '📍' },
{ name: t('nav.incidents'), href: '/incidents', icon: '🚨' }, { name: t('nav.incidents'), href: '/incidents', icon: '🚨' },
{ name: t('nav.documents'), href: '/documents', icon: '📁' }, { name: t('nav.documents'), href: '/documents', icon: '📁' },
) { name: t('nav.vehicles'), href: '/vehicles', icon: '🚗' },
]
if (authStore.canManageUsers) { if (authStore.canManageUsers) {
items.push( items.push(
{ name: t('nav.vehicles'), href: '/vehicles', icon: '🚗' }, { name: t('nav.customers'), href: '/customers', icon: '🤝' },
{ name: t('nav.customers'), href: '/customers', icon: '🤝' } { name: t('nav.partnerships'), href: '/partnerships', icon: '🔗' }
) )
} }
if (authStore.isChef) { if (authStore.isChef) {
items.push( items.push({ name: t('nav.billing'), href: '/billing', icon: '💰' })
{ name: t('nav.billing'), href: '/billing', icon: '💰' }, }
{ name: t('nav.modules'), href: '/modules', icon: '⚙️' }
) return items
})
// Bottom navigation
const bottomNavigation = computed(() => {
const items = []
if (authStore.isChef) {
items.push({ name: t('nav.modules'), href: '/modules', icon: '⚙️' })
} }
items.push( items.push(
@@ -65,17 +82,21 @@ function isActive(href: string) {
if (href === '/') return route.path === '/' if (href === '/') return route.path === '/'
return route.path.startsWith(href) return route.path.startsWith(href)
} }
function toggleModules() {
modulesExpanded.value = !modulesExpanded.value
}
</script> </script>
<template> <template>
<aside <aside
:class="[ :class="[
'fixed inset-y-0 left-0 z-50 w-64 bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 transform transition-transform lg:translate-x-0', 'fixed inset-y-0 left-0 z-50 w-64 bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 transform transition-transform lg:translate-x-0 flex flex-col',
open ? 'translate-x-0' : '-translate-x-full' open ? 'translate-x-0' : '-translate-x-full'
]" ]"
> >
<!-- Logo --> <!-- Logo -->
<div class="h-16 flex items-center px-6 border-b border-gray-200 dark:border-gray-700"> <div class="h-16 flex items-center px-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0">
<template v-if="authStore.orgLogo"> <template v-if="authStore.orgLogo">
<img <img
:src="authStore.orgLogo" :src="authStore.orgLogo"
@@ -89,26 +110,87 @@ function isActive(href: string) {
</div> </div>
<!-- Navigation --> <!-- Navigation -->
<nav class="mt-6 px-3"> <nav class="flex-1 overflow-y-auto py-4 px-3">
<router-link <!-- Core Navigation -->
v-for="item in navigation" <div class="mb-4">
:key="item.href" <router-link
:to="item.href" v-for="item in coreNavigation"
:class="[ :key="item.href"
'flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors', :to="item.href"
isActive(item.href) :class="[
? 'bg-primary-100 text-primary-700 dark:bg-primary-900 dark:text-primary-200' 'flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors',
: 'text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700' isActive(item.href)
]" ? 'bg-primary-100 text-primary-700 dark:bg-primary-900 dark:text-primary-200'
@click="$emit('close')" : 'text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
> ]"
<span class="text-xl">{{ item.icon }}</span> @click="$emit('close')"
<span class="font-medium">{{ item.name }}</span> >
</router-link> <span class="text-xl">{{ item.icon }}</span>
<span class="font-medium">{{ item.name }}</span>
</router-link>
</div>
<!-- Modules Section -->
<div class="mb-4">
<button
@click="toggleModules"
class="w-full flex items-center justify-between px-3 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:text-gray-700 dark:hover:text-gray-200"
>
<span>{{ t('nav.modules') }}</span>
<svg
:class="['w-4 h-4 transition-transform', modulesExpanded ? 'rotate-180' : '']"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</button>
<div v-show="modulesExpanded" class="mt-1">
<router-link
v-for="item in moduleNavigation"
:key="item.href"
:to="item.href"
:class="[
'flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors text-sm',
isActive(item.href)
? 'bg-primary-100 text-primary-700 dark:bg-primary-900 dark:text-primary-200'
: 'text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
]"
@click="$emit('close')"
>
<span class="text-lg">{{ item.icon }}</span>
<span class="font-medium">{{ item.name }}</span>
</router-link>
</div>
</div>
<!-- Divider -->
<div class="border-t border-gray-200 dark:border-gray-700 my-4"></div>
<!-- Bottom Navigation -->
<div>
<router-link
v-for="item in bottomNavigation"
:key="item.href"
:to="item.href"
:class="[
'flex items-center gap-3 px-3 py-2 rounded-lg mb-1 transition-colors',
isActive(item.href)
? 'bg-primary-100 text-primary-700 dark:bg-primary-900 dark:text-primary-200'
: 'text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
]"
@click="$emit('close')"
>
<span class="text-xl">{{ item.icon }}</span>
<span class="font-medium">{{ item.name }}</span>
</router-link>
</div>
</nav> </nav>
<!-- User info --> <!-- User info -->
<div class="absolute bottom-0 left-0 right-0 p-4 border-t border-gray-200 dark:border-gray-700"> <div class="flex-shrink-0 p-4 border-t border-gray-200 dark:border-gray-700">
<div class="flex items-center gap-3"> <div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-full bg-primary-100 dark:bg-primary-900 flex items-center justify-center"> <div class="w-10 h-10 rounded-full bg-primary-100 dark:bg-primary-900 flex items-center justify-center">
<span class="text-primary-600 dark:text-primary-300 font-medium"> <span class="text-primary-600 dark:text-primary-300 font-medium">