created dropdown to choose a user assigned to the task.

This commit is contained in:
test
2020-07-03 11:17:37 +02:00
parent f5dae215a4
commit c393afb7b8
2 changed files with 126 additions and 65 deletions

View File

@@ -26,10 +26,13 @@ export class TaskFormComponent implements OnInit {
public userstories: any[] = [];
public allStatus: any[] = [];
public status: ScrumStatus = {title: "", description: ""};
public allUser: any[] = [];
public user: ScrumUser = { name: "" };
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) {
this.getUserStories();
this.getTaskStatus();
this.getAllUsers();
}
ngOnInit(): void {
@@ -155,4 +158,27 @@ export class TaskFormComponent implements OnInit {
}
return status.title;
}
// Methods for choosing creator of a userstory.
getAllUsers() {
this.backendService.getUsers().subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
} else {
this.allUser.push(...response.body);
}
});
}
getAuthorById(id: number): string {
if (!id) {
return null;
}
var user = this.allUser.find((x) => x.id === id);
if (!user) {
return null;
}
return user.name;
}
}