|
|
@ -1,4 +1,8 @@ |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
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' |
|
|
|
templateUrl : 'home-commercial.component.html' |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class HomeCommercialComponent implements OnInit { |
|
|
|
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() { |
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|