feat: add qualification creation component and route
Some checks failed
Playwright Tests / test (pull_request) Failing after 1m19s

This commit is contained in:
Jan Gleytenhoover 2025-01-22 09:03:52 +01:00
parent 08adf21da9
commit 9b80777fc3
Signed by: jank
GPG key ID: 50620ADD22CD330B
8 changed files with 65 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import { MitarbeiterBearbeitenViewComponent } from "./components/mitarbeiter-bea
import { AuthGuard } from "./service/auth.service";
import { MitarbeiterErstellenComponent } from "./components/mitarbeiter-erstellen/mitarbeiter-erstellen.component";
import { QualifikationsverwaltungComponent } from "./components/qualifikationsverwaltung/qualifikationsverwaltung.component";
import { QulifikationErstellenComponent } from "./components/qualifikation-erstellen/qualifikation-erstellen.component";
export const routes: Routes = [
{
@ -18,6 +19,11 @@ export const routes: Routes = [
component: MitarbeiterverwaltungViewComponent,
canActivate: [AuthGuard],
},
{
path: "qualifikationerstellen",
component: QulifikationErstellenComponent,
canActivate: [AuthGuard],
},
{
path: "mitarbeitererstellen",
component: MitarbeiterErstellenComponent,

View file

@ -0,0 +1 @@
<app-qualifikation-form [(skill)]="skill" (skillChange)="submitted($event)"></app-qualifikation-form>

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { QulifikationErstellenComponent } from './qulifikation-erstellen.component';
describe('QulifikationErstellenComponent', () => {
let component: QulifikationErstellenComponent;
let fixture: ComponentFixture<QulifikationErstellenComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [QulifikationErstellenComponent]
})
.compileComponents();
fixture = TestBed.createComponent(QulifikationErstellenComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,29 @@
import { Component } from '@angular/core';
import { QualifikationFormComponent } from '../qualifikation-form/qualifikation-form.component';
import { QualificationGetDTO } from '../../models/skill';
import { SkillService } from '../../service/skill.service';
@Component({
selector: 'app-qulifikation-erstellen',
standalone: true,
imports: [QualifikationFormComponent],
templateUrl: './qulifikation-erstellen.component.html',
styleUrl: './qulifikation-erstellen.component.css'
})
export class QulifikationErstellenComponent {
public skill!: QualificationGetDTO;
constructor(private skillService: SkillService) { }
submitted(skill: QualificationGetDTO) {
console.log(skill);
this.skillService.createSkill(skill);
}
ngOnInit(): void {
this.skill = {
id: 0,
skill: '',
};
}
}

View file

@ -115,7 +115,7 @@ export class QualifikationFormComponent {
this.skill.skill = this.skillForm.get("name")?.value;
this.skillChange.emit(this.skill);
this.router.navigate(["/qualifikationen"]);
this.router.navigate(["/qualifikationsverwaltung"]);
}
ngOnChanges(): void {

View file

@ -15,7 +15,7 @@ import { ActivatedRoute } from '@angular/router';
export class QualifikatonBearbeitenViewComponent {
public skill!: QualificationGetDTO;
constructor(private skillService: SkillService, private route: ActivatedRoute) {}
constructor(private skillService: SkillService, private route: ActivatedRoute) { }
submitted(skill: QualificationGetDTO) {
this.skillService.updateSkill(skill);

View file

@ -28,6 +28,10 @@ export class SkillService {
}
}
createSkill(skill: QualificationGetDTO) {
this.http.post(`${SkillService.BASE_URL}/qualifications`, this.getToPutDto(skill)).subscribe();
}
constructor(private http: HttpClient, private employeeService: EmployeeService) {
}