feat(#142): ouvrir la modale au clic sur les cartes du dashboard admin.
Unifie le comportement des listes Parents, AM, Enfants, Gestionnaires, Admins et À valider avec le bouton d'action au survol. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
8ed68797aa
commit
7b69f27ca5
@ -122,6 +122,7 @@ class _AdminManagementWidgetState extends State<AdminManagementWidget> {
|
|||||||
fallbackIcon: isSuperAdmin
|
fallbackIcon: isSuperAdmin
|
||||||
? Icons.verified_user_outlined
|
? Icons.verified_user_outlined
|
||||||
: Icons.manage_accounts_outlined,
|
: Icons.manage_accounts_outlined,
|
||||||
|
onCardTap: () => _openAdminEditDialog(user),
|
||||||
subtitleLines: [
|
subtitleLines: [
|
||||||
user.email,
|
user.email,
|
||||||
'Téléphone : ${user.telephone?.trim().isNotEmpty == true ? formatPhoneForDisplay(user.telephone!) : 'Non renseigné'}',
|
'Téléphone : ${user.telephone?.trim().isNotEmpty == true ? formatPhoneForDisplay(user.telephone!) : 'Non renseigné'}',
|
||||||
|
|||||||
@ -83,6 +83,7 @@ class _AssistanteMaternelleManagementWidgetState
|
|||||||
avatarUrl: assistante.user.photoUrl,
|
avatarUrl: assistante.user.photoUrl,
|
||||||
fallbackIcon: Icons.face,
|
fallbackIcon: Icons.face,
|
||||||
vigilanceTooltip: vigilance,
|
vigilanceTooltip: vigilance,
|
||||||
|
onCardTap: () => _openAssistanteDetails(assistante),
|
||||||
subtitleLines: [
|
subtitleLines: [
|
||||||
assistante.user.email,
|
assistante.user.email,
|
||||||
'Zone : ${assistante.residenceCity ?? 'N/A'} | Capacité : ${assistante.maxChildren ?? 0}',
|
'Zone : ${assistante.residenceCity ?? 'N/A'} | Capacité : ${assistante.maxChildren ?? 0}',
|
||||||
|
|||||||
@ -33,6 +33,7 @@ class AdminEnfantUserCard extends StatelessWidget {
|
|||||||
final String? photoUrl;
|
final String? photoUrl;
|
||||||
final List<String> subtitleLines;
|
final List<String> subtitleLines;
|
||||||
final List<Widget> actions;
|
final List<Widget> actions;
|
||||||
|
final VoidCallback? onCardTap;
|
||||||
|
|
||||||
const AdminEnfantUserCard({
|
const AdminEnfantUserCard({
|
||||||
super.key,
|
super.key,
|
||||||
@ -40,12 +41,14 @@ class AdminEnfantUserCard extends StatelessWidget {
|
|||||||
this.photoUrl,
|
this.photoUrl,
|
||||||
required this.subtitleLines,
|
required this.subtitleLines,
|
||||||
this.actions = const [],
|
this.actions = const [],
|
||||||
|
this.onCardTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory AdminEnfantUserCard.fromEnfant(
|
factory AdminEnfantUserCard.fromEnfant(
|
||||||
EnfantAdminModel enfant, {
|
EnfantAdminModel enfant, {
|
||||||
List<String> extraSubtitleLines = const [],
|
List<String> extraSubtitleLines = const [],
|
||||||
List<Widget> actions = const [],
|
List<Widget> actions = const [],
|
||||||
|
VoidCallback? onCardTap,
|
||||||
}) {
|
}) {
|
||||||
final parents = enfant.parentLinks
|
final parents = enfant.parentLinks
|
||||||
.map((l) => l.parentName ?? 'Parent')
|
.map((l) => l.parentName ?? 'Parent')
|
||||||
@ -64,6 +67,7 @@ class AdminEnfantUserCard extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: actions,
|
actions: actions,
|
||||||
|
onCardTap: onCardTap,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +75,7 @@ class AdminEnfantUserCard extends StatelessWidget {
|
|||||||
ParentChildSummary child, {
|
ParentChildSummary child, {
|
||||||
List<String> extraSubtitleLines = const [],
|
List<String> extraSubtitleLines = const [],
|
||||||
List<Widget> actions = const [],
|
List<Widget> actions = const [],
|
||||||
|
VoidCallback? onCardTap,
|
||||||
}) {
|
}) {
|
||||||
return AdminEnfantUserCard(
|
return AdminEnfantUserCard(
|
||||||
title: child.fullName,
|
title: child.fullName,
|
||||||
@ -82,6 +87,7 @@ class AdminEnfantUserCard extends StatelessWidget {
|
|||||||
extra: extraSubtitleLines,
|
extra: extraSubtitleLines,
|
||||||
),
|
),
|
||||||
actions: actions,
|
actions: actions,
|
||||||
|
onCardTap: onCardTap,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +99,7 @@ class AdminEnfantUserCard extends StatelessWidget {
|
|||||||
avatarUrl: photoUrl,
|
avatarUrl: photoUrl,
|
||||||
subtitleLines: subtitleLines,
|
subtitleLines: subtitleLines,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
|
onCardTap: onCardTap,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class AdminUserCard extends StatefulWidget {
|
|||||||
final Color? titleColor;
|
final Color? titleColor;
|
||||||
final Color? infoColor;
|
final Color? infoColor;
|
||||||
final String? vigilanceTooltip;
|
final String? vigilanceTooltip;
|
||||||
|
final VoidCallback? onCardTap;
|
||||||
|
|
||||||
const AdminUserCard({
|
const AdminUserCard({
|
||||||
super.key,
|
super.key,
|
||||||
@ -26,6 +27,7 @@ class AdminUserCard extends StatefulWidget {
|
|||||||
this.titleColor,
|
this.titleColor,
|
||||||
this.infoColor,
|
this.infoColor,
|
||||||
this.vigilanceTooltip,
|
this.vigilanceTooltip,
|
||||||
|
this.onCardTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,11 +48,14 @@ class _AdminUserCardState extends State<AdminUserCard> {
|
|||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
onEnter: (_) => setState(() => _isHovered = true),
|
onEnter: (_) => setState(() => _isHovered = true),
|
||||||
onExit: (_) => setState(() => _isHovered = false),
|
onExit: (_) => setState(() => _isHovered = false),
|
||||||
|
cursor: widget.onCardTap != null
|
||||||
|
? SystemMouseCursors.click
|
||||||
|
: MouseCursor.defer,
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {},
|
onTap: widget.onCardTap,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
hoverColor: const Color(0x149CC5C0),
|
hoverColor: const Color(0x149CC5C0),
|
||||||
child: Card(
|
child: Card(
|
||||||
|
|||||||
@ -84,6 +84,7 @@ class _EnfantManagementWidgetState extends State<EnfantManagementWidget> {
|
|||||||
final enfant = filtered[index];
|
final enfant = filtered[index];
|
||||||
return AdminEnfantUserCard.fromEnfant(
|
return AdminEnfantUserCard.fromEnfant(
|
||||||
enfant,
|
enfant,
|
||||||
|
onCardTap: () => _openEnfant(enfant),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.visibility_outlined),
|
icon: const Icon(Icons.visibility_outlined),
|
||||||
|
|||||||
@ -88,6 +88,7 @@ class _GestionnaireManagementWidgetState
|
|||||||
title: user.fullName,
|
title: user.fullName,
|
||||||
fallbackIcon: Icons.assignment_ind_outlined,
|
fallbackIcon: Icons.assignment_ind_outlined,
|
||||||
avatarUrl: user.photoUrl,
|
avatarUrl: user.photoUrl,
|
||||||
|
onCardTap: () => _openGestionnaireEditDialog(user),
|
||||||
subtitleLines: [
|
subtitleLines: [
|
||||||
user.email,
|
user.email,
|
||||||
'Statut : ${user.statut ?? 'Inconnu'}',
|
'Statut : ${user.statut ?? 'Inconnu'}',
|
||||||
|
|||||||
@ -77,6 +77,7 @@ class _ParentManagementWidgetState extends State<ParentManagementWidget> {
|
|||||||
title: parent.user.fullName,
|
title: parent.user.fullName,
|
||||||
fallbackIcon: Icons.supervisor_account_outlined,
|
fallbackIcon: Icons.supervisor_account_outlined,
|
||||||
avatarUrl: parent.user.photoUrl,
|
avatarUrl: parent.user.photoUrl,
|
||||||
|
onCardTap: () => _openParentDetails(parent),
|
||||||
subtitleLines: [
|
subtitleLines: [
|
||||||
parent.user.email,
|
parent.user.email,
|
||||||
'Statut : ${_displayStatus(parent.user.statut)} | Enfants : ${parent.children.isNotEmpty ? parent.children.length : parent.childrenCount}',
|
'Statut : ${_displayStatus(parent.user.statut)} | Enfants : ${parent.children.isNotEmpty ? parent.children.length : parent.childrenCount}',
|
||||||
|
|||||||
@ -321,11 +321,12 @@ class _PendingValidationRowState extends State<_PendingValidationRow> {
|
|||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
onEnter: (_) => setState(() => _isHovered = true),
|
onEnter: (_) => setState(() => _isHovered = true),
|
||||||
onExit: (_) => setState(() => _isHovered = false),
|
onExit: (_) => setState(() => _isHovered = false),
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {},
|
onTap: widget.onOpen,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
hoverColor: const Color(0x149CC5C0),
|
hoverColor: const Color(0x149CC5C0),
|
||||||
child: Card(
|
child: Card(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user