|
|
|
@ -6,8 +6,7 @@ import {MatTableDataSource} from '@angular/material/table'; |
|
|
|
|
import {MatPaginator} from '@angular/material/paginator'; |
|
|
|
|
import {MatSort} from '@angular/material/sort'; |
|
|
|
|
|
|
|
|
|
import { FormationModel } from "@shared/api-swagger/model/models"; |
|
|
|
|
import { DisplayFormation } from "@shared/displayInfo/displays"; |
|
|
|
|
import { FormationDetailsDTO } from "@shared/api-swagger/model/models"; |
|
|
|
|
import { FormationsService } from "@shared/api-swagger/api/api"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -24,17 +23,21 @@ import { FormationsService } from "@shared/api-swagger/api/api"; |
|
|
|
|
export class HomeRHComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formationsDisponibles : DisplayFormation[]; |
|
|
|
|
formationsFiltres : DisplayFormation[]; |
|
|
|
|
asc = true; |
|
|
|
|
parPage = 15; |
|
|
|
|
numPage = 1; |
|
|
|
|
tri = ""; |
|
|
|
|
|
|
|
|
|
private formationsDisponiblesSubscription : Subscription; |
|
|
|
|
|
|
|
|
|
//displayedColumns: string[] = ["intitule", "participants", "date", "origine", "statut"]
|
|
|
|
|
displayedColumns: string[] = ["intitule", "origine", "participants", "date", "statut"] |
|
|
|
|
//displayedColumns: string[] = ["intitule", "origine", "participants", "date", "statut","certification"];
|
|
|
|
|
displayedColumns: string[] = ["intitule", "participants", "date", "statut","certification"]; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* source pour l'affichage des formations dans le tableau qui est affichée. |
|
|
|
|
*/ |
|
|
|
|
dataSource : MatTableDataSource<DisplayFormation>; |
|
|
|
|
dataSource : MatTableDataSource<FormationDetailsDTO>; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* contenu de la recherche. |
|
|
|
@ -59,31 +62,20 @@ export class HomeRHComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
|
this.formationsDisponiblesSubscription = this.service.getProchainesFormation(undefined, 1).subscribe( |
|
|
|
|
formations => this.initFormations(formations) |
|
|
|
|
); |
|
|
|
|
this.updateFormations(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
initFormations(formations:FormationModel[]) { |
|
|
|
|
this.formationsDisponibles = []; |
|
|
|
|
let formationDisplay : DisplayFormation; |
|
|
|
|
for(let formation of formations) { |
|
|
|
|
formationDisplay = new DisplayFormation(); |
|
|
|
|
formationDisplay.id = formation.id; |
|
|
|
|
formationDisplay.intitule = formation.intitule; |
|
|
|
|
formationDisplay.nbParticipants = 0; |
|
|
|
|
if(formation.participantsFormation != undefined) { |
|
|
|
|
formationDisplay.nbParticipants = formation.participantsFormation.length; |
|
|
|
|
} |
|
|
|
|
formationDisplay.datePrevu = formation.dateDebut; |
|
|
|
|
formationDisplay.origine = formation.origine; |
|
|
|
|
formationDisplay.statut = formation.statut; |
|
|
|
|
this.formationsDisponibles.push(formationDisplay); |
|
|
|
|
updateFormations() { |
|
|
|
|
this.formationsDisponiblesSubscription = this.service.getProchainesFormation(this.asc, this.numPage, this.parPage, 1, this.search, this.tri).subscribe( |
|
|
|
|
formations => this.dataSource = new MatTableDataSource(formations), |
|
|
|
|
err => console.log(err) |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
this.formationsFiltres = this.formationsDisponibles; |
|
|
|
|
this.dataSource = new MatTableDataSource(this.formationsFiltres); |
|
|
|
|
this.dataSource.paginator = this.paginator; |
|
|
|
|
this.dataSource.sort = this.sort; |
|
|
|
|
|
|
|
|
|
estCertifiee(certifiee) { |
|
|
|
|
if(certifiee) |
|
|
|
|
return "Oui"; |
|
|
|
|
return "Non"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
|