|
|
@ -1,4 +1,4 @@ |
|
|
|
import { Component, Input, OnInit, ViewChild, AfterViewInit} from "@angular/core"; |
|
|
|
import { Component, Input, OnInit, OnChanges, ViewChild, AfterViewInit} from "@angular/core"; |
|
|
|
|
|
|
|
|
|
|
|
import {MatPaginator} from '@angular/material/paginator'; |
|
|
|
import {MatPaginator} from '@angular/material/paginator'; |
|
|
|
import {MatSort} from '@angular/material/sort'; |
|
|
|
import {MatSort} from '@angular/material/sort'; |
|
|
@ -13,7 +13,7 @@ import { DatePipe } from "@angular/common"; |
|
|
|
templateUrl: "./participations-formation.table.html", |
|
|
|
templateUrl: "./participations-formation.table.html", |
|
|
|
styleUrls: ["./participations-formation.table.css"] |
|
|
|
styleUrls: ["./participations-formation.table.css"] |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class ParticipationsFormationTableComponent implements OnInit, AfterViewInit { |
|
|
|
export class ParticipationsFormationTableComponent implements OnInit, OnChanges, AfterViewInit { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ViewChild(MatPaginator) paginator: MatPaginator; |
|
|
|
@ViewChild(MatPaginator) paginator: MatPaginator; |
|
|
@ -56,21 +56,31 @@ export class ParticipationsFormationTableComponent implements OnInit, AfterViewI |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
ngOnInit() { |
|
|
|
this.dataSource = new MatTableDataSource(this.participations); |
|
|
|
|
|
|
|
this.dataSource.sortingDataAccessor = (item, property) => { |
|
|
|
} |
|
|
|
switch(property) { |
|
|
|
|
|
|
|
case 'collaborateur': return item.collaborateur.nom + " "+ item.collaborateur.prenom; |
|
|
|
ngOnChanges() { |
|
|
|
case 'ep': return item.ep.statut; |
|
|
|
if(this.participations.length > 0) { |
|
|
|
case 'evaluation': return item.estEvaluee;
|
|
|
|
this.dataSource = new MatTableDataSource(this.participations); |
|
|
|
default: return item[property]; |
|
|
|
this.dataSource.sortingDataAccessor = (item, property) => { |
|
|
|
} |
|
|
|
switch(property) { |
|
|
|
}; |
|
|
|
case 'collaborateur': return item.collaborateur.nom + " "+ item.collaborateur.prenom; |
|
|
|
this.dataSource.filterPredicate = (data, filter) => { |
|
|
|
case 'ep': return item.ep.statut; |
|
|
|
const formatted=this.pipe.transform(data.dateCreation,'dd/MM/yyyy'); |
|
|
|
case 'evaluation': return item.estEvaluee;
|
|
|
|
return formatted.indexOf(filter) >= 0 ||
|
|
|
|
case 'statut': return item.statut.libelle;
|
|
|
|
data.collaborateur.nom.toLocaleLowerCase().includes(filter) || |
|
|
|
default: return item[property]; |
|
|
|
data.collaborateur.prenom.toLocaleLowerCase().includes(filter); |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
this.dataSource.filterPredicate = (data, filter) => { |
|
|
|
|
|
|
|
const formatted=this.pipe.transform(data.dateCreation,'dd/MM/yyyy'); |
|
|
|
|
|
|
|
return formatted.indexOf(filter) >= 0 ||
|
|
|
|
|
|
|
|
data.collaborateur.nom.toLocaleLowerCase().includes(filter) || |
|
|
|
|
|
|
|
data.collaborateur.prenom.toLocaleLowerCase().includes(filter) || |
|
|
|
|
|
|
|
data.intitule.toLocaleLowerCase().includes(filter) || |
|
|
|
|
|
|
|
data.statut.libelle.toLocaleLowerCase().includes(filter); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ngAfterViewInit() { |
|
|
|
ngAfterViewInit() { |
|
|
|