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="couleur col-7" [style.background-color]="personne.couleur"></div>
<div class="col-5"> <div class="col-5">
<div class="col"> <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"> class=" btn btn-sm btn-rounded btn-secondary mb-2">
Modifier Modifier
</button> </button>
</div> </div>
<div class="col"> <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 Supprimer
</button> </button>
</div> </div>

View File

@ -1,4 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { TokenService } from 'src/app/services/token.service';
@Component({ @Component({
selector: 'app-fiche-contact', selector: 'app-fiche-contact',
@ -8,10 +9,20 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
export class FicheContactComponent implements OnInit { export class FicheContactComponent implements OnInit {
@Input() personne: any; @Input() personne: any;
@Output() clickDelete = new EventEmitter(); @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){ onClickDelete(numPerson: number){
window.alert("Le contact à bien été supprimé!") 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 { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { TokenService } from 'src/app/services/token.service';
@Component({ @Component({
selector: 'app-page-accueil', selector: 'app-page-accueil',
@ -7,9 +10,15 @@ import { Component, OnInit } from '@angular/core';
}) })
export class PageAccueilComponent implements OnInit { export class PageAccueilComponent implements OnInit {
constructor() { } constructor(private http: HttpClient, private router: Router, private tokenService: TokenService) {
}
ngOnInit(): void { ngOnInit(): void {
const token = this.tokenService.getToken();
if(token){
this.router.navigate(['tableau-de-bord']);
}
} }
} }

View File

@ -12,7 +12,7 @@
.container { .container {
display: flex; display: flex;
padding: 10px; padding: 20px;
} }
@ -26,7 +26,7 @@ button{
#boxFour{ #boxFour{
height: 150px; height: 150px;
margin-top: -70px; margin-top: -99px;
width: fit-content; width: fit-content;
} }

View File

@ -7,10 +7,8 @@
<div class="col compte text-center py-3 border"> <div class="col compte text-center py-3 border">
<div> <div>
<button class="btn btn-sm btn-rounded btn-secondary m-3" type="submit">
Tous les contacts
</button>
<button <button
*ngIf="parent"
routerLink="/ajouter-contact" routerLink="/ajouter-contact"
class="btn btn-sm btn-rounded btn-secondary m-3" 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 { ActivatedRoute, Router } from '@angular/router';
import { Contact } from 'src/app/models/contact'; import { Contact } from 'src/app/models/contact';
import { RepertoireService } from 'src/app/services/repertoire.service'; import { RepertoireService } from 'src/app/services/repertoire.service';
import { TokenService } from 'src/app/services/token.service';
@Component({ @Component({
selector: 'app-page-repertoire', selector: 'app-page-repertoire',
@ -15,18 +16,27 @@ export class PageRepertoireComponent implements OnInit {
public personneid: any; public personneid: any;
keyword: any; keyword: any;
openDetails: any; openDetails: any;
parent: boolean;
constructor( constructor(
private repertoireService: RepertoireService, private repertoireService: RepertoireService,
private router: Router, private router: Router,
private route: ActivatedRoute private route: ActivatedRoute,
private tokenService: TokenService
) { ) {
this.listContact = []; this.listContact = [];
this.listFull = []; this.listFull = [];
this.listContactInfo = ''; this.listContactInfo = '';
this.parent = false;
} }
ngOnInit(): void { ngOnInit(): void {
const roleUser = this.tokenService.getRole();
if(roleUser == "ROLE_PARENT"){
this.parent = true;
}
//récupère tout les contact et leurs info //récupère tout les contact et leurs info
this.repertoireService.getContact().subscribe((listContact: any[]) => { this.repertoireService.getContact().subscribe((listContact: any[]) => {
console.log(listContact); console.log(listContact);