Frontend: - Refactored CSS architecture with new utility classes - Updated dashboard components styling - Improved responsive grid system - Enhanced typography and variables - Updated E2E and integration tests Added: - Claude Code slash commands for validation - SSH tunnel and start test scripts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
122 lines
2.7 KiB
JavaScript
122 lines
2.7 KiB
JavaScript
import { createRouter, createWebHistory } from "vue-router";
|
|
import { useAuthStore } from "../stores/auth";
|
|
|
|
// Import views
|
|
import LoginView from "../views/LoginView.vue";
|
|
import DashboardView from "../views/DashboardView.vue";
|
|
import InvoicesView from "../views/InvoicesView.vue";
|
|
import BankCashRegisterView from "../views/BankCashRegisterView.vue";
|
|
import TelegramView from "../views/TelegramView.vue";
|
|
import CacheStatsView from "../views/CacheStatsView.vue";
|
|
import TrialBalanceView from "../views/TrialBalanceView.vue";
|
|
|
|
const routes = [
|
|
{
|
|
path: "/",
|
|
redirect: "/dashboard",
|
|
},
|
|
{
|
|
path: "/login",
|
|
name: "Login",
|
|
component: LoginView,
|
|
meta: {
|
|
requiresAuth: false,
|
|
title: "Autentificare - ROA Reports",
|
|
},
|
|
},
|
|
{
|
|
path: "/dashboard",
|
|
name: "Dashboard",
|
|
component: DashboardView,
|
|
meta: {
|
|
requiresAuth: true,
|
|
title: "Dashboard - ROA Reports",
|
|
},
|
|
},
|
|
{
|
|
path: "/invoices",
|
|
name: "Invoices",
|
|
component: InvoicesView,
|
|
meta: {
|
|
requiresAuth: true,
|
|
title: "Facturi - ROA Reports",
|
|
},
|
|
},
|
|
{
|
|
path: "/bank-cash-register",
|
|
name: "BankCashRegister",
|
|
component: BankCashRegisterView,
|
|
meta: {
|
|
requiresAuth: true,
|
|
title: "Registru Casa si Banca - ROA Reports",
|
|
},
|
|
},
|
|
{
|
|
path: "/telegram",
|
|
name: "Telegram",
|
|
component: TelegramView,
|
|
meta: {
|
|
requiresAuth: true,
|
|
title: "Telegram Bot - ROA Reports",
|
|
},
|
|
},
|
|
{
|
|
path: "/cache-stats",
|
|
name: "CacheStats",
|
|
component: CacheStatsView,
|
|
meta: {
|
|
requiresAuth: true,
|
|
title: "Cache Statistics - ROA Reports",
|
|
},
|
|
},
|
|
{
|
|
path: "/trial-balance",
|
|
name: "TrialBalance",
|
|
component: TrialBalanceView,
|
|
meta: {
|
|
requiresAuth: true,
|
|
title: "Balanță de Verificare - ROA Reports",
|
|
},
|
|
},
|
|
{
|
|
path: "/:pathMatch(.*)*",
|
|
name: "NotFound",
|
|
redirect: "/dashboard",
|
|
},
|
|
];
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
routes,
|
|
linkActiveClass: "router-link-active",
|
|
linkExactActiveClass: "router-link-exact-active",
|
|
});
|
|
|
|
// Navigation guards
|
|
router.beforeEach((to, from, next) => {
|
|
const authStore = useAuthStore();
|
|
|
|
// Set page title
|
|
if (to.meta.title) {
|
|
document.title = to.meta.title;
|
|
}
|
|
|
|
// Check authentication
|
|
if (to.meta.requiresAuth !== false && !authStore.isAuthenticated) {
|
|
// Redirect to login if not authenticated
|
|
next("/login");
|
|
} else if (to.path === "/login" && authStore.isAuthenticated) {
|
|
// Redirect to dashboard if already authenticated and trying to access login
|
|
next("/dashboard");
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
|
|
router.afterEach((to) => {
|
|
// Scroll to top after navigation
|
|
window.scrollTo(0, 0);
|
|
});
|
|
|
|
export default router;
|