Files
petitspas/frontend/lib/screens/gestionnaire/gestionnaire_dashboard_screen.dart
jmartinandCursor 9cd180bf6a feat(#161): admin peut créer gestionnaire et administrateur.
Assouplit POST /gestionnaires, PATCH /gestionnaires/:id et POST /users/admin
(+ check createAdmin) pour ADMINISTRATEUR. Masque « Ajouter » staff sur le
dashboard gestionnaire. Tests droits Roles + createAdmin.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 22:54:49 +02:00

76 lines
2.2 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import 'package:p_tits_pas/models/user.dart';
import 'package:p_tits_pas/services/auth_service.dart';
import 'package:p_tits_pas/widgets/admin/user_management_panel.dart';
import 'package:p_tits_pas/widgets/app_footer.dart';
import 'package:p_tits_pas/widgets/dashboard/dashboard_bandeau.dart';
/// Dashboard gestionnaire même shell que l'admin, sans onglet Paramètres.
/// Réutilise [UserManagementPanel].
class GestionnaireDashboardScreen extends StatefulWidget {
const GestionnaireDashboardScreen({super.key});
@override
State<GestionnaireDashboardScreen> createState() =>
_GestionnaireDashboardScreenState();
}
class _GestionnaireDashboardScreenState extends State<GestionnaireDashboardScreen> {
AppUser? _user;
@override
void initState() {
super.initState();
_loadUser();
}
Future<void> _loadUser() async {
final user = await AuthService.getCurrentUser();
if (mounted) setState(() => _user = user);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60.0),
child: DashboardBandeau(
tabItems: const [
DashboardTabItem(label: 'Gestion des utilisateurs'),
],
selectedTabIndex: 0,
onTabSelected: (_) {},
userDisplayName: _user?.fullName.isNotEmpty == true
? _user!.fullName
: 'Gestionnaire',
userEmail: _user?.email,
userRole: _user?.role,
onProfileTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Modification du profil à venir')),
);
},
onSettingsTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Paramètres à venir')),
);
},
onLogout: () {},
showLogoutConfirmation: true,
),
),
body: Column(
children: [
Expanded(
child: UserManagementPanel(
showAdministrateursTab: false,
allowStaffAccountCreation: false,
),
),
const AppFooter(),
],
),
);
}
}