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 366dee5..6300542 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';
import { FilterModule } from "@shared/filter/filter.module";
@NgModule({
@@ -39,8 +40,7 @@ import { FilterModule } from "@shared/filter/filter.module";
ReferentsModule, FormationsModule,
DemandesFormationModule, DemandesDelegationModule,
EpSaisieModule, EpModule, MatTablesModule, FilterModule,
- AffichageDetailsCollaborateurModule
-
+ AffichageDetailsCollaborateurModule, EngagementsModule
],
providers: [],
bootstrap: [AppComponent]
diff --git a/src/app/engagements/dialog-engagements.html b/src/app/engagements/dialog-engagements.html
new file mode 100644
index 0000000..c75557d
--- /dev/null
+++ b/src/app/engagements/dialog-engagements.html
@@ -0,0 +1,30 @@
+
Détails de l'engagement
+
+
+
+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
new file mode 100644
index 0000000..d139521
--- /dev/null
+++ b/src/app/engagements/engagements.component.ts
@@ -0,0 +1,86 @@
+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",
+ templateUrl: "./engagements.html"
+})
+export class EngagementsComponent {
+
+ displayedColumns : string[] = ["businessunit", "collaborateur", "action", "dispositif", "modalite", "datelimite", "etat"];
+ constructor(private dialog: MatDialog) {}
+
+ afficherDetailsEngagements(engagement: EngagementDTO) {
+ 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.html b/src/app/engagements/engagements.html
new file mode 100644
index 0000000..c5520e3
--- /dev/null
+++ b/src/app/engagements/engagements.html
@@ -0,0 +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
new file mode 100644
index 0000000..b06d1fc
--- /dev/null
+++ b/src/app/engagements/engagements.module.ts
@@ -0,0 +1,30 @@
+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 { 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, DialogEngagementsComponent
+ ],
+ exports: [],
+ imports: [
+ CommonModule,
+ RouterModule,
+ NavMenuModule,
+ EngagementsRoutingModule,
+ MatTablesModule,
+ MaterialModule,
+ FormsModule
+ ],
+})
+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/referents/assignation-referent/assignation-referent.component.ts b/src/app/referents/assignation-referent/assignation-referent.component.ts
index a5f0249..2d57ad3 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();
}
@@ -86,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.html b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html
index 70a3966..f4181f2 100644
--- a/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html
+++ b/src/app/shared/affichage-details-collaboarteur/affichage-details-collaborateur.html
@@ -2,32 +2,29 @@
{{ 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'}}
+
+
-
- Liste des EP
+
- Liste des formations
- 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 e6f49ac..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,10 +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, DialogAssignationRapideCollaborateursComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component";
+
@NgModule({
declarations: [
- AffichageDetailsCollaborateurComponent
+ 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 137bca8..6037dc9 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,10 @@ 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, DialogAssignationRapideCollaborateursComponent } from "./dialog-assignation-rapide/dialog-assignation-rapide.component";
+import { Router } from "@angular/router";
+
@Component({
selector: "affichage-details-collaborateur",
@@ -16,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) {}
+ constructor(private collaborateurService: CollaborateursService, private dialog: MatDialog, private router: Router) {}
ngOnInit() {
this.collaborateurSubscription = this.collaborateurService.getCollaborateurById(this.idCollaborateur).subscribe(
@@ -36,4 +40,21 @@ export class AffichageDetailsCollaborateurComponent implements OnInit{
this.collaborateurSubscription.unsubscribe();
}
}
+
+
+ ouvrirDetailsCollaborateur(event) {
+ this.router.navigate(["/collaborateurs",event.collaborateur.id]);
+ }
+
+ openDialog() {
+ 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
new file mode 100644
index 0000000..17b30c6
--- /dev/null
+++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide-collaborateurs.html
@@ -0,0 +1,17 @@
+
+
+ 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
new file mode 100644
index 0000000..64c0b36
--- /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..d319898
--- /dev/null
+++ b/src/app/shared/affichage-details-collaboarteur/dialog-assignation-rapide/dialog-assignation-rapide.component.ts
@@ -0,0 +1,168 @@
+import {Component, Inject, OnInit } from "@angular/core";
+import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
+import { MatSnackBar } from "@angular/material/snack-bar";
+import { CollaborateurDTO, CollaborateursService, ReferentEPDTO, ReferentsEPService } from "@shared/api-swagger";
+import { collaborateurTypeRecherche, } from "@shared/utils/cles";
+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();
+ }
+
+ ngOnDestroy() {
+ if(this.referentEPSubscription != undefined) {
+ this.referentEPSubscription.unsubscribe();
+ }
+ }
+
+
+}
+
+@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();
+ }
+
+ ngOnDestroy() {
+ 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/angular-material/angular-material.module.ts b/src/app/shared/angular-material/angular-material.module.ts
index fd6a918..94f722f 100644
--- a/src/app/shared/angular-material/angular-material.module.ts
+++ b/src/app/shared/angular-material/angular-material.module.ts
@@ -20,6 +20,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';
@@ -37,7 +39,7 @@ import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NgxMatNativeDateMod
NgxMatDatetimePickerModule, MatDatepickerModule,
NgxMatNativeDateModule, MatNativeDateModule, MatListModule,
MatCheckboxModule, MatSelectModule, MatStepperModule,
- MatChipsModule, MatSnackBarModule
+ MatChipsModule, MatSnackBarModule, MatSlideToggleModule
],
exports : [MatCardModule,
MatButtonModule, MatMenuModule,
@@ -48,7 +50,7 @@ import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NgxMatNativeDateMod
NgxMatDatetimePickerModule, MatDatepickerModule,
NgxMatNativeDateModule, MatNativeDateModule, MatListModule,
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/collaborateurs-table/collaborateurs.table.html b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.html
index 4073e78..f2543a0 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.nom }} {{ row.referent.prenom }}
+ 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 dd34cb6..ee38876 100644
--- a/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.ts
+++ b/src/app/shared/mat-tables/collaborateurs-table/collaborateurs.table.ts
@@ -200,7 +200,7 @@ export class CollaborateursTableComponent implements OnInit {
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)
);
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..eb9f040
--- /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.dispositif}}
+
+
+
+ Modalité
+ {{row.modalite}}
+
+
+
+ Date limite
+ {{row.dateLimite | date :'dd/MM/yyyy'}}
+
+
+
+ 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..7450212
--- /dev/null
+++ b/src/app/shared/mat-tables/engagements-table/engagements-table.ts
@@ -0,0 +1,195 @@
+import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
+import { MatTableDataSource } from "@angular/material/table";
+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";
+
+
+@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
+ ];
+ etatsEngagementsAffiches: Array = [
+ EtatEngagement.EnAttente, EtatEngagement.DateLimitePassee,
+ EtatEngagement.NonRealisable, EtatEngagement.Respecte
+ ];
+
+
+ /**
+ * Liste des colonnes du tableau à afficher.
+ */
+ @Input() displayedColumns : string[] = [];
+ @Input() estAffichageEP: 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.estAffichageEP) {
+ this.taille = this.engagementsSaisis.length;
+ this.dataSource = new MatTableDataSource(this.engagementsSaisis);
+ }
+ else
+ this.setBUsId();
+ }
+
+ emitEvent(engagement: EngagementsRoutingModule) {
+ if(this.eventEmitter != null)
+ this.eventEmitter.emit(engagement);
+ }
+
+
+ updateDataSource() {
+ 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 => { console.log(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) {
+ return afficherEtatEngagement(etat);
+ }
+
+ /**
+ * 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 = this.etatsEngagements.filter( e => etat != e);
+ this.setSearch();
+ }
+
+ updateBUs(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.setSearch();
+ }
+
+
+ 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 0b823ca..94e3941 100644
--- a/src/app/shared/mat-tables/mat-tables.module.ts
+++ b/src/app/shared/mat-tables/mat-tables.module.ts
@@ -5,6 +5,7 @@ import { RouterModule } from '@angular/router';
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"
import { FormationsTableComponent } from "@shared/mat-tables/formations-table/formations.table";
import { FilterModule } from "@shared/filter/filter.module";
@@ -12,6 +13,7 @@ import { FilterModule } from "@shared/filter/filter.module";
@NgModule({
declarations: [
CollaborateursTableComponent,
+ EngagementTableComponent,
FormationsTableComponent
],
imports: [
@@ -23,6 +25,7 @@ import { FilterModule } from "@shared/filter/filter.module";
],
exports: [
CollaborateursTableComponent,
+ EngagementTableComponent,
FormationsTableComponent
]
})
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/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
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};