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 @@
<input matInput type="text" formControlName="lastName" placeholder="Nom" required>
</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 -->
<mat-form-field class="full-width">
<input matInput type="email" formControlName="email" placeholder="Adresse email" required>
......@@ -26,6 +31,8 @@
</mat-hint>
</mat-form-field>
<mat-form-field class="full-width">
<input matInput type="tel" formControlName="phoneNumber" placeholder="Numéro de téléphone" required>
<mat-hint>
......@@ -54,7 +61,7 @@
<div class="text-center">
<button mat-raised-button color="primary" [disabled]="!formGroup.valid || loading">
M'inscrire
Suivant
<app-load-spinner *ngIf="loading" [block]="false"></app-load-spinner>
</button>
</div>
......
......@@ -73,6 +73,7 @@ export class StudentSignupComponent implements OnInit {
firstName: '',
lastName: '',
email: ['', Validators.email],
dateOfBirth:'',
phoneNumber: '',
gender:'',
adressNumber:'',
......@@ -108,28 +109,56 @@ export class StudentSignupComponent implements OnInit {
toggleShowPersonnalDataForm(){
this.showPersonnalDataForm = !this.showPersonnalDataForm;
}
submit() {
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 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 password: string = this.formGroup.controls.password.value;
this.registrationService.create(registration, password).pipe(
mergeMap(() => this.auth.login(registration.email, password)),
tap(() => this.snackBar.open(
`Ton compte a été créé ! Tu es maintenant connecté.`,
'OK',
{ duration: 3000 },
// this.registrationService.create(registration, password).pipe(
// mergeMap(() => this.auth.login(registration.email, password)),
// tap(() => this.snackBar.open(
// `Ton compte a été créé ! Tu es maintenant connecté.`,
// '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.loading = false),
tap(() => {
setTimeout(()=>{
this.router.navigate(['./membres/compte/donnees'])
this.router.navigate(['inscription/waiting'])
},3000)})
},2000)})
).subscribe(
() => {},
......@@ -151,4 +180,5 @@ export class StudentSignupComponent implements OnInit {
// (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