|
|
|
@ -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(); |
|
|
|
|
}, |
|
|
|
|
() => { |
|
|
|
|