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. 15
      src/app/referents/details-referent/details-referent.component.ts
  5. 2
      src/app/referents/referents.component.html
  6. 42
      src/app/referents/referents.component.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({

@ -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: [
{

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

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

@ -4,7 +4,7 @@
<mat-table matSort [dataSource]="dataSource">
<ng-container matColumnDef="agence">
<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 matColumnDef="referent">

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

Loading…
Cancel
Save