feat(qualifikation): add skill management features and fixes
This commit is contained in:
parent
8a4a617c33
commit
3d2f049312
7 changed files with 77 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
<div class="container">
|
||||
<form [formGroup]="skillForm">
|
||||
<button class="back-button">Back</button>
|
||||
<button (click)="returnToSkillList()" class="back-button">Back</button>
|
||||
|
||||
<div class="form-group">
|
||||
@if (errorMessages['name']) {
|
||||
|
|
|
@ -76,6 +76,10 @@ export class QualifikationFormComponent {
|
|||
}
|
||||
}
|
||||
|
||||
returnToSkillList() {
|
||||
this.router.navigate(["qualifikationsverwaltung"]);
|
||||
}
|
||||
|
||||
updateEmployeeLists() {
|
||||
if (this.skill.id != -1) {
|
||||
this.employeeService.getAllEmployees().subscribe(employees => {
|
||||
|
@ -105,7 +109,7 @@ export class QualifikationFormComponent {
|
|||
}
|
||||
|
||||
for (const employee of this.addableEmployees) {
|
||||
this.employeeService.removeSkillFromEmployee(this.skill.id, employee);
|
||||
this.employeeService.removeSkillFromEmployee(this.skill.id, employee.id);
|
||||
}
|
||||
|
||||
this.skill.skill = this.skillForm.get("name")?.value;
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
<input type="text" placeholder="Search employee" formControlName="search">
|
||||
<button (click)="submit()">Search</button>
|
||||
</div>
|
||||
<p class="text-body-tertiary">Search for a propertiy of a Qualification. eg. First Name</p>
|
||||
<p class="text-body-tertiary">Search for a propertiy of a Qualification. eg. Name</p>
|
||||
</form>
|
||||
<button (click)="createEmployee()" class="add-button">Add qualification</button>
|
||||
<button (click)="createSkill()" class="add-button">Add qualification</button>
|
||||
</div>
|
||||
|
||||
<table class="employee-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="sortable">First Name</span></th>
|
||||
<th><span class="sortable">Name</span></th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -1,12 +1,57 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { QualificationGetDTO } from '../../models/skill';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { SkillService } from '../../service/skill.service';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-qualifikationsverwaltung',
|
||||
standalone: true,
|
||||
imports: [],
|
||||
imports: [ReactiveFormsModule],
|
||||
templateUrl: './qualifikationsverwaltung.component.html',
|
||||
styleUrl: './qualifikationsverwaltung.component.css'
|
||||
})
|
||||
export class QualifikationsverwaltungComponent {
|
||||
skills: Array<QualificationGetDTO> = [];
|
||||
public searchForm!: FormGroup;
|
||||
|
||||
constructor(private skillService: SkillService, private router: Router) {}
|
||||
|
||||
submit() {
|
||||
const searchTerm = this.searchForm.get("search")?.value || '';
|
||||
|
||||
this.skillService.getAllSkills().subscribe(skills => {
|
||||
let foundSkills: Array<QualificationGetDTO> = [];
|
||||
for (const skill of skills) {
|
||||
if (
|
||||
skill.skill.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
searchTerm == ''
|
||||
) {
|
||||
foundSkills.push(skill);
|
||||
}
|
||||
}
|
||||
|
||||
this.skills = foundSkills;
|
||||
});
|
||||
}
|
||||
|
||||
editSkill(id: number) {
|
||||
this.router.navigate([`/qualifikationbearbeiten/${id}`]);
|
||||
}
|
||||
|
||||
createSkill() {
|
||||
this.router.navigate(['/qualifikationerstellen']);
|
||||
}
|
||||
|
||||
deleteSkill(id: number) {
|
||||
this.skillService.deleteSkill(id);
|
||||
this.skills = this.skills.filter(skill => skill.id != id);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.searchForm = new FormGroup({
|
||||
search: new FormControl(''),
|
||||
});
|
||||
this.skillService.getAllSkills().subscribe(skills => this.skills = skills);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue