Ver Fonte

dev en cours

rajah há 11 meses atrás
pai
commit
1dcc024943
30 ficheiros alterados com 292 adições e 128 exclusões
  1. 2 0
      src/app/app.routes.ts
  2. 2 4
      src/app/composants/account-details/account-details.component.ts
  3. 105 1
      src/app/composants/account-password/account-password.component.html
  4. 84 9
      src/app/composants/account-password/account-password.component.ts
  5. 2 4
      src/app/composants/account-update/account-update.component.ts
  6. 3 5
      src/app/composants/categorie-create/categorie-create.component.ts
  7. 6 8
      src/app/composants/categorie-details/categorie-details.component.ts
  8. 3 5
      src/app/composants/categorie-list/categorie-list.component.ts
  9. 3 5
      src/app/composants/categorie-update/categorie-update.component.ts
  10. 2 4
      src/app/composants/home/home.component.ts
  11. 8 1
      src/app/composants/login/login.component.html
  12. 2 4
      src/app/composants/login/login.component.ts
  13. 7 8
      src/app/composants/menu/menu.component.html
  14. 13 5
      src/app/composants/menu/menu.component.ts
  15. 2 4
      src/app/composants/participant-create/participant-create.component.ts
  16. 2 4
      src/app/composants/participant-details/participant-details.component.ts
  17. 2 4
      src/app/composants/participant-list/participant-list.component.ts
  18. 2 4
      src/app/composants/participant-update/participant-update.component.ts
  19. 3 5
      src/app/composants/production-create/production-create.component.ts
  20. 10 12
      src/app/composants/production-details/production-details.component.ts
  21. 2 4
      src/app/composants/production-list/production-list.component.ts
  22. 3 5
      src/app/composants/production-update/production-update.component.ts
  23. 3 5
      src/app/composants/production-upload/production-upload.component.ts
  24. 3 5
      src/app/composants/variable-create/variable-create.component.ts
  25. 2 4
      src/app/composants/variable-details/variable-details.component.ts
  26. 2 4
      src/app/composants/variable-list/variable-list.component.ts
  27. 2 4
      src/app/composants/variable-update/variable-update.component.ts
  28. 1 0
      src/app/interfaces/production.ts
  29. 8 0
      src/app/interfaces/user.ts
  30. 3 1
      src/app/services/account.service.ts

+ 2 - 0
src/app/app.routes.ts

@@ -8,6 +8,7 @@ import { HomeComponent } from './composants/home/home.component';
 import { LoginComponent } from './composants/login/login.component';
 import { AccountDetailsComponent } from './composants/account-details/account-details.component';
 import { AccountUpdateComponent } from './composants/account-update/account-update.component';
+import { AccountPasswordComponent } from './composants/account-password/account-password.component';
 import { AdminGuard } from './guards/admin.guard';
 import { OrgaGuard } from './guards/orga.guard';
 import { UserGuard } from './guards/user.guard';
@@ -35,6 +36,7 @@ export const routes: Routes = [
   {path: 'login', component: LoginComponent, runGuardsAndResolvers: 'always' },
   {path: 'account-details', component: AccountDetailsComponent, canActivate: [UserGuard], runGuardsAndResolvers: 'always' },
   {path: 'account-update', component: AccountUpdateComponent, canActivate: [UserGuard], runGuardsAndResolvers: 'always' },
+  {path: 'account-password', component: AccountPasswordComponent, canActivate: [UserGuard], runGuardsAndResolvers: 'always' },
   {path: 'variable-list', component: VariableListComponent, canActivate: [AdminGuard], runGuardsAndResolvers: 'always'},
   {path: 'variable-create', component: VariableCreateComponent, canActivate: [AdminGuard], runGuardsAndResolvers: 'always'},
   {path: 'variable-details/:numeroVariable', component: VariableDetailsComponent, canActivate: [AdminGuard], runGuardsAndResolvers: 'always'},

+ 2 - 4
src/app/composants/account-details/account-details.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 import { FormsModule } from '@angular/forms';
 
@@ -10,7 +10,7 @@ import { DiversService } from '../../services/divers.service'
 
 @Component({ selector: 'app-account-details', imports: [FormsModule, MenuComponent], templateUrl: './account-details.component.html', styleUrl: './account-details.component.css' })
 
-export class AccountDetailsComponent implements OnInit, AfterViewInit
+export class AccountDetailsComponent implements OnInit
 {
 
   profil: string = "";
@@ -38,8 +38,6 @@ export class AccountDetailsComponent implements OnInit, AfterViewInit
     this.accountService.getProfil().subscribe( data => { this.participant = data; });
   }
 
-  ngAfterViewInit() { }
-
   updateProfil() { this.router.navigate(['/account-update']); }
 
   updateMotDePasse() { this.router.navigate(['/account-password']); }

+ 105 - 1
src/app/composants/account-password/account-password.component.html

@@ -1 +1,105 @@
-<p>account-password works!</p>
+<app-menu></app-menu>
+<div id="main">
+<form [formGroup]="form">
+
+	<div class="card shadow center">
+    <div class="card-header"><span i18n>Changement de votre mot de passe</span></div>
+		<div class="card-header shadow-sm">
+			<button (click)="goToAccountDetails()" class="btn bg-gradient btn-primary btn-sm"><i class="fa-solid fa-xmark"></i>&nbsp;<span i18n>Retour</span></button>
+		</div>
+		<div class="card-body">
+
+  		<div class="form-group row">
+  			<label class="col-sm-4 col-form-label col-form-label-sm label-nobr"><span i18n>Nom</span></label>
+  			<div class="col-sm-8">
+          <input type="text" class="form-control form-control-sm field-separate" formControlName="nom">
+  			</div>
+  		</div>
+
+  		<div class="form-group row">
+  			<label class="col-sm-4 col-form-label col-form-label-sm label-nobr"><span i18n>Prénom</span></label>
+  			<div class="col-sm-8">
+  				<input type="text" class="form-control form-control-sm field-separate" formControlName="prenom">
+  			</div>
+  		</div>
+
+  		<div class="form-group row">
+  			<label class="col-sm-4 col-form-label col-form-label-sm label-nobr"><span i18n>Pseudonyme</span></label>
+  			<div class="col-sm-8">
+  				<input type="text" class="form-control form-control-sm field-separate"  formControlName="pseudonyme">
+  			</div>
+  		</div>
+
+@if (this.newpassword.erreur !== "") {
+			<div class="form-group row">
+        <label class="col-sm-4 col-form-label col-form-label-sm label-nobr"></label>
+        <div class="col-sm-8 col-form-label col-form-label-sm">
+					<div class="alert alert-warning" role="alert">{{ this.newpassword.erreur }}</div>
+				</div>
+			</div>
+}
+
+      <div class="form-group row">
+        <label class="col-sm-4 col-form-label col-form-label-sm label-nobr"><span i18n>Ancien mot de passe</span>&nbsp;<sup><span class="text-danger">*</span></sup></label>
+  			<div class="col-sm-8">
+          <input type="password" class="form-control form-control-sm field-separate" formControlName="oldPassword">
+          <div class="form-text field-separate" *ngIf="form.controls['oldPassword'].hasError('required')"><span i18n>Par sécurité, l'ancien mot de passe est nécessaire.</span></div>
+  			</div>
+  		</div>
+
+      <div class="form-group row">
+        <label class="col-sm-4 col-form-label col-form-label-sm label-nobr"><span i18n>Nouveau mot de passe</span>&nbsp;<sup><span class="text-danger">*</span></sup></label>
+        <div class="col-sm-8">
+          <input type="password" class="form-control form-control-sm field-separate" formControlName="newPassword">
+          <div class="form-text field-separate" *ngIf="form.controls['newPassword'].hasError('required')"><span i18n>Le nouveau mot de passe est requis.</span></div>
+          <div class="form-text field-separate" *ngIf="form.controls['newPassword'].hasError('pattern')">
+            <span i18n>Le mot de passe doit remplir ces conditions&nbsp;:</span>
+            <ul>
+              <li [ngClass]="{'d-none':checkValidations('newPassword', 'uppercase')}"><span i18n>Au moins une majuscule.</span></li>
+              <li [ngClass]="{'d-none':checkValidations('newPassword', 'lowercase')}"><span i18n>Au moins une minuscule.</span></li>
+              <li [ngClass]="{'d-none':checkValidations('newPassword', 'special-character')}"><span i18n>Au moins un caractère spécial parmi #$&#64;!%&amp;*?</span></li>
+              <li [ngClass]="{'d-none':checkValidations('newPassword', 'number')}"><span i18n>Au moins un numérique.</span></li>
+              <li [ngClass]="{'d-none':checkValidations('newPassword', 'length')}"><span i18n>Entre 8 et 16 caractères.</span></li>
+            </ul>
+          </div>
+        </div>
+      </div>
+
+      <div class="form-group row">
+        <label class="col-sm-4 col-form-label col-form-label-sm label-nobr"><span i18n>Confirmation</span>&nbsp;<sup><span class="text-danger">*</span></sup></label>
+        <div class="col-sm-8">
+          <input type="password" class="form-control form-control-sm field-separate" formControlName="confirmNewPassword">
+          <div class="form-text field-separate" *ngIf="form.controls['confirmNewPassword'].hasError('required')"><span i18n>La confirmation du nouveau mot de passe (double saisie) est requise.</span></div>
+          <div class="form-text field-separate" *ngIf="form.controls['confirmNewPassword'].hasError('pattern')">
+            <span i18n>Le mot de passe doit remplir ces conditions&nbsp;:</span>
+            <ul>
+              <li [ngClass]="{'d-none':checkValidations('confirmNewPassword', 'uppercase')}"><span i18n>Au moins une majuscule.</span></li>
+              <li [ngClass]="{'d-none':checkValidations('confirmNewPassword', 'lowercase')}"><span i18n>Au moins une minuscule.</span></li>
+              <li [ngClass]="{'d-none':checkValidations('confirmNewPassword', 'special-character')}"><span i18n>Au moins un caractère spécial parmi #$&#64;!%&amp;*?</span></li>
+              <li [ngClass]="{'d-none':checkValidations('confirmNewPassword', 'number')}"><span i18n>Au moins un numérique.</span></li>
+              <li [ngClass]="{'d-none':checkValidations('confirmNewPassword', 'length')}"><span i18n>Entre 8 et 16 caractères.</span></li>
+            </ul>
+          </div>
+          <div class="form-text field-separate" *ngIf="form.hasError('notMatched')"><span i18n class="text-danger">La confirmation n'est pas identique au nouveau mot de passe.</span></div>
+        </div>
+      </div>
+
+		</div>
+		<div class="card-footer">
+      <button type="button" class="btn bg-gradient btn-danger btn-sm text-left" data-bs-toggle="modal" data-bs-target="#modalModifier" [disabled]="!form.valid"><i class="fa-solid fa-pen"></i>&nbsp;<span i18n>Modifier</span></button>
+		</div>
+	</div>
+</form>
+
+<div class="modal fade" id="modalModifier" tabindex="-1" aria-labelledby="modalModifierTitre" aria-hidden="true">
+	<div class="modal-dialog modal-dialog-centered" role="document">
+		<div class="modal-content">
+			<div class="modal-body"><span i18n>Changement du mot de passe ?</span></div>
+			<div class="modal-footer">
+				<button type="button" class="btn bg-gradient btn-secondary btn-sm" data-bs-dismiss="modal"><span i18n>Annuler</span></button>
+        <button type="button" class="btn bg-gradient btn-danger btn-sm" (click)="updatePasswordConfirmed()" data-bs-dismiss="modal"><span i18n>Confirmer</span></button>
+			</div>
+		</div>
+	</div>
+</div>
+</div>

+ 84 - 9
src/app/composants/account-password/account-password.component.ts

@@ -1,11 +1,86 @@
-import { Component } from '@angular/core';
-
-@Component({
-  selector: 'app-account-password',
-  imports: [],
-  templateUrl: './account-password.component.html',
-  styleUrl: './account-password.component.css'
-})
-export class AccountPasswordComponent {
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { Router } from '@angular/router';
+import { FormsModule, FormBuilder, FormControl, FormGroupDirective, FormGroup, NgForm, Validators, ReactiveFormsModule } from '@angular/forms';
+
+import { MenuComponent } from '../menu/menu.component';
+import { NewPassword } from '../../interfaces/user';
+import { AccountService } from '../../services/account.service'
+
+@Component({ selector: 'app-account-password', imports: [CommonModule, FormsModule, ReactiveFormsModule, MenuComponent], templateUrl: './account-password.component.html', styleUrl: './account-password.component.css' })
+
+export class AccountPasswordComponent
+{
+
+  newpassword: NewPassword = new NewPassword();
+
+  public form!: FormGroup;
+
+  public passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[#$@!%&*?])[A-Za-z\d#$@!%&*?]{8,16}$/
+
+  constructor(
+    private accountService : AccountService,
+    private router: Router,
+    private menu: MenuComponent,
+    private formbuilder: FormBuilder
+  )
+  {
+    this.formInit();
+  }
+  private formInit()
+  {
+    this.form = this.formbuilder.group({
+      nom: { value: '', disabled: true },
+      prenom: { value: '', disabled: true },
+      pseudonyme: { value: '', disabled: true },
+      oldPassword: ['', [Validators.required]],
+      newPassword: ['', [Validators.required, Validators.pattern(this.passwordPattern)]],
+      confirmNewPassword: ['', [Validators.required, Validators.pattern(this.passwordPattern)]],
+      }, { validator: this.checkingPasswords });
+  }
+  public checkingPasswords(formGroup: FormGroup)
+  {
+    if (
+        formGroup.controls['oldPassword'].value && formGroup.controls['newPassword'].value && formGroup.controls['confirmNewPassword'].value
+        && formGroup.controls['newPassword'].value.length >= 8 && formGroup.controls['newPassword'].value.length <= 16
+        && formGroup.controls['confirmNewPassword'].value.length >= 8 && formGroup.controls['confirmNewPassword'].value.length <= 16
+        )
+    {
+     return formGroup.controls['newPassword'].value === formGroup.controls['confirmNewPassword'].value ? false : { "notMatched": true }
+    }
+
+    return false;
+  }
+  public checkValidations(index: string, type: string) {
+    switch (type)
+    {
+      case 'special-character': return /[#$@!%&*?]/.test(this.form.controls[index].value);;
+      case 'number': return /\d/.test(this.form.controls[index].value);
+      case 'lowercase': return /[a-z]/.test(this.form.controls[index].value);
+      case 'uppercase': return /[A-Z]/.test(this.form.controls[index].value);
+      case 'length': return this.form.controls[index].value.length >= 8 && this.form.controls[index].value.length <= 16;
+      default: return false
+    }
+  }
+
+  ngOnInit()
+  {
+    this.accountService.getProfil().subscribe( data => {
+      this.form.controls['nom'].setValue(data.nom);
+      this.form.controls['prenom'].setValue(data.prenom);
+      this.form.controls['pseudonyme'].setValue(data.pseudonyme);
+      this.newpassword.username = data.pseudonyme;
+    });
+  }
+
+  updatePasswordConfirmed()
+  {
+    this.newpassword.ancien = this.form.controls['oldPassword'].value;
+    this.newpassword.nouveau = this.form.controls['newPassword'].value;
+
+    this.accountService.updatePassword(this.newpassword).subscribe(data => { if (data.erreur !== "") { this.newpassword.erreur = data.erreur; } else if (data.nouveau === "<success@new>") { this.router.navigate(['/']); } });
+  }
+
+  goToAccountDetails() { this.router.navigate(['/account-details'], { queryParams: { 'refresh': this.menu.getRandomInteger(1, 100000) } }); }
 
 }

+ 2 - 4
src/app/composants/account-update/account-update.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { FormsModule, NgForm } from '@angular/forms';
 
@@ -10,7 +10,7 @@ import { DiversService } from '../../services/divers.service'
 
 @Component({ selector: 'app-account-update', imports: [FormsModule, MenuComponent], templateUrl: './account-update.component.html', styleUrl: './account-update.component.css' })
 
-export class AccountUpdateComponent implements OnInit, AfterViewInit
+export class AccountUpdateComponent implements OnInit
 {
 
   profil: string = "";
@@ -40,8 +40,6 @@ export class AccountUpdateComponent implements OnInit, AfterViewInit
     this.accountService.getProfil().subscribe(data => { this.participant = data; });
   }
 
-  ngAfterViewInit() { }
-
   updateConfirmed() { if (this.participantForm.valid) { this.accountService.updateProfil(this.participant).subscribe(); this.goToHome(); } }
 
   goToHome() { this.router.navigate(['/'], { queryParams: { 'refresh': this.menu.getRandomInteger(1, 100000) } }); }

+ 3 - 5
src/app/composants/categorie-create/categorie-create.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { Categorie } from '../../interfaces/categorie';
@@ -7,7 +7,7 @@ import { FormsModule, NgForm } from '@angular/forms';
 
 @Component({ selector: 'app-categorie-create', imports: [FormsModule, MenuComponent], templateUrl: './categorie-create.component.html', styleUrl: './categorie-create.component.css'})
 
-export class CategorieCreateComponent implements OnInit, AfterViewInit
+export class CategorieCreateComponent implements OnInit
 {
   @ViewChild('formRef') categorieForm!: NgForm;
 
@@ -15,9 +15,7 @@ export class CategorieCreateComponent implements OnInit, AfterViewInit
 
   constructor(private categorieService: CategorieService, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void { }
-
-  ngAfterViewInit() { }
+  ngOnInit() { }
 
   private saveCategorie() { this.categorieService.createCategorie(this.categorie).subscribe(); this.goToListCategorie(); }
 

+ 6 - 8
src/app/composants/categorie-details/categorie-details.component.ts

@@ -1,32 +1,30 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { MenuComponent } from '../menu/menu.component';
 import { ActivatedRoute, Router } from '@angular/router';
 import { Categorie } from '../../interfaces/categorie';
 import { CategorieService } from '../../services/categorie.service';
-import { FormsModule } from '@angular/forms'; 
+import { FormsModule } from '@angular/forms';
 
 @Component({ selector: 'app-categorie-details', imports: [FormsModule, MenuComponent], templateUrl: './categorie-details.component.html', styleUrl: './categorie-details.component.css' })
 
-export class CategorieDetailsComponent implements OnInit, AfterViewInit 
+export class CategorieDetailsComponent implements OnInit
 {
 
   numeroCategorie: number = 0;
 
   categorie: Categorie = new Categorie();
-  
+
   constructor(private categorieService: CategorieService, private route: ActivatedRoute, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void 
+  ngOnInit()
   {
     this.numeroCategorie = this.route.snapshot.params['numeroCategorie'];
     this.categorie = new Categorie();
     this.categorieService.getByIdCategorie(this.numeroCategorie).subscribe( data => { this.categorie = data; });
   }
 
-  ngAfterViewInit() { }
- 
   updateCategorie(id: number) { this.router.navigate(['/categorie-update', id]); }
-  
+
   goToListCategorie(){ this.router.navigate(['/categorie-list'], { queryParams: { 'refresh': this.menu.getRandomInteger(1, 100000) } }); }
 
 }

+ 3 - 5
src/app/composants/categorie-list/categorie-list.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { MenuComponent } from '../menu/menu.component';
 import { Router } from '@angular/router';
 import { Categorie } from '../../interfaces/categorie';
@@ -6,16 +6,14 @@ import { CategorieService } from '../../services/categorie.service';
 
 @Component({ selector: 'app-categorie-list', imports: [MenuComponent], templateUrl: './categorie-list.component.html', styleUrl: './categorie-list.component.css'})
 
-export class CategorieListComponent implements OnInit, AfterViewInit
+export class CategorieListComponent implements OnInit
 {
 
   categories: Categorie[] = [];
 
   constructor(private categorieService: CategorieService, private router: Router) { }
 
-  ngOnInit(): void { this.retreiveDatas(); }
-
-  ngAfterViewInit() { }
+  ngOnInit() { this.retreiveDatas(); }
 
   private retreiveDatas() { this.categorieService.getListCategorie().subscribe(data => { this.categories = data; }); }
 

+ 3 - 5
src/app/composants/categorie-update/categorie-update.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { Categorie } from '../../interfaces/categorie';
@@ -7,7 +7,7 @@ import { FormsModule, NgForm } from '@angular/forms';
 
 @Component({ selector: 'app-categorie-update', imports: [FormsModule, MenuComponent], templateUrl: './categorie-update.component.html', styleUrl: './categorie-update.component.css' })
 
-export class CategorieUpdateComponent implements OnInit, AfterViewInit
+export class CategorieUpdateComponent implements OnInit
 {
   @ViewChild('formRef') categorieForm!: NgForm;
 
@@ -17,14 +17,12 @@ export class CategorieUpdateComponent implements OnInit, AfterViewInit
 
   constructor(private categorieService: CategorieService, private route: ActivatedRoute, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void
+  ngOnInit()
   {
     this.numeroCategorie = this.route.snapshot.params['numeroCategorie'];
     this.categorieService.getByIdCategorie(this.numeroCategorie).subscribe(data => { this.categorie = data; });
   }
 
-  ngAfterViewInit() { }
-
   updateConfirmed() { if (this.categorieForm.valid) { this.categorieService.updateCategorie(this.numeroCategorie, this.categorie).subscribe(); this.goToListCategorie(); } }
 
   deleteConfirmed() { this.categorieService.deleteCategorie(this.numeroCategorie).subscribe(); this.goToListCategorie(); }

+ 2 - 4
src/app/composants/home/home.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { MenuComponent } from '../menu/menu.component';
 import { Message } from '../../interfaces/divers';
 import { AccountService } from '../../services/account.service'
@@ -6,7 +6,7 @@ import { DiversService } from '../../services/divers.service'
 
 @Component({ selector: 'app-home', imports: [MenuComponent], templateUrl: './home.component.html', styleUrl: './home.component.css' })
 
-export class HomeComponent implements OnInit, AfterViewInit
+export class HomeComponent implements OnInit
 {
 
   logged: boolean = false;
@@ -24,6 +24,4 @@ export class HomeComponent implements OnInit, AfterViewInit
     this.diversService.getMessage().subscribe(data => { this.message = data; });
   }
 
-  ngAfterViewInit() { }
-
 }

+ 8 - 1
src/app/composants/login/login.component.html

@@ -13,11 +13,18 @@
 			</div>
 			}
 
+			<div class="form-group row">
+				<label class="col-sm-4 col-form-label col-form-label-sm label-nobr"></label>
+				<div class="col-sm-8">
+					<div class="form-text field-separate"><span i18n>La différence minuscules-majuscules est prise en compte.</span></div>
+				</div>
+			</div>
+
 			<div class="form-group row">
 				<label class="col-sm-4 col-form-label col-form-label-sm label-nobr"><span i18n>Pseudonyme</span>&nbsp;<sup><span class="text-danger">*</span></sup></label>
 				<div class="col-sm-8">
 					<input type="text" class="form-control form-control-sm field-separate" #userid id="userid" name="userid" [(ngModel)]="identifiants.username" #userRef="ngModel" required [class.is-invalid]="userRef.invalid && userRef.touched" autofocus>
-					<div class="form-text field-separate"><span i18n>Indiquez celui fourni lors de l'inscription, s'il est commun à d'autres participants, merci de contacter l'administrateur.</span></div>
+					<div class="form-text field-separate"><span i18n>Indiquez celui fourni lors de l'inscription.<br/>S'il est commun à d'autres participants, merci de contacter l'administrateur.</span></div>
 				</div>
 			</div>
 

+ 2 - 4
src/app/composants/login/login.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild, ElementRef } from '@angular/core';
+import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
 import { Router } from '@angular/router';
 import { FormsModule, NgForm, NgModel } from '@angular/forms';
 
@@ -9,7 +9,7 @@ import { Journees } from '../../interfaces/divers';
 
 @Component({ selector: 'app-login', imports: [FormsModule, MenuComponent], templateUrl: './login.component.html', styleUrl: './login.component.css' })
 
-export class LoginComponent implements OnInit, AfterViewInit
+export class LoginComponent implements OnInit
 {
 
   hello: Journees = new Journees();
@@ -28,8 +28,6 @@ export class LoginComponent implements OnInit, AfterViewInit
     this.accountService.salute().subscribe(data => { this.hello = data; });
   }
 
-  ngAfterViewInit() { }
-
   connexion()
   {
     if (this.loginForm.valid)

+ 7 - 8
src/app/composants/menu/menu.component.html

@@ -21,8 +21,7 @@
 
 		<li><a routerLink="/chat" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Messagerie" placement="right" container="body"><i class="fa-solid fa-comments"></i></a></li>
 
-		<li><a routerLink="/production-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Productions" placement="right" container="body"><i class="fa-solid fa-save"></i></a></li>
-
+    <li><a routerLink="/production-list" routerLinkActive="active" #prodsicon class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Productions" placement="right" container="body"><i class="fa-solid fa-save"></i></a></li>
 		<li><a routerLink="/vote-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Voter" placement="right" container="body"><i class="fa-solid fa-vote-yea"></i></a></li>
 		<li><a routerLink="/result-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Résultats" placement="right" container="body"><i class="fa-solid fa-trophy"></i></a></li>
 
@@ -41,9 +40,9 @@
 
 		<li><a routerLink="/chat" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Messagerie" placement="right" container="body"><i class="fa-solid fa-comments"></i></a></li>
 
-		<li><a routerLink="/participant-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Participants" placement="right" container="body"><i class="fa-solid fa-users"></i></a></li>
+    <li><a routerLink="/participant-list" routerLinkActive="active" #usersicon class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Participants" placement="right" container="body"><i class="fa-solid fa-users"></i></a></li>
 
-		<li><a routerLink="/production-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Productions" placement="right" container="body"><i class="fa-solid fa-save"></i></a></li>
+    <li><a routerLink="/production-list" routerLinkActive="active" #prodsicon class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Productions" placement="right" container="body"><i class="fa-solid fa-save"></i></a></li>
 		<li><a routerLink="/vote-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Voter" placement="right" container="body"><i class="fa-solid fa-vote-yea"></i></a></li>
 		<li><a routerLink="/result-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Résultats" placement="right" container="body"><i class="fa-solid fa-trophy"></i></a></li>
 	</ul>
@@ -61,15 +60,15 @@
 
 		<li><a routerLink="/chat" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Messagerie" placement="right" container="body"><i class="fa-solid fa-comments"></i></a></li>
 
-		<li><a routerLink="/participant-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Participants" placement="right" container="body"><i class="fa-solid fa-users"></i></a></li>
+    <li><a routerLink="/participant-list" routerLinkActive="active" #usersicon class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Participants" placement="right" container="body"><i class="fa-solid fa-users"></i></a></li>
 
-		<li><a routerLink="/categorie-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Catégories" placement="right" container="body"><i class="fa-solid fa-layer-group"></i></a></li>
-		<li><a routerLink="/production-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Productions" placement="right" container="body"><i class="fa-solid fa-save"></i></a></li>
+    <li><a routerLink="/categorie-list" routerLinkActive="active" #compoicon class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Catégories" placement="right" container="body"><i class="fa-solid fa-layer-group"></i></a></li>
+    <li><a routerLink="/production-list" routerLinkActive="active" #prodsicon class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Productions" placement="right" container="body"><i class="fa-solid fa-save"></i></a></li>
 		<li><a routerLink="/show-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Présentations" placement="right" container="body"><i class="fa-solid fa-display"></i></a></li>
 		<li><a routerLink="/poll-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Voter" placement="right" container="body"><i class="fa-solid fa-vote-yea"></i></a></li>
 		<li><a routerLink="/result-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Résultats" placement="right" container="body"><i class="fa-solid fa-trophy"></i></a></li>
 
-		<li><a routerLink="/variable-list" routerLinkActive="active" class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Paramétrages" placement="right" container="body"><i class="fa-solid fa-sliders-h"></i></a></li>
+    <li><a routerLink="/variable-list" routerLinkActive="active" #variaicon class="nav-link rounded-0 bg-gradient" i18n-tooltip tooltip="Paramétrages" placement="right" container="body"><i class="fa-solid fa-sliders-h"></i></a></li>
 	</ul>
 </div>
 

+ 13 - 5
src/app/composants/menu/menu.component.ts

@@ -1,4 +1,4 @@
-import { Injectable, Component, OnInit, AfterViewInit, ViewChild, ElementRef, Renderer2 } from '@angular/core';
+import { Injectable, Component, OnInit, ViewChild, ElementRef, Renderer2 } from '@angular/core';
 import { Router, RouterLink, RouterLinkActive } from '@angular/router';
 import { DEFAULT_INTERRUPTSOURCES, Idle } from '@ng-idle/core';
 import { TooltipModule } from 'ngx-bootstrap/tooltip';
@@ -9,17 +9,22 @@ import { AccountService } from '../../services/account.service';
 
 @Injectable({ providedIn: 'root' })
 
-export class MenuComponent implements OnInit, AfterViewInit
+export class MenuComponent implements OnInit
 {
 
   logged: boolean = false;
   role: string = "";
 
-  private idleState: String = 'NOT_STARTED';
+  private idleState: string = 'NOT_STARTED';
   private countdown: number = 0;
   private timedOut: boolean = false;
   @ViewChild('signouticon', {static: false}) signOutIcon!: ElementRef;
 
+  @ViewChild('usersicon', {static: false}) usersIcon!: ElementRef;
+  @ViewChild('compoicon', {static: false}) compoIcon!: ElementRef;
+  @ViewChild('prodsicon', {static: false}) prodsIcon!: ElementRef;
+  @ViewChild('variaicon', {static: false}) variaIcon!: ElementRef;
+
   constructor(private idle: Idle, private router: Router, private accountService: AccountService, private el: ElementRef, private renderer: Renderer2)
   {
     this.idle.setIdle(900);
@@ -42,8 +47,6 @@ export class MenuComponent implements OnInit, AfterViewInit
     this.idle.watch();
   }
 
-  ngAfterViewInit() { }
-
   deconnexion() { this.accountService.signOut(); this.logged = false; if ((this.router.url === '/') || (this.router.url === '/home')) { window.location.reload(); } else { this.router.navigate(['/']); }  }
 
   getRandomInteger(min: number, max: number) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; }
@@ -53,4 +56,9 @@ export class MenuComponent implements OnInit, AfterViewInit
   showPendingLogout() { if (this.logged) { if (this.signOutIcon) { this.renderer.addClass(this.signOutIcon.nativeElement, 'fa-beat-fade'); this.renderer.addClass(this.signOutIcon.nativeElement, 'text-danger'); } } }
   hidePendingLogout() { if (this.logged) { if (this.signOutIcon) { this.renderer.removeClass(this.signOutIcon.nativeElement, 'fa-beat-fade'); this.renderer.removeClass(this.signOutIcon.nativeElement, 'text-danger'); } } }
 
+  activeUsersIcon() { if (this.usersIcon) { this.renderer.addClass(this.usersIcon.nativeElement, 'active'); } }
+  activeCompoIcon() { if (this.compoIcon) { this.renderer.addClass(this.compoIcon.nativeElement, 'active'); } }
+  activeProdsIcon() { if (this.prodsIcon) { this.renderer.addClass(this.prodsIcon.nativeElement, 'active'); } }
+  activeVariaIcon() { if (this.variaIcon) { this.renderer.addClass(this.variaIcon.nativeElement, 'active'); } }
+
 }

+ 2 - 4
src/app/composants/participant-create/participant-create.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { FormsModule, NgForm } from '@angular/forms';
 
@@ -11,7 +11,7 @@ import { AccountService } from '../../services/account.service';
 
 @Component({ selector: 'app-participant-create', imports: [FormsModule, MenuComponent], templateUrl: './participant-create.component.html', styleUrl: './participant-create.component.css' })
 
-export class ParticipantCreateComponent implements OnInit, AfterViewInit
+export class ParticipantCreateComponent implements OnInit
 {
 
   profil: string = "";
@@ -42,8 +42,6 @@ export class ParticipantCreateComponent implements OnInit, AfterViewInit
     this.diversService.getJournees().subscribe(data => { this.journees = data; });
   }
 
-  ngAfterViewInit() { }
-
   private saveParticipant() { this.participantService.createParticipant(this.participant).subscribe(); this.goToListParticipant(); }
 
   addParticipant() { if (this.participantForm.valid) { this.saveParticipant(); } }

+ 2 - 4
src/app/composants/participant-details/participant-details.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { FormsModule } from '@angular/forms';
 
@@ -11,7 +11,7 @@ import { AccountService } from '../../services/account.service';
 
 @Component({ selector: 'app-participant-details', imports: [FormsModule, MenuComponent], templateUrl: './participant-details.component.html', styleUrl: './participant-details.component.css' })
 
-export class ParticipantDetailsComponent implements OnInit, AfterViewInit
+export class ParticipantDetailsComponent implements OnInit
 {
 
   profil: string = "";
@@ -46,8 +46,6 @@ export class ParticipantDetailsComponent implements OnInit, AfterViewInit
     this.participantService.getByIdParticipant(this.numeroParticipant).subscribe( data => { this.participant = data; });
   }
 
-  ngAfterViewInit() { }
-
   updateParticipant(id: number) { this.router.navigate(['/participant-update', id]); }
 
   goToListParticipant() { this.router.navigate(['/participant-list'], { queryParams: { 'refresh': this.menu.getRandomInteger(1, 100000) } }); }

+ 2 - 4
src/app/composants/participant-list/participant-list.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 import { FormsModule, NgForm } from '@angular/forms';
 import { TooltipModule } from 'ngx-bootstrap/tooltip';
@@ -11,7 +11,7 @@ import { DiversService } from '../../services/divers.service'
 
 @Component({ selector: 'app-participant-list', imports: [TooltipModule, FormsModule, MenuComponent], templateUrl: './participant-list.component.html', styleUrl: './participant-list.component.css' })
 
-export class ParticipantListComponent implements OnInit, AfterViewInit
+export class ParticipantListComponent implements OnInit
 {
 
   journees: Journees = new Journees();
@@ -35,8 +35,6 @@ export class ParticipantListComponent implements OnInit, AfterViewInit
     this.retreiveDatas();
   }
 
-  ngAfterViewInit() { }
-
   private retreiveDatas() { this.participantService.getListParticipant(this.nomFiltre, this.statutFiltre, this.arriveFiltre, this.listeTri).subscribe(data => { this.participants = data; }); }
 
   getNombreJours(j1: boolean, j2: boolean, j3: boolean)

+ 2 - 4
src/app/composants/participant-update/participant-update.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { FormsModule, NgForm } from '@angular/forms';
 
@@ -11,7 +11,7 @@ import { AccountService } from '../../services/account.service';
 
 @Component({ selector: 'app-participant-update', imports: [FormsModule, MenuComponent], templateUrl: './participant-update.component.html', styleUrl: './participant-update.component.css' })
 
-export class ParticipantUpdateComponent implements OnInit, AfterViewInit
+export class ParticipantUpdateComponent implements OnInit
 {
 
   profil: string = "";
@@ -47,8 +47,6 @@ export class ParticipantUpdateComponent implements OnInit, AfterViewInit
     this.participantService.getByIdParticipant(this.numeroParticipant).subscribe(data => { this.participant = data; });
   }
 
-  ngAfterViewInit() { }
-
   updateConfirmed() { if (this.participantForm.valid) { this.participantService.updateParticipant(this.numeroParticipant, this.participant).subscribe(); this.goToListParticipant(); } }
 
   deleteConfirmed() { this.participantService.deleteParticipant(this.numeroParticipant).subscribe(); this.goToListParticipant(); }

+ 3 - 5
src/app/composants/production-create/production-create.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { MenuComponent } from '../menu/menu.component';
 import { Production, ProductionEnum, ProductionTypeList } from '../../interfaces/production';
 import { ProductionService } from '../../services/production.service';
@@ -9,7 +9,7 @@ import { FormsModule, NgForm } from '@angular/forms';
 
 @Component({ selector: 'app-production-create', imports: [FormsModule, MenuComponent], templateUrl: './production-create.component.html', styleUrl: './production-create.component.css' })
 
-export class ProductionCreateComponent implements OnInit, AfterViewInit
+export class ProductionCreateComponent implements OnInit
 {
 
   participants: ParticipantShort[] = [];
@@ -22,9 +22,7 @@ export class ProductionCreateComponent implements OnInit, AfterViewInit
 
   constructor(private productionService: ProductionService, private participantService: ParticipantService, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void { this.retreiveParticipants(); }
-
-  ngAfterViewInit() { }
+  ngOnInit() { this.retreiveParticipants(); }
 
   private retreiveParticipants() { this.participantService.getOptionListParticipant().subscribe(data => { this.participants = data; }); }
 

+ 10 - 12
src/app/composants/production-details/production-details.component.ts

@@ -1,36 +1,34 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { ProductionShort, ProductionEnum, ProductionTypeList } from '../../interfaces/production';
 import { ProductionService } from '../../services/production.service';
-import { FormsModule } from '@angular/forms'; 
+import { FormsModule } from '@angular/forms';
 
 @Component({ selector: 'app-production-details', imports: [FormsModule, MenuComponent], templateUrl: './production-details.component.html', styleUrl: './production-details.component.css' })
 
-export class ProductionDetailsComponent implements OnInit, AfterViewInit
+export class ProductionDetailsComponent implements OnInit
 {
-  
+
   numeroProduction: number = 0;
 
   types: ProductionEnum[] = ProductionTypeList;
-  
+
   production: ProductionShort = new ProductionShort();
-  
+
   constructor(private productionService: ProductionService, private route: ActivatedRoute, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void 
-  { 
+  ngOnInit()
+  {
     this.numeroProduction = this.route.snapshot.params['numeroProduction'];
     this.production = new ProductionShort();
     this.productionService.getByIdProduction(this.numeroProduction).subscribe( data => { this.production = data; });
   }
-  
-  ngAfterViewInit() { }
 
   updateArchive(id: number) { this.router.navigate(['/production-upload', id]); }
-  
+
   updateProduction(id: number) { this.router.navigate(['/production-update', id]); }
 
   goToListProduction() {this.router.navigate(['/production-list'], { queryParams: { 'refresh': this.menu.getRandomInteger(1, 100000) } }); }
-  
+
 }

+ 2 - 4
src/app/composants/production-list/production-list.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { ProductionShort, ProductionEnum, ProductionTypeList } from '../../interfaces/production';
@@ -8,7 +8,7 @@ import { TooltipModule } from 'ngx-bootstrap/tooltip';
 
 @Component({ selector: 'app-production-list', imports: [TooltipModule, MenuComponent], templateUrl: './production-list.component.html', styleUrl: './production-list.component.css' })
 
-export class ProductionListComponent implements OnInit, AfterViewInit
+export class ProductionListComponent implements OnInit
 {
   productions: ProductionShort[] = [];
 
@@ -18,8 +18,6 @@ export class ProductionListComponent implements OnInit, AfterViewInit
 
   ngOnInit() { this.retreiveDatas(); }
 
-  ngAfterViewInit() { }
-
   private retreiveDatas() { this.productionService.getListProduction().subscribe(data => { this.productions = data; }); }
 
   goToRefreshListProduction(){ this.retreiveDatas(); }

+ 3 - 5
src/app/composants/production-update/production-update.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { ProductionShort, ProductionEnum, ProductionTypeList } from '../../interfaces/production';
@@ -9,7 +9,7 @@ import { FormsModule, NgForm } from '@angular/forms';
 
 @Component({ selector: 'app-production-update', imports: [FormsModule, MenuComponent], templateUrl: './production-update.component.html', styleUrl: './production-update.component.css' })
 
-export class ProductionUpdateComponent implements OnInit, AfterViewInit
+export class ProductionUpdateComponent implements OnInit
 {
 
   participants: ParticipantShort[] = [];
@@ -24,15 +24,13 @@ export class ProductionUpdateComponent implements OnInit, AfterViewInit
 
   constructor(private productionService: ProductionService, private participantService: ParticipantService, private route: ActivatedRoute, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void
+  ngOnInit()
   {
     this.retreiveParticipants();
     this.numeroProduction = this.route.snapshot.params['numeroProduction'];
     this.productionService.getByIdProduction(this.numeroProduction).subscribe(data => { this.production = data; });
   }
 
-  ngAfterViewInit() { }
-
   private retreiveParticipants() { this.participantService.getOptionListParticipant().subscribe(data => { this.participants = data; }); }
 
   onVignetteSelected(event: any)

+ 3 - 5
src/app/composants/production-upload/production-upload.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { ProductionFile } from '../../interfaces/production';
@@ -7,7 +7,7 @@ import { FormsModule } from '@angular/forms';
 
 @Component({ selector: 'app-production-upload', imports: [FormsModule, MenuComponent], templateUrl: './production-upload.component.html', styleUrl: './production-upload.component.css' })
 
-export class ProductionUploadComponent implements OnInit, AfterViewInit
+export class ProductionUploadComponent implements OnInit
 {
 
   production: ProductionFile = new ProductionFile();
@@ -16,14 +16,12 @@ export class ProductionUploadComponent implements OnInit, AfterViewInit
 
   constructor(private productionService: ProductionService, private route: ActivatedRoute, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void
+  ngOnInit()
   {
     this.numeroProduction = this.route.snapshot.params['numeroProduction'];
     this.productionService.getByIdProductionFile(this.numeroProduction).subscribe(data => { this.production = data; });
   }
 
-  ngAfterViewInit() { }
-
   onArchiveSelected(event: any)
   {
     const et = event.target;

+ 3 - 5
src/app/composants/variable-create/variable-create.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { Variable } from '../../interfaces/variable';
 import { VariableService } from '../../services/variable.service';
@@ -7,7 +7,7 @@ import { FormsModule, NgForm, NgModel } from '@angular/forms';
 
 @Component({ selector: 'app-variable-create', imports: [FormsModule, MenuComponent], templateUrl: './variable-create.component.html', styleUrl: './variable-create.component.css' })
 
-export class VariableCreateComponent implements OnInit, AfterViewInit
+export class VariableCreateComponent implements OnInit
 {
 
   @ViewChild('formRef') variableForm!: NgForm;
@@ -18,9 +18,7 @@ export class VariableCreateComponent implements OnInit, AfterViewInit
 
   constructor(private variableService: VariableService, private router: Router, private menu: MenuComponent) { }
 
-  ngOnInit(): void { }
-
-  ngAfterViewInit() { }
+  ngOnInit() { }
 
   private saveVariable() { this.variableService.createVariable(this.variable).subscribe(); this.goToListVariable(); }
 

+ 2 - 4
src/app/composants/variable-details/variable-details.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { Variable } from '../../interfaces/variable';
@@ -7,7 +7,7 @@ import { FormsModule } from '@angular/forms';
 
 @Component({ selector: 'app-variable-details', imports: [FormsModule, MenuComponent], templateUrl: './variable-details.component.html', styleUrl: './variable-details.component.css' })
 
-export class VariableDetailsComponent implements OnInit, AfterViewInit
+export class VariableDetailsComponent implements OnInit
 {
 
   numeroVariable: number = 0;
@@ -23,8 +23,6 @@ export class VariableDetailsComponent implements OnInit, AfterViewInit
     this.variableService.getByIdVariable(this.numeroVariable).subscribe( data => { this.variable = data; });
   }
 
-  ngAfterViewInit() { }
-
   updateVariable(id: number) { this.router.navigate(['/variable-update', id]); }
 
   goToListVariable() { this.router.navigate(['/variable-list'], { queryParams: { 'refresh': this.menu.getRandomInteger(1, 100000) } }); }

+ 2 - 4
src/app/composants/variable-list/variable-list.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { Variable, VariableType } from '../../interfaces/variable';
@@ -7,7 +7,7 @@ import { FormsModule, NgForm } from '@angular/forms';
 
 @Component({ selector: 'app-variable-list', imports: [FormsModule, MenuComponent], templateUrl: './variable-list.component.html', styleUrl: './variable-list.component.css' })
 
-export class VariableListComponent implements OnInit, AfterViewInit
+export class VariableListComponent implements OnInit
 {
 
   types: VariableType[] = [];
@@ -19,8 +19,6 @@ export class VariableListComponent implements OnInit, AfterViewInit
 
   ngOnInit() { this.goToRefreshListVariable(); }
 
-  ngAfterViewInit() { }
-
   private retreiveDatas() { this.variableService.getListVariable(this.typeFiltre).subscribe(data => { this.variables = data; }); }
   private retreiveTypes() { this.variableService.getOptionListVariableType().subscribe(data => { this.types = data; }); }
 

+ 2 - 4
src/app/composants/variable-update/variable-update.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { MenuComponent } from '../menu/menu.component';
 import { Variable } from '../../interfaces/variable';
@@ -7,7 +7,7 @@ import { FormsModule, NgForm } from '@angular/forms';
 
 @Component({ selector: 'app-variable-update', imports: [FormsModule, MenuComponent], templateUrl: './variable-update.component.html', styleUrl: './variable-update.component.css' })
 
-export class VariableUpdateComponent implements OnInit, AfterViewInit
+export class VariableUpdateComponent implements OnInit
 {
 
   @ViewChild('formRef') variableForm!: NgForm;
@@ -24,8 +24,6 @@ export class VariableUpdateComponent implements OnInit, AfterViewInit
     this.variableService.getByIdVariable(this.numeroVariable).subscribe(data => { this.variable = data; });
   }
 
-  ngAfterViewInit() { }
-
   updateConfirmed() { if (this.variableForm.valid) { this.variableService.updateVariable(this.numeroVariable, this.variable).subscribe(); this.goToListVariable(); } }
 
   deleteConfirmed() { this.variableService.deleteVariable(this.numeroVariable).subscribe(); this.goToListVariable(); }

+ 1 - 0
src/app/interfaces/production.ts

@@ -51,6 +51,7 @@ export class ProductionShort
 export class ProductionFile
 {
   numeroProduction: number = 0;
+  numeroParticipant: number = 0;
   titre: string = "";
   nomArchive: string = "";
   archive!: string | any;

+ 8 - 0
src/app/interfaces/user.ts

@@ -17,3 +17,11 @@ export class RefreshToken
   accessToken: string = "";
   refreshToken: string = "";
 }
+
+export class NewPassword
+{
+  username: string = "";
+  ancien: string = "";
+  nouveau: string = "";
+  erreur: string = "";
+}

+ 3 - 1
src/app/services/account.service.ts

@@ -5,7 +5,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
 import { map } from 'rxjs/operators';
 
 import { Environnement } from '../env';
-import { User, RefreshToken } from '../interfaces/user';
+import { User, RefreshToken, NewPassword } from '../interfaces/user';
 import { Participant } from '../interfaces/participant';
 import { Journees } from '../interfaces/divers';
 
@@ -74,4 +74,6 @@ export class AccountService
 
   updateProfil(participant: Participant): Observable<Object>{ return this.httpClient.put(`${this.baseURLacc}/update`, participant); }
 
+  updatePassword(newpass: NewPassword) { return this.httpClient.post<NewPassword>(`${this.baseURLacc}/newmdp`, newpass); }
+
 }