Ajout d'un navbar pour chaque rôle

master
Yanaël GRETTE 5 years ago
parent ccb676071f
commit f7ab45774b
  1. 10
      src/app/angular-material/angular-material.module.ts
  2. 10
      src/app/app.component.html
  3. 9
      src/app/app.module.ts
  4. 4
      src/app/home/home.component.html
  5. 7
      src/app/home/home.component.ts
  6. 5
      src/app/nav-menu/index.ts
  7. 9
      src/app/nav-menu/nav-menu-assistante/nav-menu-assistante.component.html
  8. 8
      src/app/nav-menu/nav-menu-assistante/nav-menu-assistante.component.ts
  9. 2
      src/app/nav-menu/nav-menu-collaborateur/nav-menu-collaborateur.component.html
  10. 8
      src/app/nav-menu/nav-menu-collaborateur/nav-menu-collaborateur.component.ts
  11. 10
      src/app/nav-menu/nav-menu-commercial/nav-menu-commercial.component.html
  12. 8
      src/app/nav-menu/nav-menu-commercial/nav-menu-commercial.component.ts
  13. 16
      src/app/nav-menu/nav-menu-rh/nav-menu-rh.component.html
  14. 8
      src/app/nav-menu/nav-menu-rh/nav-menu-rh.component.ts
  15. 23
      src/app/nav-menu/nav-menu.component.html
  16. 21
      src/app/nav-menu/nav-menu.component.ts
  17. BIN
      src/assets/img/logo.png
  18. BIN
      src/favicon.ico

@ -3,9 +3,15 @@ import { CommonModule } from "@angular/common";
/*import { /*import {
} from "@angular/material";//*/ } from "@angular/material";//*/
import {MatCardModule} from '@angular/material/card';
import { MatButtonModule } from '@angular/material/button';
import {MatMenuModule} from '@angular/material/menu';
import {MatIconModule} from '@angular/material/icon';
@NgModule({ @NgModule({
imports : [] exports : [MatCardModule,
MatButtonModule, MatMenuModule,
MatIconModule
]
}) })
export class MaterialModule {} export class MaterialModule {}

@ -1,6 +1,4 @@
<body> <!--<app-nav-menu></app-nav-menu>-->
<!--<app-nav-menu></app-nav-menu>--> <div class="container">
<div class="container"> <router-outlet></router-outlet>
<router-outlet></router-outlet> </div>
</div>
</body>

@ -10,6 +10,9 @@ import { MaterialModule } from "./angular-material/angular-material.module";
import { HomeComponent, HomeAssistanteComponent, HomeCollaborateurComponent, import { HomeComponent, HomeAssistanteComponent, HomeCollaborateurComponent,
HomeCommercialComponent, HomeRHComponent } from './home'; HomeCommercialComponent, HomeRHComponent } from './home';
import { NavMenuComponent, NavMenuAssistanteComponent,
NavMenuCollaborateurComponent, NavMenuCommercialComponent, NavMenuRHComponent } from "./nav-menu";
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@ -18,13 +21,15 @@ let keycloakService: KeycloakService = new KeycloakService();
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, HomeComponent, HomeAssistanteComponent AppComponent, HomeComponent, HomeAssistanteComponent
, HomeCollaborateurComponent, HomeCommercialComponent, HomeRHComponent , HomeCollaborateurComponent, HomeCommercialComponent, HomeRHComponent, NavMenuComponent,
NavMenuAssistanteComponent, NavMenuCollaborateurComponent, NavMenuCommercialComponent, NavMenuRHComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
KeycloakAngularModule, KeycloakAngularModule,
AppRoutingModule, AppRoutingModule,
BrowserAnimationsModule BrowserAnimationsModule,
MaterialModule
], ],
providers: [ providers: [
{ {

@ -1,5 +1,5 @@
<button on-click="logout()"> logout </button> <app-nav-menu></app-nav-menu>
<h1> Bonjour {{ keycloakService.getKeycloakInstance().profile.firstName }} {{ keycloakService.getKeycloakInstance().profile.lastName }}</h1> <h1> Bonjour</h1>
<home-assistante *ngIf="this.keycloakService.isUserInRole(role.assistante)"></home-assistante> <home-assistante *ngIf="this.keycloakService.isUserInRole(role.assistante)"></home-assistante>
<home-collaborateur *ngIf="this.keycloakService.isUserInRole(role.collaborateur)"></home-collaborateur> <home-collaborateur *ngIf="this.keycloakService.isUserInRole(role.collaborateur)"></home-collaborateur>
<home-commercial *ngIf="this.keycloakService.isUserInRole(role.commercial)"></home-commercial> <home-commercial *ngIf="this.keycloakService.isUserInRole(role.commercial)"></home-commercial>

@ -2,10 +2,12 @@ import { Component, OnInit } from '@angular/core';
import { KeycloakService } from 'keycloak-angular'; import { KeycloakService } from 'keycloak-angular';
/*
import { HomeAssistanteComponent } from './home-assistante/home-assistante.component'; import { HomeAssistanteComponent } from './home-assistante/home-assistante.component';
import { HomeCollaborateurComponent } from './home-collaborateur/home-collaborateur.component'; import { HomeCollaborateurComponent } from './home-collaborateur/home-collaborateur.component';
import { HomeCommercialComponent } from './home-commercial/home-commercial.component'; import { HomeCommercialComponent } from './home-commercial/home-commercial.component';
import { HomeRHComponent } from './home-rh/home-rh.component'; import { HomeRHComponent } from './home-rh/home-rh.component';
//*/
import { Role } from '../utils/roles'; import { Role } from '../utils/roles';
@ -22,9 +24,6 @@ export class HomeComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
async logout() {
console.log("Disconnected button clicked");
await this.keycloakService.logout();
}
} }

@ -0,0 +1,5 @@
export * from "./nav-menu.component";
export * from "./nav-menu-assistante/nav-menu-assistante.component";
export * from "./nav-menu-collaborateur/nav-menu-collaborateur.component";
export * from "./nav-menu-commercial/nav-menu-commercial.component";
export * from "./nav-menu-rh/nav-menu-rh.component";

@ -0,0 +1,9 @@
<button mat-button [matMenuTriggerFor]="menuCollaborateurs">
<span>Collaborateurs</span>
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menuCollaborateurs="matMenu">
<button mat-menu-item>Liste des collaborateurs</button>
<button mat-menu-item>Liste des EPs collaborateurs non signés</button>
</mat-menu>
<button mat-button>Liste des référents</button>

@ -0,0 +1,8 @@
import { Component } from "@angular/core";
@Component({
selector : "app-nav-menu-assistante",
templateUrl : "./nav-menu-assistante.component.html"
})
export class NavMenuAssistanteComponent {}

@ -0,0 +1,2 @@
<button mat-button>Liste des EP</button>
<button mat-button>Liste des Formations</button>

@ -0,0 +1,8 @@
import { Component } from "@angular/core";
@Component({
selector : "app-nav-menu-collaborateur",
templateUrl : "./nav-menu-collaborateur.component.html"
})
export class NavMenuCollaborateurComponent {}

@ -0,0 +1,10 @@
<button mat-button [matMenuTriggerFor]="menuCollaborateurs">
<span>Collaborateurs</span>
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menuCollaborateurs="matMenu">
<button mat-menu-item>Liste de tous les collaborateurs</button>
<button mat-menu-item>Liste des collaborateurs suivis</button>
</mat-menu>
<button mat-button>Liste des formations</button>
<button mat-button>EP effectués</button>

@ -0,0 +1,8 @@
import { Component } from "@angular/core";
@Component({
selector : "app-nav-menu-commercial",
templateUrl : "./nav-menu-commercial.component.html"
})
export class NavMenuCommercialComponent {}

@ -0,0 +1,16 @@
<button mat-button [matMenuTriggerFor]="menuFormation">
<span>Formation</span>
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menuFormation="matMenu">
<button mat-menu-item>Ajouter une nouvelle formation</button>
<button mat-menu-item>Liste des formations</button>
</mat-menu>
<button mat-button [matMenuTriggerFor]="menuDemande">
<span>Demande de formations</span>
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menuDemande="matMenu">
<button mat-menu-item>Créer une nouvelle demande de formation</button>
<button mat-menu-item>Liste des demandes</button>
</mat-menu>

@ -0,0 +1,8 @@
import { Component } from "@angular/core";
@Component({
selector : "app-nav-menu-rh",
templateUrl : "./nav-menu-rh.component.html"
})
export class NavMenuRHComponent {}

@ -0,0 +1,23 @@
<header>
<mat-card>
<!--Mettre l'icon APSIDE-->
<img src="../../assets/img/logo.png">
<!--LIEN VERS HOME-->
<button mat-button>Accueil</button>
<!--RESTE MENU EN FONCTION DES ROLES-->
<app-nav-menu-assistante *ngIf="this.keycloakService.isUserInRole(role.assistante)"></app-nav-menu-assistante>
<app-nav-menu-collaborateur *ngIf="this.keycloakService.isUserInRole(role.collaborateur)"></app-nav-menu-collaborateur>
<app-nav-menu-commercial *ngIf="this.keycloakService.isUserInRole(role.commercial)"></app-nav-menu-commercial>
<app-nav-menu-rh *ngIf="this.keycloakService.isUserInRole(role.rh)"></app-nav-menu-rh>
<!--METTRE QUELQUE CHOSE DE SIMILAIRE A SYGES-->
<!--<button mat-button on-click="logout()"> logout </button>-->
<button mat-button [matMenuTriggerFor]="menuMore">
<span>{{ keycloakService.getKeycloakInstance().profile.firstName }} {{ keycloakService.getKeycloakInstance().profile.lastName }}</span>
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menuMore="matMenu">
<button mat-menu-item on-click="logout()">Déconnexion</button>
</mat-menu>
</mat-card>
</header>

@ -0,0 +1,21 @@
import { Component } from '@angular/core';
import { KeycloakService } from 'keycloak-angular';
import { Role } from '../utils/roles';
@Component({
selector: 'app-nav-menu',
templateUrl: './nav-menu.component.html',
})
export class NavMenuComponent {
role = Role;
constructor(public keycloakService : KeycloakService){}
isExpanded = false;
async logout() {
await this.keycloakService.logout();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

After

Width:  |  Height:  |  Size: 46 KiB

Loading…
Cancel
Save