diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 1a9d282..0b23766 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -38,6 +38,7 @@ import { SettingsComponent } from './admin-dashboard/settings/settings.component
import {MatListModule} from "@angular/material/list";
import { TaskgroupDashboardComponent } from './taskgroups/taskgroup-dashboard/taskgroup-dashboard.component';
import { TaskgroupCreationComponent } from './taskgroups/taskgroup-creation/taskgroup-creation.component';
+import { TaskgroupDeletionComponent } from './taskgroups/taskgroup-deletion/taskgroup-deletion.component';
@NgModule({
declarations: [
@@ -56,7 +57,8 @@ import { TaskgroupCreationComponent } from './taskgroups/taskgroup-creation/task
RegistrationComponent,
SettingsComponent,
TaskgroupDashboardComponent,
- TaskgroupCreationComponent
+ TaskgroupCreationComponent,
+ TaskgroupDeletionComponent
],
imports: [
BrowserModule,
diff --git a/frontend/src/app/taskgroups/taskgroup-creation/taskgroup-creation.component.ts b/frontend/src/app/taskgroups/taskgroup-creation/taskgroup-creation.component.ts
index 5cefc1d..8b299b7 100644
--- a/frontend/src/app/taskgroups/taskgroup-creation/taskgroup-creation.component.ts
+++ b/frontend/src/app/taskgroups/taskgroup-creation/taskgroup-creation.component.ts
@@ -72,7 +72,5 @@ export class TaskgroupCreationComponent implements OnInit {
}
})
}
-
-
}
}
diff --git a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html
index 03ec6d5..747ee96 100644
--- a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html
+++ b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html
@@ -11,7 +11,7 @@
{{taskgroup.taskgroupName}}
-
+
diff --git a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts
index 005ea39..fd65051 100644
--- a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts
+++ b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import {MatDialog} from "@angular/material/dialog";
import {TaskgroupCreationComponent} from "../taskgroup-creation/taskgroup-creation.component";
import {TaskgroupEntityInfo, TaskgroupService} from "../../../api";
+import {TaskgroupDeletionComponent} from "../taskgroup-deletion/taskgroup-deletion.component";
@Component({
selector: 'app-taskgroup-dashboard',
@@ -40,4 +41,13 @@ export class TaskgroupDashboardComponent implements OnInit {
}
})
}
+
+ openTaskgroupDeletion(taskgroup: TaskgroupEntityInfo) {
+ const dialogRef = this.dialog.open(TaskgroupDeletionComponent, {data: taskgroup, minWidth: "400px"});
+ dialogRef.afterClosed().subscribe(res => {
+ if(res) {
+ this.taskgroups = this.taskgroups.filter(ctg => ctg.taskgroupID != taskgroup.taskgroupID)
+ }
+ })
+ }
}
diff --git a/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.css b/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.html b/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.html
new file mode 100644
index 0000000..71015c2
--- /dev/null
+++ b/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.html
@@ -0,0 +1,8 @@
+Delete Taskgroup
+
+Are you sure, you want to delete your taskgroup {{data.taskgroupName}}? This cannot be undone!
+
+
+
+
+
diff --git a/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.spec.ts b/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.spec.ts
new file mode 100644
index 0000000..4f7d1d5
--- /dev/null
+++ b/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TaskgroupDeletionComponent } from './taskgroup-deletion.component';
+
+describe('TaskgroupDeletionComponent', () => {
+ let component: TaskgroupDeletionComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ TaskgroupDeletionComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(TaskgroupDeletionComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.ts b/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.ts
new file mode 100644
index 0000000..d19a62d
--- /dev/null
+++ b/frontend/src/app/taskgroups/taskgroup-deletion/taskgroup-deletion.component.ts
@@ -0,0 +1,46 @@
+import {Component, Inject, OnInit} from '@angular/core';
+import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
+import {TaskgroupEntityInfo, TaskgroupService} from "../../../api";
+import {MatSnackBar} from "@angular/material/snack-bar";
+
+@Component({
+ selector: 'app-taskgroup-deletion',
+ templateUrl: './taskgroup-deletion.component.html',
+ styleUrls: ['./taskgroup-deletion.component.css']
+})
+export class TaskgroupDeletionComponent implements OnInit {
+
+ constructor(@Inject(MAT_DIALOG_DATA) public data: TaskgroupEntityInfo,
+ private dialogRef: MatDialogRef,
+ private taskgroupService: TaskgroupService,
+ private snackbar: MatSnackBar) { }
+
+ pending: boolean = false;
+
+ ngOnInit(): void {
+ }
+
+ cancel() {
+ this.dialogRef.close(false);
+ }
+
+ confirm() {
+ this.pending = true;
+ this.taskgroupService.taskgroupsTaskgroupIDDelete(this.data.taskgroupID).subscribe({
+ next: resp => {
+ this.pending = false;
+ this.dialogRef.close(true);
+ },
+ error: err => {
+ this.pending = false;
+ if(err.stats == 403) {
+ this.snackbar.open("No permission", "", {duration: 2000});
+ } else if(err.status == 404) {
+ this.snackbar.open("Not found", "", {duration: 2000});
+ } else {
+ this.snackbar.open("Unexpected error", "");
+ }
+ }
+ })
+ }
+}