+
+
-
-
-
-
-
-
+
+
Neue Userstory anlegen
-
-
-
+
+
+
+
+
+
+
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/app/userstory-form/userstory-form.component.ts b/src/app/userstory-form/userstory-form.component.ts
index c3ca4c5..d94b164 100644
--- a/src/app/userstory-form/userstory-form.component.ts
+++ b/src/app/userstory-form/userstory-form.component.ts
@@ -1,17 +1,29 @@
import { Component, OnInit, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { BackendService, ScrumUserstory, Priority } from '../services/backend.service';
+import {
+ ScrumTask,
+ ScrumStatus,
+ ScrumCategory,
+ ScrumUser,
+ ScrumProject,
+} from '../services/backend.service';
@Component({
selector: 'app-userstory-form',
templateUrl: './userstory-form.component.html',
- styleUrls: [ './userstory-form.component.css' ]
+ styleUrls: ['./userstory-form.component.css']
})
export class UserstoryFormComponent implements OnInit {
@Input() public userstory: ScrumUserstory;
+ public allStatus: any[] = [];
+ public status: ScrumStatus = { title: "", description: "" };
private editing: boolean;
- constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {}
+
+ constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {
+ this.getUserstoryStatus();
+ }
ngOnInit(): void {
if (this.userstory === null || this.userstory === undefined) {
@@ -43,7 +55,55 @@ export class UserstoryFormComponent implements OnInit {
this.activeModalService.dismiss(this.userstory);
}
- //focusTitleField() {
- // document.getElementById('titleField').focus();
- //}
+ getUserstoryStatus() {
+ this.backendService.getAllStatus().subscribe((response) => {
+ if (response.status > 399) {
+ alert('Fehler');
+ } else {
+ this.allStatus.push(...response.body);
+ }
+ });
+ }
+
+ createUserstoryStatus(status: ScrumStatus) {
+ this.backendService.postStatus(status).subscribe((response) => {
+ if (response.status > 399) {
+ alert('Fehler');
+ }
+ else {
+ this.allStatus.push(response.body);
+ }
+ });
+ }
+
+ deleteStatus(id: number) {
+ var status = this.allStatus.find((x) => x.id === id);
+ this.backendService.deleteStatus(status).subscribe((response) => {
+ if (response.status > 399) {
+ alert('Fehler');
+ }
+ else {
+ const index = this.allStatus.indexOf(status);
+ if (index !== -1) {
+ this.allStatus.splice(index, 1);
+ }
+ }
+ this.userstory.statusid = null;
+ });
+ }
+
+ getAllPriorities(): string[] {
+ return Object.values(Priority);
+ }
+ getStatusTitleById(id: number): string {
+ if (!id) {
+ return null;
+ }
+ var status = this.allStatus.find((x) => x.id === id);
+ if (!status) {
+ return null;
+ }
+ return status.title;
+ }
+
}