feat(#44): dashboard gestionnaire + redirection login rôle gestionnaire

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
MARTIN Julien 2026-02-25 16:20:59 +01:00
parent e8c6665a06
commit e990d576cf
4 changed files with 66 additions and 7 deletions

View File

@ -20,6 +20,7 @@ import '../screens/auth/am_register_step3_screen.dart';
import '../screens/auth/am_register_step4_screen.dart'; import '../screens/auth/am_register_step4_screen.dart';
import '../screens/home/home_screen.dart'; import '../screens/home/home_screen.dart';
import '../screens/administrateurs/admin_dashboardScreen.dart'; import '../screens/administrateurs/admin_dashboardScreen.dart';
import '../screens/gestionnaire/gestionnaire_dashboard_screen.dart';
import '../screens/home/parent_screen/ParentDashboardScreen.dart'; import '../screens/home/parent_screen/ParentDashboardScreen.dart';
import '../screens/unknown_screen.dart'; import '../screens/unknown_screen.dart';
@ -53,6 +54,10 @@ class AppRouter {
path: '/admin-dashboard', path: '/admin-dashboard',
builder: (BuildContext context, GoRouterState state) => const AdminDashboardScreen(), builder: (BuildContext context, GoRouterState state) => const AdminDashboardScreen(),
), ),
GoRoute(
path: '/gestionnaire-dashboard',
builder: (BuildContext context, GoRouterState state) => const GestionnaireDashboardScreen(),
),
GoRoute( GoRoute(
path: '/parent-dashboard', path: '/parent-dashboard',
builder: (BuildContext context, GoRouterState state) => const ParentDashboardScreen(), builder: (BuildContext context, GoRouterState state) => const ParentDashboardScreen(),

View File

@ -131,9 +131,11 @@ class _LoginPageState extends State<LoginScreen> with WidgetsBindingObserver {
switch (role.toLowerCase()) { switch (role.toLowerCase()) {
case 'super_admin': case 'super_admin':
case 'administrateur': case 'administrateur':
case 'gestionnaire':
context.go('/admin-dashboard'); context.go('/admin-dashboard');
break; break;
case 'gestionnaire':
context.go('/gestionnaire-dashboard');
break;
case 'parent': case 'parent':
context.go('/parent-dashboard'); context.go('/parent-dashboard');
break; break;

View File

@ -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<GestionnaireDashboardScreen> createState() =>
_GestionnaireDashboardScreenState();
}
class _GestionnaireDashboardScreenState extends State<GestionnaireDashboardScreen> {
@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(),
],
),
);
}
}

View File

@ -3,17 +3,22 @@ import 'package:go_router/go_router.dart';
import 'package:p_tits_pas/services/auth_service.dart'; import 'package:p_tits_pas/services/auth_service.dart';
/// Barre du dashboard admin : onglets Gestion des utilisateurs | Paramètres + déconnexion. /// Barre du dashboard admin : onglets Gestion des utilisateurs | Paramètres + déconnexion.
/// Pour le dashboard gestionnaire : [showSettingsTab] = false, [roleLabel] = 'Gestionnaire'.
class DashboardAppBarAdmin extends StatelessWidget class DashboardAppBarAdmin extends StatelessWidget
implements PreferredSizeWidget { implements PreferredSizeWidget {
final int selectedIndex; final int selectedIndex;
final ValueChanged<int> onTabChange; final ValueChanged<int> onTabChange;
final bool setupCompleted; final bool setupCompleted;
final bool showSettingsTab;
final String roleLabel;
const DashboardAppBarAdmin({ const DashboardAppBarAdmin({
Key? key, Key? key,
required this.selectedIndex, required this.selectedIndex,
required this.onTabChange, required this.onTabChange,
this.setupCompleted = true, this.setupCompleted = true,
this.showSettingsTab = true,
this.roleLabel = 'Admin',
}) : super(key: key); }) : super(key: key);
@override @override
@ -39,21 +44,23 @@ class DashboardAppBarAdmin extends StatelessWidget
children: [ children: [
_buildNavItem(context, 'Gestion des utilisateurs', 0, _buildNavItem(context, 'Gestion des utilisateurs', 0,
enabled: setupCompleted), enabled: setupCompleted),
if (showSettingsTab) ...[
const SizedBox(width: 24), const SizedBox(width: 24),
_buildNavItem(context, 'Paramètres', 1, enabled: true), _buildNavItem(context, 'Paramètres', 1, enabled: true),
], ],
],
), ),
), ),
), ),
], ],
), ),
actions: [ actions: [
const Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: Center( child: Center(
child: Text( child: Text(
'Admin', roleLabel,
style: TextStyle( style: const TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,