parent
b018d20079
commit
e4c80ba618
@ -0,0 +1,17 @@ |
|||||||
|
<div class = mb-3> |
||||||
|
<table> |
||||||
|
<tr> |
||||||
|
<th>Name</th> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td> |
||||||
|
<input id="businessunit-name" [(ngModel)]="businessunit.name" placeholder="name"> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
|
||||||
|
<select name="agence" id="agence-select" [(ngModel)]="businessunit.agenceId"> |
||||||
|
<option value="">-- Choisissez l'agence de cette business Unit --</option> |
||||||
|
<option *ngFor="let agence of agences" [ngValue]="agence.id">{{agence.name}}</option> |
||||||
|
</select> |
||||||
|
</div> |
@ -0,0 +1,42 @@ |
|||||||
|
import {Component, Input, OnInit} from '@angular/core'; |
||||||
|
import {Businessunit} from "../../../interfaces/businessunit"; |
||||||
|
import {HttpClient} from "@angular/common/http"; |
||||||
|
import {BusinessunitService} from "../../../services/businessunit.service"; |
||||||
|
import {Agence} from "../../../interfaces/agence"; |
||||||
|
import {AgenceService} from "../../../services/agence.service"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-businessunit-detail', |
||||||
|
templateUrl: './businessunit-detail.component.html', |
||||||
|
styleUrls: ['./businessunit-detail.component.scss'] |
||||||
|
}) |
||||||
|
export class BusinessunitDetailComponent implements OnInit { |
||||||
|
|
||||||
|
businessunits : Businessunit[] = []; |
||||||
|
@Input() |
||||||
|
businessunit = {} as Businessunit ; |
||||||
|
agences : Agence[] = []; |
||||||
|
agence = {} as Agence ; |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http : HttpClient, |
||||||
|
private businessunitService: BusinessunitService, |
||||||
|
private agenceService: AgenceService, |
||||||
|
) { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.getBusinessunits(); |
||||||
|
this.getAgences(); |
||||||
|
} |
||||||
|
|
||||||
|
getBusinessunits():void { |
||||||
|
this.businessunitService.getBusinessunits() |
||||||
|
.subscribe(businessunits => this.businessunits = businessunits); |
||||||
|
} |
||||||
|
|
||||||
|
getAgences():void { |
||||||
|
this.agenceService.getAgences() |
||||||
|
.subscribe(agences => this.agences = agences); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1 +1,12 @@ |
|||||||
<p>businessunit-edit works!</p> |
|
||||||
|
<div *ngIf="businessunit"> |
||||||
|
|
||||||
|
<h2>{{businessunit.name | uppercase}} </h2> |
||||||
|
<div><span>id : </span>{{businessunit.id}}</div> |
||||||
|
|
||||||
|
<app-businessunit-detail [businessunit]="businessunit"></app-businessunit-detail> |
||||||
|
|
||||||
|
<button (click)="goBack()">Retour</button> |
||||||
|
<button (click)="save()">Sauvegarder les changements</button> |
||||||
|
<button (click)="delete()">Supprimer le businessunit</button> |
||||||
|
</div> |
||||||
|
Loading…
Reference in new issue