edit profil fonctionnel

thierry
Viiciouss 7 years ago
parent fb28daffd0
commit 0d83c487d1

@ -17,13 +17,6 @@
<div class="card-body" style="padding-left: 20%; padding-right: 20%;">
<!--Name-->
<div *ngIf="(user | async)?.displayName === 'Parrain'" >
<div class="md-form">
<i class="fa fa-envelope prefix grey-text"></i>
<input type="email" id="orangeForm-email" [(ngModel)]="parrain.email" placeholder="{{parrain.email}}" name="email" required pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" #email="ngModel">
<div *ngIf="email.errors && email.errors.pattern && (email.dirty || email.touched)" class="alert alert-danger">
Email is required and format should be <strong><i>john@parrain.fr</i></strong>.
</div>
</div>
<button class="btn btn-deep-orange" (click)="modifyPasswordSection()">Modifier Email/Mot de passe</button>
<div class="card" *ngIf="modifiermdp">
<div class="md-form">
@ -84,7 +77,7 @@
<i class="fa fa-user prefix grey-text"></i>
<input type="text" id="orangeForm-Familyname" [(ngModel)]="parrain.telephone" placeholder="{{parrain.telephone}}">
</div>
<button class="btn btn-green btn-rounded waves-light" [disabled]="(newPassword != '') && (newPassword != ConfirmPassword)">Modifier Profil</button>
<button class="btn btn-green btn-rounded waves-light" [disabled]="(newPassword != '') && (newPassword != ConfirmPassword)" (click)="modifyProfile()">Modifier Profil</button>
</div>
<div *ngIf="(user | async)?.displayName === 'Commercant'" >
@ -134,7 +127,7 @@
<i class="fa fa-info prefix grey-text"></i>
<input type="text" id="orangeForm-Familyname" [(ngModel)]="commercant.siret" placeholder="{{commercant.siret}}">
</div>
<button class="btn btn-green btn-rounded waves-light" [disabled]="(newPassword != '') && (newPassword != ConfirmPassword)">Modifier Profil</button>
<button class="btn btn-green btn-rounded waves-light" [disabled]="(newPassword != '') && (newPassword != ConfirmPassword)" (click)="modifyProfile()">Modifier Profil</button>
</div>
<button class="btn btn-default btn-rounded waves-light" (click)="goToProfil()">Retour</button>

@ -90,12 +90,19 @@ export class EditProfilComponent implements OnInit {
modifyProfile() {
if (this.newPassword === '') {
if (this.localUser.status === 'Parrain') {
this.authService.modifyProfile(this.localUser, this.parrain);
} else if (this.localUser.status === 'Commercant') {
this.authService.modifyProfile(this.localUser, this.commercant);
}
console.log('erreur mot de passe pas changer');
} else {
if (this.localUser.status === 'Parrain') {
this.parrain.password = this.newPassword;
this.authService.modifyProfile(this.localUser, this.parrain);
} else if (this.localUser.status === 'Commercant') {
this.commercant.password = this.newPassword;
this.authService.modifyProfile(this.localUser, this.commercant);
}
}
}

Loading…
Cancel
Save