fix(inscription-am): étape 1/2 obligatoires alignées API (min 2 car., photo)
- Étape 1 : prénom/nom min 2 caractères (minPersonNameLength sur PersonalInfoFormScreen pour AM) - Étape 2 : ville/pays naissance min 2 ; photo réelle + consentement obligatoires ; isStep2Complete strict - registerAM : lieu naissance trim + toujours envoyer photo_base64 ; lieu_* non null si valide - Étape 4 : blocage envoi si isRegistrationComplete faux Made-with: Cursor
This commit is contained in:
@@ -168,6 +168,13 @@ class AuthService {
|
||||
if (data.placesAvailable == null) {
|
||||
throw Exception('Le nombre de places disponibles est requis.');
|
||||
}
|
||||
final lieuVille = data.birthCity.trim();
|
||||
final lieuPays = data.birthCountry.trim();
|
||||
if (lieuVille.length < 2 || lieuPays.length < 2) {
|
||||
throw Exception(
|
||||
'La ville et le pays de naissance sont requis (au moins 2 caractères chacun).',
|
||||
);
|
||||
}
|
||||
String? photoBase64;
|
||||
String? photoFilename;
|
||||
|
||||
@@ -193,6 +200,10 @@ class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
if (photoBase64 == null || photoBase64.isEmpty) {
|
||||
throw Exception('Une photo de profil est requise pour finaliser l’inscription.');
|
||||
}
|
||||
|
||||
final body = <String, dynamic>{
|
||||
'email': data.email,
|
||||
'prenom': data.firstName,
|
||||
@@ -201,14 +212,14 @@ class AuthService {
|
||||
'adresse': data.streetAddress.isNotEmpty ? data.streetAddress : null,
|
||||
'code_postal': data.postalCode.isNotEmpty ? data.postalCode : null,
|
||||
'ville': data.city.isNotEmpty ? data.city : null,
|
||||
if (photoBase64 != null) 'photo_base64': photoBase64,
|
||||
if (photoBase64 != null) 'photo_filename': photoFilename ?? 'photo_am.jpg',
|
||||
'photo_base64': photoBase64,
|
||||
'photo_filename': photoFilename ?? 'photo_am.jpg',
|
||||
'consentement_photo': data.photoConsent,
|
||||
'date_naissance': data.dateOfBirth != null
|
||||
? '${data.dateOfBirth!.year}-${data.dateOfBirth!.month.toString().padLeft(2, '0')}-${data.dateOfBirth!.day.toString().padLeft(2, '0')}'
|
||||
: null,
|
||||
'lieu_naissance_ville': data.birthCity.isNotEmpty ? data.birthCity : null,
|
||||
'lieu_naissance_pays': data.birthCountry.isNotEmpty ? data.birthCountry : null,
|
||||
'lieu_naissance_ville': lieuVille,
|
||||
'lieu_naissance_pays': lieuPays,
|
||||
'nir': normalizeNir(data.nir),
|
||||
'numero_agrement': data.agrementNumber,
|
||||
'date_agrement':
|
||||
|
||||
Reference in New Issue
Block a user