Mise à jour du home commercial

develop
Yanaël GRETTE 4 years ago
parent ba121e4eec
commit de956f8bc3
  1. 9
      src/app/home/home-commercial/home-commercial.component.html
  2. 46
      src/app/home/home-commercial/home-commercial.component.ts

@ -1 +1,8 @@
<h1> Page Commercial </h1>
<ng-container *ngIf="estReferentEPEnCours">
<h2>Vos prochains EP</h2>
<ep-table [rechercherParBU]="false" [rechercherParDate]="true" [typeRechercheEP]="epTypeRecherche.RechercheEPReferentEnCours" [displayedColumns]="displayedColumns" [idCollaborateur]="collaborateurConnecte.id" (eventEmitter)="ouvrirEP($event)" ></ep-table>
</ng-container>
<ng-container *ngIf="!estReferentEPEnCours">
<h2>Vous n'avez actuellement aucun EP en cours</h2>
</ng-container>

@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { CollaborateurDTO, EpService } from '@shared/api-swagger';
import { cles, epTypeRecherche } from '@shared/utils/cles';
import { Subscription } from 'rxjs';
/**
@ -12,9 +16,49 @@ import { Component, OnInit } from '@angular/core';
templateUrl : 'home-commercial.component.html'
})
export class HomeCommercialComponent implements OnInit {
constructor() {
collaborateurConnecte: CollaborateurDTO;
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.checkEPReferent();
}
}
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)
);
}
ouvrirEP(event) {
if(event.type == "ep")
this.router.navigate(["/ep", event.ep.id]);
}
ngDestroy() {
if(this.countEPReferent != undefined)
this.countEPReferent.unsubscribe();
}
}

Loading…
Cancel
Save