fix(#112): préremplissage AM complet en reprise + lien login repositionné
Parse dates/places/consentement de façon robuste, rafraîchit l'étape 2 AM et place « J'ai un numéro de dossier » sous « Créer un compte ». Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:p_tits_pas/models/dossier_unifie.dart';
|
||||
import 'package:p_tits_pas/utils/reprise_mapper.dart';
|
||||
|
||||
/// Réponse GET /auth/reprise-dossier. Tickets #111, #112.
|
||||
class RepriseDossier {
|
||||
@@ -20,7 +21,7 @@ class RepriseDossier {
|
||||
final List<EnfantDossier> enfants;
|
||||
final String? texteMotivation;
|
||||
|
||||
final bool? consentementPhoto;
|
||||
final bool consentementPhoto;
|
||||
final String? dateNaissance;
|
||||
final String? lieuNaissanceVille;
|
||||
final String? lieuNaissancePays;
|
||||
@@ -48,7 +49,7 @@ class RepriseDossier {
|
||||
this.parents = const [],
|
||||
this.enfants = const [],
|
||||
this.texteMotivation,
|
||||
this.consentementPhoto,
|
||||
this.consentementPhoto = false,
|
||||
this.dateNaissance,
|
||||
this.lieuNaissanceVille,
|
||||
this.lieuNaissancePays,
|
||||
@@ -80,9 +81,6 @@ class RepriseDossier {
|
||||
.toList()
|
||||
: <EnfantDossier>[];
|
||||
|
||||
final nbMax = json['nb_max_enfants'];
|
||||
final places = json['place_disponible'];
|
||||
|
||||
return RepriseDossier(
|
||||
id: json['id']?.toString() ?? '',
|
||||
email: json['email']?.toString() ?? '',
|
||||
@@ -101,17 +99,22 @@ class RepriseDossier {
|
||||
enfants: enfantsList,
|
||||
texteMotivation: (json['texte_motivation'] ?? json['presentation_dossier'])
|
||||
?.toString(),
|
||||
consentementPhoto: json['consentement_photo'] == true,
|
||||
dateNaissance: json['date_naissance']?.toString(),
|
||||
consentementPhoto: RepriseMapper.optionalBool(json['consentement_photo']) ||
|
||||
RepriseMapper.optionalBool(json['consent_photo']),
|
||||
dateNaissance: RepriseMapper.optionalDateString(json['date_naissance']),
|
||||
lieuNaissanceVille: json['lieu_naissance_ville']?.toString(),
|
||||
lieuNaissancePays: json['lieu_naissance_pays']?.toString(),
|
||||
numeroAgrement: json['numero_agrement']?.toString(),
|
||||
numeroAgrement: (json['numero_agrement'] ?? json['numero_agrement_am'])
|
||||
?.toString(),
|
||||
nir: json['nir']?.toString(),
|
||||
dateAgrement: json['date_agrement']?.toString(),
|
||||
nbMaxEnfants: nbMax is int ? nbMax : (nbMax is num ? nbMax.toInt() : null),
|
||||
placeDisponible:
|
||||
places is int ? places : (places is num ? places.toInt() : null),
|
||||
biographie: json['biographie']?.toString(),
|
||||
dateAgrement: RepriseMapper.optionalDateString(json['date_agrement']),
|
||||
nbMaxEnfants: RepriseMapper.optionalInt(
|
||||
json['nb_max_enfants'] ?? json['capacite_accueil'],
|
||||
),
|
||||
placeDisponible: RepriseMapper.optionalInt(
|
||||
json['place_disponible'] ?? json['places_disponibles'],
|
||||
),
|
||||
biographie: (json['biographie'] ?? json['presentation'])?.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user