feat(#138): refonte modale enfant admin en format paysage.
Alignement sur les fiches AM/parent : photo identité, champs en grille, zone AM rattachable (y compris à naître) ou carte scolarisation, suppression réservée au super_admin et ouverture au clic sur la carte depuis la fiche parent. Refs: #138 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
77d952a6f7
commit
7951c38d4d
@ -478,6 +478,25 @@ class UserService {
|
|||||||
return EnfantAdminModel.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
return EnfantAdminModel.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<void> deleteEnfant(String enfantId) async {
|
||||||
|
final response = await http.delete(
|
||||||
|
Uri.parse('${ApiConfig.baseUrl}${ApiConfig.enfants}/$enfantId'),
|
||||||
|
headers: await _headers(),
|
||||||
|
);
|
||||||
|
if (response.statusCode != 200 && response.statusCode != 204) {
|
||||||
|
throw Exception(_extractErrorMessage(response.body, 'Erreur suppression enfant'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// AM dont la liste d'enfants actifs contient [enfantId] (API actuelle).
|
||||||
|
static Future<AssistanteMaternelleModel?> findAmForEnfant(String enfantId) async {
|
||||||
|
final ams = await getAssistantesMaternelles();
|
||||||
|
for (final am in ams) {
|
||||||
|
if (am.children.any((c) => c.id == enfantId)) return am;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
static ParentModel _parentModelFromBody(String body) {
|
static ParentModel _parentModelFromBody(String body) {
|
||||||
final decoded = jsonDecode(body);
|
final decoded = jsonDecode(body);
|
||||||
return ParentModel.fromJson(
|
return ParentModel.fromJson(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -64,6 +64,7 @@ class AdminChildrenAffiliationPanel extends StatelessWidget {
|
|||||||
final c = children[i];
|
final c = children[i];
|
||||||
return AdminEnfantUserCard.fromSummary(
|
return AdminEnfantUserCard.fromSummary(
|
||||||
c,
|
c,
|
||||||
|
onCardTap: () => onOpen(c),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.visibility_outlined),
|
icon: const Icon(Icons.visibility_outlined),
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class AdminUserCard extends StatefulWidget {
|
|||||||
final Color? infoColor;
|
final Color? infoColor;
|
||||||
final String? vigilanceTooltip;
|
final String? vigilanceTooltip;
|
||||||
final VoidCallback? onCardTap;
|
final VoidCallback? onCardTap;
|
||||||
|
final EdgeInsetsGeometry? margin;
|
||||||
|
|
||||||
const AdminUserCard({
|
const AdminUserCard({
|
||||||
super.key,
|
super.key,
|
||||||
@ -28,6 +29,7 @@ class AdminUserCard extends StatefulWidget {
|
|||||||
this.infoColor,
|
this.infoColor,
|
||||||
this.vigilanceTooltip,
|
this.vigilanceTooltip,
|
||||||
this.onCardTap,
|
this.onCardTap,
|
||||||
|
this.margin,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -59,7 +61,7 @@ class _AdminUserCardState extends State<AdminUserCard> {
|
|||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
hoverColor: const Color(0x149CC5C0),
|
hoverColor: const Color(0x149CC5C0),
|
||||||
child: Card(
|
child: Card(
|
||||||
margin: const EdgeInsets.only(bottom: 12),
|
margin: widget.margin ?? const EdgeInsets.only(bottom: 12),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
color: widget.backgroundColor,
|
color: widget.backgroundColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user