account-details.component.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { Component, OnInit } from '@angular/core';
  2. import { Router } from '@angular/router';
  3. import { FormsModule } from '@angular/forms';
  4. import { MenuComponent } from '../menu/menu.component';
  5. import { Participant, ParticipantEnum, ProfilList } from '../../interfaces/participant';
  6. import { AccountService } from '../../services/account.service'
  7. import { Journees } from '../../interfaces/divers';
  8. import { DiversService } from '../../services/divers.service'
  9. @Component({ selector: 'app-account-details', imports: [FormsModule, MenuComponent], templateUrl: './account-details.component.html', styleUrl: './account-details.component.css' })
  10. export class AccountDetailsComponent implements OnInit
  11. {
  12. profil: string = "";
  13. profils: ParticipantEnum[] = ProfilList;
  14. journees: Journees = new Journees();
  15. participant: Participant = new Participant();
  16. constructor(
  17. private diversService: DiversService,
  18. private accountService : AccountService,
  19. private router: Router,
  20. private menu: MenuComponent
  21. ) { }
  22. ngOnInit()
  23. {
  24. this.profil = this.accountService.getRole();
  25. this.journees = new Journees();
  26. this.diversService.getJournees().subscribe(data => { this.journees = data; });
  27. this.participant = new Participant();
  28. this.accountService.getProfil().subscribe( data => { this.participant = data; });
  29. }
  30. updateProfil() { this.router.navigate(['/account-update']); }
  31. updateMotDePasse() { this.router.navigate(['/account-password']); }
  32. goToHome() { this.router.navigate(['/'], { queryParams: { 'refresh': this.menu.getRandomInteger(1, 100000) } }); }
  33. }