From 0a9d17741c1f9ced15be96b5538c2aba7ac32197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Thu, 11 Feb 2021 16:28:34 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20d=C3=A9tails=20d'u?= =?UTF-8?q?n=20r=C3=A9f=C3=A9rent=20et=20des=20d=C3=A9tails=20d'un=20colla?= =?UTF-8?q?borateur=20avec=20utilisation=20d'un=20composant=20r=C3=A9utili?= =?UTF-8?q?sable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.module.ts | 4 +- .../collaborateurs/collaborateurs.module.ts | 2 + .../details-collaborateur.component.html | 17 +-- .../details-collaborateur.component.ts | 130 +----------------- .../details-referent.component.html | 7 +- .../details-referent.component.ts | 37 +---- src/app/referents/referents.module.ts | 2 + .../affichage-details-collaborateur.html | 23 ++++ .../affichage-details-collaborateur.module.ts | 20 +++ .../affichage-details-collaborateur.ts | 30 ++++ .../shared/mat-tables/mat-tables.module.ts | 4 +- 11 files changed, 96 insertions(+), 180 deletions(-) create mode 100644 src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html create mode 100644 src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts create mode 100644 src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 891e137..50df755 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -20,6 +20,7 @@ import { FormationsModule } from './formations'; import { DemandesFormationModule } from './demandes-formation'; import { DemandesDelegationModule } from './demandes-delegation'; import { EpSaisieModule } from "./ep-saisie"; +import { AffichageDetailsCollaborateurModule } from "@shared/affichage-details-collaboarteur/affichage-details-collaborateur.module"; import { EpModule } from "./ep" import { AuthModule } from '@shared/auth/auth.module'; @@ -36,7 +37,8 @@ import { MatTablesModule } from "@shared/mat-tables/mat-tables.module"; HomeModule, CollaborateursModule, ReferentsModule, FormationsModule, DemandesFormationModule, DemandesDelegationModule, - EpSaisieModule, EpModule, MatTablesModule + EpSaisieModule, EpModule, MatTablesModule, + AffichageDetailsCollaborateurModule ], providers: [], diff --git a/src/app/collaborateurs/collaborateurs.module.ts b/src/app/collaborateurs/collaborateurs.module.ts index f8f470c..6ebb1a0 100644 --- a/src/app/collaborateurs/collaborateurs.module.ts +++ b/src/app/collaborateurs/collaborateurs.module.ts @@ -15,6 +15,7 @@ import { FormationsCollaboateurComponent } from "./formations-collaborateur/form import { MatTablesModule } from "@shared/mat-tables/mat-tables.module"; import { CollaborateursRoutingModule } from "./collaborateurs.routing.module"; +import { AffichageDetailsCollaborateurModule } from "@shared/affichage-details-collaboarteur/affichage-details-collaborateur.module"; /** * Module collaborateur. @@ -36,6 +37,7 @@ import { CollaborateursRoutingModule } from "./collaborateurs.routing.module"; MaterialModule, NavMenuModule, MatTablesModule, + AffichageDetailsCollaborateurModule, CollaborateursRoutingModule, RouterModule ], diff --git a/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.html b/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.html index 7db1129..ae6883f 100644 --- a/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.html +++ b/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.html @@ -1,20 +1,13 @@ - -

{{ collaborateur.prenom }} {{ collaborateur.nom }}

- -

Agence : {{ collaborateur.businessUnit.nom}}

-

Date embauche : {{ collaborateur.dateArrivee}}

-
- - - + + + Affichage de la liste des EP effectués

Liste des précédents EP

@@ -34,7 +27,7 @@ - + Voir détails EP @@ -42,3 +35,5 @@ + +--> \ No newline at end of file diff --git a/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts b/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts index 440919c..5a40066 100644 --- a/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts +++ b/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts @@ -1,15 +1,7 @@ -import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core'; +import { Component } from '@angular/core'; -import { Observable, Subscription } from 'rxjs'; import {ActivatedRoute} from '@angular/router'; -import {MatTableDataSource} from '@angular/material/table'; -import {MatPaginator} from '@angular/material/paginator'; -import {MatSort} from '@angular/material/sort'; - -import { CollaborateursService, EpService } from "@shared/api-swagger/api/api"; - -import { EpInformationDTO, CollaborateurDTO } from "@shared/api-swagger/model/models"; /** * Composant pour gérer l'affichage des détails d'un collaborateur et de ses EP @@ -18,124 +10,10 @@ import { EpInformationDTO, CollaborateurDTO } from "@shared/api-swagger/model/mo selector: 'app-details-collaborateur', templateUrl: './details-collaborateur.component.html' }) -export class DetailsCollaborateurComponent implements OnInit { - - /** - * Ordre de tri à envoyer au serveur (true : croissant, false : décroissantà). - */ - asc = true; - /** - * Numéro de la page à afficher dans le tableau. - */ - numPage = 1; - /** - * Nombre d'élément du tableau à affiche en une page. - */ - parPage = 5; - /** - * contenu de la recherche pour trouver un référent. - */ - search = ""; - /** - * Permet de savoir sur quelle attribut d'un CollaborateurDTO doit être trié le tableau. - */ - tri = ""; - - /** - * Nombre d'EP effectué permettant de savoir si il faut faire afficher le tableau ou non - */ - nbEP = 0; - - /** - * Collaborateur dont on affiche les détails - */ - collaborateur: CollaborateurDTO; - /** - * Observable pour récupérer le collaborateur - */ - private collaborateurSubscription : Subscription; - /** - * Observable pour récupérer la liste des EP du collaborateur - */ - private epSubscription : Subscription; - /** - * Les colonnes à afficher dans le tableau. - */ - displayedColumns: string[] = ["dateentretien", "referent", "type", "details"]; - - /** - * dataSource dans lequel sera stockée les informations à faire afficher dans le Mat Table - */ - dataSource : MatTableDataSource; - /** - * Variable qui permet de vérifier que le chargement des EP a bien été fait - */ - eploaded = false; - /** - * id du collaborateur à récupérer dans l'URL - */ - idCollaborateur: any; - - /** - * Pagination du tableau. - */ - @ViewChild(MatPaginator) paginator: MatPaginator; - - /** - * Tri par les éléments du tableau selon la colonne choisie. - */ - @ViewChild(MatSort) sort: MatSort; +export class DetailsCollaborateurComponent { - constructor(private collaborateusrService:CollaborateursService, private epService:EpService, private route: ActivatedRoute) {} - - ngOnInit() { - //récupérer l'id du collaborateur dans les paramètres de l'URL + idCollaborateur: string; + constructor(private route: ActivatedRoute) { this.idCollaborateur = this.route.snapshot.paramMap.get('id'); - this.collaborateurSubscription = this.collaborateusrService.getCollaborateurById(this.idCollaborateur).subscribe( - collaborateur => { - this.collaborateur = collaborateur; - this.updateEP(); - }, - err => console.log(err) - ); - } - - getReferent(referent : CollaborateurDTO) { - if(referent == undefined || referent == null) { return "Referent indisponible"} - return referent.prenom + " "+ referent.nom; - } - - /** - * Mise à jour du tableau des EP lors d'un changement de page du tableau, du nombre d'élément à afficher ou d'un tri. - * La fonction est aussi appelé au début du chargement et à l'utilisation de la barre de recherche. - */ - updateEP() { - this.epSubscription = this.epService.getEPSignesCollaborateur(this.idCollaborateur).subscribe( - ep => - { - console.log(ep); - if(ep != null) { - - this.nbEP = ep.length; - this.dataSource = new MatTableDataSource(ep); - } - }, - err => console.log(err) - ); - this.eploaded = true; - //this.dataSource.paginator = this.paginator; - //this.dataSource.sort = this.sort; - } - - /** - * Une fois la page fermée, il est nécessaire de se désabonner des Oberservable afin d'éviter les fuites mémoires. - */ - ngOnDestroy() { - if(this.epSubscription!= undefined) { - this.epSubscription.unsubscribe(); - } - if(this.collaborateurSubscription!= undefined) { - this.collaborateurSubscription.unsubscribe(); - } } } diff --git a/src/app/referents/details-referent/details-referent.component.html b/src/app/referents/details-referent/details-referent.component.html index 01bad8f..4aee49f 100644 --- a/src/app/referents/details-referent/details-referent.component.html +++ b/src/app/referents/details-referent/details-referent.component.html @@ -1,7 +1,2 @@ - -

{{ referent.prenom}} {{referent.nom}} ({{referent.businessUnit.nom}})

-
- - - + \ No newline at end of file diff --git a/src/app/referents/details-referent/details-referent.component.ts b/src/app/referents/details-referent/details-referent.component.ts index 74e001a..a176757 100644 --- a/src/app/referents/details-referent/details-referent.component.ts +++ b/src/app/referents/details-referent/details-referent.component.ts @@ -1,47 +1,18 @@ -import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core'; +import { Component } from '@angular/core'; -import { Subscription } from 'rxjs'; import {ActivatedRoute} from '@angular/router'; -import {MatTableDataSource} from '@angular/material/table'; -import {MatPaginator} from '@angular/material/paginator'; -import {MatSort} from '@angular/material/sort'; - -import { CollaborateursService, EpService } from "@shared/api-swagger/api/api"; - -import { CollaborateurDTO, EpDTO } from "@shared/api-swagger/model/models"; - /** */ @Component({ selector: 'app-details-referent', templateUrl: './details-referent.component.html' }) -export class DetailsReferentComponent implements OnInit { - referent: CollaborateurDTO; - private referentSubscription : Subscription; - idReferent : any; - - - constructor(private service:CollaborateursService, private route: ActivatedRoute) {} +export class DetailsReferentComponent{ + idReferent : string; - ngOnInit() { + constructor(private route: ActivatedRoute) { this.idReferent = this.route.snapshot.paramMap.get("id"); - this.referentSubscription = this.service.getCollaborateurById(this.idReferent).subscribe( - referent => this.initReferent(referent), - err => console.log(err) - ) - } - - initReferent(referent:CollaborateurDTO) { - this.referent = referent; - - } - - ngOnDestroy() { - if(this.referentSubscription!=undefined) { - this.referentSubscription.unsubscribe(); - } } } diff --git a/src/app/referents/referents.module.ts b/src/app/referents/referents.module.ts index 2879938..e1c2707 100644 --- a/src/app/referents/referents.module.ts +++ b/src/app/referents/referents.module.ts @@ -11,6 +11,7 @@ import { ReferentsComponent } from './referents.component'; import { DetailsReferentComponent } from './details-referent/details-referent.component'; import { ReferentsRoutingModule } from './referents.routing.module'; import { AssignationReferentComponent, DialogAssignationReferentComponent } from "./assignation-referent/assignation-referent.component"; +import { AffichageDetailsCollaborateurModule } from "@shared/affichage-details-collaboarteur/affichage-details-collaborateur.module"; @NgModule({ declarations: [ DetailsReferentComponent, @@ -26,6 +27,7 @@ import { AssignationReferentComponent, DialogAssignationReferentComponent } from FormsModule, RouterModule, ReactiveFormsModule, + AffichageDetailsCollaborateurModule, ReferentsRoutingModule, MatTablesModule ], diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html new file mode 100644 index 0000000..726fd6f --- /dev/null +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html @@ -0,0 +1,23 @@ + +

{{ collaborateur.nom }} {{ collaborateur.prenom }}

+

Agence : {{ collaborateur.businessUnit.nom}} ({{ collaborateur.businessUnit.agence.nom}})

+ +

Aucun référent

+

Référent : {{ collaborateur.referent.nom }} {{ collaborateur.referent.prenom }}

+
+

Date embauche : {{ collaborateur.dateArrivee | date: 'dd MMMM yyyy'}}

+

Date départ : {{ collaborateur.dateDepart | date: 'dd MMMM yyyy'}}

+ + +

Liste des EP

+

Liste des futurs formations

+

Liste des formations effectuées

+

Liste des collaborateurs

+

Liste des EP effectués

+

Liste des EP en cours

+
+ +
+ + + \ No newline at end of file diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts new file mode 100644 index 0000000..78d0690 --- /dev/null +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from "@angular/core"; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { MaterialModule } from "../angular-material/angular-material.module"; +import { AffichageDetailsCollaborateurComponent } from "@shared/affichage-details-collaboarteur/affichage-details-collaborateur"; + + +@NgModule({ + declarations: [ + AffichageDetailsCollaborateurComponent + ], + imports: [ + MaterialModule, + CommonModule, + FormsModule + ], + exports: [AffichageDetailsCollaborateurComponent] +}) +export class AffichageDetailsCollaborateurModule {} diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts new file mode 100644 index 0000000..74d00cd --- /dev/null +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts @@ -0,0 +1,30 @@ +import { Component, Input, OnInit } from "@angular/core"; +import { CollaborateurDTO, CollaborateursService } from "@shared/api-swagger"; +import { Subscription } from "rxjs"; + +@Component({ + selector: "affichage-details-collaborateur", + templateUrl: "affichage-details-collaborateur.html" +}) +export class AffichageDetailsCollaborateurComponent implements OnInit{ + @Input() idCollaborateur: string; + @Input() estReferent: boolean=false; + + collaborateur: CollaborateurDTO = undefined; + private collaborateurSubscription: Subscription; + + constructor(private collaborateurService: CollaborateursService) {} + + ngOnInit() { + this.collaborateurSubscription = this.collaborateurService.getCollaborateurById(this.idCollaborateur).subscribe( + collab => this.collaborateur = collab, + err => console.log(err) + ); + } + + ngOnDestroy() { + if(this.collaborateurSubscription != undefined) { + this.collaborateurSubscription.unsubscribe(); + } + } +} \ No newline at end of file diff --git a/src/app/shared/mat-tables/mat-tables.module.ts b/src/app/shared/mat-tables/mat-tables.module.ts index aafba7e..8d18aa8 100644 --- a/src/app/shared/mat-tables/mat-tables.module.ts +++ b/src/app/shared/mat-tables/mat-tables.module.ts @@ -5,9 +5,7 @@ import { FormsModule } from '@angular/forms'; import { MaterialModule } from "../angular-material/angular-material.module"; import { CollaborateursTableComponent } from "@shared/mat-tables/collaborateurs-table/collaborateurs.table"; -/** - * Module des nav utilisés pour chaque role - */ + @NgModule({ declarations: [ CollaborateursTableComponent