diff --git a/src/app/components/home/home.component.html b/src/app/components/home/home.component.html index 38e0a7f..05f9745 100644 --- a/src/app/components/home/home.component.html +++ b/src/app/components/home/home.component.html @@ -1,8 +1,6 @@ -

Services Collaborateurs EPA

+

Services Collaborateurs EPA

-

- -
+
Fins de périodes d'essai @@ -17,7 +15,7 @@ - + {{getCollaborateurById(periodeEssai.collaborateurId).name}} {{getCollaborateurById(periodeEssai.collaborateurId).firstName}} {{getSplitDate(periodeEssai.plannedEndingDate.toString())}} @@ -97,6 +95,45 @@ + + Statistiques + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EntitéTotal
Business Units{{businessUnits.length}}
Agences{{agences.length}}
Collaborateur{{collaborateurs.length}}
Référencements{{referencements.length}}
Périodes d'essai{{periodeEssais.length}}
-
+
+ + + + +
diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts index c04dec0..3f1d810 100644 --- a/src/app/components/home/home.component.ts +++ b/src/app/components/home/home.component.ts @@ -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; }); }