diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9f63a3a..fec8549 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -25,7 +25,7 @@ const routes: Routes = [ { path: paths_collaborateurs.path, loadChildren: () => import('./collaborateurs/collaborateurs.module').then(m=> m.CollaborateursModule) - }/*, + }, { path: paths_demandes_delegation.path, loadChildren: () => import('./demandes-delegation/demandes-delegation.module').then(m=> m.DemandesDelegationModule) @@ -41,15 +41,15 @@ const routes: Routes = [ { path: paths_saisie_ep.path, loadChildren: () => import('./ep-saisie/ep-saisie.module').then(m=> m.EpSaisieModule) - }, + }/*, { path: paths_formation.path, loadChildren: () => import('./formations/formations.module').then(m=> m.FormationsModule) - }, + }*/, { path: paths_referents.path, loadChildren: () => import('./referents/referents.module').then(m=> m.ReferentsModule) - }*/ + } ]; @NgModule({ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index de26755..7c9625d 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -17,14 +17,14 @@ import { ApiModule } from '@shared/api-swagger' import { HomeModule } from './home'; import { CollaborateursModule } from './collaborateurs'; -/* + import { ReferentsModule } from './referents'; -import { FormationsModule } from './formations'; +//import { FormationsModule } from './formations'; import { DemandesFormationModule } from './demandes-formation'; import { DemandesDelegationModule } from './demandes-delegation'; import { EpSaisieModule } from "./ep-saisie"; import { EpModule } from "./ep" -*/ + import { environment } from '@env'; @@ -42,10 +42,10 @@ let keycloakService: KeycloakService = new KeycloakService(); BrowserModule, BrowserAnimationsModule, KeycloakAngularModule, AppRoutingModule, HttpClientModule, ApiModule, - HomeModule, CollaborateursModule//, + HomeModule, CollaborateursModule, //ReferentsModule, FormationsModule, - //DemandesFormationModule, DemandesDelegationModule, - //EpSaisieModule + DemandesFormationModule, DemandesDelegationModule, + EpSaisieModule, EpModule ], providers: [ { diff --git a/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts b/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts index d067ede..e934bff 100644 --- a/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts +++ b/src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts @@ -48,7 +48,6 @@ 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) diff --git a/src/app/referents/details-referent/details-referent.component.html b/src/app/referents/details-referent/details-referent.component.html index 82352ef..01bad8f 100644 --- a/src/app/referents/details-referent/details-referent.component.html +++ b/src/app/referents/details-referent/details-referent.component.html @@ -1,6 +1,6 @@ -

{{referent.prenom }} {{referent.nom }} ({{referent.businessUnit.nom }})

+

{{ referent.prenom}} {{referent.nom}} ({{referent.businessUnit.nom}})

diff --git a/src/app/referents/details-referent/details-referent.component.ts b/src/app/referents/details-referent/details-referent.component.ts index 26d7fab..916dc98 100644 --- a/src/app/referents/details-referent/details-referent.component.ts +++ b/src/app/referents/details-referent/details-referent.component.ts @@ -7,11 +7,9 @@ import {MatTableDataSource} from '@angular/material/table'; import {MatPaginator} from '@angular/material/paginator'; import {MatSort} from '@angular/material/sort'; -import { ReferentsService } from "@shared/api-swagger/api/api"; +import { ReferentsService, 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 { ReferentDTO, EpDTO } from "@shared/api-swagger/model/models"; /** */ @@ -20,7 +18,7 @@ import { DisplayEP } from "@shared/displayInfo/displays"; templateUrl: './details-referent.component.html' }) export class DetailsReferentComponent implements OnInit { - referent: CollaborateurModel; + referent: ReferentDTO; private referentSubscription : Subscription; idReferent : any; @@ -28,14 +26,17 @@ export class DetailsReferentComponent implements OnInit { constructor(private service:ReferentsService, private route: ActivatedRoute) {} ngOnInit() { + this.idReferent = this.route.snapshot.paramMap.get("id"); this.referentSubscription = this.service.getReferentById(this.idReferent).subscribe( - referent => this.initReferent(referent) + referent => this.initReferent(referent[0]), + err => console.log(err) ) } - initReferent(referent:CollaborateurModel) { + initReferent(referent:ReferentDTO) { this.referent = referent; + } ngOnDestroy() { diff --git a/src/app/referents/referents.component.html b/src/app/referents/referents.component.html index 4d6d9c4..320ec14 100644 --- a/src/app/referents/referents.component.html +++ b/src/app/referents/referents.component.html @@ -4,7 +4,7 @@ Agence - {{ row.agence}} + {{ row.businessUnit.nom}} diff --git a/src/app/referents/referents.component.ts b/src/app/referents/referents.component.ts index 9a07bd3..af4c1a5 100644 --- a/src/app/referents/referents.component.ts +++ b/src/app/referents/referents.component.ts @@ -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; - + dataSource : MatTableDataSource; + 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() {