feat: add qualification creation component and route
Some checks failed
Playwright Tests / test (pull_request) Failing after 1m19s
Some checks failed
Playwright Tests / test (pull_request) Failing after 1m19s
This commit is contained in:
parent
08adf21da9
commit
9b80777fc3
8 changed files with 65 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<app-qualifikation-form [(skill)]="skill" (skillChange)="submitted($event)"></app-qualifikation-form>
|
|
@ -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();
|
||||
});
|
||||
});
|
|
@ -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: '',
|
||||
};
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue