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">
<ng-container matColumnDef="agence">
<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 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 { CollaborateursComponent } from "./collaborateurs.component";
/*
import { DetailsCollaborateurComponent } from "./details-collaborateur/details-collaborateur.component";
import { EvaluationComponent } from "./formations-collaborateur/details-evaluation/evaluation.component";
import { EditEvaluationComponent } from "./formations-collaborateur/edit-evaluation/edit-evaluation.component";
import { FormationsCollaboateurComponent } from "./formations-collaborateur/formations-collaborateur.component";
*/
import { CollaborateursRoutingModule } from "./collaborateurs.routing.module";
@NgModule({
declarations: [
CollaborateursComponent
/*DetailsCollaborateurComponent, EvaluationComponent, EditEvaluationComponent,
, FormationsCollaboateurComponent*/
CollaborateursComponent, DetailsCollaborateurComponent,
DetailsCollaborateurComponent, EvaluationComponent, EditEvaluationComponent,
FormationsCollaboateurComponent
],
exports: [
CollaborateursComponent

@ -2,23 +2,22 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CollaborateursComponent } from "./collaborateurs.component";
/*
import { DetailsCollaborateurComponent } from "./details-collaborateur/details-collaborateur.component";
import { FormationsCollaboateurComponent } from "./formations-collaborateur/formations-collaborateur.component";
import { EvaluationComponent } from './formations-collaborateur/details-evaluation/evaluation.component';
import { EditEvaluationComponent } from './formations-collaborateur/edit-evaluation/edit-evaluation.component';
*/
import { paths_collaborateurs } from '@shared/utils/paths';
import { KeycloakGuard } from '@shared/guards/keycloakguard';
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.evaluation, component: EvaluationComponent, 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>
</ng-container>
<ng-container *ngIf= "eploaded && epEffectues.length==0">
<ng-container *ngIf= "eploaded && nbEP==0">
<h3> Aucun EP effectué encore </h3>
</ng-container>
<ng-container *ngIf= "eploaded && epEffectues.length!=0">
<ng-container *ngIf= "eploaded && nbEP>0">
<h3>Liste des précédents EP</h3>
<mat-table [dataSource]="this.dataSource" matSort>
<ng-container matColumnDef="dateentretien">
<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 matColumnDef="referent">
@ -28,7 +28,7 @@
<ng-container matColumnDef="type">
<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 matColumnDef="details">

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

@ -16,7 +16,7 @@
<ng-container matColumnDef="agence">
<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 matColumnDef="collaborateur">

Loading…
Cancel
Save