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