Checkpoint: Tableau de bord personnalisé pour formateurs avec statistiques (total séquences, séquences à venir, total apprenants) et liste des prochaines interventions avec détails (dates, lieu, capacité). Redirection automatique des formateurs vers /formateur au lieu de /admin. Notifications automatiques par email pour les formateurs lors de nouvelles inscriptions, annulations, capacité maximale atteinte et places disponibles. Menus Configuration, Traçabilité et Analyses masqués pour les formateurs.
This commit is contained in:
@@ -102,11 +102,19 @@ export default function DashboardLayout({
|
||||
return saved ? parseInt(saved, 10) : DEFAULT_WIDTH;
|
||||
});
|
||||
const { loading, user } = useAuth();
|
||||
const [location, setLocation] = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem(SIDEBAR_WIDTH_KEY, sidebarWidth.toString());
|
||||
}, [sidebarWidth]);
|
||||
|
||||
// Rediriger les formateurs vers leur tableau de bord
|
||||
useEffect(() => {
|
||||
if (user && user.role === 'formateur' && location === '/admin') {
|
||||
setLocation('/formateur');
|
||||
}
|
||||
}, [user, location, setLocation]);
|
||||
|
||||
if (loading) {
|
||||
return <DashboardLayoutSkeleton />
|
||||
}
|
||||
@@ -182,6 +190,17 @@ function DashboardLayoutContent({
|
||||
return section.title !== 'Configuration' && section.title !== 'Traçabilité' && section.title !== 'Analyses';
|
||||
}
|
||||
return true;
|
||||
}).map(section => {
|
||||
// Modifier le chemin du tableau de bord pour les formateurs
|
||||
if (section.title === 'Tableau de bord' && user?.role === 'formateur') {
|
||||
return {
|
||||
...section,
|
||||
items: section.items.map(item =>
|
||||
item.path === '/admin' ? { ...item, path: '/formateur' } : item
|
||||
)
|
||||
};
|
||||
}
|
||||
return section;
|
||||
});
|
||||
const [isResizing, setIsResizing] = useState(false);
|
||||
const sidebarRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
Reference in New Issue
Block a user