Merge pull request 'feat: add qualification creation component and route' (#75) from feature/create-skill into main
All checks were successful
Playwright Tests / test (push) Successful in 2m13s
All checks were successful
Playwright Tests / test (push) Successful in 2m13s
Reviewed-on: #75
This commit is contained in:
commit
2a337f3586
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 { AuthGuard } from "./service/auth.service";
|
||||||
import { MitarbeiterErstellenComponent } from "./components/mitarbeiter-erstellen/mitarbeiter-erstellen.component";
|
import { MitarbeiterErstellenComponent } from "./components/mitarbeiter-erstellen/mitarbeiter-erstellen.component";
|
||||||
import { QualifikationsverwaltungComponent } from "./components/qualifikationsverwaltung/qualifikationsverwaltung.component";
|
import { QualifikationsverwaltungComponent } from "./components/qualifikationsverwaltung/qualifikationsverwaltung.component";
|
||||||
|
import { QulifikationErstellenComponent } from "./components/qualifikation-erstellen/qualifikation-erstellen.component";
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -18,6 +19,11 @@ export const routes: Routes = [
|
||||||
component: MitarbeiterverwaltungViewComponent,
|
component: MitarbeiterverwaltungViewComponent,
|
||||||
canActivate: [AuthGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "qualifikationerstellen",
|
||||||
|
component: QulifikationErstellenComponent,
|
||||||
|
canActivate: [AuthGuard],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "mitarbeitererstellen",
|
path: "mitarbeitererstellen",
|
||||||
component: MitarbeiterErstellenComponent,
|
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: './qualifikation-erstellen.component.html',
|
||||||
|
styleUrl: './qualifikation-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.skill.skill = this.skillForm.get("name")?.value;
|
||||||
this.skillChange.emit(this.skill);
|
this.skillChange.emit(this.skill);
|
||||||
|
|
||||||
this.router.navigate(["/qualifikationen"]);
|
this.router.navigate(["/qualifikationsverwaltung"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(): void {
|
ngOnChanges(): void {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||||
export class QualifikatonBearbeitenViewComponent {
|
export class QualifikatonBearbeitenViewComponent {
|
||||||
public skill!: QualificationGetDTO;
|
public skill!: QualificationGetDTO;
|
||||||
|
|
||||||
constructor(private skillService: SkillService, private route: ActivatedRoute) {}
|
constructor(private skillService: SkillService, private route: ActivatedRoute) { }
|
||||||
|
|
||||||
submitted(skill: QualificationGetDTO) {
|
submitted(skill: QualificationGetDTO) {
|
||||||
this.skillService.updateSkill(skill);
|
this.skillService.updateSkill(skill);
|
||||||
|
|
|
@ -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) {
|
constructor(private http: HttpClient, private employeeService: EmployeeService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue