|
|
|
@ -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() { |
|
|
|
|