feat: Implement unified Vue SPA with granular service control
Consolidate Reports and Data Entry apps into a single Vue.js SPA with: Architecture: - Module-based structure with lazy-loaded routes (@reports, @data-entry) - Error boundaries per module to prevent cascade failures - Dual API proxy in Vite for microservices (reports:8001, data-entry:8003) - Pinia store factories for shared auth, company, and period stores - Vite path aliases for clear module boundaries (@shared, @reports, @data-entry) Service Management: - Granular service control scripts (backend-reports.sh, backend-data-entry.sh, bot.sh, frontend.sh) - 87% faster frontend restart: 7s vs 53s full restart - 38% faster full startup: 33s vs 53s via parallel backend initialization - Enhanced start-dev.sh with proper service timeouts (OCR: 30s, Vite: 15s, Bot: 10s) - status.sh for comprehensive health checks Features: - Auto-select first company on login with period auto-load - Hamburger menu with feature toggle support - JWT token auto-injection via axios interceptors - Unified header with company/period selectors - IIS web.config for production deployment with multi-API routing UX Improvements: - Vue watchers for reactive company/period loading - Lazy store initialization with graceful error handling - Period persistence per user+company in localStorage - Feature flags for optional modules Deployment: - Single IIS site serves unified frontend with API proxy rules - Maintains separate backend processes for microservices - Windows line ending fixes (.env CRLF → LF conversion) Stats: 112 files changed, 38,342 insertions(+), 2,342 deletions(-) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
118
src/router/index.js
Normal file
118
src/router/index.js
Normal file
@@ -0,0 +1,118 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () => import('@/views/LoginWrapper.vue'),
|
||||
meta: { requiresAuth: false, title: 'Autentificare - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: '/reports',
|
||||
component: () => import('@/modules/reports/ReportsLayout.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
children: [
|
||||
{
|
||||
path: 'dashboard',
|
||||
name: 'Dashboard',
|
||||
component: () => import('@reports/views/DashboardView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Dashboard - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: 'invoices',
|
||||
name: 'Invoices',
|
||||
component: () => import('@reports/views/InvoicesView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Facturi - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: 'bank-cash',
|
||||
name: 'BankCash',
|
||||
component: () => import('@reports/views/BankCashRegisterView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Casa și Banca - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: 'trial-balance',
|
||||
name: 'TrialBalance',
|
||||
component: () => import('@reports/views/TrialBalanceView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Balanță de Verificare - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: 'telegram',
|
||||
name: 'Telegram',
|
||||
component: () => import('@reports/views/TelegramView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Telegram Bot - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: 'cache-stats',
|
||||
name: 'CacheStats',
|
||||
component: () => import('@reports/views/CacheStatsView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Statistici Cache - ROA2WEB' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/data-entry',
|
||||
component: () => import('@/modules/data-entry/DataEntryLayout.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'ReceiptsList',
|
||||
component: () => import('@data-entry/views/receipts/ReceiptsListView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Lista Bonuri - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'ReceiptCreate',
|
||||
component: () => import('@data-entry/views/receipts/ReceiptCreateView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Bon Nou - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
name: 'ReceiptDetail',
|
||||
component: () => import('@data-entry/views/receipts/ReceiptCreateView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Detalii Bon - ROA2WEB' }
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
name: 'ReceiptEdit',
|
||||
component: () => import('@data-entry/views/receipts/ReceiptCreateView.vue'),
|
||||
meta: { requiresAuth: true, title: 'Editare Bon - ROA2WEB' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/reports/dashboard'
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
redirect: '/reports/dashboard'
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes
|
||||
})
|
||||
|
||||
// Navigation guard for authentication
|
||||
router.beforeEach((to, from, next) => {
|
||||
const isAuthenticated = !!localStorage.getItem('access_token')
|
||||
|
||||
if (to.meta.requiresAuth && !isAuthenticated) {
|
||||
next('/login')
|
||||
} else if (to.path === '/login' && isAuthenticated) {
|
||||
next('/reports/dashboard')
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
// Set page title after navigation
|
||||
router.afterEach((to) => {
|
||||
document.title = to.meta.title || 'ROA2WEB'
|
||||
window.scrollTo(0, 0)
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user