From 06d13b43f9c71aec89b475d1b2523c30c61ad284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Fri, 12 Feb 2021 09:59:12 +0100 Subject: [PATCH 1/9] =?UTF-8?q?Affichage=20de=20la=20liste=20des=20collabo?= =?UTF-8?q?rateurs=20d'un=20r=C3=A9f=C3=A9rent=20depuis=20ses=20d=C3=A9tai?= =?UTF-8?q?ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../affichage-details-collaborateur.html | 21 ++-- .../affichage-details-collaborateur.module.ts | 5 +- .../affichage-details-collaborateur.ts | 9 ++ .../collaborateurs.table.html | 96 ++++++++++--------- .../collaborateurs.table.ts | 9 +- 5 files changed, 82 insertions(+), 58 deletions(-) diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html index 726fd6f..b60c1d1 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html @@ -9,12 +9,21 @@

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

+ + + + + + + + + + + + + + +
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 index 78d0690..e6f49ac 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts @@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms'; import { MaterialModule } from "../angular-material/angular-material.module"; import { AffichageDetailsCollaborateurComponent } from "@shared/affichage-details-collaboarteur/affichage-details-collaborateur"; - +import { MatTablesModule } from '@shared/mat-tables/mat-tables.module'; @NgModule({ declarations: [ @@ -13,7 +13,8 @@ import { AffichageDetailsCollaborateurComponent } from "@shared/affichage-detail imports: [ MaterialModule, CommonModule, - FormsModule + FormsModule, + MatTablesModule ], exports: [AffichageDetailsCollaborateurComponent] }) diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts index 74d00cd..137bca8 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts @@ -1,6 +1,7 @@ import { Component, Input, OnInit } from "@angular/core"; import { CollaborateurDTO, CollaborateursService } from "@shared/api-swagger"; import { Subscription } from "rxjs"; +import { collaborateurTypeRecherche } from "@shared/utils/cles"; @Component({ selector: "affichage-details-collaborateur", @@ -10,6 +11,14 @@ export class AffichageDetailsCollaborateurComponent implements OnInit{ @Input() idCollaborateur: string; @Input() estReferent: boolean=false; + + typeRecherche : string = collaborateurTypeRecherche.collaborateursEP; + + displayedColumns : string[] = ["businessunit", "collaborateur", "datearrivee"]; + + rechercherParBU: boolean = true; + + collaborateur: CollaborateurDTO = undefined; private collaborateurSubscription: Subscription; diff --git a/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html index 4073e78..85f2e08 100644 --- a/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html +++ b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html @@ -3,20 +3,19 @@ - - - - - Rechercher un collaborateur - - - close - - - + + + + Rechercher un collaborateur + + + close + + + - {{bu.nom}} + {{bu.nom}} @@ -30,7 +29,7 @@ - + Date de fin clear @@ -38,46 +37,49 @@ + + +

Aucun collaborateur à afficher

+
+ + + - - - - - - Agence - {{ row.businessUnit.nom }} - + + + Agence + {{ row.businessUnit.nom }} + - - Collabotareur - {{row.nom}} {{row.prenom}} - + + Collabotareur + {{row.nom}} {{row.prenom}} + - - Date embauche - {{row.dateArrivee | date:'dd/MM/yyyy'}} - + + Date embauche + {{row.dateArrivee | date:'dd/MM/yyyy'}} + - - Référent - - {{ row.referent.prenom }} {{ row.referent.nom }} - Aucun référent - - + + Référent + + {{ row.referent.prenom }} {{ row.referent.nom }} + Aucun référent + + - - - + + + - + - +
\ No newline at end of file diff --git a/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.ts b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.ts index 63dedcd..ee38876 100644 --- a/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.ts +++ b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.ts @@ -70,7 +70,7 @@ export class CollaborateursTableComponent implements OnInit { /** * Nombre total d'élément du tableau */ - taille: number; + taille: number = 0; /** @@ -93,6 +93,9 @@ export class CollaborateursTableComponent implements OnInit { */ dateFin: Date = undefined; + + @Input() idReferent: string; + /** * Indiquer si il s'agit d'une recherche collaborateur, d'un recherche référentEP ou d'une recherche collaborateurEP d'un référent */ @@ -193,11 +196,11 @@ export class CollaborateursTableComponent implements OnInit { * Afficher les informations des collaborateursEP d'un référent */ updateCollaborateursEP() { - this.collaborateursDisponiblesSubscription = this.service.getCollaborateursByReferent(this.collaborateurConnecte.id, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( + this.collaborateursDisponiblesSubscription = this.service.getCollaborateursByReferent(this.idReferent, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( collaborateurs => { console.log(collaborateurs); this.dataSource = new MatTableDataSource(collaborateurs);}, err => console.log(err) ); - this.collaborateursDisponiblesCountSubscription = this.service.getCollaborateursByReferentCount(this.collaborateurConnecte.id, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( + this.collaborateursDisponiblesCountSubscription = this.service.getCollaborateursByReferentCount(this.idReferent, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( count => { console.log(count); this.taille=count;}, err => console.log(err) ); From 954f1613ef134f0c2cd370db1c05242f9e1a38cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Fri, 12 Feb 2021 11:25:51 +0100 Subject: [PATCH 2/9] =?UTF-8?q?Ajout=20de=20la=20possibilit=C3=A9=20de=20c?= =?UTF-8?q?hanger=20le=20r=C3=A9f=C3=A9rent=20EP=20d'un=20collaborateur=20?= =?UTF-8?q?depuis=20ses=20d=C3=A9tails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assignation-referent.component.ts | 1 + .../affichage-details-collaborateur.html | 6 +- .../affichage-details-collaborateur.module.ts | 4 +- .../affichage-details-collaborateur.ts | 14 +++- ...log-assignation-rapide-collaborateurs.html | 1 + .../dialog-assignation-rapide-referent.html | 8 +++ .../dialog-assignation-rapide.component.ts | 66 +++++++++++++++++++ 7 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html create mode 100644 src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html create mode 100644 src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts diff --git a/src/app/referents/assignation-referent/assignation-referent.component.ts b/src/app/referents/assignation-referent/assignation-referent.component.ts index a5f0249..4796684 100644 --- a/src/app/referents/assignation-referent/assignation-referent.component.ts +++ b/src/app/referents/assignation-referent/assignation-referent.component.ts @@ -54,6 +54,7 @@ export class AssignationReferentComponent { } choixReferent(event: any) { + console.log(event); this.referentChoisi = event.collaborateur; this.setCollaborateurEP(); } diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html index b60c1d1..0b705ee 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html @@ -2,12 +2,14 @@

{{ 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 }}

+

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'}}

+ + 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 index e6f49ac..8d0bf88 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts @@ -5,10 +5,12 @@ import { FormsModule } from '@angular/forms'; import { MaterialModule } from "../angular-material/angular-material.module"; import { AffichageDetailsCollaborateurComponent } from "@shared/affichage-details-collaboarteur/affichage-details-collaborateur"; import { MatTablesModule } from '@shared/mat-tables/mat-tables.module'; +import { DialogAssignationRapideReferentComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component"; + @NgModule({ declarations: [ - AffichageDetailsCollaborateurComponent + AffichageDetailsCollaborateurComponent, DialogAssignationRapideReferentComponent ], imports: [ MaterialModule, diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts index 137bca8..721022f 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts @@ -2,6 +2,9 @@ import { Component, Input, OnInit } from "@angular/core"; import { CollaborateurDTO, CollaborateursService } from "@shared/api-swagger"; import { Subscription } from "rxjs"; import { collaborateurTypeRecherche } from "@shared/utils/cles"; +import { MatDialog } from "@angular/material/dialog"; +import { DialogAssignationRapideReferentComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component"; + @Component({ selector: "affichage-details-collaborateur", @@ -22,7 +25,7 @@ export class AffichageDetailsCollaborateurComponent implements OnInit{ collaborateur: CollaborateurDTO = undefined; private collaborateurSubscription: Subscription; - constructor(private collaborateurService: CollaborateursService) {} + constructor(private collaborateurService: CollaborateursService, private dialog: MatDialog) {} ngOnInit() { this.collaborateurSubscription = this.collaborateurService.getCollaborateurById(this.idCollaborateur).subscribe( @@ -36,4 +39,13 @@ export class AffichageDetailsCollaborateurComponent implements OnInit{ this.collaborateurSubscription.unsubscribe(); } } + + openDialog() { + let datas = { data: this.collaborateur, width: "80%", height: '80%'}; + let dialog = DialogAssignationRapideReferentComponent; + if(this.estReferent) + console.log("ui"); + else + this.dialog.open( dialog, datas ); + } } \ No newline at end of file diff --git a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html new file mode 100644 index 0000000..3e8fc5e --- /dev/null +++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html new file mode 100644 index 0000000..4ad2232 --- /dev/null +++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html @@ -0,0 +1,8 @@ + + +

{{referentChoisi.nom}} {{referentChoisi.prenom}} {{ estReferentActuel() ? "(Référent actuel)" : "" }}

+ +
+

Veuillez choisir un référent

+ + \ No newline at end of file diff --git a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts new file mode 100644 index 0000000..286b2dd --- /dev/null +++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts @@ -0,0 +1,66 @@ +import {Component, Inject } from "@angular/core"; +import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; +import { CollaborateurDTO, ReferentEPDTO, ReferentsEPService } from "@shared/api-swagger"; +import { collaborateurTypeRecherche, } from "@shared/utils/cles"; +import { DialogAssignationReferentComponent } from "app/referents/assignation-referent/assignation-referent.component"; +import { Subscription } from "rxjs"; + +@Component({ + selector: "dialog-assignation-rapide-referent", + templateUrl: "dialog-assignation-rapide-referent.html" +}) +export class DialogAssignationRapideReferentComponent { + + rechercherParDate: boolean = false; + + rechercherParBU: boolean = true; + + referentChoisi : CollaborateurDTO = undefined; + + roles : string[] = ["Manager", "RA", "CP", "TL"]; + + + typeRecherche: string = collaborateurTypeRecherche.referents; + + displayedColumns : string[] = ["businessunit", "collaborateur"]; + + private referentEPSubscription: Subscription; + + constructor(private dialogRef: MatDialogRef, private referentsEPService: ReferentsEPService, + @Inject(MAT_DIALOG_DATA) private data: CollaborateurDTO) { + this.referentChoisi = data.referent; + } + + selectionnerReferent(event) { + this.referentChoisi = event.collaborateur; + } + + mettreAJourReferent() { + const referentEPDTO: ReferentEPDTO = { + idReferent : this.referentChoisi.id, + idsCollaborateur : [this.data.id], + }; + + this.referentEPSubscription = this.referentsEPService.updateReferentCollaborateur(referentEPDTO, this.data.id).subscribe( + () => location.reload(), + err => console.log(err) + ); + + } + + estReferentActuel() { + return this.referentChoisi != undefined && this.data.referent != undefined &&this.referentChoisi.id == this.data.referent.id; + } + + annuler() { + this.dialogRef.close(); + } + + onDestroy() { + if(this.referentEPSubscription != undefined) { + this.referentEPSubscription.unsubscribe(); + } + } + + +} \ No newline at end of file From 053a0419e149fcfe8c1dcc5839a43db17336e20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Fri, 12 Feb 2021 13:57:33 +0100 Subject: [PATCH 3/9] =?UTF-8?q?Ajout=20de=20la=20possibilit=C3=A9=20de=20m?= =?UTF-8?q?ettre=20=C3=A0=20jour=20les=20collaborateurs=20EP=20d'un=20r?= =?UTF-8?q?=C3=A9f=C3=A9rent=20depuis=20ses=20d=C3=A9tails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assignation-referent.component.ts | 4 - .../affichage-details-collaborateur.module.ts | 5 +- .../affichage-details-collaborateur.ts | 17 +-- ...log-assignation-rapide-collaborateurs.html | 18 ++- .../dialog-assignation-rapide-referent.html | 2 +- .../dialog-assignation-rapide.component.ts | 110 +++++++++++++++++- .../collaborateurs.table.html | 2 +- 7 files changed, 138 insertions(+), 20 deletions(-) diff --git a/src/app/referents/assignation-referent/assignation-referent.component.ts b/src/app/referents/assignation-referent/assignation-referent.component.ts index 4796684..2d57ad3 100644 --- a/src/app/referents/assignation-referent/assignation-referent.component.ts +++ b/src/app/referents/assignation-referent/assignation-referent.component.ts @@ -87,10 +87,6 @@ export class AssignationReferentComponent { this.collaborateursSelectionnes.push(event.collaborateur); } - peutAjouterCollaborateur(event) : boolean { - return event.type == "collaborateur" && !this.collaborateursSelectionnes.some(event.collaborateur) && !this.collaborateursEP.includes(event.collaborateur); - } - contientCollaborateur(listes: CollaborateurDTO[], collaborateur: CollaborateurDTO ) : boolean { return listes.some(c => c.id == collaborateur.id); } 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 index 8d0bf88..8ae3cf0 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.module.ts @@ -5,12 +5,13 @@ import { FormsModule } from '@angular/forms'; import { MaterialModule } from "../angular-material/angular-material.module"; import { AffichageDetailsCollaborateurComponent } from "@shared/affichage-details-collaboarteur/affichage-details-collaborateur"; import { MatTablesModule } from '@shared/mat-tables/mat-tables.module'; -import { DialogAssignationRapideReferentComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component"; +import { DialogAssignationRapideReferentComponent, DialogAssignationRapideCollaborateursComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component"; @NgModule({ declarations: [ - AffichageDetailsCollaborateurComponent, DialogAssignationRapideReferentComponent + AffichageDetailsCollaborateurComponent, DialogAssignationRapideReferentComponent, + DialogAssignationRapideCollaborateursComponent ], imports: [ MaterialModule, diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts index 721022f..0c568bc 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts @@ -3,7 +3,7 @@ import { CollaborateurDTO, CollaborateursService } from "@shared/api-swagger"; import { Subscription } from "rxjs"; import { collaborateurTypeRecherche } from "@shared/utils/cles"; import { MatDialog } from "@angular/material/dialog"; -import { DialogAssignationRapideReferentComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component"; +import { DialogAssignationRapideReferentComponent, DialogAssignationRapideCollaborateursComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component"; @Component({ @@ -41,11 +41,14 @@ export class AffichageDetailsCollaborateurComponent implements OnInit{ } openDialog() { - let datas = { data: this.collaborateur, width: "80%", height: '80%'}; - let dialog = DialogAssignationRapideReferentComponent; - if(this.estReferent) - console.log("ui"); - else - this.dialog.open( dialog, datas ); + const datas = { data: this.collaborateur, width: "80%", height: '80%'}; + let dialog; + if(this.estReferent) { + dialog = DialogAssignationRapideCollaborateursComponent; + } + else { + dialog = DialogAssignationRapideReferentComponent; + } + this.dialog.open(dialog, datas); } } \ No newline at end of file diff --git a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html index 3e8fc5e..17b30c6 100644 --- a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html +++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html @@ -1 +1,17 @@ - \ No newline at end of file + + +

Collaborateurs sélectionnés :

+ + + {{collaborateur.nom}} {{collaborateur.prenom}} + cancel + + + +
+

Veuillez sélectionner au moins un collaborateur

+ + diff --git a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html index 4ad2232..64c0b36 100644 --- a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html +++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-referent.html @@ -5,4 +5,4 @@

Veuillez choisir un référent

- \ No newline at end of file + \ No newline at end of file diff --git a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts index 286b2dd..27bccf8 100644 --- a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts +++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts @@ -1,8 +1,8 @@ -import {Component, Inject } from "@angular/core"; +import {Component, Inject, OnInit } from "@angular/core"; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import { CollaborateurDTO, ReferentEPDTO, ReferentsEPService } from "@shared/api-swagger"; +import { MatSnackBar } from "@angular/material/snack-bar"; +import { CollaborateurDTO, CollaborateursService, ReferentEPDTO, ReferentsEPService } from "@shared/api-swagger"; import { collaborateurTypeRecherche, } from "@shared/utils/cles"; -import { DialogAssignationReferentComponent } from "app/referents/assignation-referent/assignation-referent.component"; import { Subscription } from "rxjs"; @Component({ @@ -26,7 +26,7 @@ export class DialogAssignationRapideReferentComponent { private referentEPSubscription: Subscription; - constructor(private dialogRef: MatDialogRef, private referentsEPService: ReferentsEPService, + constructor(private dialogRef: MatDialogRef, private referentsEPService: ReferentsEPService, @Inject(MAT_DIALOG_DATA) private data: CollaborateurDTO) { this.referentChoisi = data.referent; } @@ -63,4 +63,106 @@ export class DialogAssignationRapideReferentComponent { } +} + +@Component({ + selector: "dialog-assignation-rapide-collaborateurs", + templateUrl: "dialog-assignation-rapide-collaborateurs.html" +}) +export class DialogAssignationRapideCollaborateursComponent implements OnInit{ + rechercherParDate: boolean = false; + + rechercherParBU: boolean = true; + + roles : string[] = ["Collaborateur"]; + + + typeRecherche: string = collaborateurTypeRecherche.collaborateurs; + + displayedColumns : string[] = ["businessunit", "collaborateur", "datearrivee", "referent"]; + + collaborateursEP: CollaborateurDTO[] = []; + collaborateursSelectionnes: CollaborateurDTO[] = []; + + + private collaborateurSubscription: Subscription; + private referentEPSubscription: Subscription; + + constructor(private dialogRef: MatDialogRef, private referentsEPService: ReferentsEPService, + private collaborateurService: CollaborateursService, @Inject(MAT_DIALOG_DATA) private data: CollaborateurDTO, + private snackBar: MatSnackBar) { + } + + ngOnInit() { + this.collaborateurSubscription = this.collaborateurService.getCollaborateursByReferent(this.data.id).subscribe( + collaborateurs => this.collaborateursEP = collaborateurs, + err => console.log(err) + ); + } + + + ajoutCollaborateur(event:any) { + if(event.type != "collaborateur") + return; + if(event.collaborateur.id == this.data.id) { + this.openSnackBar("Un collaborateur ne peut pas être son propre référent"); + return; + } + if(this.contientCollaborateur(this.collaborateursSelectionnes, event.collaborateur)){ + this.enleverCollaborateur(event.collaborateur); + return; + } + if(this.contientCollaborateur(this.collaborateursEP, event.collaborateur)){ + this.openSnackBar("Le référent choisi est déjà le référent EP du collaborateur sélectionné") + return; + } + this.collaborateursSelectionnes.push(event.collaborateur); + } + + contientCollaborateur(listes: CollaborateurDTO[], collaborateur: CollaborateurDTO ) : boolean { + return listes.some(c => c.id == collaborateur.id); + } + + enleverCollaborateur(collaborateur: CollaborateurDTO) { + this.collaborateursSelectionnes = this.collaborateursSelectionnes.filter(c => c.id != collaborateur.id); + } + + ajouterCollaborateur(event) { + if(event.type == "collaborateur") { + + } + } + + mettreAJourReferentEP() { + const referentEP : ReferentEPDTO = { + idReferent: this.data.id, + idsCollaborateur: this.collaborateursSelectionnes.map( c => c.id) + }; + + this.referentEPSubscription = this.referentsEPService.updateCollaborateursReferent(referentEP, this.data.id).subscribe( + () => location.reload(), + err => console.log(err) + ); + } + + openSnackBar(message: string) { + this.snackBar.open(message,"", { + duration: 5000, + horizontalPosition: "center", + verticalPosition: "top", + }); + } + + annuler() { + this.dialogRef.close(); + } + + onDestroy() { + if(this.referentEPSubscription != undefined) { + this.referentEPSubscription.unsubscribe(); + } + if(this.collaborateurSubscription != undefined) { + this.collaborateurSubscription.unsubscribe(); + } + } } \ No newline at end of file diff --git a/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html index 85f2e08..f2543a0 100644 --- a/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html +++ b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html @@ -65,7 +65,7 @@ Référent - {{ row.referent.prenom }} {{ row.referent.nom }} + {{ row.referent.nom }} {{ row.referent.prenom }} Aucun référent From c2ed6550f92cc812a779daf429ea42c9ddfe6306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Fri, 12 Feb 2021 14:11:50 +0100 Subject: [PATCH 4/9] =?UTF-8?q?Ajout=20d'un=20acc=C3=A8s=20aux=20d=C3=A9ta?= =?UTF-8?q?ils=20d'un=20collaborateur=20depuis=20la=20liste=20des=20r?= =?UTF-8?q?=C3=A9f=C3=A9rents=20EP=20d'un=20r=C3=A9f=C3=A9rent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../affichage-details-collaborateur.html | 2 +- .../affichage-details-collaborateur.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html index 0b705ee..f4181f2 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html @@ -18,7 +18,7 @@ - + diff --git a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts index 0c568bc..6037dc9 100644 --- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts +++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.ts @@ -4,6 +4,7 @@ import { Subscription } from "rxjs"; import { collaborateurTypeRecherche } from "@shared/utils/cles"; import { MatDialog } from "@angular/material/dialog"; import { DialogAssignationRapideReferentComponent, DialogAssignationRapideCollaborateursComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component"; +import { Router } from "@angular/router"; @Component({ @@ -19,13 +20,13 @@ export class AffichageDetailsCollaborateurComponent implements OnInit{ displayedColumns : string[] = ["businessunit", "collaborateur", "datearrivee"]; - rechercherParBU: boolean = true; - + rechercherParBU: boolean = false; + rechercherParDate: boolean= false; collaborateur: CollaborateurDTO = undefined; private collaborateurSubscription: Subscription; - constructor(private collaborateurService: CollaborateursService, private dialog: MatDialog) {} + constructor(private collaborateurService: CollaborateursService, private dialog: MatDialog, private router: Router) {} ngOnInit() { this.collaborateurSubscription = this.collaborateurService.getCollaborateurById(this.idCollaborateur).subscribe( @@ -40,6 +41,11 @@ export class AffichageDetailsCollaborateurComponent implements OnInit{ } } + + ouvrirDetailsCollaborateur(event) { + this.router.navigate(["/collaborateurs",event.collaborateur.id]); + } + openDialog() { const datas = { data: this.collaborateur, width: "80%", height: '80%'}; let dialog; From e7516a21880926d54f4fc37b69184c80608505de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Mon, 15 Feb 2021 08:53:00 +0100 Subject: [PATCH 5/9] =?UTF-8?q?Impl=C3=A9mentation=20de=20la=20table=20des?= =?UTF-8?q?=20engagements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialog-assignation-rapide.component.ts | 4 +- .../engagements-table/engagements-table.css | 0 .../engagements-table/engagements-table.html | 95 +++++++++ .../engagements-table/engagements-table.ts | 191 ++++++++++++++++++ .../shared/mat-tables/mat-tables.module.ts | 4 +- src/app/shared/utils/cles.ts | 7 +- 6 files changed, 296 insertions(+), 5 deletions(-) create mode 100644 src/app/shared/mat-tables/engagements-table/engagements-table.css create mode 100644 src/app/shared/mat-tables/engagements-table/engagements-table.html create mode 100644 src/app/shared/mat-tables/engagements-table/engagements-table.ts diff --git a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts index 27bccf8..d319898 100644 --- a/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts +++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts @@ -56,7 +56,7 @@ export class DialogAssignationRapideReferentComponent { this.dialogRef.close(); } - onDestroy() { + ngOnDestroy() { if(this.referentEPSubscription != undefined) { this.referentEPSubscription.unsubscribe(); } @@ -157,7 +157,7 @@ export class DialogAssignationRapideCollaborateursComponent implements OnInit{ this.dialogRef.close(); } - onDestroy() { + ngOnDestroy() { if(this.referentEPSubscription != undefined) { this.referentEPSubscription.unsubscribe(); } diff --git a/src/app/shared/mat-tables/engagements-table/engagements-table.css b/src/app/shared/mat-tables/engagements-table/engagements-table.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/shared/mat-tables/engagements-table/engagements-table.html b/src/app/shared/mat-tables/engagements-table/engagements-table.html new file mode 100644 index 0000000..8b57a87 --- /dev/null +++ b/src/app/shared/mat-tables/engagements-table/engagements-table.html @@ -0,0 +1,95 @@ + + + + + + + + + Rechercher un collaborateur + + + close + + + + + + {{bu.nom}} + + + + + {{afficherEtat(etat)}} + + + + +

Aucun engagements à afficher

+
+ + + + + Agence + {{row.ep.collaborateur.businessUnit.nom}} + + + + Collaborateur + {{row.ep.collaborateur.nom}} {{row.ep.collaborateur.prenom}} + + + + Action + {{row.action}} + + + + Dispositif + {{row.dispotitif}} + + + + Modalité + {{row.modalite}} + + + + Date limite + {{row.dateLimite}} + + + + Etat engagement + {{afficherEtat(row.etatEngagement)}} + + + + EP + Voir EP + + + + + Mettre à jour l'engagement + + + + + Supprimer l'engagement + + + + + + + + + +
\ No newline at end of file diff --git a/src/app/shared/mat-tables/engagements-table/engagements-table.ts b/src/app/shared/mat-tables/engagements-table/engagements-table.ts new file mode 100644 index 0000000..5c5e1d2 --- /dev/null +++ b/src/app/shared/mat-tables/engagements-table/engagements-table.ts @@ -0,0 +1,191 @@ +import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; +import { MatTableDataSource } from "@angular/material/table"; +import { BusinessUnitDTO, CollaborateurDTO, EngagementDTO, EngagementsService, EtatEngagement } from "@shared/api-swagger"; +import { cles, engagementTypeRecherche } from "@shared/utils/cles"; +import { Subscription } from "rxjs"; + + +@Component({ + selector: "engagements-table", + templateUrl: "./engagements-table.html" +}) +export class EngagementTableComponent implements OnInit { + + + chargement : boolean = true; + + /** + * * Ordre de tri à envoyer au serveur (true : croissant, false : décroissantà). + */ + asc : boolean = true; + + /** + * Numéro de la page à afficher dans le tableau. + */ + numPage: number = 1; + + /** + * Nombre d'élément du tableau à affiche en une page. + */ + parPage: number = 15; + + /** + * Nombre total d'élément du tableau + */ + taille: number = 0; + + /** + * Liste des business units du collaborateur connecté + */ + bus: Array = []; + + /** + * contenu de la recherche pour trouver un collaborateur. + */ + search: string = ""; + + /** + * Options pour choisir le nombre de page à affiche + */ + pageOption = [ 5, 15, 20, 30, 50]; + + /** + * Permet de savoir sur quelle attribut d'un CollaborateurDTO doit être trié le tableau. + */ + tri: string = "collaborateur"; + + /** + * Liste des id des business units des collaborateurs à afficher + */ + private busIds: Array = []; + + /** + * Liste des tous les états engagements + */ + etatsEngagements: Array = [ + EtatEngagement.EnAttente, EtatEngagement.DateLimitePassee, + EtatEngagement.NonRealisable, EtatEngagement.Respecte + ]; + + /** + * Liste des colonnes du tableau à afficher. + */ + @Input() displayedColumns : string[]; + @Input() estSaisieEP: boolean = false; + @Input() engagementsSaisis: EngagementDTO[] = []; + + @Output() eventEmitter: EventEmitter = new EventEmitter(); + + dataSource: MatTableDataSource; + engagementSubscription: Subscription; + engagementCountSubscripton: Subscription; + etatsEngagementsSubscription: Subscription; + + constructor(private engagementService: EngagementsService) {} + + ngOnInit() { + if(this.estSaisieEP) { + this.taille = this.engagementsSaisis.length; + this.dataSource = new MatTableDataSource(this.engagementsSaisis); + } + else + this.setBUsId(); + } + + + updateDataSource() { + if(this.busIds.length == 0) { + this.taille = 0; + this.dataSource = new MatTableDataSource(undefined); + } + this.engagementSubscription = this.engagementService.getEngagements(this.etatsEngagements, this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( + engagements => this.dataSource = new MatTableDataSource(engagements), + err => console.log(err) + ); + + this.engagementCountSubscripton = this.engagementService.getEngagementsCount(this.etatsEngagements, this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( + count => this.taille = count, + err => console.log(err) + ); + } + + afficherEtat(etat: EtatEngagement) { + switch(etat) { + case EtatEngagement.Respecte: + return "Respecté"; + case EtatEngagement.NonRealisable: + return "Non réalisable"; + case EtatEngagement.EnAttente: + return "En attente"; + case EtatEngagement.DateLimitePassee: + return "Date limite passée"; + } + } + + /** + * création de la liste des business unit du collaborateur connecté pour afficher les checkboxes + */ + setBUsId() { + if(sessionStorage.getItem(cles.sessionKeyConnectee) == undefined){ + setTimeout( () => this.setBUsId(), 1000); + } + else { + const collaborateurConnecte : CollaborateurDTO = JSON.parse(sessionStorage.getItem(cles.sessionKeyConnectee)); + this.bus = collaborateurConnecte.businessUnit.agence.bu; + for(let bu of this.bus) { + this.busIds.push(bu.id); + } + this.updateDataSource(); + this.chargement = false; + } + } + + setSearch() { + this.numPage = 1; + this.updateDataSource(); + } + + resetSearch() { + this.search = ""; + this.setSearch(); + } + + /** + * Mettre à jour le nomre d'élément à afficher par page et le numéro de la page + * @param event évènement de la pagination + */ + updatePageInfo(event){ + this.parPage = event.pageSize; + this.numPage = event.pageIndex+1; + this.updateDataSource(); + } + + updateEtatsEngagement(event:boolean, etat:EtatEngagement) { + if(event) { + this.etatsEngagements.push(etat); + } + else + this.etatsEngagements + } + + updateCheckbox(event, bu) { + // si la checkbox a été cochée + if(event) { + this.busIds.push(bu.id) + } + else{ + this.busIds = this.busIds.filter( (id) => id != bu.id); + } + this.numPage = 1; + this.updateDataSource(); + } + + ngOnDestroy() { + if(this.engagementSubscription != undefined) { + this.engagementSubscription.unsubscribe(); + } + if(this.engagementCountSubscripton != undefined) { + this.engagementCountSubscripton.unsubscribe(); + } + } +} diff --git a/src/app/shared/mat-tables/mat-tables.module.ts b/src/app/shared/mat-tables/mat-tables.module.ts index 8d18aa8..4ecd359 100644 --- a/src/app/shared/mat-tables/mat-tables.module.ts +++ b/src/app/shared/mat-tables/mat-tables.module.ts @@ -4,11 +4,11 @@ import { FormsModule } from '@angular/forms'; import { MaterialModule } from "../angular-material/angular-material.module"; import { CollaborateursTableComponent } from "@shared/mat-tables/collaborateurs-table/collaborateurs.table"; - +import { EngagementTableComponent } from "@shared/mat-tables/engagements-table/engagements-table" @NgModule({ declarations: [ - CollaborateursTableComponent + CollaborateursTableComponent, EngagementTableComponent ], imports: [ MaterialModule, diff --git a/src/app/shared/utils/cles.ts b/src/app/shared/utils/cles.ts index 3d5461b..ac3f33d 100644 --- a/src/app/shared/utils/cles.ts +++ b/src/app/shared/utils/cles.ts @@ -2,9 +2,14 @@ export const cles = { sessionKeyConnectee : "collaborateurConnecte", } - export const collaborateurTypeRecherche = { collaborateurs: "collaborateurs", referents: "referents", collaborateursEP: "collaborateursEP" +} + +export const engagementTypeRecherche = { + saisieEP: "saisieEP", + consultationEP: "consultationEP", + engagementsRH: "engagementRH" } \ No newline at end of file From b340fd26ff32548cc1f4abb4c7200e4b3779f2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Mon, 15 Feb 2021 09:30:14 +0100 Subject: [PATCH 6/9] Ajout et affichage du module engagement --- src/app/app-routing.module.ts | 7 +++++- src/app/app.module.ts | 3 ++- src/app/engagements/engagements.component.ts | 13 ++++++++++ src/app/engagements/engagements.html | 3 +++ src/app/engagements/engagements.module.ts | 25 +++++++++++++++++++ .../engagements/engagements.routing.module.ts | 19 ++++++++++++++ src/app/engagements/index.ts | 2 ++ .../engagements-table/engagements-table.ts | 2 +- .../nav-menu-rh/nav-menu-rh.component.html | 2 +- src/app/shared/utils/paths.ts | 8 +++++- 10 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 src/app/engagements/engagements.component.ts create mode 100644 src/app/engagements/engagements.html create mode 100644 src/app/engagements/engagements.module.ts create mode 100644 src/app/engagements/engagements.routing.module.ts create mode 100644 src/app/engagements/index.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index a694790..4a07133 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -8,7 +8,7 @@ import { HomeComponent } from './home/'; import { AuthGuard } from '@shared/auth/auth.guard'; import { paths_collaborateurs, paths_demandes_delegation, paths_demandes_formation, - paths_ep, paths_saisie_ep, paths_formation, paths_home, paths_referents } from '@shared/utils/paths'; + paths_ep, paths_saisie_ep, paths_formation, paths_home, paths_referents, paths_engagements } from '@shared/utils/paths'; import { Role } from '@shared/utils/roles'; @@ -64,6 +64,11 @@ const routes: Routes = [ { path: paths_referents.path, loadChildren: () => import('./referents/referents.module').then(m=> m.ReferentsModule) + }, + //chargement des chemin du module engagement à partir du routing de ce module + { + path: paths_engagements.path, + loadChildren: () => import('./engagements/engagements.module').then(m => m.EngagementsModule) } ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 50df755..b36ec41 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -25,6 +25,7 @@ import { EpModule } from "./ep" import { AuthModule } from '@shared/auth/auth.module'; import { MatTablesModule } from "@shared/mat-tables/mat-tables.module"; +import { EngagementsModule } from './engagements'; @NgModule({ declarations: [ @@ -38,7 +39,7 @@ import { MatTablesModule } from "@shared/mat-tables/mat-tables.module"; ReferentsModule, FormationsModule, DemandesFormationModule, DemandesDelegationModule, EpSaisieModule, EpModule, MatTablesModule, - AffichageDetailsCollaborateurModule + AffichageDetailsCollaborateurModule, EngagementsModule ], providers: [], diff --git a/src/app/engagements/engagements.component.ts b/src/app/engagements/engagements.component.ts new file mode 100644 index 0000000..273f319 --- /dev/null +++ b/src/app/engagements/engagements.component.ts @@ -0,0 +1,13 @@ +import { Component } from "@angular/core"; + +@Component({ + selector: "app-engagements", + templateUrl: "./engagements.html" +}) +export class EngagementsComponent { + + + constructor() {} + + +} \ No newline at end of file diff --git a/src/app/engagements/engagements.html b/src/app/engagements/engagements.html new file mode 100644 index 0000000..4a20eae --- /dev/null +++ b/src/app/engagements/engagements.html @@ -0,0 +1,3 @@ + + +

Liste des engagements

diff --git a/src/app/engagements/engagements.module.ts b/src/app/engagements/engagements.module.ts new file mode 100644 index 0000000..04ca3c1 --- /dev/null +++ b/src/app/engagements/engagements.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from "@angular/core"; +import { CommonModule } from "@angular/common"; +import { RouterModule } from '@angular/router'; + +import { MaterialModule } from "@shared/angular-material/angular-material.module"; + +import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; +import { EngagementsComponent } from "./engagements.component"; +import { EngagementsRoutingModule } from "./engagements.routing.module"; + + + +@NgModule({ + declarations: [ + EngagementsComponent + ], + exports: [], + imports: [ + CommonModule, + RouterModule, + NavMenuModule, + EngagementsRoutingModule + ], +}) +export class EngagementsModule {} \ No newline at end of file diff --git a/src/app/engagements/engagements.routing.module.ts b/src/app/engagements/engagements.routing.module.ts new file mode 100644 index 0000000..905ca37 --- /dev/null +++ b/src/app/engagements/engagements.routing.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + + +import { EngagementsComponent } from "./engagements.component"; + +import { AuthGuard } from '@shared/auth/auth.guard'; + + + +const routes: Routes = [ + { path: '', component: EngagementsComponent, pathMatch: 'full', canActivate: [AuthGuard]} +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] + }) + export class EngagementsRoutingModule {} \ No newline at end of file diff --git a/src/app/engagements/index.ts b/src/app/engagements/index.ts new file mode 100644 index 0000000..e47f613 --- /dev/null +++ b/src/app/engagements/index.ts @@ -0,0 +1,2 @@ +export * from './engagements.component'; +export * from './engagements.module'; diff --git a/src/app/shared/mat-tables/engagements-table/engagements-table.ts b/src/app/shared/mat-tables/engagements-table/engagements-table.ts index 5c5e1d2..7ec657d 100644 --- a/src/app/shared/mat-tables/engagements-table/engagements-table.ts +++ b/src/app/shared/mat-tables/engagements-table/engagements-table.ts @@ -178,7 +178,7 @@ export class EngagementTableComponent implements OnInit { } this.numPage = 1; this.updateDataSource(); - } + } ngOnDestroy() { if(this.engagementSubscription != undefined) { diff --git a/src/app/shared/nav-menu/nav-menu-rh/nav-menu-rh.component.html b/src/app/shared/nav-menu/nav-menu-rh/nav-menu-rh.component.html index 6ed5071..6c8a233 100644 --- a/src/app/shared/nav-menu/nav-menu-rh/nav-menu-rh.component.html +++ b/src/app/shared/nav-menu/nav-menu-rh/nav-menu-rh.component.html @@ -20,6 +20,6 @@ - + diff --git a/src/app/shared/utils/paths.ts b/src/app/shared/utils/paths.ts index 0c8b5ea..a9577ac 100644 --- a/src/app/shared/utils/paths.ts +++ b/src/app/shared/utils/paths.ts @@ -93,5 +93,11 @@ const paths_referents = { get: ":id" }; +const paths_engagements = { + base: "/engagements", + path: "engagements" +} + + export { paths_collaborateurs, paths_demandes_delegation, paths_demandes_formation, - paths_ep, paths_saisie_ep, paths_formation, paths_home, paths_referents}; + paths_ep, paths_saisie_ep, paths_formation, paths_home, paths_referents, paths_engagements}; From 43aac7cbfc585616c0f4bd1d0eec1463ac595242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Mon, 15 Feb 2021 10:21:20 +0100 Subject: [PATCH 7/9] Affichage de la liste des engagements --- src/app/engagements/engagements.component.ts | 7 ++-- src/app/engagements/engagements.html | 2 ++ src/app/engagements/engagements.module.ts | 4 ++- .../engagements-table/engagements-table.html | 34 +++++++++---------- .../engagements-table/engagements-table.ts | 31 ++++++++++++----- .../shared/mat-tables/mat-tables.module.ts | 2 +- 6 files changed, 50 insertions(+), 30 deletions(-) diff --git a/src/app/engagements/engagements.component.ts b/src/app/engagements/engagements.component.ts index 273f319..7a1c655 100644 --- a/src/app/engagements/engagements.component.ts +++ b/src/app/engagements/engagements.component.ts @@ -1,4 +1,5 @@ import { Component } from "@angular/core"; +import { EngagementDTO } from "@shared/api-swagger"; @Component({ selector: "app-engagements", @@ -6,8 +7,10 @@ import { Component } from "@angular/core"; }) export class EngagementsComponent { - + displayedColumns : string[] = ["businessunit", "collaborateur", "action", "dispositif", "modalite", "datelimite", "etat"]; constructor() {} - + afficherDetailsEngagements(engagement: EngagementDTO) { + console.log(engagement); + } } \ No newline at end of file diff --git a/src/app/engagements/engagements.html b/src/app/engagements/engagements.html index 4a20eae..c5520e3 100644 --- a/src/app/engagements/engagements.html +++ b/src/app/engagements/engagements.html @@ -1,3 +1,5 @@

Liste des engagements

+ + \ No newline at end of file diff --git a/src/app/engagements/engagements.module.ts b/src/app/engagements/engagements.module.ts index 04ca3c1..fb4e8b2 100644 --- a/src/app/engagements/engagements.module.ts +++ b/src/app/engagements/engagements.module.ts @@ -7,6 +7,7 @@ import { MaterialModule } from "@shared/angular-material/angular-material.module import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; import { EngagementsComponent } from "./engagements.component"; import { EngagementsRoutingModule } from "./engagements.routing.module"; +import { MatTablesModule } from "@shared/mat-tables/mat-tables.module"; @@ -19,7 +20,8 @@ import { EngagementsRoutingModule } from "./engagements.routing.module"; CommonModule, RouterModule, NavMenuModule, - EngagementsRoutingModule + EngagementsRoutingModule, + MatTablesModule ], }) export class EngagementsModule {} \ No newline at end of file diff --git a/src/app/shared/mat-tables/engagements-table/engagements-table.html b/src/app/shared/mat-tables/engagements-table/engagements-table.html index 8b57a87..38fee0a 100644 --- a/src/app/shared/mat-tables/engagements-table/engagements-table.html +++ b/src/app/shared/mat-tables/engagements-table/engagements-table.html @@ -3,7 +3,7 @@ - + Rechercher un collaborateur @@ -15,12 +15,12 @@ - {{bu.nom}} + {{bu.nom}} - {{afficherEtat(etat)}} + {{afficherEtat(etat)}} @@ -29,61 +29,61 @@ - + - Agence + Agence {{row.ep.collaborateur.businessUnit.nom}} - Collaborateur + Collaborateur {{row.ep.collaborateur.nom}} {{row.ep.collaborateur.prenom}} - Action + Action {{row.action}} - - Dispositif + + Dispositif {{row.dispotitif}} - Modalité + Modalité {{row.modalite}} - Date limite + Date limite {{row.dateLimite}} - Etat engagement + Etat engagement {{afficherEtat(row.etatEngagement)}} - EP + EP Voir EP - + Mettre à jour l'engagement - + Supprimer l'engagement - + - = [ + EtatEngagement.EnAttente, EtatEngagement.DateLimitePassee, + EtatEngagement.NonRealisable, EtatEngagement.Respecte + ]; + /** * Liste des colonnes du tableau à afficher. */ - @Input() displayedColumns : string[]; - @Input() estSaisieEP: boolean = false; + @Input() displayedColumns : string[] = []; + @Input() estAffichageEP: boolean = false; @Input() engagementsSaisis: EngagementDTO[] = []; @Output() eventEmitter: EventEmitter = new EventEmitter(); @@ -84,7 +90,7 @@ export class EngagementTableComponent implements OnInit { constructor(private engagementService: EngagementsService) {} ngOnInit() { - if(this.estSaisieEP) { + if(this.estAffichageEP) { this.taille = this.engagementsSaisis.length; this.dataSource = new MatTableDataSource(this.engagementsSaisis); } @@ -92,14 +98,20 @@ export class EngagementTableComponent implements OnInit { this.setBUsId(); } + emitEvent(engagement: EngagementsRoutingModule) { + if(this.eventEmitter != null) + this.eventEmitter.emit(engagement); + } + updateDataSource() { - if(this.busIds.length == 0) { + if(this.busIds.length == 0 || this.etatsEngagements.length == 0) { this.taille = 0; this.dataSource = new MatTableDataSource(undefined); + return; } this.engagementSubscription = this.engagementService.getEngagements(this.etatsEngagements, this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( - engagements => this.dataSource = new MatTableDataSource(engagements), + engagements => { console.log(engagements); this.dataSource = new MatTableDataSource(engagements); }, err => console.log(err) ); @@ -165,10 +177,11 @@ export class EngagementTableComponent implements OnInit { this.etatsEngagements.push(etat); } else - this.etatsEngagements + this.etatsEngagements = this.etatsEngagements.filter( e => etat != e); + this.setSearch(); } - updateCheckbox(event, bu) { + updateBUs(event, bu) { // si la checkbox a été cochée if(event) { this.busIds.push(bu.id) @@ -176,10 +189,10 @@ export class EngagementTableComponent implements OnInit { else{ this.busIds = this.busIds.filter( (id) => id != bu.id); } - this.numPage = 1; - this.updateDataSource(); + this.setSearch(); } + ngOnDestroy() { if(this.engagementSubscription != undefined) { this.engagementSubscription.unsubscribe(); diff --git a/src/app/shared/mat-tables/mat-tables.module.ts b/src/app/shared/mat-tables/mat-tables.module.ts index 4ecd359..d93ea50 100644 --- a/src/app/shared/mat-tables/mat-tables.module.ts +++ b/src/app/shared/mat-tables/mat-tables.module.ts @@ -15,6 +15,6 @@ import { EngagementTableComponent } from "@shared/mat-tables/engagements-table/e CommonModule, FormsModule ], - exports: [CollaborateursTableComponent] + exports: [CollaborateursTableComponent, EngagementTableComponent] }) export class MatTablesModule {} From 6e404274c301f58b12efbe2c66074566173c90f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Mon, 15 Feb 2021 14:42:29 +0100 Subject: [PATCH 8/9] =?UTF-8?q?Ajout=20d'un=20popup=20permettant=20d'affic?= =?UTF-8?q?he=20les=20d=C3=A9tails=20d'un=20engagement=20de=20le=20valider?= =?UTF-8?q?=20ou=20bien=20le=20refuser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/engagements/dialog-engagements.html | 30 +++++++ src/app/engagements/engagements.component.ts | 78 ++++++++++++++++++- src/app/engagements/engagements.module.ts | 9 ++- .../angular-material.module.ts | 6 +- .../api-swagger/model/etatEngagement.ts | 15 +++- .../engagements-table/engagements-table.html | 4 +- .../engagements-table/engagements-table.ts | 13 +--- 7 files changed, 132 insertions(+), 23 deletions(-) create mode 100644 src/app/engagements/dialog-engagements.html diff --git a/src/app/engagements/dialog-engagements.html b/src/app/engagements/dialog-engagements.html new file mode 100644 index 0000000..053d8bb --- /dev/null +++ b/src/app/engagements/dialog-engagements.html @@ -0,0 +1,30 @@ +

Détails de l'engagement

+

Collaborateur: {{collaborateur.nom}} {{collaborateur.prenom}}

+

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

+

EP effectué le {{ ep.datePrevisionnelle | date: 'dd/MM/yyyy' }}

+

Action : {{ data.action}}

+

Modalité: {{ data.modalite }}

+

Date limite: {{ data.dateLimite | date: 'dd/MM/yyyy' }}

+

Etat : {{ afficherEtat(data.etatEngagement) }}

+

Raison non réalisable : {{data.raisonNonRealisable}}

+ + + + + Engagement respecté + + +
+ + Raison du refus + + + +
+ +
+ +
+ + + diff --git a/src/app/engagements/engagements.component.ts b/src/app/engagements/engagements.component.ts index 7a1c655..d139521 100644 --- a/src/app/engagements/engagements.component.ts +++ b/src/app/engagements/engagements.component.ts @@ -1,5 +1,9 @@ -import { Component } from "@angular/core"; -import { EngagementDTO } from "@shared/api-swagger"; +import { Component, Inject } from "@angular/core"; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog"; +import { MatSnackBar } from "@angular/material/snack-bar"; +import { CollaborateurDTO, EngagementDTO, EngagementsService, EpInformationDTO, EtatEngagement, afficherEtatEngagement } from "@shared/api-swagger"; +import { Subscription } from "rxjs"; + @Component({ selector: "app-engagements", @@ -8,9 +12,75 @@ import { EngagementDTO } from "@shared/api-swagger"; export class EngagementsComponent { displayedColumns : string[] = ["businessunit", "collaborateur", "action", "dispositif", "modalite", "datelimite", "etat"]; - constructor() {} + constructor(private dialog: MatDialog) {} afficherDetailsEngagements(engagement: EngagementDTO) { - console.log(engagement); + const datas = { data: engagement, width: "80%", height: '80%'}; + this.dialog.open(DialogEngagementsComponent, datas); + } +} + +@Component( { + selector: "dialog-engagements", + templateUrl: "dialog-engagements.html" +}) +export class DialogEngagementsComponent { + ep: EpInformationDTO; + collaborateur: CollaborateurDTO; + referent: CollaborateurDTO; + etatEngagement: any = EtatEngagement; + engagementsSubscription: Subscription; + + donnerReponse: boolean = false; + raisonRefus : string = ""; + engagementRespecte: boolean = true; + + + constructor(private dialogRef : MatDialogRef, @Inject(MAT_DIALOG_DATA) public data : EngagementDTO, private engagementsService: EngagementsService, + private snackBar: MatSnackBar){ + this.ep = data.ep; + this.collaborateur = data.ep.collaborateur; + this.referent = data.ep.referent; + } + + mettreAJourEngagement() { + let engagement : EngagementDTO = this.data; + if(this.engagementRespecte) { + engagement.etatEngagement = EtatEngagement.Respecte; + } + else { + if(this.raisonRefus.length == 0) { + this.snackBar.open("Vous devez justifier le refus de respecter l'engagement.", "Attention", { + duration: 5000, + horizontalPosition: "center", + verticalPosition: "top", + }); + return; + } + engagement.raisonNonRealisable = this.raisonRefus; + engagement.etatEngagement = EtatEngagement.NonRealisable; + } + this.engagementsSubscription = this.engagementsService.updateEngagement(engagement, engagement.id).subscribe( + () => location.reload(), + err => console.log(err) + ); + } + + afficherEtat(etat: EtatEngagement) { + return afficherEtatEngagement(etat); + } + + fermer() { + this.dialogRef.close(); + } + + repondre() { + this.donnerReponse = true; + } + + ngOnDestroy() { + if(this.engagementsSubscription != null) { + this.engagementsSubscription.unsubscribe(); + } } } \ No newline at end of file diff --git a/src/app/engagements/engagements.module.ts b/src/app/engagements/engagements.module.ts index fb4e8b2..b06d1fc 100644 --- a/src/app/engagements/engagements.module.ts +++ b/src/app/engagements/engagements.module.ts @@ -5,15 +5,16 @@ import { RouterModule } from '@angular/router'; import { MaterialModule } from "@shared/angular-material/angular-material.module"; import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; -import { EngagementsComponent } from "./engagements.component"; +import { DialogEngagementsComponent, EngagementsComponent } from "./engagements.component"; import { EngagementsRoutingModule } from "./engagements.routing.module"; import { MatTablesModule } from "@shared/mat-tables/mat-tables.module"; +import { FormsModule } from "@angular/forms"; @NgModule({ declarations: [ - EngagementsComponent + EngagementsComponent, DialogEngagementsComponent ], exports: [], imports: [ @@ -21,7 +22,9 @@ import { MatTablesModule } from "@shared/mat-tables/mat-tables.module"; RouterModule, NavMenuModule, EngagementsRoutingModule, - MatTablesModule + MatTablesModule, + MaterialModule, + FormsModule ], }) export class EngagementsModule {} \ No newline at end of file diff --git a/src/app/shared/angular-material/angular-material.module.ts b/src/app/shared/angular-material/angular-material.module.ts index ceda0f8..195bc88 100644 --- a/src/app/shared/angular-material/angular-material.module.ts +++ b/src/app/shared/angular-material/angular-material.module.ts @@ -19,6 +19,8 @@ import {MatSelectModule} from '@angular/material/select'; import {MatStepperModule} from '@angular/material/stepper'; import {MatChipsModule} from '@angular/material/chips'; import {MatSnackBarModule} from '@angular/material/snack-bar'; +import {MatSlideToggleModule} from '@angular/material/slide-toggle'; + import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NgxMatNativeDateModule } from '@angular-material-components/datetime-picker'; @@ -36,7 +38,7 @@ import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NgxMatNativeDateMod NgxMatDatetimePickerModule, MatDatepickerModule, NgxMatNativeDateModule, MatNativeDateModule, MatCheckboxModule, MatSelectModule, MatStepperModule, - MatChipsModule, MatSnackBarModule + MatChipsModule, MatSnackBarModule, MatSlideToggleModule ], exports : [MatCardModule, MatButtonModule, MatMenuModule, @@ -47,7 +49,7 @@ import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NgxMatNativeDateMod NgxMatDatetimePickerModule, MatDatepickerModule, NgxMatNativeDateModule, MatNativeDateModule, MatCheckboxModule, MatSelectModule, MatStepperModule, - MatChipsModule, MatSnackBarModule + MatChipsModule, MatSnackBarModule, MatSlideToggleModule ] }) export class MaterialModule {} diff --git a/src/app/shared/api-swagger/model/etatEngagement.ts b/src/app/shared/api-swagger/model/etatEngagement.ts index ac12563..17b2f26 100644 --- a/src/app/shared/api-swagger/model/etatEngagement.ts +++ b/src/app/shared/api-swagger/model/etatEngagement.ts @@ -20,4 +20,17 @@ export const EtatEngagement = { Respecte: 'Respecte' as EtatEngagement, NonRealisable: 'NonRealisable' as EtatEngagement, DateLimitePassee: 'DateLimitePassee' as EtatEngagement -}; \ No newline at end of file +}; + +export function afficherEtatEngagement(etatEngagement: EtatEngagement) { + switch(etatEngagement) { + case EtatEngagement.Respecte: + return "Respecté"; + case EtatEngagement.NonRealisable: + return "Non réalisable"; + case EtatEngagement.EnAttente: + return "En attente"; + case EtatEngagement.DateLimitePassee: + return "Date limite passée"; + } +} \ No newline at end of file diff --git a/src/app/shared/mat-tables/engagements-table/engagements-table.html b/src/app/shared/mat-tables/engagements-table/engagements-table.html index 38fee0a..eb9f040 100644 --- a/src/app/shared/mat-tables/engagements-table/engagements-table.html +++ b/src/app/shared/mat-tables/engagements-table/engagements-table.html @@ -47,7 +47,7 @@ Dispositif - {{row.dispotitif}} + {{row.dispositif}} @@ -57,7 +57,7 @@ Date limite - {{row.dateLimite}} + {{row.dateLimite | date :'dd/MM/yyyy'}} diff --git a/src/app/shared/mat-tables/engagements-table/engagements-table.ts b/src/app/shared/mat-tables/engagements-table/engagements-table.ts index 50e8d47..7450212 100644 --- a/src/app/shared/mat-tables/engagements-table/engagements-table.ts +++ b/src/app/shared/mat-tables/engagements-table/engagements-table.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; import { MatTableDataSource } from "@angular/material/table"; -import { BusinessUnitDTO, CollaborateurDTO, EngagementDTO, EngagementsService, EtatEngagement } from "@shared/api-swagger"; +import { BusinessUnitDTO, CollaborateurDTO, EngagementDTO, EngagementsService, EtatEngagement, afficherEtatEngagement } from "@shared/api-swagger"; import { cles, engagementTypeRecherche } from "@shared/utils/cles"; import { EngagementsRoutingModule } from "app/engagements/engagements.routing.module"; import { Subscription } from "rxjs"; @@ -122,16 +122,7 @@ export class EngagementTableComponent implements OnInit { } afficherEtat(etat: EtatEngagement) { - switch(etat) { - case EtatEngagement.Respecte: - return "Respecté"; - case EtatEngagement.NonRealisable: - return "Non réalisable"; - case EtatEngagement.EnAttente: - return "En attente"; - case EtatEngagement.DateLimitePassee: - return "Date limite passée"; - } + return afficherEtatEngagement(etat); } /** From 7e30f21dede3fa9aa311a3eb25f90ba7951709ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Mon, 15 Feb 2021 14:56:32 +0100 Subject: [PATCH 9/9] =?UTF-8?q?Possibilit=C3=A9=20d'acc=C3=A9der=20aux=20d?= =?UTF-8?q?=C3=A9tails=20du=20collaborateur,=20du=20r=C3=A9f=C3=A9rent=20e?= =?UTF-8?q?t=20de=20l'EP=20concern=C3=A9s=20par=20l'engagement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/engagements/dialog-engagements.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/engagements/dialog-engagements.html b/src/app/engagements/dialog-engagements.html index 053d8bb..c75557d 100644 --- a/src/app/engagements/dialog-engagements.html +++ b/src/app/engagements/dialog-engagements.html @@ -1,7 +1,7 @@

Détails de l'engagement

-

Collaborateur: {{collaborateur.nom}} {{collaborateur.prenom}}

-

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

-

EP effectué le {{ ep.datePrevisionnelle | date: 'dd/MM/yyyy' }}

+

+

+

Action : {{ data.action}}

Modalité: {{ data.modalite }}

Date limite: {{ data.dateLimite | date: 'dd/MM/yyyy' }}