diff --git a/src/app/home/home-rh/home-rh.component.html b/src/app/home/home-rh/home-rh.component.html index 76900d5..464ad1f 100644 --- a/src/app/home/home-rh/home-rh.component.html +++ b/src/app/home/home-rh/home-rh.component.html @@ -13,17 +13,22 @@ Date prévisionnelle - {{ row.datePrevu | date:'dd/MM/yyyy à hh:mm' }} + {{ row.dateDebut | date:'dd/MM/yyyy à hh:mm' }} - + Statut - {{row.statut}} + {{row.statut.libelle}} + + + + Certifiée + {{estCertifiee(row.estCertifie)}} diff --git a/src/app/home/home-rh/home-rh.component.ts b/src/app/home/home-rh/home-rh.component.ts index 973778f..cd5c1bc 100644 --- a/src/app/home/home-rh/home-rh.component.ts +++ b/src/app/home/home-rh/home-rh.component.ts @@ -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; + dataSource : MatTableDataSource; /** * 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); - } - this.formationsFiltres = this.formationsDisponibles; - this.dataSource = new MatTableDataSource(this.formationsFiltres); - this.dataSource.paginator = this.paginator; - this.dataSource.sort = this.sort; + 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) + ) + } + + estCertifiee(certifiee) { + if(certifiee) + return "Oui"; + return "Non"; } ngOnDestroy() { diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index e231718..ae8d2b6 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,7 +1,8 @@

Bonjour

+ +--> diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index d45cbc4..f3fa964 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -6,18 +6,18 @@ import { FormsModule } from '@angular/forms'; import { MaterialModule } from "@shared/angular-material/angular-material.module"; import {HomeAssistanteComponent} from './home-assistante/home-assistante.component'; +import {HomeRHComponent} from './home-rh/home-rh.component'; /* import {HomeCollaborateurComponent} from './home-collaborateur/home-collaborateur.component'; import {HomeCommercialComponent} from './home-commercial/home-commercial.component'; -import {HomeRHComponent} from './home-rh/home-rh.component'; */ import {HomeComponent} from './home.component'; import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; @NgModule({ declarations: [ - HomeComponent, HomeAssistanteComponent + HomeComponent, HomeAssistanteComponent, HomeRHComponent /*, HomeCollaborateurComponent, - HomeCommercialComponent, HomeRHComponent*/ + HomeCommercialComponent, */ ], exports: [ HomeComponent