feat(#159/#160): suppressions métier dashboard — API + UI (squash develop).
Matrice PO #154 : supprimer dossiers famille/AM, parents, enfants et comptes staff avec règles métier (placements clôturés, sans_enfant, cascade foyer, droits gestionnaire/admin). Poubelle en liste, dialogues de confirmation, garde-fou gestionnaire→gestionnaire. Inclut polish hauteur modale fiche AM.
This commit is contained in:
@@ -13,6 +13,10 @@ class DossierListItem {
|
||||
final String? statut;
|
||||
/// Photo profil (AM) — affichée à la place de l’icône si présente.
|
||||
final String? photoUrl;
|
||||
/// Dossier famille sans enfant lié (#159 / #160).
|
||||
final bool sansEnfant;
|
||||
/// Nombre d’enfants du foyer (famille uniquement ; null pour AM).
|
||||
final int? enfantsCount;
|
||||
|
||||
const DossierListItem({
|
||||
required this.type,
|
||||
@@ -21,8 +25,32 @@ class DossierListItem {
|
||||
this.emails = const [],
|
||||
this.statut,
|
||||
this.photoUrl,
|
||||
this.sansEnfant = false,
|
||||
this.enfantsCount,
|
||||
});
|
||||
|
||||
DossierListItem copyWith({
|
||||
DossierListType? type,
|
||||
String? numeroDossier,
|
||||
String? libelle,
|
||||
List<String>? emails,
|
||||
String? statut,
|
||||
String? photoUrl,
|
||||
bool? sansEnfant,
|
||||
int? enfantsCount,
|
||||
}) {
|
||||
return DossierListItem(
|
||||
type: type ?? this.type,
|
||||
numeroDossier: numeroDossier ?? this.numeroDossier,
|
||||
libelle: libelle ?? this.libelle,
|
||||
emails: emails ?? this.emails,
|
||||
statut: statut ?? this.statut,
|
||||
photoUrl: photoUrl ?? this.photoUrl,
|
||||
sansEnfant: sansEnfant ?? this.sansEnfant,
|
||||
enfantsCount: enfantsCount ?? this.enfantsCount,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isFamille => type == DossierListType.famille;
|
||||
bool get isAm => type == DossierListType.assistanteMaternelle;
|
||||
|
||||
@@ -98,6 +126,19 @@ class DossierListItem {
|
||||
}
|
||||
}
|
||||
|
||||
final childIds = <String>{};
|
||||
var maxCountFallback = 0;
|
||||
for (final p in entry.value) {
|
||||
for (final c in p.children) {
|
||||
final id = c.id.trim();
|
||||
if (id.isNotEmpty) childIds.add(id);
|
||||
}
|
||||
final n = p.children.isNotEmpty ? p.children.length : p.childrenCount;
|
||||
if (n > maxCountFallback) maxCountFallback = n;
|
||||
}
|
||||
final enfantsCount =
|
||||
childIds.isNotEmpty ? childIds.length : maxCountFallback;
|
||||
|
||||
items.add(
|
||||
DossierListItem(
|
||||
type: DossierListType.famille,
|
||||
@@ -105,6 +146,8 @@ class DossierListItem {
|
||||
libelle: names.isNotEmpty ? names.join(' - ') : 'Famille',
|
||||
emails: emails,
|
||||
statut: _preferStatut(statuts),
|
||||
enfantsCount: enfantsCount,
|
||||
sansEnfant: enfantsCount == 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user