diff --git a/src/app/employee/create/create.component.html b/src/app/employee/create/create.component.html
index bd139c9..50c81ea 100644
--- a/src/app/employee/create/create.component.html
+++ b/src/app/employee/create/create.component.html
@@ -27,20 +27,13 @@
Postcode
-
+
Phone
-
-
-
-
- Skills
-
- {{ skill.skill }}
-
+
diff --git a/src/app/employee/create/create.component.ts b/src/app/employee/create/create.component.ts
index 98e6a39..83cb773 100644
--- a/src/app/employee/create/create.component.ts
+++ b/src/app/employee/create/create.component.ts
@@ -1,5 +1,5 @@
import {Component, inject, OnInit} from '@angular/core';
-import {FormArray, FormBuilder, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
+import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
import {MatFormField, MatLabel} from "@angular/material/form-field";
import {MatInput} from "@angular/material/input";
import {MatButton} from "@angular/material/button";
@@ -12,11 +12,7 @@ import {
} from "@angular/material/dialog";
import {Employee} from "../Employee";
import EmployeeApiService from "../../services/employee-api.service";
-import {Observable} from "rxjs";
-import {MatOption, MatSelect} from "@angular/material/select";
-import {AsyncPipe, NgForOf, NgIf} from "@angular/common";
-import {Qualification} from "../../Qualification";
-import QualificationService from "../../services/qualification.service";
+import {NgIf} from "@angular/common";
@Component({
selector: 'app-create-employee',
@@ -30,11 +26,7 @@ import QualificationService from "../../services/qualification.service";
MatDialogTitle,
MatDialogActions,
MatDialogClose,
- MatSelect,
- MatOption,
- NgForOf,
NgIf,
- AsyncPipe,
],
templateUrl: './create.component.html',
standalone: true,
@@ -45,9 +37,6 @@ export class CreateComponent implements OnInit {
employeeService: EmployeeApiService = inject(EmployeeApiService);
formBuilder: FormBuilder = inject(FormBuilder);
dialogRef: MatDialogRef = inject(MatDialogRef);
- qualificationService: QualificationService = inject(QualificationService);
- skills!: Observable
- formSkills: FormArray = this.formBuilder.array([]);
ngOnInit(): void {
this.employeeForm = this.formBuilder.group({
@@ -57,31 +46,16 @@ export class CreateComponent implements OnInit {
postcode: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(5)]],
city: ['', Validators.required],
phone: ['', Validators.required],
- skillSet: this.formSkills
});
-
- this.skills = this.qualificationService.getAll();
-
- this.skills.subscribe((qualifications: Qualification[]) => {
- qualifications.forEach((qualification: Qualification) => {
-
- this.formSkills.push(this.formBuilder.group(qualification));
- });
- })
}
submit() {
- console.log(this.employeeForm?.controls['skillSet'].value)
if (this.employeeForm === null || !this.employeeForm.valid) {
console.error('Form invalid');
return;
}
- const newEmployee = this.employeeForm.value as Employee;
- //newEmployee.skillSet = newEmployee.skillSet?.map((selected: boolean, index: number) => {return })
- return;
-
- this.employeeService.create(newEmployee).subscribe();
+ this.employeeService.create(this.employeeForm.value as Employee).subscribe();
this.dialogRef.close();
}
}