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 @@
- +
diff --git a/frontend/src/app/tasks/task-editor/task-editor.component.ts b/frontend/src/app/tasks/task-editor/task-editor.component.ts index 32f5318..6dd4acc 100644 --- a/frontend/src/app/tasks/task-editor/task-editor.component.ts +++ b/frontend/src/app/tasks/task-editor/task-editor.component.ts @@ -26,6 +26,12 @@ export class TaskEditorComponent implements OnInit { private snackbar: MatSnackBar) { } ngOnInit(): void { + if(this.editorData.task != undefined) { + this.nameCtrl.setValue(this.editorData.task.taskName); + this.etaCtrl.setValue(this.editorData.task.eta) + this.startDate.setValue(this.editorData.task.startDate); + this.endDate.setValue(this.editorData.task.deadline); + } } cancel() { @@ -33,6 +39,14 @@ export class TaskEditorComponent implements OnInit { } submit() { + if(this.editorData.task != undefined) { + this.editTask() + } else { + this.createTask(); + } + } + + createTask() { this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, { taskName: this.nameCtrl.value, eta: this.etaCtrl.value, @@ -55,4 +69,8 @@ export class TaskEditorComponent implements OnInit { } }) } + + editTask() { + //todo: api call + } }