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