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