|
|
|
@ -8,8 +8,7 @@ import {MatSort} from '@angular/material/sort'; |
|
|
|
|
|
|
|
|
|
import { ReferentsService } from "@shared/api-swagger/api/api"; |
|
|
|
|
|
|
|
|
|
import { CollaborateurModel } from "@shared/api-swagger/model/collaborateurModel"; |
|
|
|
|
import { DisplayCollaborateur } from "@shared/displayInfo/displays"; |
|
|
|
|
import { ReferentDTO } from "@shared/api-swagger/model/models"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -20,19 +19,22 @@ import { DisplayCollaborateur } from "@shared/displayInfo/displays"; |
|
|
|
|
}) |
|
|
|
|
export class ReferentsComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
referentsDiponibles : DisplayCollaborateur[]; |
|
|
|
|
referentsFiltre : DisplayCollaborateur[]; |
|
|
|
|
asc = true; |
|
|
|
|
numPage = 1; |
|
|
|
|
parPage = 5; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private referentsDisponiblesSubscription : Subscription; |
|
|
|
|
|
|
|
|
|
displayedColumns : string[] = ["agence", "referent"]; |
|
|
|
|
|
|
|
|
|
dataSource : MatTableDataSource<DisplayCollaborateur>; |
|
|
|
|
|
|
|
|
|
dataSource : MatTableDataSource<ReferentDTO>; |
|
|
|
|
roles : string[] = ["Commercial"]; |
|
|
|
|
/** |
|
|
|
|
* contenu de la recherche. |
|
|
|
|
*/ |
|
|
|
|
search = ""; |
|
|
|
|
|
|
|
|
|
tri = ""; |
|
|
|
|
/** |
|
|
|
|
* Pagination du tableau. |
|
|
|
|
*/ |
|
|
|
@ -50,26 +52,16 @@ export class ReferentsComponent implements OnInit { |
|
|
|
|
constructor(private service: ReferentsService) {} |
|
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
|
this.referentsDisponiblesSubscription = this.service.getReferents(undefined, undefined, 1).subscribe( |
|
|
|
|
referents => { this.initReferents(referents); } |
|
|
|
|
); |
|
|
|
|
this.updateDataSource(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
initReferents(referents:CollaborateurModel[]) { |
|
|
|
|
this.referentsDiponibles = []; |
|
|
|
|
let referentDisplay: DisplayCollaborateur; |
|
|
|
|
for(let r of referents) { |
|
|
|
|
referentDisplay = new DisplayCollaborateur(); |
|
|
|
|
referentDisplay.id = r.id; |
|
|
|
|
referentDisplay.prenom = r.prenom; |
|
|
|
|
referentDisplay.nom = r.nom; |
|
|
|
|
referentDisplay.agence = r.businessUnit.nom; |
|
|
|
|
this.referentsDiponibles.push(referentDisplay); |
|
|
|
|
} |
|
|
|
|
this.referentsFiltre = this.referentsDiponibles; |
|
|
|
|
this.dataSource = new MatTableDataSource(this.referentsFiltre); |
|
|
|
|
this.dataSource.paginator = this.paginator; |
|
|
|
|
this.dataSource.sort = this.sort; |
|
|
|
|
updateDataSource() { |
|
|
|
|
this.referentsDisponiblesSubscription = this.service.getReferents(this.asc, this.numPage, this.parPage, this.roles, 1, undefined, this.search, this.tri).subscribe( |
|
|
|
|
referents => this.dataSource = new MatTableDataSource(referents), |
|
|
|
|
err => console.log(err) |
|
|
|
|
); |
|
|
|
|
//this.dataSource.paginator = this.paginator;
|
|
|
|
|
//this.dataSource.sort = this.sort;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
|