Mise à jour de l'affichage des détails d'un collaborateur

develop
Yanaël GRETTE 4 years ago
parent 8b04b1ae08
commit d06122909a
  1. 2
      src/app/collaborateurs/collaborateurs.component.html
  2. 10
      src/app/collaborateurs/collaborateurs.module.ts
  3. 7
      src/app/collaborateurs/collaborateurs.routing.module.ts
  4. 8
      src/app/collaborateurs/details-collaborateur/details-collaborateur.component.html
  5. 52
      src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts
  6. 2
      src/app/home/home-assistante/home-assistante.component.html

@ -4,7 +4,7 @@
<mat-table matSort [dataSource]="dataSource"> <mat-table matSort [dataSource]="dataSource">
<ng-container matColumnDef="agence"> <ng-container matColumnDef="agence">
<mat-header-cell *matHeaderCellDef mat-sort-header>Agence</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Agence</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.businessunit.nom }}</mat-cell> <mat-cell *matCellDef="let row">{{ row.businessUnit.nom }}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="collaborateur"> <ng-container matColumnDef="collaborateur">

@ -8,20 +8,20 @@ import { MaterialModule } from "@shared/angular-material/angular-material.module
import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; import {NavMenuModule} from '@shared/nav-menu/nav-menu.module';
import { CollaborateursComponent } from "./collaborateurs.component"; import { CollaborateursComponent } from "./collaborateurs.component";
/*
import { DetailsCollaborateurComponent } from "./details-collaborateur/details-collaborateur.component"; import { DetailsCollaborateurComponent } from "./details-collaborateur/details-collaborateur.component";
import { EvaluationComponent } from "./formations-collaborateur/details-evaluation/evaluation.component"; import { EvaluationComponent } from "./formations-collaborateur/details-evaluation/evaluation.component";
import { EditEvaluationComponent } from "./formations-collaborateur/edit-evaluation/edit-evaluation.component"; import { EditEvaluationComponent } from "./formations-collaborateur/edit-evaluation/edit-evaluation.component";
import { FormationsCollaboateurComponent } from "./formations-collaborateur/formations-collaborateur.component"; import { FormationsCollaboateurComponent } from "./formations-collaborateur/formations-collaborateur.component";
*/
import { CollaborateursRoutingModule } from "./collaborateurs.routing.module"; import { CollaborateursRoutingModule } from "./collaborateurs.routing.module";
@NgModule({ @NgModule({
declarations: [ declarations: [
CollaborateursComponent CollaborateursComponent, DetailsCollaborateurComponent,
/*DetailsCollaborateurComponent, EvaluationComponent, EditEvaluationComponent, DetailsCollaborateurComponent, EvaluationComponent, EditEvaluationComponent,
, FormationsCollaboateurComponent*/ FormationsCollaboateurComponent
], ],
exports: [ exports: [
CollaborateursComponent CollaborateursComponent

@ -2,23 +2,22 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { CollaborateursComponent } from "./collaborateurs.component"; import { CollaborateursComponent } from "./collaborateurs.component";
/*
import { DetailsCollaborateurComponent } from "./details-collaborateur/details-collaborateur.component"; import { DetailsCollaborateurComponent } from "./details-collaborateur/details-collaborateur.component";
import { FormationsCollaboateurComponent } from "./formations-collaborateur/formations-collaborateur.component"; import { FormationsCollaboateurComponent } from "./formations-collaborateur/formations-collaborateur.component";
import { EvaluationComponent } from './formations-collaborateur/details-evaluation/evaluation.component'; import { EvaluationComponent } from './formations-collaborateur/details-evaluation/evaluation.component';
import { EditEvaluationComponent } from './formations-collaborateur/edit-evaluation/edit-evaluation.component'; import { EditEvaluationComponent } from './formations-collaborateur/edit-evaluation/edit-evaluation.component';
*/
import { paths_collaborateurs } from '@shared/utils/paths'; import { paths_collaborateurs } from '@shared/utils/paths';
import { KeycloakGuard } from '@shared/guards/keycloakguard'; import { KeycloakGuard } from '@shared/guards/keycloakguard';
const routes: Routes = [ const routes: Routes = [
{ path:'', component: CollaborateursComponent, pathMatch: 'full', canActivate: [KeycloakGuard] }/*, { path:'', component: CollaborateursComponent, pathMatch: 'full', canActivate: [KeycloakGuard] },
{ path:paths_collaborateurs.formations, component: FormationsCollaboateurComponent, canActivate: [KeycloakGuard] }, { path:paths_collaborateurs.formations, component: FormationsCollaboateurComponent, canActivate: [KeycloakGuard] },
{ path:paths_collaborateurs.evaluation, component: EvaluationComponent, canActivate: [KeycloakGuard] }, { path:paths_collaborateurs.evaluation, component: EvaluationComponent, canActivate: [KeycloakGuard] },
{ path:paths_collaborateurs.edit, component: EditEvaluationComponent, canActivate: [KeycloakGuard] }, { path:paths_collaborateurs.edit, component: EditEvaluationComponent, canActivate: [KeycloakGuard] },
{ path:paths_collaborateurs.get, component: DetailsCollaborateurComponent, canActivate: [KeycloakGuard] }*/ { path:paths_collaborateurs.get, component: DetailsCollaborateurComponent, canActivate: [KeycloakGuard] }
]; ];

@ -9,16 +9,16 @@
<mat-spinner></mat-spinner> <mat-spinner></mat-spinner>
</ng-container> </ng-container>
<ng-container *ngIf= "eploaded && epEffectues.length==0"> <ng-container *ngIf= "eploaded && nbEP==0">
<h3> Aucun EP effectué encore </h3> <h3> Aucun EP effectué encore </h3>
</ng-container> </ng-container>
<ng-container *ngIf= "eploaded && epEffectues.length!=0"> <ng-container *ngIf= "eploaded && nbEP>0">
<h3>Liste des précédents EP</h3> <h3>Liste des précédents EP</h3>
<mat-table [dataSource]="this.dataSource" matSort> <mat-table [dataSource]="this.dataSource" matSort>
<ng-container matColumnDef="dateentretien"> <ng-container matColumnDef="dateentretien">
<mat-header-cell *matHeaderCellDef mat-sort-header>Date entretient</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Date entretient</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.dateentretien}}</mat-cell> <mat-cell *matCellDef="let row">{{ row.datePrevisionnelle }}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="referent"> <ng-container matColumnDef="referent">
@ -28,7 +28,7 @@
<ng-container matColumnDef="type"> <ng-container matColumnDef="type">
<mat-header-cell *matHeaderCellDef mat-sort-header>Type</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Type</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.type}}</mat-cell> <mat-cell *matCellDef="let row">{{ row.type }}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="details"> <ng-container matColumnDef="details">

@ -9,9 +9,7 @@ import {MatSort} from '@angular/material/sort';
import { CollaborateursService, EpService } from "@shared/api-swagger/api/api"; import { CollaborateursService, EpService } from "@shared/api-swagger/api/api";
import { CollaborateurModel } from "@shared/api-swagger/model/collaborateurModel"; import { EpInformationDTO, CollaborateurDTO } from "@shared/api-swagger/model/models";
import { EpModel } from "@shared/api-swagger/model/epModel";
import { DisplayEP } from "@shared/displayInfo/displays";
/** /**
*/ */
@ -20,13 +18,19 @@ import { DisplayEP } from "@shared/displayInfo/displays";
templateUrl: './details-collaborateur.component.html' templateUrl: './details-collaborateur.component.html'
}) })
export class DetailsCollaborateurComponent implements OnInit { export class DetailsCollaborateurComponent implements OnInit {
//epCollaborateurIdCollaborateurGet
collaborateur: CollaborateurModel; asc = true;
numPage = 1;
parPage = 5;
search = "";
tri = "";
nbEP = 0;
collaborateur: CollaborateurDTO;
private collaborateurSubscription : Subscription; private collaborateurSubscription : Subscription;
private epSubscription : Subscription; private epSubscription : Subscription;
epEffectues : DisplayEP[];
displayedColumns: string[] = ["dateentretien", "referent", "type", "details"]; displayedColumns: string[] = ["dateentretien", "referent", "type", "details"];
dataSource : MatTableDataSource<DisplayEP>; dataSource : MatTableDataSource<EpInformationDTO>;
eploaded = false; eploaded = false;
idCollaborateur: any; idCollaborateur: any;
@ -44,35 +48,31 @@ export class DetailsCollaborateurComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.idCollaborateur = this.route.snapshot.paramMap.get('id'); this.idCollaborateur = this.route.snapshot.paramMap.get('id');
console.log(this.idCollaborateur);
this.collaborateurSubscription = this.collaborateusrService.getCollaborateurById(this.idCollaborateur).subscribe( this.collaborateurSubscription = this.collaborateusrService.getCollaborateurById(this.idCollaborateur).subscribe(
collaborateur => this.initCollaborateur(collaborateur[0]), collaborateur => this.initCollaborateur(collaborateur[0]),
err => console.log(err) err => console.log(err)
); );
} }
initCollaborateur(collaborateur:CollaborateurModel) { initCollaborateur(collaborateur:CollaborateurDTO) {
this.collaborateur = collaborateur; this.collaborateur = collaborateur;
this.epSubscription = this.epService.getEPByCollaborateur(this.idCollaborateur).subscribe( this.updateEP()
ep => this.initEP(ep)
)
} }
initEP(ep:EpModel[]) { updateEP() {
this.epEffectues = []; console.log(this.idCollaborateur);
let epDisplay : DisplayEP; this.epSubscription = this.epService.getEPByCollaborateur(this.asc, this.idCollaborateur, this.numPage, this.parPage, undefined, this.search, this.tri).subscribe(
for(let un_ep of ep) { ep =>
epDisplay = new DisplayEP(); {
epDisplay.id = un_ep.id; this.nbEP = ep.length;
epDisplay.referent = un_ep.referent; this.dataSource = new MatTableDataSource(ep);
epDisplay.etat = un_ep.etat; },
epDisplay.type = un_ep.type; err => console.log(err)
epDisplay.dateentretien = un_ep.dateEntretien; );
this.epEffectues.push(epDisplay);
}
this.dataSource = new MatTableDataSource(this.epEffectues);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
this.eploaded = true; this.eploaded = true;
//this.dataSource.paginator = this.paginator;
//this.dataSource.sort = this.sort;
} }
ngOnDestroy() { ngOnDestroy() {

@ -16,7 +16,7 @@
<ng-container matColumnDef="agence"> <ng-container matColumnDef="agence">
<mat-header-cell *matHeaderCellDef mat-sort-header> Agence </mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header> Agence </mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.collaborateur.businessunit.nom}} </mat-cell> <mat-cell *matCellDef="let row"> {{row.collaborateur.businessUnit.nom}} </mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="collaborateur"> <ng-container matColumnDef="collaborateur">

Loading…
Cancel
Save