Merge pull request #58 from AlineRinquin/aline

Aline
This commit is contained in:
AlineRinquin 2022-02-26 17:50:09 +01:00 committed by GitHub
commit c9d964f7dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 11 deletions

View File

@ -4,13 +4,17 @@
<div class="couleur col-7" [style.background-color]="personne.couleur"></div>
<div class="col-5">
<div class="col">
<button routerLink="../modifier-contact/{{personne.id}}"
<button
*ngIf="parent"
routerLink="../modifier-contact/{{personne.id}}"
class=" btn btn-sm btn-rounded btn-secondary mb-2">
Modifier
</button>
</div>
<div class="col">
<button class=" btn btn-sm btn-rounded btn-secondary" (click)="onClickDelete(personne.id)">
<button
*ngIf="parent"
class=" btn btn-sm btn-rounded btn-secondary" (click)="onClickDelete(personne.id)">
Supprimer
</button>
</div>

View File

@ -1,4 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { TokenService } from 'src/app/services/token.service';
@Component({
selector: 'app-fiche-contact',
@ -8,10 +9,20 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
export class FicheContactComponent implements OnInit {
@Input() personne: any;
@Output() clickDelete = new EventEmitter();
parent: boolean;
constructor() {}
ngOnInit(): void {}
constructor(private tokenService: TokenService) {
this.parent = false;
}
ngOnInit(): void {
const roleUser = this.tokenService.getRole();
if(roleUser == "ROLE_PARENT"){
this.parent = true;
}
}
onClickDelete(numPerson: number){
window.alert("Le contact à bien été supprimé!")

View File

@ -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']);
}
}
}

View File

@ -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;
}

View File

@ -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"
>

View File

@ -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);