up séparation

pull/20/head
Clement FERRERE 2 years ago
parent 95ad6f1d20
commit 83f90d8a2e
  1. 10
      src/app/components/businessunit/businessunit-add/businessunit-add.component.ts
  2. 5
      src/app/components/businessunit/businessunit.component.html

@ -12,7 +12,6 @@ import {ToastrService} from "ngx-toastr";
})
export class BusinessunitAddComponent implements OnInit {
businessunits: Businessunit[] = [];
businessunit = {} as Businessunit;
registerForm!: FormGroup;
@ -31,21 +30,14 @@ export class BusinessunitAddComponent implements OnInit {
}
ngOnInit(): void {
this.getBusinessunits();
this.registerForm = this.formBuilder.group({
name: ['', Validators.required],
});
}
getBusinessunits(): void {
this.businessunitService.getBusinessunits()
.subscribe(businessunits => this.businessunits = businessunits);
}
add(businessunit: Businessunit): void {
this.businessunitService.addBusinessunit(businessunit)
.subscribe(businessunit => {
this.businessunits.push(businessunit);
.subscribe(() => {
this.showSuccess();
},
() => {

@ -2,6 +2,11 @@
<h2 class=mb-4>Business Units</h2>
<div style="display: flex">
<p style="margin: 10px 0 10px 0">Pour ajouter une nouvelle business unit, cliquez ici : </p>
<button routerLink="/businessunits/add">Ajouter</button>
</div>
<div class="mb-5 col-12" style="overflow-x:auto;">
<table class="table">
<thead>

Loading…
Cancel
Save