Mise à jour du home RH

develop
Yanaël GRETTE 4 years ago
parent 03cecbed1e
commit d7b947c956
  1. 13
      src/app/home/home-rh/home-rh.component.html
  2. 48
      src/app/home/home-rh/home-rh.component.ts
  3. 3
      src/app/home/home.component.html
  4. 6
      src/app/home/home.module.ts

@ -13,17 +13,22 @@
<ng-container matColumnDef="date"> <ng-container matColumnDef="date">
<mat-header-cell *matHeaderCellDef>Date prévisionnelle</mat-header-cell> <mat-header-cell *matHeaderCellDef>Date prévisionnelle</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.datePrevu | date:'dd/MM/yyyy à hh:mm' }}</mat-cell> <mat-cell *matCellDef="let row">{{ row.dateDebut | date:'dd/MM/yyyy à hh:mm' }}</mat-cell>
</ng-container> </ng-container>
<!--
<ng-container matColumnDef="origine"> <ng-container matColumnDef="origine">
<mat-header-cell *matHeaderCellDef>Origine</mat-header-cell> <mat-header-cell *matHeaderCellDef>Origine</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.origine}}</mat-cell> <mat-cell *matCellDef="let row">{{row.origine}}</mat-cell>
</ng-container> </ng-container>
-->
<ng-container matColumnDef="statut"> <ng-container matColumnDef="statut">
<mat-header-cell *matHeaderCellDef>Statut</mat-header-cell> <mat-header-cell *matHeaderCellDef>Statut</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.statut}}</mat-cell> <mat-cell *matCellDef="let row">{{row.statut.libelle}}</mat-cell>
</ng-container>
<ng-container matColumnDef="certification">
<mat-header-cell *matHeaderCellDef>Certifiée</mat-header-cell>
<mat-cell *matCellDef="let row">{{estCertifiee(row.estCertifie)}}</mat-cell>
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>

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

@ -1,7 +1,8 @@
<app-nav-menu></app-nav-menu> <app-nav-menu></app-nav-menu>
<h1> Bonjour</h1> <h1> Bonjour</h1>
<home-assistante *ngIf="this.userRole == role.assistante"></home-assistante> <home-assistante *ngIf="this.userRole == role.assistante"></home-assistante>
<home-rh *ngIf="this.userRole ==role.rh"></home-rh>
<!-- <!--
<home-collaborateur *ngIf="this.userRole ==role.collaborateur"></home-collaborateur> <home-collaborateur *ngIf="this.userRole ==role.collaborateur"></home-collaborateur>
<home-commercial *ngIf="this.userRole ==role.commercial"></home-commercial> <home-commercial *ngIf="this.userRole ==role.commercial"></home-commercial>
<home-rh *ngIf="this.userRole ==role.rh"></home-rh>--> -->

@ -6,18 +6,18 @@ import { FormsModule } from '@angular/forms';
import { MaterialModule } from "@shared/angular-material/angular-material.module"; import { MaterialModule } from "@shared/angular-material/angular-material.module";
import {HomeAssistanteComponent} from './home-assistante/home-assistante.component'; 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 {HomeCollaborateurComponent} from './home-collaborateur/home-collaborateur.component';
import {HomeCommercialComponent} from './home-commercial/home-commercial.component'; import {HomeCommercialComponent} from './home-commercial/home-commercial.component';
import {HomeRHComponent} from './home-rh/home-rh.component';
*/ */
import {HomeComponent} from './home.component'; import {HomeComponent} from './home.component';
import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; import {NavMenuModule} from '@shared/nav-menu/nav-menu.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
HomeComponent, HomeAssistanteComponent HomeComponent, HomeAssistanteComponent, HomeRHComponent
/*, HomeCollaborateurComponent, /*, HomeCollaborateurComponent,
HomeCommercialComponent, HomeRHComponent*/ HomeCommercialComponent, */
], ],
exports: [ exports: [
HomeComponent HomeComponent

Loading…
Cancel
Save