redirection page acceuil et miseen place de privation d'action si enfant
This commit is contained in:
parent
1d4a2c957c
commit
4386c4b474
6 changed files with 43 additions and 11 deletions
|
|
@ -1,4 +1,7 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { TokenService } from 'src/app/services/token.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-accueil',
|
||||
|
|
@ -7,9 +10,15 @@ import { Component, OnInit } from '@angular/core';
|
|||
})
|
||||
export class PageAccueilComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(private http: HttpClient, private router: Router, private tokenService: TokenService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
const token = this.tokenService.getToken();
|
||||
if(token){
|
||||
this.router.navigate(['tableau-de-bord']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
.container {
|
||||
display: flex;
|
||||
padding: 10px;
|
||||
padding: 20px;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ button{
|
|||
|
||||
#boxFour{
|
||||
height: 150px;
|
||||
margin-top: -70px;
|
||||
margin-top: -99px;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,8 @@
|
|||
|
||||
<div class="col compte text-center py-3 border">
|
||||
<div>
|
||||
<button class="btn btn-sm btn-rounded btn-secondary m-3" type="submit">
|
||||
Tous les contacts
|
||||
</button>
|
||||
<button
|
||||
*ngIf="parent"
|
||||
routerLink="/ajouter-contact"
|
||||
class="btn btn-sm btn-rounded btn-secondary m-3"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Contact } from 'src/app/models/contact';
|
||||
import { RepertoireService } from 'src/app/services/repertoire.service';
|
||||
import { TokenService } from 'src/app/services/token.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-repertoire',
|
||||
|
|
@ -15,18 +16,27 @@ export class PageRepertoireComponent implements OnInit {
|
|||
public personneid: any;
|
||||
keyword: any;
|
||||
openDetails: any;
|
||||
parent: boolean;
|
||||
|
||||
constructor(
|
||||
private repertoireService: RepertoireService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute
|
||||
private route: ActivatedRoute,
|
||||
private tokenService: TokenService
|
||||
) {
|
||||
this.listContact = [];
|
||||
this.listFull = [];
|
||||
this.listContactInfo = '';
|
||||
this.parent = false;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
const roleUser = this.tokenService.getRole();
|
||||
|
||||
if(roleUser == "ROLE_PARENT"){
|
||||
this.parent = true;
|
||||
}
|
||||
|
||||
//récupère tout les contact et leurs info
|
||||
this.repertoireService.getContact().subscribe((listContact: any[]) => {
|
||||
console.log(listContact);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue