diff --git a/src/app/Qualification.ts b/src/app/Qualification.ts
new file mode 100644
index 0000000..c5821f7
--- /dev/null
+++ b/src/app/Qualification.ts
@@ -0,0 +1,7 @@
+export class Qualification {
+ constructor(
+ public id?: number,
+ public skill?: string
+ ) {
+ }
+}
diff --git a/src/app/employee/Employee.ts b/src/app/employee/Employee.ts
index 1debefc..ca15e4f 100644
--- a/src/app/employee/Employee.ts
+++ b/src/app/employee/Employee.ts
@@ -1,10 +1,15 @@
+import {Qualification} from "../Qualification";
+
export class Employee {
- constructor(public id?: number,
- public lastName?: string,
- public firstName?: string,
- public street?: string,
- public postcode?: string,
- public city?: string,
- public phone?: string) {
+ constructor(
+ public id?: number,
+ public lastName?: string,
+ public firstName?: string,
+ public street?: string,
+ public postcode?: string,
+ public city?: string,
+ public phone?: string,
+ public skillSet?: Qualification[]
+ ) {
}
}
diff --git a/src/app/employee/create/create.component.css b/src/app/employee/create/create.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/employee/create/create.component.html b/src/app/employee/create/create.component.html
new file mode 100644
index 0000000..50c81ea
--- /dev/null
+++ b/src/app/employee/create/create.component.html
@@ -0,0 +1,46 @@
+
Create Employee
+
+
+
+
diff --git a/src/app/employee/create/create.component.ts b/src/app/employee/create/create.component.ts
new file mode 100644
index 0000000..83cb773
--- /dev/null
+++ b/src/app/employee/create/create.component.ts
@@ -0,0 +1,61 @@
+import {Component, inject, OnInit} from '@angular/core';
+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";
+import {
+ MatDialogActions,
+ MatDialogClose,
+ MatDialogContent,
+ MatDialogRef,
+ MatDialogTitle
+} from "@angular/material/dialog";
+import {Employee} from "../Employee";
+import EmployeeApiService from "../../services/employee-api.service";
+import {NgIf} from "@angular/common";
+
+@Component({
+ selector: 'app-create-employee',
+ imports: [
+ ReactiveFormsModule,
+ MatFormField,
+ MatInput,
+ MatButton,
+ MatLabel,
+ MatDialogContent,
+ MatDialogTitle,
+ MatDialogActions,
+ MatDialogClose,
+ NgIf,
+ ],
+ templateUrl: './create.component.html',
+ standalone: true,
+ styleUrl: './create.component.css'
+})
+export class CreateComponent implements OnInit {
+ employeeForm: FormGroup | null = null;
+ employeeService: EmployeeApiService = inject(EmployeeApiService);
+ formBuilder: FormBuilder = inject(FormBuilder);
+ dialogRef: MatDialogRef = inject(MatDialogRef);
+
+ ngOnInit(): void {
+ this.employeeForm = this.formBuilder.group({
+ firstName: ['', Validators.required],
+ lastName: ['', Validators.required],
+ street: ['', Validators.required],
+ postcode: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(5)]],
+ city: ['', Validators.required],
+ phone: ['', Validators.required],
+ });
+ }
+
+ submit() {
+ if (this.employeeForm === null || !this.employeeForm.valid) {
+ console.error('Form invalid');
+ return;
+ }
+
+ this.employeeService.create(this.employeeForm.value as Employee).subscribe();
+ this.dialogRef.close();
+ }
+}
diff --git a/src/app/employee/table/table.component.html b/src/app/employee/table/table.component.html
index 635216f..d5f743e 100644
--- a/src/app/employee/table/table.component.html
+++ b/src/app/employee/table/table.component.html
@@ -4,7 +4,7 @@
Employee Directory
-