|
|
|
@ -6,6 +6,10 @@ import {CollaborateurService} from "../../services/collaborateur.service"; |
|
|
|
|
import {PeriodeEssaiService} from "../../services/periode-essai.service"; |
|
|
|
|
import {Referencement} from "../../interfaces/referencement"; |
|
|
|
|
import {ReferencementService} from "../../services/referencement.service"; |
|
|
|
|
import {Businessunit} from "../../interfaces/businessunit"; |
|
|
|
|
import {Agence} from "../../interfaces/agence"; |
|
|
|
|
import {BusinessunitService} from "../../services/businessunit.service"; |
|
|
|
|
import {AgenceService} from "../../services/agence.service"; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-home', |
|
|
|
@ -14,18 +18,24 @@ import {ReferencementService} from "../../services/referencement.service"; |
|
|
|
|
}) |
|
|
|
|
export class HomeComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
businessUnits: Businessunit[] = []; |
|
|
|
|
agences: Agence[] = []; |
|
|
|
|
collaborateurs: Collaborateur[] = []; |
|
|
|
|
referencements: Referencement[] = []; |
|
|
|
|
periodeEssais: PeriodeEssai[] = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
collaborateursSansRef: Collaborateur[] = []; |
|
|
|
|
idReferredTab: number[] = []; |
|
|
|
|
collaborateurs: Collaborateur[] = []; |
|
|
|
|
periodeEssais: PeriodeEssai[] = []; |
|
|
|
|
|
|
|
|
|
periodeEssaisEnCours: PeriodeEssai[] = []; |
|
|
|
|
|
|
|
|
|
isShown : boolean = false; |
|
|
|
|
isShown: boolean = false; |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private http: HttpClient, |
|
|
|
|
private businessUnitService: BusinessunitService, |
|
|
|
|
private agenceService: AgenceService, |
|
|
|
|
private collaborateurService: CollaborateurService, |
|
|
|
|
private periodeEssaiService: PeriodeEssaiService, |
|
|
|
|
private referencementService: ReferencementService, |
|
|
|
@ -42,10 +52,8 @@ export class HomeComponent implements OnInit { |
|
|
|
|
this.collaborateurService.getCollaborateurs() |
|
|
|
|
.subscribe(collaborateurs => { |
|
|
|
|
this.collaborateurs = collaborateurs; |
|
|
|
|
|
|
|
|
|
this.referencementService.getReferencements() |
|
|
|
|
.subscribe(referencements => { |
|
|
|
|
|
|
|
|
|
this.referencements = referencements; |
|
|
|
|
this.referencements.forEach(ref => { |
|
|
|
|
|
|
|
|
@ -54,7 +62,6 @@ export class HomeComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.collaborateurs.forEach(collab => { |
|
|
|
|
if (this.idReferredTab.find(id => collab.id == id) == undefined) { |
|
|
|
|
this.collaborateursSansRef.push(collab); |
|
|
|
@ -63,12 +70,16 @@ export class HomeComponent implements OnInit { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
this.getPeriodeEssais(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getCollaborateurs(): void { |
|
|
|
|
this.collaborateurService.getCollaborateurs() |
|
|
|
|
.subscribe(collaborateurs => this.collaborateurs = collaborateurs); |
|
|
|
|
this.businessUnitService.getBusinessunits().subscribe( |
|
|
|
|
businessUnits => { |
|
|
|
|
this.businessUnits = businessUnits |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
this.agenceService.getAgences().subscribe( |
|
|
|
|
agences => { |
|
|
|
|
this.agences = agences |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getCollaborateurById(id: number): Collaborateur { |
|
|
|
@ -86,13 +97,13 @@ export class HomeComponent implements OnInit { |
|
|
|
|
getPeriodeEssais() { |
|
|
|
|
this.periodeEssaiService.getPeriodeEssais() |
|
|
|
|
.subscribe(periodeEssais => { |
|
|
|
|
this.periodeEssais = periodeEssais; |
|
|
|
|
periodeEssais.forEach(pe => { |
|
|
|
|
if (new Date(pe.plannedEndingDate).getTime() > new Date().getTime() && new Date(pe.plannedEndingDate).getTime() < HomeComponent.getNextWeek().getTime()) { |
|
|
|
|
this.periodeEssaisEnCours.push(pe); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.periodeEssaisEnCours.sort((b, a) => new Date(b.plannedEndingDate).getTime() - new Date(a.plannedEndingDate).getTime()); |
|
|
|
|
this.periodeEssais = this.periodeEssaisEnCours; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|