update liste des agences

pull/20/head
Clement FERRERE 2 years ago
parent 0f01fc486b
commit f2c80893cd
  1. 6
      src/app/components/agence/agence.component.html
  2. 11
      src/app/components/agence/agence.component.ts

@ -40,14 +40,14 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th scope="col">ID</th>
<th scope="col">Nom</th> <th scope="col">Nom</th>
<th scope="col"> Business Unit attitrée</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let agence of agences"> <tr *ngFor="let agence of agences">
<th scope="row">{{agence.id}}</th> <th >{{agence.name}}</th>
<td> {{agence.name}} </td> <td >{{getBusinessUnitById(agence.businessUnitId).name}}</td>
<td><a routerLink="{{agence.id}}"> Modifier </a></td> <td><a routerLink="{{agence.id}}"> Modifier </a></td>
</tr> </tr>
</tbody> </tbody>

@ -53,6 +53,17 @@ export class AgenceComponent implements OnInit {
.subscribe(businessunits => this.businessUnits = businessunits); .subscribe(businessunits => this.businessUnits = businessunits);
} }
getBusinessUnitById(id: number): Businessunit {
let bu = {} as Businessunit;
this.businessUnits.forEach(c => {
if (c.id == id) {
bu = c;
return;
}
});
return bu;
}
add(agence: Agence): void { add(agence: Agence): void {
this.agenceService.addAgence(agence) this.agenceService.addAgence(agence)
.subscribe(agence => { .subscribe(agence => {

Loading…
Cancel
Save