Status dropdown now w/ add and delete working

This commit is contained in:
2020-07-02 10:18:52 +02:00
parent 5b0e1a24c7
commit 18160c4127
2 changed files with 23 additions and 14 deletions

View File

@@ -25,7 +25,7 @@ export class TaskFormComponent implements OnInit {
public userstoryId: string;
public userstories: any[] = [];
public allStatus: any[] = [];
public status: ScrumStatus = { title: '', description: '' };
public status: ScrumStatus = {title: "", description: ""};
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {
this.getUserStories();
@@ -97,19 +97,32 @@ export class TaskFormComponent implements OnInit {
});
}
createTaskStatus() {
this.backendService.postStatus(this.status).subscribe((response) => {
createTaskStatus(status:ScrumStatus) {
this.backendService.postStatus(status).subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
}
else
{
this.allStatus.push(response.body);
}
});
}
deleteStatus() {
this.backendService.deleteStatus(this.status).subscribe((response) => {
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.task.statusid=null;
});
}