Mise à jour de l'affichage de la liste des référents et des détails d'un référent

develop
Yanaël GRETTE 4 years ago
parent d06122909a
commit cad23074d6
  1. 8
      src/app/app-routing.module.ts
  2. 12
      src/app/app.module.ts
  3. 1
      src/app/collaborateurs/details-collaborateur/details-collaborateur.component.ts
  4. 2
      src/app/referents/details-referent/details-referent.component.html
  5. 15
      src/app/referents/details-referent/details-referent.component.ts
  6. 2
      src/app/referents/referents.component.html
  7. 42
      src/app/referents/referents.component.ts

@ -25,7 +25,7 @@ const routes: Routes = [
{ {
path: paths_collaborateurs.path, path: paths_collaborateurs.path,
loadChildren: () => import('./collaborateurs/collaborateurs.module').then(m=> m.CollaborateursModule) loadChildren: () => import('./collaborateurs/collaborateurs.module').then(m=> m.CollaborateursModule)
}/*, },
{ {
path: paths_demandes_delegation.path, path: paths_demandes_delegation.path,
loadChildren: () => import('./demandes-delegation/demandes-delegation.module').then(m=> m.DemandesDelegationModule) loadChildren: () => import('./demandes-delegation/demandes-delegation.module').then(m=> m.DemandesDelegationModule)
@ -41,15 +41,15 @@ const routes: Routes = [
{ {
path: paths_saisie_ep.path, path: paths_saisie_ep.path,
loadChildren: () => import('./ep-saisie/ep-saisie.module').then(m=> m.EpSaisieModule) loadChildren: () => import('./ep-saisie/ep-saisie.module').then(m=> m.EpSaisieModule)
}, }/*,
{ {
path: paths_formation.path, path: paths_formation.path,
loadChildren: () => import('./formations/formations.module').then(m=> m.FormationsModule) loadChildren: () => import('./formations/formations.module').then(m=> m.FormationsModule)
}, }*/,
{ {
path: paths_referents.path, path: paths_referents.path,
loadChildren: () => import('./referents/referents.module').then(m=> m.ReferentsModule) loadChildren: () => import('./referents/referents.module').then(m=> m.ReferentsModule)
}*/ }
]; ];
@NgModule({ @NgModule({

@ -17,14 +17,14 @@ import { ApiModule } from '@shared/api-swagger'
import { HomeModule } from './home'; import { HomeModule } from './home';
import { CollaborateursModule } from './collaborateurs'; import { CollaborateursModule } from './collaborateurs';
/*
import { ReferentsModule } from './referents'; import { ReferentsModule } from './referents';
import { FormationsModule } from './formations'; //import { FormationsModule } from './formations';
import { DemandesFormationModule } from './demandes-formation'; import { DemandesFormationModule } from './demandes-formation';
import { DemandesDelegationModule } from './demandes-delegation'; import { DemandesDelegationModule } from './demandes-delegation';
import { EpSaisieModule } from "./ep-saisie"; import { EpSaisieModule } from "./ep-saisie";
import { EpModule } from "./ep" import { EpModule } from "./ep"
*/
import { environment } from '@env'; import { environment } from '@env';
@ -42,10 +42,10 @@ let keycloakService: KeycloakService = new KeycloakService();
BrowserModule, BrowserAnimationsModule, BrowserModule, BrowserAnimationsModule,
KeycloakAngularModule, AppRoutingModule, KeycloakAngularModule, AppRoutingModule,
HttpClientModule, ApiModule, HttpClientModule, ApiModule,
HomeModule, CollaborateursModule//, HomeModule, CollaborateursModule,
//ReferentsModule, FormationsModule, //ReferentsModule, FormationsModule,
//DemandesFormationModule, DemandesDelegationModule, DemandesFormationModule, DemandesDelegationModule,
//EpSaisieModule EpSaisieModule, EpModule
], ],
providers: [ providers: [
{ {

@ -48,7 +48,6 @@ 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)

@ -1,6 +1,6 @@
<app-nav-menu></app-nav-menu> <app-nav-menu></app-nav-menu>
<ng-container *ngIf="referent!=undefined"> <ng-container *ngIf="referent!=undefined">
<h2> {{referent.prenom }} {{referent.nom }} ({{referent.businessUnit.nom }}) </h2> <h2> {{ referent.prenom}} {{referent.nom}} ({{referent.businessUnit.nom}})</h2>
</ng-container> </ng-container>
<ng-container *ngIf="referent==undefined"> <ng-container *ngIf="referent==undefined">
<mat-spinner></mat-spinner> <mat-spinner></mat-spinner>

@ -7,11 +7,9 @@ import {MatTableDataSource} from '@angular/material/table';
import {MatPaginator} from '@angular/material/paginator'; import {MatPaginator} from '@angular/material/paginator';
import {MatSort} from '@angular/material/sort'; 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 { ReferentDTO, EpDTO } from "@shared/api-swagger/model/models";
import { EpModel } from "@shared/api-swagger/model/epModel";
import { DisplayEP } from "@shared/displayInfo/displays";
/** /**
*/ */
@ -20,7 +18,7 @@ import { DisplayEP } from "@shared/displayInfo/displays";
templateUrl: './details-referent.component.html' templateUrl: './details-referent.component.html'
}) })
export class DetailsReferentComponent implements OnInit { export class DetailsReferentComponent implements OnInit {
referent: CollaborateurModel; referent: ReferentDTO;
private referentSubscription : Subscription; private referentSubscription : Subscription;
idReferent : any; idReferent : any;
@ -28,14 +26,17 @@ export class DetailsReferentComponent implements OnInit {
constructor(private service:ReferentsService, private route: ActivatedRoute) {} constructor(private service:ReferentsService, private route: ActivatedRoute) {}
ngOnInit() { ngOnInit() {
this.idReferent = this.route.snapshot.paramMap.get("id"); this.idReferent = this.route.snapshot.paramMap.get("id");
this.referentSubscription = this.service.getReferentById(this.idReferent).subscribe( 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; this.referent = referent;
} }
ngOnDestroy() { ngOnDestroy() {

@ -4,7 +4,7 @@
<mat-table matSort [dataSource]="dataSource"> <mat-table matSort [dataSource]="dataSource">
<ng-container matColumnDef="agence"> <ng-container matColumnDef="agence">
<mat-header-cell *matHeaderCellDef mat-sort-header>Agence</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Agence</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.agence}}</mat-cell> <mat-cell *matCellDef="let row">{{ row.businessUnit.nom}}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="referent"> <ng-container matColumnDef="referent">

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

Loading…
Cancel
Save