From 6e33a9285f7cb24b286a6f8904485208fcec3492 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 22 Oct 2023 00:49:06 +0200 Subject: [PATCH] Update Frontend for editing and deleting tasks --- backend/.idea/misc.xml | 4 ++++ .../taskgroup-dashboard.component.css | 2 +- .../task-dashboard.component.css | 8 ++++++-- .../task-dashboard.component.html | 13 ++++++++++++ .../task-dashboard.component.ts | 20 +++++++++++++++++-- .../task-editor/task-editor.component.html | 5 +++-- 6 files changed, 45 insertions(+), 7 deletions(-) diff --git a/backend/.idea/misc.xml b/backend/.idea/misc.xml index 42e3abe..82ab2cc 100644 --- a/backend/.idea/misc.xml +++ b/backend/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -8,4 +9,7 @@ + + \ No newline at end of file diff --git a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.css b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.css index 1128c49..34bbabd 100644 --- a/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.css +++ b/frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.css @@ -1,6 +1,6 @@ .container { margin: 20px auto; - width: 60%; + width: 70%; } .spacer { diff --git a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.css b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.css index 84850cb..65aa36b 100644 --- a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.css +++ b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.css @@ -20,8 +20,12 @@ td, th { margin: 0 auto; } -.mat-column-status, .mat-column-finished { +.mat-column-status, .mat-column-eta { + width: 32px; + text-align: left; +} + +.mat-column-edit, .mat-column-delete, .mat-column-finished { width: 32px; text-align: center; } - diff --git a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html index e2bfdb0..91b6367 100644 --- a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html +++ b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html @@ -35,6 +35,19 @@
+ + + + + + + + + + + + + diff --git a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts index 2430e7e..80d1178 100644 --- a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts +++ b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts @@ -4,6 +4,8 @@ import {MatPaginator} from "@angular/material/paginator"; import {MatSort} from "@angular/material/sort"; import {MatTableDataSource} from "@angular/material/table"; import {TaskEditorComponent} from "../task-editor/task-editor.component"; +import {TaskEditorData} from "../task-editor/TaskEditorData"; +import {MatDialog, MatDialogRef} from "@angular/material/dialog"; @Component({ selector: 'app-task-dashboard', @@ -27,10 +29,11 @@ export class TaskDashboardComponent implements OnChanges{ @ViewChild(MatPaginator) paginator: MatPaginator | undefined @ViewChild(MatSort) sort: MatSort | undefined - displayedColumns: string[] = ['status', 'name', 'eta', 'start', 'deadline', 'finished']; + displayedColumns: string[] = ['status', 'name', 'eta', 'start', 'deadline', 'finished', 'edit', 'delete']; datasource: MatTableDataSource = new MatTableDataSource(); - constructor(private taskService: TaskService) { + constructor(private taskService: TaskService, + private dialog: MatDialog) { } @@ -46,4 +49,17 @@ export class TaskDashboardComponent implements OnChanges{ getStatusOfTask(task: TaskEntityInfo) { return "green"; } + + deleteTask(task: TaskEntityInfo) { + //todo: implement task delete api call + } + + editTask(task: TaskEntityInfo) { + const taskEditorInfo: TaskEditorData = { + task: task, + taskgroupID: this.taskgroupID! + }; + const dialogRef = this.dialog.open(TaskEditorComponent, {data: taskEditorInfo, minWidth: "400px"}) + + } } diff --git a/frontend/src/app/tasks/task-editor/task-editor.component.html b/frontend/src/app/tasks/task-editor/task-editor.component.html index 6382b81..df5b8b8 100644 --- a/frontend/src/app/tasks/task-editor/task-editor.component.html +++ b/frontend/src/app/tasks/task-editor/task-editor.component.html @@ -1,4 +1,5 @@ -

Create New Task

+

Edit Task ({{editorData.task!.taskName}})

+

Create New Task

Name @@ -27,5 +28,5 @@
- +