From 481fa6663008766366d462fc6541a6b9fd40db46 Mon Sep 17 00:00:00 2001 From: Julien Martin Date: Sat, 28 Mar 2026 18:07:46 +0100 Subject: [PATCH] =?UTF-8?q?chore(front):=20supprimer=20le=20pr=C3=A9rempli?= =?UTF-8?q?ssage=20et=20les=20donn=C3=A9es=20al=C3=A9atoires=20=C3=A0=20l?= =?UTF-8?q?=E2=80=99inscription?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Parcours AM : plus de jeu de test Marie DUBOIS ni photo factice - Parcours parent : plus de DataGenerator ; enfants vides à l’ajout - Suppression de data_generator.dart (inutilisé) Made-with: Cursor --- .../auth/am_register_step1_screen.dart | 32 +++------ .../auth/am_register_step2_screen.dart | 33 +-------- .../auth/am_register_step3_screen.dart | 13 +--- .../auth/parent_register_step1_screen.dart | 35 +++------- .../auth/parent_register_step2_screen.dart | 21 +++--- .../auth/parent_register_step3_screen.dart | 17 ++--- .../auth/parent_register_step4_screen.dart | 14 +--- frontend/lib/utils/data_generator.dart | 70 ------------------- 8 files changed, 38 insertions(+), 197 deletions(-) delete mode 100644 frontend/lib/utils/data_generator.dart diff --git a/frontend/lib/screens/auth/am_register_step1_screen.dart b/frontend/lib/screens/auth/am_register_step1_screen.dart index 14a4db1..86df609 100644 --- a/frontend/lib/screens/auth/am_register_step1_screen.dart +++ b/frontend/lib/screens/auth/am_register_step1_screen.dart @@ -13,29 +13,15 @@ class AmRegisterStep1Screen extends StatelessWidget { Widget build(BuildContext context) { final registrationData = Provider.of(context, listen: false); - // Données de test : Marie DUBOIS (jeu de test 03_seed_test_data.sql / docs/test-data) - PersonalInfoData initialData; - if (registrationData.firstName.isEmpty) { - initialData = PersonalInfoData( - firstName: 'Marie', - lastName: 'DUBOIS', - phone: '0696345678', - email: 'marie.dubois@ptits-pas.fr', - address: '25 Rue de la République', - postalCode: '95870', - city: 'Bezons', - ); - } else { - initialData = PersonalInfoData( - firstName: registrationData.firstName, - lastName: registrationData.lastName, - phone: registrationData.phone, - email: registrationData.email, - address: registrationData.streetAddress, - postalCode: registrationData.postalCode, - city: registrationData.city, - ); - } + final initialData = PersonalInfoData( + firstName: registrationData.firstName, + lastName: registrationData.lastName, + phone: registrationData.phone, + email: registrationData.email, + address: registrationData.streetAddress, + postalCode: registrationData.postalCode, + city: registrationData.city, + ); return PersonalInfoFormScreen( stepText: 'Étape 1/4', diff --git a/frontend/lib/screens/auth/am_register_step2_screen.dart b/frontend/lib/screens/auth/am_register_step2_screen.dart index bf354d4..362a317 100644 --- a/frontend/lib/screens/auth/am_register_step2_screen.dart +++ b/frontend/lib/screens/auth/am_register_step2_screen.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:go_router/go_router.dart'; -import 'package:intl/intl.dart'; -import 'dart:io'; import '../../models/am_registration_data.dart'; import '../../models/card_assets.dart'; @@ -17,24 +15,9 @@ class AmRegisterStep2Screen extends StatefulWidget { class _AmRegisterStep2ScreenState extends State { String? _photoPathFramework; - File? _photoFile; Future _pickPhoto() async { - // TODO: Remplacer par la vraie logique ImagePicker - // final imagePicker = ImagePicker(); - // final pickedFile = await imagePicker.pickImage(source: ImageSource.gallery); - // if (pickedFile != null) { - // setState(() { - // _photoFile = File(pickedFile.path); - // _photoPathFramework = pickedFile.path; - // }); - // } else { - setState(() { - _photoPathFramework = 'assets/images/icon_assmat.png'; - _photoFile = null; - }); - // } - print("Photo sélectionnée: $_photoPathFramework"); + // TODO: brancher ImagePicker ; ne pas préremplir de chemin factice } @override @@ -53,20 +36,6 @@ class _AmRegisterStep2ScreenState extends State { capacity: registrationData.capacity, ); - // Données de test : Marie DUBOIS (jeu de test 03_seed_test_data.sql / docs/test-data) - if (registrationData.dateOfBirth == null && registrationData.nir.isEmpty) { - initialData = ProfessionalInfoData( - photoPath: 'assets/images/icon_assmat.png', - photoConsent: true, - dateOfBirth: DateTime(1980, 6, 8), - birthCity: 'Bezons', - birthCountry: 'France', - nir: '280062A00100191', - agrementNumber: 'AGR-2019-095001', - capacity: 4, - ); - } - return ProfessionalInfoFormScreen( stepText: 'Étape 2/4', title: 'Vos informations professionnelles', diff --git a/frontend/lib/screens/auth/am_register_step3_screen.dart b/frontend/lib/screens/auth/am_register_step3_screen.dart index 7bda43f..3d77845 100644 --- a/frontend/lib/screens/auth/am_register_step3_screen.dart +++ b/frontend/lib/screens/auth/am_register_step3_screen.dart @@ -13,22 +13,13 @@ class AmRegisterStep3Screen extends StatelessWidget { Widget build(BuildContext context) { final data = Provider.of(context, listen: false); - // Données de test : Marie DUBOIS (jeu de test 03_seed_test_data.sql / docs/test-data) - String initialText = data.presentationText; - bool initialCgu = data.cguAccepted; - - if (initialText.isEmpty) { - initialText = 'Assistante maternelle agréée depuis 2019. Spécialité bébés 0-18 mois. Accueil bienveillant et cadre sécurisant. 2 places disponibles.'; - initialCgu = true; - } - return PresentationFormScreen( stepText: 'Étape 3/4', title: 'Présentation et Conditions', cardColor: CardColorHorizontal.peach, textFieldHint: 'Ex: Disponible immédiatement, 10 ans d\'expérience, formation premiers secours...', - initialText: initialText, - initialCguAccepted: initialCgu, + initialText: data.presentationText, + initialCguAccepted: data.cguAccepted, previousRoute: '/am-register-step2', onSubmit: (text, cguAccepted) { data.updatePresentationAndCgu( diff --git a/frontend/lib/screens/auth/parent_register_step1_screen.dart b/frontend/lib/screens/auth/parent_register_step1_screen.dart index bfabab3..becad34 100644 --- a/frontend/lib/screens/auth/parent_register_step1_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step1_screen.dart @@ -3,7 +3,6 @@ import 'package:provider/provider.dart'; import 'package:go_router/go_router.dart'; import '../../models/user_registration_data.dart'; -import '../../utils/data_generator.dart'; import '../../widgets/personal_info_form_screen.dart'; import '../../models/card_assets.dart'; @@ -15,31 +14,15 @@ class ParentRegisterStep1Screen extends StatelessWidget { final registrationData = Provider.of(context, listen: false); final parent1 = registrationData.parent1; - // Générer des données de test si vide - PersonalInfoData initialData; - if (parent1.firstName.isEmpty) { - final genFirstName = DataGenerator.firstName(); - final genLastName = DataGenerator.lastName(); - initialData = PersonalInfoData( - firstName: genFirstName, - lastName: genLastName, - phone: DataGenerator.phone(), - email: DataGenerator.email(genFirstName, genLastName), - address: DataGenerator.address(), - postalCode: DataGenerator.postalCode(), - city: DataGenerator.city(), - ); - } else { - initialData = PersonalInfoData( - firstName: parent1.firstName, - lastName: parent1.lastName, - phone: parent1.phone, - email: parent1.email, - address: parent1.address, - postalCode: parent1.postalCode, - city: parent1.city, - ); - } + final initialData = PersonalInfoData( + firstName: parent1.firstName, + lastName: parent1.lastName, + phone: parent1.phone, + email: parent1.email, + address: parent1.address, + postalCode: parent1.postalCode, + city: parent1.city, + ); return PersonalInfoFormScreen( stepText: 'Étape 1/5', diff --git a/frontend/lib/screens/auth/parent_register_step2_screen.dart b/frontend/lib/screens/auth/parent_register_step2_screen.dart index efa3277..af9b9a2 100644 --- a/frontend/lib/screens/auth/parent_register_step2_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step2_screen.dart @@ -3,7 +3,6 @@ import 'package:provider/provider.dart'; import 'package:go_router/go_router.dart'; import '../../models/user_registration_data.dart'; -import '../../utils/data_generator.dart'; import '../../widgets/personal_info_form_screen.dart'; import '../../models/card_assets.dart'; @@ -19,21 +18,17 @@ class ParentRegisterStep2Screen extends StatelessWidget { bool hasParent2 = parent2 != null; bool sameAddress = false; - // Générer des données de test si vide PersonalInfoData initialData; if (parent2 == null || parent2.firstName.isEmpty) { - final genFirstName = DataGenerator.firstName(); - final genLastName = DataGenerator.lastName(); - sameAddress = DataGenerator.boolean(); - + sameAddress = false; initialData = PersonalInfoData( - firstName: genFirstName, - lastName: genLastName, - phone: DataGenerator.phone(), - email: DataGenerator.email(genFirstName, genLastName), - address: sameAddress ? parent1.address : DataGenerator.address(), - postalCode: sameAddress ? parent1.postalCode : DataGenerator.postalCode(), - city: sameAddress ? parent1.city : DataGenerator.city(), + firstName: parent2?.firstName ?? '', + lastName: parent2?.lastName ?? '', + phone: parent2?.phone ?? '', + email: parent2?.email ?? '', + address: parent2?.address ?? '', + postalCode: parent2?.postalCode ?? '', + city: parent2?.city ?? '', ); } else { sameAddress = (parent2.address == parent1.address && diff --git a/frontend/lib/screens/auth/parent_register_step3_screen.dart b/frontend/lib/screens/auth/parent_register_step3_screen.dart index 12e472b..029cf79 100644 --- a/frontend/lib/screens/auth/parent_register_step3_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step3_screen.dart @@ -7,7 +7,6 @@ import '../../widgets/hover_relief_widget.dart'; import '../../widgets/child_card_widget.dart'; import '../../widgets/custom_navigation_button.dart'; import '../../models/user_registration_data.dart'; -import '../../utils/data_generator.dart'; import '../../models/card_assets.dart'; import '../../config/display_config.dart'; import 'package:provider/provider.dart'; @@ -92,8 +91,6 @@ class _ParentRegisterStep3ScreenState extends State { void _addChild(UserRegistrationData registrationData) { // Prend registrationData setState(() { - bool isUnborn = DataGenerator.boolean(); - // Trouver la première couleur non utilisée CardColorVertical cardColor = _childCardColors.firstWhere( (color) => !_usedColors.contains(color), @@ -102,11 +99,11 @@ class _ParentRegisterStep3ScreenState extends State { final newChild = ChildData( lastName: registrationData.parent1.lastName, - firstName: DataGenerator.firstName(), - dob: DataGenerator.dob(isUnborn: isUnborn), - isUnbornChild: isUnborn, - photoConsent: DataGenerator.boolean(), - multipleBirth: DataGenerator.boolean(), + firstName: '', + dob: '', + isUnbornChild: false, + photoConsent: false, + multipleBirth: false, cardColor: cardColor, ); registrationData.addChild(newChild); @@ -317,7 +314,7 @@ class _ParentRegisterStep3ScreenState extends State { onToggleIsUnborn: (newValue) { final oldChild = registrationData.children[index]; registrationData.updateChild(index, ChildData( - firstName: oldChild.firstName, lastName: oldChild.lastName, dob: DataGenerator.dob(isUnborn: newValue), + firstName: oldChild.firstName, lastName: oldChild.lastName, dob: oldChild.dob, photoConsent: oldChild.photoConsent, multipleBirth: oldChild.multipleBirth, isUnbornChild: newValue, imageFile: oldChild.imageFile, cardColor: oldChild.cardColor )); @@ -423,7 +420,7 @@ class _ParentRegisterStep3ScreenState extends State { onToggleIsUnborn: (newValue) { final oldChild = registrationData.children[index]; registrationData.updateChild(index, ChildData( - firstName: oldChild.firstName, lastName: oldChild.lastName, dob: DataGenerator.dob(isUnborn: newValue), + firstName: oldChild.firstName, lastName: oldChild.lastName, dob: oldChild.dob, photoConsent: oldChild.photoConsent, multipleBirth: oldChild.multipleBirth, isUnbornChild: newValue, imageFile: oldChild.imageFile, cardColor: oldChild.cardColor )); diff --git a/frontend/lib/screens/auth/parent_register_step4_screen.dart b/frontend/lib/screens/auth/parent_register_step4_screen.dart index 10ae74d..f5a4ec8 100644 --- a/frontend/lib/screens/auth/parent_register_step4_screen.dart +++ b/frontend/lib/screens/auth/parent_register_step4_screen.dart @@ -5,7 +5,6 @@ import 'package:go_router/go_router.dart'; import '../../models/user_registration_data.dart'; import '../../widgets/presentation_form_screen.dart'; import '../../models/card_assets.dart'; -import '../../utils/data_generator.dart'; class ParentRegisterStep4Screen extends StatelessWidget { const ParentRegisterStep4Screen({super.key}); @@ -14,22 +13,13 @@ class ParentRegisterStep4Screen extends StatelessWidget { Widget build(BuildContext context) { final registrationData = Provider.of(context, listen: false); - // Générer un texte de test si vide - String initialText = registrationData.motivationText; - bool initialCgu = registrationData.cguAccepted; - - if (initialText.isEmpty) { - initialText = DataGenerator.motivation(); - initialCgu = true; - } - return PresentationFormScreen( stepText: 'Étape 4/5', title: 'Motivation de votre demande', cardColor: CardColorHorizontal.green, textFieldHint: 'Écrivez ici pour motiver votre demande...', - initialText: initialText, - initialCguAccepted: initialCgu, + initialText: registrationData.motivationText, + initialCguAccepted: registrationData.cguAccepted, previousRoute: '/parent-register-step3', onSubmit: (text, cguAccepted) { registrationData.updateMotivation(text); diff --git a/frontend/lib/utils/data_generator.dart b/frontend/lib/utils/data_generator.dart deleted file mode 100644 index d7ffde5..0000000 --- a/frontend/lib/utils/data_generator.dart +++ /dev/null @@ -1,70 +0,0 @@ -import 'dart:math'; - -class DataGenerator { - static final Random _random = Random(); - - // Méthodes publiques pour la génération de nombres aléatoires - static int randomInt(int max) => _random.nextInt(max); - static int randomIntInRange(int min, int max) => min + _random.nextInt(max - min); - static bool randomBool() => _random.nextBool(); - - static final List _firstNames = [ - 'Alice', 'Bob', 'Charlie', 'David', 'Eva', 'Félix', 'Gabrielle', 'Hugo', 'Inès', 'Jules', - 'Léa', 'Manon', 'Nathan', 'Oscar', 'Pauline', 'Quentin', 'Raphaël', 'Sophie', 'Théo', 'Victoire' - ]; - - static final List _lastNames = [ - 'Martin', 'Bernard', 'Dubois', 'Thomas', 'Robert', 'Richard', 'Petit', 'Durand', 'Leroy', 'Moreau', - 'Simon', 'Laurent', 'Lefebvre', 'Michel', 'Garcia', 'David', 'Bertrand', 'Roux', 'Vincent', 'Fournier' - ]; - - static final List _addressSuffixes = [ - 'Rue de la Paix', 'Boulevard des Rêves', 'Avenue du Soleil', 'Place des Étoiles', 'Chemin des Champs' - ]; - - static final List _motivationSnippets = [ - 'Nous cherchons une personne de confiance.', - 'Nos horaires sont atypiques.', - 'Notre enfant est plein de vie.', - 'Nous souhaitons une garde à temps plein.', - 'Une adaptation en douceur est primordiale pour nous.', - 'Nous avons hâte de vous rencontrer.', - 'La pédagogie Montessori nous intéresse.' - ]; - - static String firstName() => _firstNames[_random.nextInt(_firstNames.length)]; - static String lastName() => _lastNames[_random.nextInt(_lastNames.length)]; - static String address() => "${_random.nextInt(100) + 1} ${_addressSuffixes[_random.nextInt(_addressSuffixes.length)]}"; - static String postalCode() => "750${_random.nextInt(10)}${_random.nextInt(10)}"; - static String city() => "Paris"; - static String phone() => "06${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}"; - static String email(String firstName, String lastName) => "${firstName.toLowerCase()}.${lastName.toLowerCase()}@example.com"; - static String password() => "password123"; // Simple pour le test - - static String dob({bool isUnborn = false}) { - final now = DateTime.now(); - if (isUnborn) { - final provisionalDate = now.add(Duration(days: _random.nextInt(180) + 30)); // Entre 1 et 7 mois dans le futur - return "${provisionalDate.day.toString().padLeft(2, '0')}/${provisionalDate.month.toString().padLeft(2, '0')}/${provisionalDate.year}"; - } else { - final birthYear = now.year - _random.nextInt(3); // Enfants de 0 à 2 ans - final birthMonth = _random.nextInt(12) + 1; - final birthDay = _random.nextInt(28) + 1; // Simple, évite les pbs de jours/mois - return "${birthDay.toString().padLeft(2, '0')}/${birthMonth.toString().padLeft(2, '0')}/${birthYear}"; - } - } - - static bool boolean() => _random.nextBool(); - - static String motivation() { - int count = _random.nextInt(3) + 2; // 2 à 4 phrases - List chosenSnippets = []; - while(chosenSnippets.length < count) { - String snippet = _motivationSnippets[_random.nextInt(_motivationSnippets.length)]; - if (!chosenSnippets.contains(snippet)) { - chosenSnippets.add(snippet); - } - } - return chosenSnippets.join(' '); - } -} \ No newline at end of file