diff --git a/src/app/home/home-collaborateur/home-collaborateur.component.html b/src/app/home/home-collaborateur/home-collaborateur.component.html
index 319236e..86dbe32 100644
--- a/src/app/home/home-collaborateur/home-collaborateur.component.html
+++ b/src/app/home/home-collaborateur/home-collaborateur.component.html
@@ -1 +1,29 @@
-
Page collaborateur
+
+
+
+
+
+ Aucun prochain EP n'a été trouvé
+
+
+
+
+ Prochain {{ep.type}} disponible pour saisie le {{ ep.dateDisponibilite | date: "dd/MM/yyyy" }}
+
+
+
+ {{ep.type}} : {{ afficherStatutEP(ep.statut) }}
+ Disponible depuis le {{ ep.dateDisponibilite | date : "dd/MM/yyyy" }}
+ Date d'entretien le {{ ep.datePrevisionnelle | date : "dd/MM/yyyy" }}
+
+
+
+
+
+
+
+
+
+ Vos prochains EP
+
+
\ No newline at end of file
diff --git a/src/app/home/home-collaborateur/home-collaborateur.component.ts b/src/app/home/home-collaborateur/home-collaborateur.component.ts
index ae07a6f..6b8902f 100644
--- a/src/app/home/home-collaborateur/home-collaborateur.component.ts
+++ b/src/app/home/home-collaborateur/home-collaborateur.component.ts
@@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { affichageStatut, CollaborateurDTO, EpInformationDTO, EpService, StatutEp } from '@shared/api-swagger';
+import { cles, epTypeRecherche } from '@shared/utils/cles';
+import { Subscription } from 'rxjs';
/**
@@ -12,9 +16,75 @@ import { Component, OnInit } from '@angular/core';
templateUrl : 'home-collaborateur.component.html'
})
export class HomeCollaborateurComponent implements OnInit {
- constructor() {
+
+ statutEP: any = StatutEp;
+
+ chargement: boolean = true;
+
+ collaborateurConnecte: CollaborateurDTO;
+ ep: EpInformationDTO;
+
+ prochainEPSubscription: Subscription;
+
+ countEPReferent: Subscription;
+
+ estReferentEPEnCours: boolean = false;
+
+ displayedColumns : string[] = ["agence", "collaborateur", "datearrivee", "typeep", "statutep", "dateentretien", "consultation" ];
+
+ epTypeRecherche : any = epTypeRecherche;
+
+ constructor(private epService: EpService, private router: Router) {
}
ngOnInit() {
+ this.setCollaborateurConnecte();
+ }
+
+ setCollaborateurConnecte() {
+ if(sessionStorage.getItem(cles.sessionKeyConnectee) == undefined) {
+ setTimeout( () => this.setCollaborateurConnecte(), 1000);
+ }
+ else {
+ this.collaborateurConnecte = JSON.parse(sessionStorage.getItem(cles.sessionKeyConnectee));
+ this.getProchainEP();
+ this.checkEPReferent();
+ }
+ }
+
+ getProchainEP() {
+ this.prochainEPSubscription = this.epService.getProchainEPCollaborateur(this.collaborateurConnecte.id).subscribe(
+ ep => {
+ this.ep = ep;
+ this.chargement = false;
+ },
+ err => console.log(err)
+ );
+ }
+
+ checkEPReferent() {
+ this.countEPReferent = this.epService.getEPEnCoursReferentCount(this.collaborateurConnecte.id, true, 1, 15, "", "", true, undefined, undefined).subscribe(
+ count => this.estReferentEPEnCours = count > 0,
+ err => console.log(err)
+ );
+ }
+
+ afficherStatutEP(statut: StatutEp) {
+ return affichageStatut(statut);
+ }
+
+ ouvrirEP(event) {
+ if(event.type == "ep")
+ this.router.navigate(["/ep", event.ep.id]);
}
+
+ ngDestroy() {
+ if(this.prochainEPSubscription != undefined)
+ this.prochainEPSubscription.unsubscribe();
+ if(this.countEPReferent != undefined)
+ this.countEPReferent.unsubscribe();
+ }
+
+
+
}