diff --git a/frontend/lib/config/app_router.dart b/frontend/lib/config/app_router.dart index d5e2ad6..8408cf4 100644 --- a/frontend/lib/config/app_router.dart +++ b/frontend/lib/config/app_router.dart @@ -20,6 +20,7 @@ import '../screens/auth/am_register_step3_screen.dart'; import '../screens/auth/am_register_step4_screen.dart'; import '../screens/home/home_screen.dart'; import '../screens/administrateurs/admin_dashboardScreen.dart'; +import '../screens/gestionnaire/gestionnaire_dashboard_screen.dart'; import '../screens/home/parent_screen/ParentDashboardScreen.dart'; import '../screens/unknown_screen.dart'; @@ -53,6 +54,10 @@ class AppRouter { path: '/admin-dashboard', builder: (BuildContext context, GoRouterState state) => const AdminDashboardScreen(), ), + GoRoute( + path: '/gestionnaire-dashboard', + builder: (BuildContext context, GoRouterState state) => const GestionnaireDashboardScreen(), + ), GoRoute( path: '/parent-dashboard', builder: (BuildContext context, GoRouterState state) => const ParentDashboardScreen(), diff --git a/frontend/lib/screens/auth/login_screen.dart b/frontend/lib/screens/auth/login_screen.dart index 8efaf2e..96064e7 100644 --- a/frontend/lib/screens/auth/login_screen.dart +++ b/frontend/lib/screens/auth/login_screen.dart @@ -131,9 +131,11 @@ class _LoginPageState extends State with WidgetsBindingObserver { switch (role.toLowerCase()) { case 'super_admin': case 'administrateur': - case 'gestionnaire': context.go('/admin-dashboard'); break; + case 'gestionnaire': + context.go('/gestionnaire-dashboard'); + break; case 'parent': context.go('/parent-dashboard'); break; diff --git a/frontend/lib/screens/gestionnaire/gestionnaire_dashboard_screen.dart b/frontend/lib/screens/gestionnaire/gestionnaire_dashboard_screen.dart new file mode 100644 index 0000000..7be3387 --- /dev/null +++ b/frontend/lib/screens/gestionnaire/gestionnaire_dashboard_screen.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:p_tits_pas/widgets/admin/dashboard_admin.dart'; +import 'package:p_tits_pas/widgets/admin/user_management_panel.dart'; +import 'package:p_tits_pas/widgets/app_footer.dart'; + +/// Dashboard gestionnaire – même shell que l'admin, sans onglet Paramètres. +/// Réutilise [AdminUserManagementPanel]. +class GestionnaireDashboardScreen extends StatefulWidget { + const GestionnaireDashboardScreen({super.key}); + + @override + State createState() => + _GestionnaireDashboardScreenState(); +} + +class _GestionnaireDashboardScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: PreferredSize( + preferredSize: const Size.fromHeight(60.0), + child: Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide(color: Colors.grey.shade300), + ), + ), + child: DashboardAppBarAdmin( + selectedIndex: 0, + onTabChange: (_) {}, + showSettingsTab: false, + roleLabel: 'Gestionnaire', + setupCompleted: true, + ), + ), + ), + body: Column( + children: [ + const Expanded(child: AdminUserManagementPanel()), + const AppFooter(), + ], + ), + ); + } +} diff --git a/frontend/lib/widgets/admin/dashboard_admin.dart b/frontend/lib/widgets/admin/dashboard_admin.dart index ff1aa3b..c837f8f 100644 --- a/frontend/lib/widgets/admin/dashboard_admin.dart +++ b/frontend/lib/widgets/admin/dashboard_admin.dart @@ -3,17 +3,22 @@ import 'package:go_router/go_router.dart'; import 'package:p_tits_pas/services/auth_service.dart'; /// Barre du dashboard admin : onglets Gestion des utilisateurs | Paramètres + déconnexion. +/// Pour le dashboard gestionnaire : [showSettingsTab] = false, [roleLabel] = 'Gestionnaire'. class DashboardAppBarAdmin extends StatelessWidget implements PreferredSizeWidget { final int selectedIndex; final ValueChanged onTabChange; final bool setupCompleted; + final bool showSettingsTab; + final String roleLabel; const DashboardAppBarAdmin({ Key? key, required this.selectedIndex, required this.onTabChange, this.setupCompleted = true, + this.showSettingsTab = true, + this.roleLabel = 'Admin', }) : super(key: key); @override @@ -39,8 +44,10 @@ class DashboardAppBarAdmin extends StatelessWidget children: [ _buildNavItem(context, 'Gestion des utilisateurs', 0, enabled: setupCompleted), - const SizedBox(width: 24), - _buildNavItem(context, 'Paramètres', 1, enabled: true), + if (showSettingsTab) ...[ + const SizedBox(width: 24), + _buildNavItem(context, 'Paramètres', 1, enabled: true), + ], ], ), ), @@ -48,12 +55,12 @@ class DashboardAppBarAdmin extends StatelessWidget ], ), actions: [ - const Padding( - padding: EdgeInsets.symmetric(horizontal: 16), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), child: Center( child: Text( - 'Admin', - style: TextStyle( + roleLabel, + style: const TextStyle( color: Colors.black, fontSize: 16, fontWeight: FontWeight.w500,