Compare commits
2 Commits
579b6cae90
...
bde97c24db
| Author | SHA1 | Date | |
|---|---|---|---|
| bde97c24db | |||
| 9ae6533b4d |
@ -200,16 +200,10 @@ export class AuthService {
|
|||||||
adresse: dto.adresse,
|
adresse: dto.adresse,
|
||||||
code_postal: dto.code_postal,
|
code_postal: dto.code_postal,
|
||||||
ville: dto.ville,
|
ville: dto.ville,
|
||||||
profession: dto.profession,
|
|
||||||
situation_familiale: dto.situation_familiale,
|
|
||||||
token_creation_mdp: tokenCreationMdp,
|
token_creation_mdp: tokenCreationMdp,
|
||||||
token_creation_mdp_expire_le: tokenExpiration,
|
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);
|
const savedParent1 = await manager.save(Users, parent1);
|
||||||
|
|
||||||
// Créer Parent 2 si renseigné
|
// Créer Parent 2 si renseigné
|
||||||
@ -327,16 +321,10 @@ export class AuthService {
|
|||||||
adresse: dto.adresse,
|
adresse: dto.adresse,
|
||||||
code_postal: dto.code_postal,
|
code_postal: dto.code_postal,
|
||||||
ville: dto.ville,
|
ville: dto.ville,
|
||||||
profession: dto.profession,
|
|
||||||
situation_familiale: dto.situation_familiale,
|
|
||||||
token_creation_mdp: tokenCreationMdp,
|
token_creation_mdp: tokenCreationMdp,
|
||||||
token_creation_mdp_expire_le: dateExpiration,
|
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);
|
const parent1Enregistre = await manager.save(Users, parent1);
|
||||||
|
|
||||||
let parent2Enregistre: Users | null = null;
|
let parent2Enregistre: Users | null = null;
|
||||||
|
|||||||
@ -66,22 +66,6 @@ export class RegisterParentCompletDto {
|
|||||||
@MaxLength(150)
|
@MaxLength(150)
|
||||||
ville?: string;
|
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)
|
// ÉTAPE 2 : PARENT 2 / CO-PARENT (Optionnel)
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|||||||
@ -59,22 +59,6 @@ export class RegisterParentDto {
|
|||||||
@MaxLength(150)
|
@MaxLength(150)
|
||||||
ville?: string;
|
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) ===
|
// === Informations co-parent (optionnel) ===
|
||||||
@ApiProperty({ example: 'thomas.martin@ptits-pas.fr', required: false })
|
@ApiProperty({ example: 'thomas.martin@ptits-pas.fr', required: false })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
|||||||
@ -22,11 +22,9 @@ class _ParentRegisterStep1ScreenState extends State<ParentRegisterStep1Screen> {
|
|||||||
final _firstNameController = TextEditingController();
|
final _firstNameController = TextEditingController();
|
||||||
final _phoneController = TextEditingController();
|
final _phoneController = TextEditingController();
|
||||||
final _emailController = TextEditingController();
|
final _emailController = TextEditingController();
|
||||||
final _passwordController = TextEditingController();
|
final _addressController = TextEditingController();
|
||||||
final _confirmPasswordController = TextEditingController();
|
final _postalCodeController = TextEditingController();
|
||||||
final _addressController = TextEditingController(); // Rue seule
|
final _cityController = TextEditingController();
|
||||||
final _postalCodeController = TextEditingController(); // Restauré
|
|
||||||
final _cityController = TextEditingController(); // Restauré
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -48,8 +46,6 @@ class _ParentRegisterStep1ScreenState extends State<ParentRegisterStep1Screen> {
|
|||||||
_lastNameController.text = genLastName;
|
_lastNameController.text = genLastName;
|
||||||
_phoneController.text = DataGenerator.phone();
|
_phoneController.text = DataGenerator.phone();
|
||||||
_emailController.text = DataGenerator.email(genFirstName, genLastName);
|
_emailController.text = DataGenerator.email(genFirstName, genLastName);
|
||||||
_passwordController.text = DataGenerator.password();
|
|
||||||
_confirmPasswordController.text = _passwordController.text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -58,8 +54,6 @@ class _ParentRegisterStep1ScreenState extends State<ParentRegisterStep1Screen> {
|
|||||||
_firstNameController.dispose();
|
_firstNameController.dispose();
|
||||||
_phoneController.dispose();
|
_phoneController.dispose();
|
||||||
_emailController.dispose();
|
_emailController.dispose();
|
||||||
_passwordController.dispose();
|
|
||||||
_confirmPasswordController.dispose();
|
|
||||||
_addressController.dispose();
|
_addressController.dispose();
|
||||||
_postalCodeController.dispose();
|
_postalCodeController.dispose();
|
||||||
_cityController.dispose();
|
_cityController.dispose();
|
||||||
@ -88,9 +82,9 @@ class _ParentRegisterStep1ScreenState extends State<ParentRegisterStep1Screen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
// Indicateur d'étape (à rendre dynamique)
|
// Indicateur d'étape
|
||||||
Text(
|
Text(
|
||||||
'Étape 1/5',
|
'Étape 1/6',
|
||||||
style: GoogleFonts.merienda(fontSize: 16, color: Colors.black54),
|
style: GoogleFonts.merienda(fontSize: 16, color: Colors.black54),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
@ -121,54 +115,43 @@ class _ParentRegisterStep1ScreenState extends State<ParentRegisterStep1Screen> {
|
|||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(flex: 12, child: CustomAppTextField(controller: _lastNameController, labelText: 'Nom', hintText: 'Votre nom de famille', 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()), // Espace de 4%
|
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)),
|
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(
|
Row(
|
||||||
children: [
|
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: 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()), // Espace de 4%
|
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)),
|
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),
|
const SizedBox(height: 32),
|
||||||
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),
|
|
||||||
CustomAppTextField(
|
CustomAppTextField(
|
||||||
controller: _addressController,
|
controller: _addressController,
|
||||||
labelText: 'Adresse (N° et Rue)',
|
labelText: 'Adresse (N° et Rue)',
|
||||||
hintText: 'Numéro et nom de votre rue',
|
hintText: 'Numéro et nom de votre rue',
|
||||||
style: CustomAppTextFieldStyle.beige,
|
style: CustomAppTextFieldStyle.beige,
|
||||||
fieldWidth: double.infinity,
|
fieldWidth: double.infinity,
|
||||||
|
labelFontSize: 22.0,
|
||||||
|
inputFontSize: 20.0,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 32),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
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),
|
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<ParentRegisterStep1Screen> {
|
|||||||
ParentData(
|
ParentData(
|
||||||
firstName: _firstNameController.text,
|
firstName: _firstNameController.text,
|
||||||
lastName: _lastNameController.text,
|
lastName: _lastNameController.text,
|
||||||
address: _addressController.text, // Rue
|
address: _addressController.text,
|
||||||
postalCode: _postalCodeController.text, // Ajout
|
postalCode: _postalCodeController.text,
|
||||||
city: _cityController.text, // Ajout
|
city: _cityController.text,
|
||||||
phone: _phoneController.text,
|
phone: _phoneController.text,
|
||||||
email: _emailController.text,
|
email: _emailController.text,
|
||||||
password: _passwordController.text,
|
password: '', // Pas de mot de passe à cette étape
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
Navigator.pushNamed(context, '/parent-register/step2', arguments: _registrationData);
|
Navigator.pushNamed(context, '/parent-register/step2', arguments: _registrationData);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user