modification popup-update-user
This commit is contained in:
parent
080a50e2fe
commit
500b32626e
6 changed files with 156 additions and 83 deletions
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
<!-- ------------------------------------------------------------------------------------ -->
|
<!-- ------------------------------------------------------------------------------------ -->
|
||||||
|
|
||||||
<mat-label>Tags</mat-label>
|
|
||||||
|
|
||||||
<!-- ------------------------------------------------------------------------------------ -->
|
|
||||||
|
|
||||||
<mat-chip-list #chipList aria-label="Fruit selection">
|
<mat-chip-list #chipList aria-label="Fruit selection">
|
||||||
|
|
||||||
<mat-chip
|
<mat-chip
|
||||||
|
|
@ -20,7 +16,7 @@
|
||||||
</mat-chip>
|
</mat-chip>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
placeholder="Tapez un tag et pressez 'Entré' pour l'inserer"
|
placeholder="Tapez un centre d'intérêt"
|
||||||
#tagInput
|
#tagInput
|
||||||
[formControl]="formControl"
|
[formControl]="formControl"
|
||||||
[matAutocomplete]="auto"
|
[matAutocomplete]="auto"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,10 @@ mat-form-field {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mat-chip-list {
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
|
||||||
mat-chip {
|
mat-chip {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export class PageProfilUserComponent implements OnInit
|
||||||
onModifier()
|
onModifier()
|
||||||
{
|
{
|
||||||
const config = {
|
const config = {
|
||||||
width: '35%',
|
width: '70%',
|
||||||
data: { user: this.user }
|
data: { user: this.user }
|
||||||
};
|
};
|
||||||
this.dialog
|
this.dialog
|
||||||
|
|
|
||||||
|
|
@ -1,88 +1,125 @@
|
||||||
<div class="myContainer">
|
<div class="myContainer">
|
||||||
<div class="boite">
|
|
||||||
|
|
||||||
<!-- photo de profil -->
|
<!-- Photo de profil -->
|
||||||
<div style="text-align: center">
|
<div style="text-align: center; font-size: small">
|
||||||
<img [src]="userCopy.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
<img [src]="userCopy.profilePictureUrl" onerror="this.onerror=null; this.src='assets/profil.png'"><br>
|
||||||
<input title="lien vers image" type="text" [(ngModel)]="userCopy.profilePictureUrl" style="width: 90%">
|
<input title="lien vers image"
|
||||||
</div>
|
type="text"
|
||||||
|
class="form-control inputUrlImage"
|
||||||
|
style="font-size: small"
|
||||||
|
[(ngModel)]="userCopy.profilePictureUrl">
|
||||||
|
</div><br>
|
||||||
|
|
||||||
<!-- divider -->
|
<!-- Col gauche & droite -->
|
||||||
<br><mat-divider></mat-divider><br>
|
<div class="row">
|
||||||
|
<ng-template *ngIf="true; then leftCol"></ng-template>
|
||||||
|
<ng-template *ngIf="true; then rightCol"></ng-template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- message d'erreur -->
|
||||||
|
<div *ngIf="hasError" style="text-align: center; margin-bottom: 20px;">
|
||||||
|
<span class="mat-error"><br>{{errorMessage}}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Boutons -->
|
||||||
|
<div style="width: 100%; text-align: right">
|
||||||
|
<button mat-button (click)="this.dialogRef.close(null)"> Annuler </button>
|
||||||
|
<button mat-button (click)="onValider()"> Enregistrer </button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Colonne gauche -->
|
||||||
|
<ng-template #leftCol>
|
||||||
|
<div class="col-6">
|
||||||
|
|
||||||
<!-- login -->
|
<!-- login -->
|
||||||
<mat-form-field appearance="fill">
|
<div class="form-group row myRow">
|
||||||
<mat-label>Pseudo</mat-label>
|
<label for="login" class="col-sm-6 col-form-label myLeftLabel">Login:</label>
|
||||||
<input matInput type="text" [(ngModel)]="userCopy.login">
|
<div class="col-sm-6">
|
||||||
</mat-form-field>
|
<input type="text" class="form-control myValue" id="login" [(ngModel)]="userCopy.login">
|
||||||
<br>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- email -->
|
|
||||||
<mat-form-field appearance="fill">
|
|
||||||
<mat-label>Email</mat-label>
|
|
||||||
<input matInput type="text" [(ngModel)]="userCopy.mail">
|
|
||||||
</mat-form-field>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<!-- dateOfBirth -->
|
<!-- dateOfBirth -->
|
||||||
<mat-form-field appearance="fill">
|
<div class="form-group row myRow">
|
||||||
<mat-label>Date de naissance</mat-label>
|
<label for="dateOfBirth" class="col-sm-6 col-form-label myLeftLabel">Date de naissance:</label>
|
||||||
<input matInput type="date"
|
<div class="col-sm-6">
|
||||||
[ngModel] ="userCopy.dateOfBirth | date:'yyyy-MM-dd'"
|
<input type="date"
|
||||||
(ngModelChange)="userCopy.dateOfBirth = $event">
|
class="form-control myValue"
|
||||||
</mat-form-field>
|
id="dateOfBirth"
|
||||||
<br>
|
[ngModel] ="userCopy.dateOfBirth | date:'yyyy-MM-dd'"
|
||||||
|
(ngModelChange)="userCopy.dateOfBirth = $event">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- gender -->
|
<!-- sexe -->
|
||||||
<mat-radio-group [(ngModel)]="userCopy.gender">
|
<div class="myRow" style="text-align: right; margin-right: 15px">
|
||||||
<mat-radio-button value="man"> Homme </mat-radio-button>
|
<mat-radio-group [(ngModel)]="userCopy.gender">
|
||||||
<mat-radio-button value="woman"> Femme </mat-radio-button>
|
<mat-radio-button value="man"> Homme </mat-radio-button>
|
||||||
</mat-radio-group>
|
<mat-radio-button value="woman"> Femme </mat-radio-button>
|
||||||
<br><br>
|
</mat-radio-group>
|
||||||
|
</div>
|
||||||
<!-- interets -->
|
|
||||||
<app-input-interests-profil
|
|
||||||
[myInterests]="userCopy.interests"
|
|
||||||
(eventEmitter)="onEventInputInterests($event)"></app-input-interests-profil>
|
|
||||||
|
|
||||||
<!-- divider -->
|
|
||||||
<br><mat-divider></mat-divider><br>
|
|
||||||
|
|
||||||
<!-- Modifier mot de passe -->
|
<!-- Modifier mot de passe -->
|
||||||
<div style="margin-bottom: 10px">
|
<div class="form-group row" style="margin: 10px 0px 10px 0px">
|
||||||
Modifier mot de passe:
|
<label for="changePassword" class="col-sm-6 col-form-label myLeftLabel">Modifier mot de passe:</label>
|
||||||
<mat-checkbox [(ngModel)]="changePassword"></mat-checkbox>
|
<div class="col-sm-6">
|
||||||
|
<mat-checkbox id="changePassword" [(ngModel)]="changePassword"></mat-checkbox>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- nouveau mot de passe -->
|
<!-- Nouveau mot de passe -->
|
||||||
<div *ngIf="changePassword">
|
<div class="form-group row" style="margin: 10px 0px 10px 0px">
|
||||||
<!-- Nouveau mot de passe -->
|
<label for="newPassword" class="col-sm-6 col-form-label myLeftLabel"></label>
|
||||||
<mat-form-field appearance="fill">
|
<div class="col-sm-6">
|
||||||
<mat-label>Nouveau mot de passe</mat-label>
|
<input type="password"
|
||||||
<input matInput type="password" [(ngModel)]="newPassword">
|
class="form-control myValue"
|
||||||
</mat-form-field>
|
id="newPassword"
|
||||||
<br>
|
placeholder=" Nouveau mot de passe"
|
||||||
<!-- Confirmation npuveau mot de passe -->
|
[(ngModel)]="newPassword"
|
||||||
<mat-form-field appearance="fill">
|
[disabled]="!changePassword">
|
||||||
<mat-label>Confirmation nouveau mot de passe</mat-label>
|
</div>
|
||||||
<input matInput type="password" [(ngModel)]="confirmNewPassword">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="!changePassword"><br></div>
|
|
||||||
|
|
||||||
<!-- divider -->
|
|
||||||
<mat-divider></mat-divider><br>
|
|
||||||
|
|
||||||
<!-- message d'erreur -->
|
|
||||||
<div *ngIf="hasError" style="text-align: center; margin-bottom: 20px;">
|
|
||||||
<span class="mat-error">{{errorMessage}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- boutons -->
|
<!-- Confirmation nouveau mot de passe -->
|
||||||
<div style="width: 100%; text-align: right">
|
<div class="form-group row" style="margin: 10px 0px 10px 0px">
|
||||||
<button mat-button (click)="this.dialogRef.close(null)"> Annuler </button>
|
<label for="confimNewPassword" class="col-sm-6 col-form-label myLeftLabel"></label>
|
||||||
<button mat-button (click)="onValider()"> Enregistrer </button>
|
<div class="col-sm-6">
|
||||||
|
<input type="password"
|
||||||
|
class="form-control myValue"
|
||||||
|
id="confimNewPassword"
|
||||||
|
placeholder=" Confirmation nouveau mot de passe"
|
||||||
|
[(ngModel)]="confirmNewPassword"
|
||||||
|
[disabled]="!changePassword">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</ng-template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Colonne droite -->
|
||||||
|
<ng-template #rightCol>
|
||||||
|
<div class="col-6" style="border-left: solid 1px #e6e6e6">
|
||||||
|
|
||||||
|
<!-- interests -->
|
||||||
|
<div class="form-group row myRow">
|
||||||
|
<label for="interests" class="col-sm-3 col-form-label myLeftLabel">Centres d'intérêt:</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<app-input-interests-profil
|
||||||
|
id="interests"
|
||||||
|
[myInterests]="userCopy.interests"
|
||||||
|
(eventEmitter)="onEventInputInterests($event)"></app-input-interests-profil>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.boite {
|
.myContainer {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,6 +15,42 @@ img {
|
||||||
font-size: xxx-large;
|
font-size: xxx-large;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inputUrlImage {
|
||||||
|
width: 80%;
|
||||||
|
text-align: center;
|
||||||
|
margin-left: 10%;
|
||||||
|
margin-right: 10%;
|
||||||
|
font-size: small;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.myRow {
|
||||||
|
margin: 15px 0px 15px 0px;
|
||||||
|
}
|
||||||
|
.myLeftLabel {
|
||||||
|
text-align: right;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
margin: 0px 0px 0px 0px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.myRightLabel {
|
||||||
|
text-align: left;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
margin: 0px 0px 0px 0px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.myValue {
|
||||||
|
text-align: left;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
margin: 0px 0px 0px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
// aura
|
// aura
|
||||||
|
|
|
||||||
|
|
@ -67,15 +67,15 @@ export class PopupUpdateUserComponent implements OnInit
|
||||||
checkField()
|
checkField()
|
||||||
{
|
{
|
||||||
if(this.userCopy.login.length === 0) {
|
if(this.userCopy.login.length === 0) {
|
||||||
this.errorMessage = "Veuillez remplir le champ 'login'" ;
|
this.errorMessage = "Veuillez remplir le champ 'login'." ;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
else if(this.userCopy.mail.length === 0) {
|
else if(this.userCopy.mail.length === 0) {
|
||||||
this.errorMessage = "Veuillez remplir le champ 'email'" ;
|
this.errorMessage = "Veuillez remplir le champ 'email'." ;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
else if(!this.isValidEmail(this.userCopy.mail)) {
|
else if(!this.isValidEmail(this.userCopy.mail)) {
|
||||||
this.errorMessage = "Email invalide" ;
|
this.errorMessage = "Email invalide." ;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
else if((this.userCopy.dateOfBirth === undefined) || (this.userCopy.dateOfBirth === null)) {
|
else if((this.userCopy.dateOfBirth === undefined) || (this.userCopy.dateOfBirth === null)) {
|
||||||
|
|
@ -84,10 +84,10 @@ export class PopupUpdateUserComponent implements OnInit
|
||||||
}
|
}
|
||||||
else if(this.changePassword) {
|
else if(this.changePassword) {
|
||||||
if (this.newPassword.length === 0) {
|
if (this.newPassword.length === 0) {
|
||||||
this.errorMessage = "Veuillez remplir le champ 'mot de passe'" ;
|
this.errorMessage = "Veuillez remplir le champ 'mot de passe'." ;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
} else if (this.newPassword !== this.confirmNewPassword) {
|
} else if (this.newPassword !== this.confirmNewPassword) {
|
||||||
this.errorMessage = "Le mot de passe est différent de sa confirmation" ;
|
this.errorMessage = "Le mot de passe est différent de sa confirmation." ;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue