From 9ae6533b4d8281736949aff9f459cf55116b9b79 Mon Sep 17 00:00:00 2001 From: Julien Martin Date: Mon, 1 Dec 2025 23:19:58 +0100 Subject: [PATCH] =?UTF-8?q?feat(#36):=20Inscription=20Parent=20-=20=C3=89t?= =?UTF-8?q?ape=201=20(Parent=201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend: - Retrait des champs non-CDC: profession, situation_familiale, date_naissance - Nettoyage des DTOs RegisterParentCompletDto et RegisterParentDto - Mise à jour de la logique dans auth.service.ts (inscrireParentComplet et legacy) Frontend Step1: - Suppression des champs mot de passe et confirmation - Correction de l'indicateur d'étape: 1/5 → 1/6 - Améliorations visuelles: * Taille des labels: 18 → 22px * Taille de police des champs: 18 → 20px * Espacement entre champs: 20 → 32px * Meilleure répartition verticale avec spaceEvenly Note: Le champ password est conservé dans le modèle ParentData pour compatibilité avec Step2 --- backend/src/routes/auth/auth.service.ts | 12 ---- .../auth/dto/register-parent-complet.dto.ts | 16 ----- .../routes/auth/dto/register-parent.dto.ts | 16 ----- .../parent/parent_register_step1_screen.dart | 67 +++++++------------ 4 files changed, 25 insertions(+), 86 deletions(-) diff --git a/backend/src/routes/auth/auth.service.ts b/backend/src/routes/auth/auth.service.ts index 4184fd0..0dbdfd5 100644 --- a/backend/src/routes/auth/auth.service.ts +++ b/backend/src/routes/auth/auth.service.ts @@ -200,16 +200,10 @@ export class AuthService { adresse: dto.adresse, code_postal: dto.code_postal, ville: dto.ville, - profession: dto.profession, - situation_familiale: dto.situation_familiale, token_creation_mdp: tokenCreationMdp, token_creation_mdp_expire_le: tokenExpiration, }); - if (dto.date_naissance) { - parent1.date_naissance = new Date(dto.date_naissance); - } - const savedParent1 = await manager.save(Users, parent1); // Créer Parent 2 si renseigné @@ -327,16 +321,10 @@ export class AuthService { adresse: dto.adresse, code_postal: dto.code_postal, ville: dto.ville, - profession: dto.profession, - situation_familiale: dto.situation_familiale, token_creation_mdp: tokenCreationMdp, token_creation_mdp_expire_le: dateExpiration, }); - if (dto.date_naissance) { - parent1.date_naissance = new Date(dto.date_naissance); - } - const parent1Enregistre = await manager.save(Users, parent1); let parent2Enregistre: Users | null = null; diff --git a/backend/src/routes/auth/dto/register-parent-complet.dto.ts b/backend/src/routes/auth/dto/register-parent-complet.dto.ts index bfc062a..7d1c36a 100644 --- a/backend/src/routes/auth/dto/register-parent-complet.dto.ts +++ b/backend/src/routes/auth/dto/register-parent-complet.dto.ts @@ -66,22 +66,6 @@ export class RegisterParentCompletDto { @MaxLength(150) ville?: string; - @ApiProperty({ example: 'Infirmière', required: false }) - @IsOptional() - @IsString() - @MaxLength(150) - profession?: string; - - @ApiProperty({ enum: SituationFamilialeType, example: SituationFamilialeType.MARIE, required: false }) - @IsOptional() - @IsEnum(SituationFamilialeType) - situation_familiale?: SituationFamilialeType; - - @ApiProperty({ example: '1990-04-03', required: false }) - @IsOptional() - @IsDateString() - date_naissance?: string; - // ============================================ // ÉTAPE 2 : PARENT 2 / CO-PARENT (Optionnel) // ============================================ diff --git a/backend/src/routes/auth/dto/register-parent.dto.ts b/backend/src/routes/auth/dto/register-parent.dto.ts index 92b57a8..a022724 100644 --- a/backend/src/routes/auth/dto/register-parent.dto.ts +++ b/backend/src/routes/auth/dto/register-parent.dto.ts @@ -59,22 +59,6 @@ export class RegisterParentDto { @MaxLength(150) ville?: string; - @ApiProperty({ example: 'Infirmière', required: false }) - @IsOptional() - @IsString() - @MaxLength(150) - profession?: string; - - @ApiProperty({ enum: SituationFamilialeType, example: SituationFamilialeType.MARIE, required: false }) - @IsOptional() - @IsEnum(SituationFamilialeType) - situation_familiale?: SituationFamilialeType; - - @ApiProperty({ example: '1990-04-03', required: false }) - @IsOptional() - @IsDateString() - date_naissance?: string; - // === Informations co-parent (optionnel) === @ApiProperty({ example: 'thomas.martin@ptits-pas.fr', required: false }) @IsOptional() diff --git a/frontend/lib/screens/auth/parent/parent_register_step1_screen.dart b/frontend/lib/screens/auth/parent/parent_register_step1_screen.dart index 9058360..194208a 100644 --- a/frontend/lib/screens/auth/parent/parent_register_step1_screen.dart +++ b/frontend/lib/screens/auth/parent/parent_register_step1_screen.dart @@ -22,11 +22,9 @@ class _ParentRegisterStep1ScreenState extends State { final _firstNameController = TextEditingController(); final _phoneController = TextEditingController(); final _emailController = TextEditingController(); - final _passwordController = TextEditingController(); - final _confirmPasswordController = TextEditingController(); - final _addressController = TextEditingController(); // Rue seule - final _postalCodeController = TextEditingController(); // Restauré - final _cityController = TextEditingController(); // Restauré + final _addressController = TextEditingController(); + final _postalCodeController = TextEditingController(); + final _cityController = TextEditingController(); @override void initState() { @@ -48,8 +46,6 @@ class _ParentRegisterStep1ScreenState extends State { _lastNameController.text = genLastName; _phoneController.text = DataGenerator.phone(); _emailController.text = DataGenerator.email(genFirstName, genLastName); - _passwordController.text = DataGenerator.password(); - _confirmPasswordController.text = _passwordController.text; } @override @@ -58,8 +54,6 @@ class _ParentRegisterStep1ScreenState extends State { _firstNameController.dispose(); _phoneController.dispose(); _emailController.dispose(); - _passwordController.dispose(); - _confirmPasswordController.dispose(); _addressController.dispose(); _postalCodeController.dispose(); _cityController.dispose(); @@ -88,9 +82,9 @@ class _ParentRegisterStep1ScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - // Indicateur d'étape (à rendre dynamique) + // Indicateur d'étape Text( - 'Étape 1/5', + 'Étape 1/6', style: GoogleFonts.merienda(fontSize: 16, color: Colors.black54), ), const SizedBox(height: 10), @@ -121,54 +115,43 @@ class _ParentRegisterStep1ScreenState extends State { key: _formKey, child: Column( mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ + const SizedBox(height: 10), Row( children: [ - Expanded(flex: 12, child: CustomAppTextField(controller: _lastNameController, labelText: 'Nom', hintText: 'Votre nom de famille', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity)), - Expanded(flex: 1, child: const SizedBox()), // Espace de 4% - Expanded(flex: 12, child: CustomAppTextField(controller: _firstNameController, labelText: 'Prénom', hintText: 'Votre prénom', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity)), + Expanded(flex: 12, child: CustomAppTextField(controller: _lastNameController, labelText: 'Nom', hintText: 'Votre nom de famille', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, labelFontSize: 22.0, inputFontSize: 20.0)), + Expanded(flex: 1, child: const SizedBox()), + Expanded(flex: 12, child: CustomAppTextField(controller: _firstNameController, labelText: 'Prénom', hintText: 'Votre prénom', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, labelFontSize: 22.0, inputFontSize: 20.0)), ], ), - const SizedBox(height: 20), + const SizedBox(height: 32), Row( children: [ - Expanded(flex: 12, child: CustomAppTextField(controller: _phoneController, labelText: 'Téléphone', keyboardType: TextInputType.phone, hintText: 'Votre numéro de téléphone', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity)), - Expanded(flex: 1, child: const SizedBox()), // Espace de 4% - Expanded(flex: 12, child: CustomAppTextField(controller: _emailController, labelText: 'Email', keyboardType: TextInputType.emailAddress, hintText: 'Votre adresse e-mail', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity)), + Expanded(flex: 12, child: CustomAppTextField(controller: _phoneController, labelText: 'Téléphone', keyboardType: TextInputType.phone, hintText: 'Votre numéro de téléphone', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, labelFontSize: 22.0, inputFontSize: 20.0)), + Expanded(flex: 1, child: const SizedBox()), + Expanded(flex: 12, child: CustomAppTextField(controller: _emailController, labelText: 'Email', keyboardType: TextInputType.emailAddress, hintText: 'Votre adresse e-mail', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, labelFontSize: 22.0, inputFontSize: 20.0)), ], ), - const SizedBox(height: 20), - Row( - children: [ - Expanded(flex: 12, child: CustomAppTextField(controller: _passwordController, labelText: 'Mot de passe', obscureText: true, hintText: 'Créez votre mot de passe', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, validator: (value) { - if (value == null || value.isEmpty) return 'Mot de passe requis'; - if (value.length < 6) return '6 caractères minimum'; - return null; - })), - Expanded(flex: 1, child: const SizedBox()), // Espace de 4% - Expanded(flex: 12, child: CustomAppTextField(controller: _confirmPasswordController, labelText: 'Confirmation', obscureText: true, hintText: 'Confirmez le mot de passe', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, validator: (value) { - if (value == null || value.isEmpty) return 'Confirmation requise'; - if (value != _passwordController.text) return 'Ne correspond pas'; - return null; - })), - ], - ), - const SizedBox(height: 20), + const SizedBox(height: 32), CustomAppTextField( controller: _addressController, labelText: 'Adresse (N° et Rue)', hintText: 'Numéro et nom de votre rue', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, + labelFontSize: 22.0, + inputFontSize: 20.0, ), - const SizedBox(height: 20), + const SizedBox(height: 32), Row( children: [ - Expanded(flex: 1, child: CustomAppTextField(controller: _postalCodeController, labelText: 'Code Postal', keyboardType: TextInputType.number, hintText: 'Code postal', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity)), + Expanded(flex: 1, child: CustomAppTextField(controller: _postalCodeController, labelText: 'Code Postal', keyboardType: TextInputType.number, hintText: 'Code postal', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, labelFontSize: 22.0, inputFontSize: 20.0)), const SizedBox(width: 20), - Expanded(flex: 4, child: CustomAppTextField(controller: _cityController, labelText: 'Ville', hintText: 'Votre ville', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity)), + Expanded(flex: 4, child: CustomAppTextField(controller: _cityController, labelText: 'Ville', hintText: 'Votre ville', style: CustomAppTextFieldStyle.beige, fieldWidth: double.infinity, labelFontSize: 22.0, inputFontSize: 20.0)), ], ), + const SizedBox(height: 10), ], ), ), @@ -205,12 +188,12 @@ class _ParentRegisterStep1ScreenState extends State { ParentData( firstName: _firstNameController.text, lastName: _lastNameController.text, - address: _addressController.text, // Rue - postalCode: _postalCodeController.text, // Ajout - city: _cityController.text, // Ajout + address: _addressController.text, + postalCode: _postalCodeController.text, + city: _cityController.text, phone: _phoneController.text, email: _emailController.text, - password: _passwordController.text, + password: '', // Pas de mot de passe à cette étape ) ); Navigator.pushNamed(context, '/parent-register/step2', arguments: _registrationData);