feat(#131): grille enfants AM, statuts garde et polish champs admin.
Aligne le front sur les statuts enfant back (garde/sans_garde), refond l’onglet Enfants accueillis en grille 2×2 avec correction des places, et unifie les champs validation éditables/lecture seule. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:p_tits_pas/models/enfant_admin_model.dart';
|
||||
import 'package:p_tits_pas/services/user_service.dart';
|
||||
import 'package:p_tits_pas/utils/enfant_status_utils.dart';
|
||||
|
||||
/// Fiche enfant consultation / édition (ticket #138).
|
||||
class AdminChildDetailModal extends StatefulWidget {
|
||||
@@ -29,7 +30,6 @@ class _AdminChildDetailModalState extends State<AdminChildDetailModal> {
|
||||
bool _dirty = false;
|
||||
bool _saving = false;
|
||||
|
||||
static const _statuses = ['a_naitre', 'actif', 'scolarise'];
|
||||
static const _genders = ['H', 'F', 'Autre'];
|
||||
|
||||
static const _labelStyle = TextStyle(
|
||||
@@ -46,7 +46,10 @@ class _AdminChildDetailModalState extends State<AdminChildDetailModal> {
|
||||
_nomCtrl = TextEditingController(text: e.lastName ?? '');
|
||||
_birthCtrl = TextEditingController(text: e.birthDate ?? '');
|
||||
_dueCtrl = TextEditingController(text: e.dueDate ?? '');
|
||||
_status = _statuses.contains(e.status) ? e.status : 'actif';
|
||||
_status = normalizeEnfantStatus(e.status);
|
||||
if (!enfantStatusValues.contains(_status)) {
|
||||
_status = 'sans_garde';
|
||||
}
|
||||
_gender = _normalizeGender(e.gender);
|
||||
_consentPhoto = e.consentPhoto;
|
||||
_isMultiple = e.isMultiple;
|
||||
@@ -213,8 +216,13 @@ class _AdminChildDetailModalState extends State<AdminChildDetailModal> {
|
||||
child: _labeledDropdown(
|
||||
'Statut',
|
||||
_status,
|
||||
_statuses
|
||||
.map((s) => MapEntry(s, _statusLabel(s)))
|
||||
enfantStatusValues
|
||||
.map(
|
||||
(s) => MapEntry(
|
||||
s,
|
||||
enfantStatusLabel(s, gender: _gender),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
(v) => setState(() {
|
||||
_status = v;
|
||||
@@ -388,19 +396,6 @@ class _AdminChildDetailModalState extends State<AdminChildDetailModal> {
|
||||
);
|
||||
}
|
||||
|
||||
String _statusLabel(String status) {
|
||||
switch (status) {
|
||||
case 'a_naitre':
|
||||
return 'À naître';
|
||||
case 'actif':
|
||||
return 'Actif';
|
||||
case 'scolarise':
|
||||
return 'Scolarisé';
|
||||
default:
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
String _genderLabel(String gender) {
|
||||
switch (gender) {
|
||||
case 'H':
|
||||
|
||||
Reference in New Issue
Block a user