Status dropdown now w/ add and delete working
This commit is contained in:
parent
5b0e1a24c7
commit
18160c4127
@ -53,21 +53,17 @@
|
||||
<div class="form-group">
|
||||
<div ngbDropdown class="dropdown">
|
||||
<button ngbDropdownToggle class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Status
|
||||
Status: {{task.statusid}}
|
||||
</button>
|
||||
<div ngbDropdownMenu class="dropdown-menu" aria-labelledby="dropdownMenu2">
|
||||
<label for="Inhalt">Status wählen</label>
|
||||
<select class="custom-select mr-sm-2" id="prio" required name="prio" [(ngModel)]="task.statusid">
|
||||
<option *ngFor="let status of allStatus" [value]="status.id">{{
|
||||
status.title
|
||||
}}</option>
|
||||
</select>
|
||||
<option ngbDropdownItem *ngFor="let status of allStatus" (click)="task.statusid = status.id">{{ status.title }}</option>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<label for="Inhalt">Neuer Status</label>
|
||||
<input type="text" class="form-control" [(ngModel)]="status.title">
|
||||
<button ngbDropdownItem class="dropdown-item" type="button" (click)="createTaskStatus()">Status anlegen</button>
|
||||
<button ngbDropdownItem class="dropdown-item" type="button" (click)="deleteStatus()">Status löschen</button>
|
||||
<input #statusname type="text" id="statusname" class="form-control" (change)="status.title=statusname.value">
|
||||
<button ngbDropdownItem class="dropdown-item" type="button" (click)="createTaskStatus(status)">Status anlegen</button>
|
||||
<button ngbDropdownItem class="dropdown-item" type="button" (click)="deleteStatus(task.statusid)">Status löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-menu">
|
||||
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user