|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
import { Component, OnInit, OnDestroy, ViewChild, ViewChildren } from '@angular/core'; |
|
|
|
|
|
|
|
|
|
import { MatDatepickerInputEvent } from '@angular/material/datepicker'; |
|
|
|
|
|
|
|
|
|
import { Observable, Subscription } from 'rxjs'; |
|
|
|
|
|
|
|
|
|
import {MatTableDataSource} from '@angular/material/table'; |
|
|
|
@ -64,12 +66,25 @@ export class CollaborateursComponent implements OnInit { |
|
|
|
|
*/ |
|
|
|
|
tri = ""; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Liste des business units du collaborateur connecté |
|
|
|
|
*/ |
|
|
|
|
bus = []; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Liste des id des business units des collaborateurs à afficher |
|
|
|
|
*/ |
|
|
|
|
busIds: Array<number> = []; |
|
|
|
|
|
|
|
|
|
taille = 100; |
|
|
|
|
/** |
|
|
|
|
* Nombre total d'élément du tableau |
|
|
|
|
*/ |
|
|
|
|
taille: number; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Options pour choisir le nombre de page à affiche |
|
|
|
|
*/ |
|
|
|
|
pageOption = [ 5, 15, 20, 30, 50]; |
|
|
|
|
|
|
|
|
|
pageEvent: PageEvent; |
|
|
|
@ -88,6 +103,17 @@ export class CollaborateursComponent implements OnInit { |
|
|
|
|
* Spécifie si la liste des collaborateurs est en cours de chargement dans le tableau. |
|
|
|
|
*/ |
|
|
|
|
chargement = true; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
*
|
|
|
|
|
*/ |
|
|
|
|
dateDebut = undefined; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
*
|
|
|
|
|
*/ |
|
|
|
|
dateFin = undefined; |
|
|
|
|
|
|
|
|
|
constructor(private service: CollaborateursService, private collaborateurConnecte: CollaborateurConnecte) {} |
|
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
@ -100,11 +126,11 @@ export class CollaborateursComponent implements OnInit { |
|
|
|
|
*/ |
|
|
|
|
updateDataSource() { |
|
|
|
|
//récupérer la liste des collaborateur et mettre à jour le tableau
|
|
|
|
|
this.collaborateursDisponiblesSubscription = this.service.getCollaborateurs(this.roles, this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( |
|
|
|
|
this.collaborateursDisponiblesSubscription = this.service.getCollaborateurs(this.roles, this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri, this.dateDebut, this.dateFin).subscribe( |
|
|
|
|
collaborateurs => { console.log(collaborateurs); this.dataSource = new MatTableDataSource(collaborateurs);}, |
|
|
|
|
err => console.log(err) |
|
|
|
|
); |
|
|
|
|
this.collaborateursDisponiblesCountSubscription = this.service.getCollaborateursCount(this.roles, this.busIds,this.asc, this.numPage, this.parPage, this.search, this.tri).subscribe( |
|
|
|
|
this.collaborateursDisponiblesCountSubscription = this.service.getCollaborateursCount(this.roles, this.busIds,this.asc, this.numPage, this.parPage, this.search, this.tri, this.dateDebut, this.dateFin).subscribe( |
|
|
|
|
count => { console.log(count); this.taille=count;}, |
|
|
|
|
err => console.log(err) |
|
|
|
|
); |
|
|
|
@ -112,7 +138,13 @@ export class CollaborateursComponent implements OnInit { |
|
|
|
|
//this.dataSource.sort = this.sort;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateDateToUndefined(val : number) { |
|
|
|
|
if(val == 1) |
|
|
|
|
this.dateDebut = undefined; |
|
|
|
|
if(val == 2) |
|
|
|
|
this.dateFin = undefined; |
|
|
|
|
this.updateDataSource(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updatePageInfo(event) : PageEvent{ |
|
|
|
|
this.parPage = event.pageSize; |
|
|
|
@ -121,6 +153,10 @@ export class CollaborateursComponent implements OnInit { |
|
|
|
|
return event; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setDate(e : MatDatepickerInputEvent<any>, val:number) { |
|
|
|
|
this.updateDataSource(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setSearch() { |
|
|
|
|
this.numPage = 1; |
|
|
|
|
this.updateDataSource(); |
|
|
|
|