Files
pulse-crm-frontend/src/router/index.js
FluxKit 7b0fd718b0 feat: Redesign navigation menu like Close.com
- Inbox, Chancen (Pipeline), Leads, Kontakte, Firmen, Aktivitäten
- Konversationen, Workflows, Berichte (coming soon)
- Team & Einstellungen at bottom
- Expandable submenus for Leads and Workflows
- User profile at top of sidebar
- German labels
2026-02-25 13:25:19 +00:00

103 lines
2.4 KiB
JavaScript

import { createRouter, createWebHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const routes = [
{
path: '/login',
name: 'Login',
component: () => import('@/views/LoginView.vue'),
meta: { guest: true }
},
{
path: '/',
component: () => import('@/layouts/AppLayout.vue'),
meta: { requiresAuth: true },
children: [
{
path: '',
name: 'Dashboard',
component: () => import('@/views/DashboardView.vue')
},
{
path: 'inbox',
name: 'Inbox',
component: () => import('@/views/InboxView.vue')
},
{
path: 'leads',
name: 'Leads',
component: () => import('@/views/ContactsView.vue') // Uses contacts view for now
},
{
path: 'contacts',
name: 'Contacts',
component: () => import('@/views/ContactsView.vue')
},
{
path: 'contacts/:id',
name: 'ContactDetail',
component: () => import('@/views/ContactDetailView.vue')
},
{
path: 'companies',
name: 'Companies',
component: () => import('@/views/CompaniesView.vue')
},
{
path: 'companies/:id',
name: 'CompanyDetail',
component: () => import('@/views/CompanyDetailView.vue')
},
{
path: 'pipeline',
name: 'Pipeline',
component: () => import('@/views/PipelineView.vue')
},
{
path: 'deals/:id',
name: 'DealDetail',
component: () => import('@/views/DealDetailView.vue')
},
{
path: 'activities',
name: 'Activities',
component: () => import('@/views/ActivitiesView.vue')
},
{
path: 'settings',
name: 'Settings',
component: () => import('@/views/SettingsView.vue')
},
{
path: 'team',
name: 'Team',
component: () => import('@/views/UsersView.vue'),
meta: { roles: ['owner', 'admin'] }
}
]
},
{
path: '/:pathMatch(.*)*',
redirect: '/'
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
router.beforeEach((to, from, next) => {
const auth = useAuthStore()
if (to.meta.requiresAuth && !auth.isAuthenticated) {
next('/login')
} else if (to.meta.guest && auth.isAuthenticated) {
next('/')
} else {
next()
}
})
export default router