Skip to content
Snippets Groups Projects
Commit b1fdd683 authored by Mélissa Aïdli's avatar Mélissa Aïdli
Browse files

Added date of birth + Changed submit

parent c08aa02b
Branches
No related tags found
1 merge request!80New signup
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
<input matInput type="text" formControlName="lastName" placeholder="Nom" required> <input matInput type="text" formControlName="lastName" placeholder="Nom" required>
</mat-form-field> </mat-form-field>
<!--Date of birth-->
<mat-form-field class="full-width">
<input matInput type="date" formControlName="dateOfBirth" placeholder="Date de naissance" required>
</mat-form-field>
<!-- Email --> <!-- Email -->
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput type="email" formControlName="email" placeholder="Adresse email" required> <input matInput type="email" formControlName="email" placeholder="Adresse email" required>
...@@ -26,6 +31,8 @@ ...@@ -26,6 +31,8 @@
</mat-hint> </mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput type="tel" formControlName="phoneNumber" placeholder="Numéro de téléphone" required> <input matInput type="tel" formControlName="phoneNumber" placeholder="Numéro de téléphone" required>
<mat-hint> <mat-hint>
...@@ -54,7 +61,7 @@ ...@@ -54,7 +61,7 @@
<div class="text-center"> <div class="text-center">
<button mat-raised-button color="primary" [disabled]="!formGroup.valid || loading"> <button mat-raised-button color="primary" [disabled]="!formGroup.valid || loading">
M'inscrire Suivant
<app-load-spinner *ngIf="loading" [block]="false"></app-load-spinner> <app-load-spinner *ngIf="loading" [block]="false"></app-load-spinner>
</button> </button>
</div> </div>
......
...@@ -73,6 +73,7 @@ export class StudentSignupComponent implements OnInit { ...@@ -73,6 +73,7 @@ export class StudentSignupComponent implements OnInit {
firstName: '', firstName: '',
lastName: '', lastName: '',
email: ['', Validators.email], email: ['', Validators.email],
dateOfBirth:'',
phoneNumber: '', phoneNumber: '',
gender:'', gender:'',
adressNumber:'', adressNumber:'',
...@@ -108,28 +109,56 @@ export class StudentSignupComponent implements OnInit { ...@@ -108,28 +109,56 @@ export class StudentSignupComponent implements OnInit {
toggleShowPersonnalDataForm(){ toggleShowPersonnalDataForm(){
this.showPersonnalDataForm = !this.showPersonnalDataForm; this.showPersonnalDataForm = !this.showPersonnalDataForm;
} }
submit() { submit() {
this.loading = true; this.loading = true;
const {email,firstName,lastName,phoneNumber} = this.formGroup.value const {email,firstName,lastName,phoneNumber,dateOfBirth} = this.formGroup.value
//const {gender,adressNumber,street,zipCode,city,personnalPhone,parentsPhone,parentsEmail,school,grade,section,specialTeaching,scholarship,fatherActivity,motherActivity,parentsStatus,dependantsNumber} = this.formGroup.value; //const {gender,adressNumber,street,zipCode,city,personnalPhone,parentsPhone,parentsEmail,school,grade,section,specialTeaching,scholarship,fatherActivity,motherActivity,parentsStatus,dependantsNumber} = this.formGroup.value;
const registration: Registration = {email,firstName,lastName,phoneNumber}; const registration: Registration = {email,firstName,lastName,phoneNumber,dateOfBirth};
// const personnalData: PersonnalData = {gender,adressNumber,street,zipCode,city,personnalPhone,parentsPhone,parentsEmail,school,grade,section,specialTeaching,scholarship,fatherActivity,motherActivity,parentsStatus,dependantsNumber}; // const personnalData: PersonnalData = {gender,adressNumber,street,zipCode,city,personnalPhone,parentsPhone,parentsEmail,school,grade,section,specialTeaching,scholarship,fatherActivity,motherActivity,parentsStatus,dependantsNumber};
const password: string = this.formGroup.controls.password.value; const password: string = this.formGroup.controls.password.value;
this.registrationService.create(registration, password).pipe(
mergeMap(() => this.auth.login(registration.email, password)), // this.registrationService.create(registration, password).pipe(
tap(() => this.snackBar.open( // mergeMap(() => this.auth.login(registration.email, password)),
`Ton compte a été créé ! Tu es maintenant connecté.`, // tap(() => this.snackBar.open(
'OK', // `Ton compte a été créé ! Tu es maintenant connecté.`,
{ duration: 3000 }, // 'OK',
// { duration: 3000 },
// )),
// tap(()=> this.error = ""),
// tap(() => this.loading = false),
// tap(() => {
// setTimeout(()=>{
// this.router.navigate(['inscription/waiting'])
// },3000)})
// ).subscribe(
// () => {},
// (error) => {
// this.loading=false
// if(error.error.email){
// this.error = "Erreur, cet email est déjà utilisé !"
// }
// }
// );
this.registrationService.create(registration, password).pipe(tap(() => this.snackBar.open(
`Les informations sont valides ! Nous allons t'envoyer un mail d'activation.`,'OK',
{ duration: 2000 },
)), )),
tap(()=> this.error = ""), tap(()=> this.error = ""),
tap(() => this.loading = false), tap(() => this.loading = false),
tap(() => { tap(() => {
setTimeout(()=>{ setTimeout(()=>{
this.router.navigate(['./membres/compte/donnees']) this.router.navigate(['inscription/waiting'])
},3000)}) },2000)})
).subscribe( ).subscribe(
() => {}, () => {},
...@@ -151,4 +180,5 @@ export class StudentSignupComponent implements OnInit { ...@@ -151,4 +180,5 @@ export class StudentSignupComponent implements OnInit {
// (error) => this.loading = false, // (error) => this.loading = false,
// ); // );
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment