diff --git a/docs/development/ZENTRAL.md b/docs/development/ZENTRAL.md index 5b9952b..99e9cdb 100644 --- a/docs/development/ZENTRAL.md +++ b/docs/development/ZENTRAL.md @@ -22,3 +22,5 @@ File riassuntivo dello stato di sviluppo di Zentral. - [Menu Refactoring](./devlog/menu-refactoring.md) - Riorganizzazione menu e moduli (Dashboard, Clienti, Articoli, Risorse) - [2025-12-03 Implementazione Modulo Personale](./devlog/2025-12-03_implementazione_modulo_personale.md) - **In Corso** - Implementazione entità, API e Frontend per gestione Personale (Dipendenti, Contratti, Assenze, Pagamenti). +- [2025-12-04 Zentral Dashboard and Menu Cleanup](./devlog/2025-12-04-023000_zentral_dashboard.md) - **Completato** + - Pulizia menu Zentral (rimozione voci ridondanti) e creazione nuova Dashboard principale con riepilogo moduli attivi. diff --git a/docs/development/devlog/2025-12-04-023000_zentral_dashboard.md b/docs/development/devlog/2025-12-04-023000_zentral_dashboard.md new file mode 100644 index 0000000..1a961f0 --- /dev/null +++ b/docs/development/devlog/2025-12-04-023000_zentral_dashboard.md @@ -0,0 +1,25 @@ +# Zentral Dashboard and Menu Cleanup + +## Stato Attuale +Completato. + +## Lavoro Svolto +1. **Pulizia Menu Zentral**: + - Verificato che le voci "Clienti", "Articoli" e "Risorse" nel menu "Zentral" erano ridondanti o non funzionanti. + - "Articoli" è gestito dal modulo Warehouse (`/warehouse/articles`). + - "Clienti" e "Risorse" erano link non funzionanti (`/clienti`, `/risorse` non definiti nelle rotte). + - Rimossi questi elementi dal menu laterale (`Sidebar.tsx`). + - Appiattito il menu "Zentral" in un'unica voce di primo livello "Zentral Dashboard" che punta direttamente alla home page. + +2. **Nuova Zentral Dashboard**: + - Aggiornato `src/frontend/src/pages/Dashboard.tsx` per diventare la nuova homepage "Zentral Dashboard". + - La dashboard ora mostra: + - Un messaggio di benvenuto con il conteggio dei moduli attivi. + - Una griglia di card per ogni modulo attivo, con icona, nome, descrizione e pulsante per aprire l'applicazione. + - Gestione dello stato di caricamento e caso di nessun modulo attivo. + - La dashboard utilizza `useModules` per recuperare dinamicamente i moduli attivi. + - Integrata con il sistema di Tab (`openTab`) per aprire le applicazioni. + +## Prossimi Passi Suggeriti +- Implementare endpoint di backend per recuperare statistiche globali reali (es. numero ordini aperti, valore magazzino, ecc.) da mostrare nella dashboard principale. +- Aggiungere widget personalizzabili nella dashboard. diff --git a/src/frontend/src/components/Sidebar.tsx b/src/frontend/src/components/Sidebar.tsx index 7419afb..43cb166 100644 --- a/src/frontend/src/components/Sidebar.tsx +++ b/src/frontend/src/components/Sidebar.tsx @@ -17,8 +17,6 @@ import { Event as EventIcon, People as PeopleIcon, Place as PlaceIcon, - Inventory as InventoryIcon, - Person as PersonIcon, CalendarMonth as CalendarIcon, Print as PrintIcon, Extension as ModulesIcon, @@ -84,15 +82,10 @@ export default function Sidebar({ onClose }: { onClose?: () => void }) { const menuStructure: MenuItem[] = [ { - id: 'core', - label: 'Zentral', + id: 'dashboard', + label: 'Zentral Dashboard', icon: , - children: [ - { id: 'dashboard', label: t('menu.dashboard'), icon: , path: '/' }, - { id: 'clients', label: t('menu.clients'), icon: , path: '/clienti' }, - { id: 'articles', label: t('menu.articles'), icon: , path: '/articoli' }, - { id: 'resources', label: t('menu.resources'), icon: , path: '/risorse' }, - ], + path: '/', }, { id: 'warehouse', diff --git a/src/frontend/src/pages/Dashboard.tsx b/src/frontend/src/pages/Dashboard.tsx index 9e50f89..23e6e7d 100644 --- a/src/frontend/src/pages/Dashboard.tsx +++ b/src/frontend/src/pages/Dashboard.tsx @@ -1,20 +1,205 @@ -import { Box, Typography, Grid, Paper } from '@mui/material'; + +import { + Box, + Typography, + Grid, + Paper, + Card, + CardContent, + CardActions, + Button, + Chip, + useTheme, + alpha +} from '@mui/material'; +import { + Dashboard as DashboardIcon, + Event as EventIcon, + People as PeopleIcon, + ShoppingCart as ShoppingCartIcon, + Sell as SellIcon, + Factory as ProductionIcon, + Settings as SettingsIcon, + ArrowForward as ArrowForwardIcon, + Storage as StorageIcon +} from '@mui/icons-material'; +import { useModules } from '../contexts/ModuleContext'; +import { useLanguage } from '../contexts/LanguageContext'; +import { useTabs } from '../contexts/TabContext'; export default function Dashboard() { + const { activeModules, isLoading } = useModules(); + const { t } = useLanguage(); + const { openTab } = useTabs(); + const theme = useTheme(); + + const getModuleIcon = (code: string) => { + switch (code) { + case 'warehouse': return ; + case 'purchases': return ; + case 'sales': return ; + case 'production': return ; + case 'events': return ; + case 'hr': return ; + default: return ; + } + }; + + const getModulePath = (code: string) => { + switch (code) { + case 'warehouse': return '/warehouse'; + case 'purchases': return '/purchases/orders'; // Default to orders for now + case 'sales': return '/sales/orders'; + case 'production': return '/production'; + case 'events': return '/events/list'; + case 'hr': return '/hr/dipendenti'; + default: return '/'; + } + }; + + const handleModuleClick = (module: any) => { + const path = getModulePath(module.code); + openTab(path, module.name); + }; + + if (isLoading) { + return Loading...; + } + return ( - - - Dashboard - + + + + Zentral Dashboard + + + Overview of your active modules and system status + + + + {/* System Status / Welcome Card */} - - Welcome to Zentral - - Select a module from the menu to get started. - + + + + + Welcome back! + + + You have {activeModules.length} active modules running. + Select a module below to start working or manage your subscriptions in the Admin panel. + + + + + + + + {/* Active Modules Grid */} + + + Active Applications + + + + {activeModules.map((module) => ( + + handleModuleClick(module)} + > + + + + {getModuleIcon(module.code)} + + + + {module.name} + + + + + + {module.description || `Manage your ${module.name.toLowerCase()} efficiently.`} + + + + + + + + ))} + + {activeModules.length === 0 && ( + + + + No active modules found + + + + + )} );