issue-44 #75
@ -11,6 +11,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -85,6 +86,10 @@ public class TaskController {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
if(taskFieldInfo.getStartDate() == null) {
|
||||
taskFieldInfo.setStartDate(LocalDate.now());
|
||||
}
|
||||
|
||||
ServiceResult<Task> creationResult = taskService.createTask(taskgroupPermissionResult.getResult(), taskFieldInfo);
|
||||
if(creationResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
|
||||
return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
|
||||
|
@ -22,6 +22,10 @@ public class TaskEntityInfo {
|
||||
|
||||
private int workTime;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
private boolean hasActiveSchedules;
|
||||
|
||||
public TaskEntityInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
@ -33,6 +37,8 @@ public class TaskEntityInfo {
|
||||
}
|
||||
this.finished = task.isFinished();
|
||||
this.workTime = task.getWorkTime();
|
||||
this.finishable = task.isFinishable();
|
||||
this.hasActiveSchedules = task.hasActiveSchedule();
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -98,4 +104,20 @@ public class TaskEntityInfo {
|
||||
public void setWorkTime(int workTime) {
|
||||
this.workTime = workTime;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
|
||||
public boolean isHasActiveSchedules() {
|
||||
return hasActiveSchedules;
|
||||
}
|
||||
|
||||
public void setHasActiveSchedules(boolean hasActiveSchedules) {
|
||||
this.hasActiveSchedules = hasActiveSchedules;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package core.api.models.timemanager.tasks;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDate;
|
||||
@ -19,6 +20,8 @@ public class TaskFieldInfo {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDate deadline;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
public TaskFieldInfo() {
|
||||
}
|
||||
|
||||
@ -60,4 +63,12 @@ public class TaskFieldInfo {
|
||||
public void setDeadline(LocalDate deadline) {
|
||||
this.deadline = deadline;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public class TaskOverviewInfo {
|
||||
private LocalDate limit;
|
||||
private boolean overdue;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
public TaskOverviewInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
@ -26,6 +27,7 @@ public class TaskOverviewInfo {
|
||||
if(task.getDeadline() != null) {
|
||||
this.overdue = LocalDate.now().isAfter(task.getDeadline());
|
||||
}
|
||||
this.finishable = task.isFinishable();
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -75,4 +77,12 @@ public class TaskOverviewInfo {
|
||||
public void setOverdue(boolean overdue) {
|
||||
this.overdue = overdue;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,12 @@ public class TaskShortInfo {
|
||||
private long taskID;
|
||||
private String taskName;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
public TaskShortInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
this.finishable = task.isFinishable();
|
||||
}
|
||||
|
||||
public TaskShortInfo(long taskID, String taskName) {
|
||||
@ -32,4 +35,12 @@ public class TaskShortInfo {
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public class TaskTaskgroupInfo {
|
||||
|
||||
private List<TaskgroupEntityInfo> taskgroups;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
public TaskTaskgroupInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
@ -42,6 +44,7 @@ public class TaskTaskgroupInfo {
|
||||
List<Taskgroup> taskgroupList = Taskgroup.getAncestorList(task.getTaskgroup());
|
||||
taskgroupList.add(task.getTaskgroup());
|
||||
this.taskgroups = taskgroupList.stream().map(TaskgroupEntityInfo::new).toList();
|
||||
this.finishable = task.isFinishable();
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -115,4 +118,12 @@ public class TaskTaskgroupInfo {
|
||||
public void setTaskgroups(List<TaskgroupEntityInfo> taskgroups) {
|
||||
this.taskgroups = taskgroups;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package core.entities.timemanager;
|
||||
|
||||
import core.api.models.timemanager.tasks.TaskFieldInfo;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@ -29,21 +31,25 @@ public class Task {
|
||||
|
||||
private boolean finished;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
@OneToMany(mappedBy = "task", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private List<AbstractSchedule> basicTaskSchedules;
|
||||
|
||||
private int workTime;
|
||||
|
||||
public Task(Taskgroup taskgroup, String taskName, LocalDate startDate, LocalDate deadline, int eta) {
|
||||
this.taskgroup = taskgroup;
|
||||
this.taskName = taskName;
|
||||
this.startDate = startDate;
|
||||
this.deadline = deadline;
|
||||
this.eta = eta;
|
||||
this.finished = false;
|
||||
public Task() {
|
||||
}
|
||||
|
||||
public Task() {
|
||||
public Task(Taskgroup taskgroup, TaskFieldInfo taskFieldInfo) {
|
||||
this.taskgroup = taskgroup;
|
||||
this.taskName = taskFieldInfo.getTaskName();
|
||||
this.startDate = taskFieldInfo.getStartDate();
|
||||
this.deadline = taskFieldInfo.getDeadline();
|
||||
this.eta = taskFieldInfo.getEta();
|
||||
this.finished = false;
|
||||
this.finishable = taskFieldInfo.isFinishable();
|
||||
System.err.println(this.finishable);
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -91,7 +97,7 @@ public class Task {
|
||||
}
|
||||
|
||||
public void finish() {
|
||||
this.finished = true;
|
||||
this.finished = !this.finished;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
@ -171,4 +177,12 @@ public class Task {
|
||||
}
|
||||
return abstractSchedules;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class TaskService {
|
||||
return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
Task task = new Task(taskgroup, taskFieldInfo.getTaskName(), taskFieldInfo.getStartDate(), taskFieldInfo.getDeadline(), taskFieldInfo.getEta());
|
||||
Task task = new Task(taskgroup, taskFieldInfo);
|
||||
taskgroup.getTasks().add(task);
|
||||
taskRepository.save(task);
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (1, NULL, 0, NULL, 'Task 1', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (2, NULL, 0, NULL, 'Task 2', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (3, '2022-03-20', 0, NULL, 'Task 3', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (1, NULL, 0, NULL, 'Task 1', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (2, NULL, 0, NULL, 'Task 2', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (3, '2022-03-20', 0, NULL, 'Task 3', 2, false, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (4, '2022-03-20', 0, NULL, 'Task 4', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (5, '2022-03-20', 0, '2021-03-20', 'Task 5', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (6, '2022-03-20', 0, '2021-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (4, '2022-03-20', 0, NULL, 'Task 4', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (5, '2022-03-20', 0, '2021-03-20', 'Task 5', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (6, '2022-03-20', 0, '2021-03-20', 'Task 6', 2, true, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (7, NULL, 0, '2043-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (8, NULL, 0, '2043-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (9, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (10, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (7, NULL, 0, '2043-03-20', 'Task 6', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (8, NULL, 0, '2043-03-20', 'Task 6', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (9, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (10, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, true, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (11, NULL, 0, '2022-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (12, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (11, NULL, 0, '2022-03-20', 'Task 6', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (12, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, false, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (13, NULL, 0, '2022-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (14, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (15, NULL, 0, NULL, 'Task 15', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (13, NULL, 0, '2022-03-20', 'Task 6', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (14, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (15, NULL, 0, NULL, 'Task 15', 2, false, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (16, NULL, 0, NULL, 'Task 15', 9, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (17, NULL, 0, NULL, 'Task 17', 9, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (18, NULL, 0, NULL, 'Task 17', 10, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (16, NULL, 0, NULL, 'Task 15', 9, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (17, NULL, 0, NULL, 'Task 17', 9, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (18, NULL, 0, NULL, 'Task 17', 10, true, 0, true);
|
@ -44,5 +44,13 @@ export interface TaskEntityInfo {
|
||||
* number in minutes that was already worked on this task
|
||||
*/
|
||||
workTime: number;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
/**
|
||||
* determines whether the task has active schedules
|
||||
*/
|
||||
hasActiveSchedules: boolean;
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,14 @@ export interface TaskFieldInfo {
|
||||
/**
|
||||
* date from which the task can be started
|
||||
*/
|
||||
startDate: string;
|
||||
startDate?: string;
|
||||
/**
|
||||
* date until the task has to be finished
|
||||
*/
|
||||
deadline: string;
|
||||
deadline?: string;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
}
|
||||
|
||||
|
@ -37,5 +37,10 @@ export interface TaskOverviewInfo {
|
||||
* number in minutes that was already worked on this task
|
||||
*/
|
||||
activeTime?: number;
|
||||
taskgroupPath: Array<TaskgroupEntityInfo>;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
}
|
||||
|
||||
|
@ -20,5 +20,9 @@ export interface TaskShortInfo {
|
||||
* name of task
|
||||
*/
|
||||
taskName: string;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
}
|
||||
|
||||
|
@ -46,5 +46,9 @@ export interface TaskTaskgroupInfo {
|
||||
*/
|
||||
workTime: number;
|
||||
taskgroups: Array<TaskgroupEntityInfo>;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,6 @@
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button class="grayBtn" (click)="stopTask(false)">Stop</button>
|
||||
<button mat-raised-button class="greenBtn" (click)="stopTask(true)">Finish</button>
|
||||
<button mat-raised-button class="greenBtn" *ngIf="activeSchedule!.task.finishable" (click)="stopTask(true)">Finish</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button color="primary" class="btn-without-radius" (click)="startTaskNow(task)">Start now</button>
|
||||
<button *ngIf="taskgroupID != undefined" mat-raised-button class="yellowBtn btn-without-radius" [routerLink]="['/taskgroups', taskgroupID!, 'tasks', task.taskID, 'schedule']">Schedule</button>
|
||||
<button mat-raised-button class="greenBtn btn-without-radius" (click)="finishTask(task)">Finish</button>
|
||||
<button *ngIf="task.finishable" mat-raised-button class="greenBtn btn-without-radius" (click)="finishTask(task)">Finish</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
|
@ -80,13 +80,15 @@ export class TaskOverviewComponent {
|
||||
const dialogRef = this.dialog.open(TaskEditorComponent, {data: editorData, width: "600px"})
|
||||
dialogRef.afterClosed().subscribe(res => {
|
||||
if(res != undefined) {
|
||||
const taskOverviewInfo = {
|
||||
const taskOverviewInfo: TaskOverviewInfo = {
|
||||
taskID: res.taskID,
|
||||
eta: res.eta,
|
||||
limit: res.deadline,
|
||||
taskName: res.taskName,
|
||||
activeTime: 0,
|
||||
overdue: res.overdue
|
||||
overdue: res.overdue,
|
||||
taskgroupPath: [],
|
||||
finishable: res.finishable
|
||||
}
|
||||
this.creationEmitter.emit({
|
||||
task: taskOverviewInfo,
|
||||
|
@ -19,8 +19,9 @@ export class ScheduleDashboardComponent implements OnInit{
|
||||
|
||||
@Input('taskgroup') taskgroup: TaskgroupEntityInfo | undefined
|
||||
@Input('task') task: TaskEntityInfo | undefined
|
||||
@Input('schedules') schedules: ScheduleInfo[] = []
|
||||
|
||||
|
||||
schedules: ScheduleInfo[] = []
|
||||
|
||||
constructor(private scheduleService: ScheduleService,
|
||||
private snackbar: MatSnackBar) {
|
||||
@ -28,11 +29,7 @@ export class ScheduleDashboardComponent implements OnInit{
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.scheduleService.schedulesTaskIDGet(this.task!.taskID).subscribe({
|
||||
next: resp => {
|
||||
this.schedules = resp;
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
reschedule() {
|
||||
|
@ -35,7 +35,7 @@
|
||||
<ng-container matColumnDef="status">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||
<td mat-cell *matCellDef="let task">
|
||||
<div class="status-indicator" [style.background-color]="getStatusOfTask(task)"></div>
|
||||
<p>{{getStatusOfTask(task)}}</p>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="edit">
|
||||
|
@ -8,6 +8,7 @@ import {TaskEditorData} from "../task-editor/TaskEditorData";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {ClearTaskDialogComponent, ClearTaskDialogData} from "../clear-task-dialog/clear-task-dialog.component";
|
||||
import * as moment from "moment/moment";
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-dashboard',
|
||||
@ -52,7 +53,13 @@ export class TaskDashboardComponent implements OnChanges{
|
||||
}
|
||||
|
||||
getStatusOfTask(task: TaskEntityInfo) {
|
||||
return "green";
|
||||
if(moment(task.deadline, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isBefore(moment())) {
|
||||
return "🔴";
|
||||
} else if(task.finishable){
|
||||
return "🟠";
|
||||
} else {
|
||||
return "🟢";
|
||||
}
|
||||
}
|
||||
|
||||
deleteTask(deletedTask: TaskEntityInfo) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<mat-card-title>
|
||||
<div class="task-header-container">
|
||||
<div class="left">
|
||||
<div>🟢 {{task!.taskName}}</div>
|
||||
<div>{{taskStatus + " " + task!.taskName}}</div>
|
||||
</div>
|
||||
<button class="right lightBlueBtn" mat-raised-button style="margin-left: auto">Add Subtask</button>
|
||||
</div>
|
||||
@ -23,7 +23,7 @@
|
||||
<button mat-flat-button class="yellowBtn" (click)="startTaskNow()">Start now</button>
|
||||
<button mat-flat-button class="grayBtn" (click)="openTaskEditor()">Edit</button>
|
||||
<!--<button mat-raised-button>Copy</button>-->
|
||||
<button mat-flat-button class="greenBtn" >Finished</button>
|
||||
<button mat-flat-button class="greenBtn" *ngIf="task!.finishable" (click)="finishTask()">{{task!.finished ? 'Reopen':'Finish'}}</button>
|
||||
</div>
|
||||
|
||||
<div style="float:right;">
|
||||
@ -39,7 +39,7 @@
|
||||
<mat-expansion-panel *ngIf="taskgroup != undefined && task != undefined" style="margin-top: 20px" expanded>
|
||||
<mat-expansion-panel-header>Schedules</mat-expansion-panel-header>
|
||||
<div>
|
||||
<app-schedule-dashboard [taskgroup]="taskgroup" [task]="task"></app-schedule-dashboard>
|
||||
<app-schedule-dashboard [taskgroup]="taskgroup" [task]="task" #scheduleDashboard [schedules]="schedules"></app-schedule-dashboard>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</div>
|
||||
|
@ -1,11 +1,20 @@
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {ScheduleService, TaskEntityInfo, TaskgroupEntityInfo, TaskgroupService, TaskService} from "../../../api";
|
||||
import {
|
||||
ScheduleInfo,
|
||||
ScheduleService,
|
||||
TaskEntityInfo,
|
||||
TaskgroupEntityInfo,
|
||||
TaskgroupService,
|
||||
TaskService
|
||||
} from "../../../api";
|
||||
import {TaskDashboardComponent} from "../task-dashboard/task-dashboard.component";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {TaskEditorComponent} from "../task-editor/task-editor.component";
|
||||
import {TaskEditorData} from "../task-editor/TaskEditorData";
|
||||
import * as moment from "moment";
|
||||
import {ScheduleDashboardComponent} from "../../schedules/schedule-dashboard/schedule-dashboard.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-detail-overview',
|
||||
@ -31,6 +40,9 @@ export class TaskDetailOverviewComponent implements OnInit {
|
||||
@ViewChild('navLinkList') navLinkListComponent: NavigationLinkListComponent | undefined
|
||||
|
||||
task: TaskEntityInfo | undefined
|
||||
schedules: ScheduleInfo[] = []
|
||||
|
||||
taskStatus: string = "🟢"
|
||||
|
||||
constructor(private activatedRoute: ActivatedRoute,
|
||||
private taskgroupService: TaskgroupService,
|
||||
@ -70,15 +82,26 @@ export class TaskDetailOverviewComponent implements OnInit {
|
||||
this.taskService.tasksTaskIDGet(Number(params.get('taskID'))).subscribe({
|
||||
next: resp => {
|
||||
this.task = resp;
|
||||
this.taskStatus = this.getStatusOfTask(resp)
|
||||
}
|
||||
});
|
||||
this.scheduleService.schedulesTaskIDGet(Number(params.get('taskID'))).subscribe({
|
||||
next: resp => {
|
||||
this.schedules = resp;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getStatusOfTask(task: TaskEntityInfo | undefined) {
|
||||
return "green";
|
||||
|
||||
getStatusOfTask(task: TaskEntityInfo ) {
|
||||
if(moment(task.deadline, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isBefore(moment())) {
|
||||
return "🔴";
|
||||
} else if(this.schedules.length == 0){
|
||||
return "🟠";
|
||||
} else {
|
||||
return "🟢";
|
||||
}
|
||||
}
|
||||
|
||||
openTaskEditor() {
|
||||
@ -101,4 +124,12 @@ export class TaskDetailOverviewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
finishTask() {
|
||||
this.taskService.tasksTaskIDFinishPost(this.task!.taskID).subscribe({
|
||||
next: resp => {
|
||||
this.task!.finished = !this.task!.finished;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {TaskEntityInfo} from "../../../api";
|
||||
import {TaskEntityInfo, TaskTaskgroupInfo} from "../../../api";
|
||||
|
||||
export interface TaskEditorData {
|
||||
taskgroupID: number;
|
||||
task: TaskEntityInfo | undefined
|
||||
task: TaskTaskgroupInfo | TaskEntityInfo | undefined
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
<mat-datepicker-toggle matIconSuffix [for]="deadlinepicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #deadlinepicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-slide-toggle [(ngModel)]="finishable">Finishable</mat-slide-toggle>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions align="end">
|
||||
|
@ -20,6 +20,8 @@ export class TaskEditorComponent implements OnInit {
|
||||
nameCtrl: FormControl = new FormControl('', [Validators.required, Validators.maxLength(255)])
|
||||
etaCtrl: FormControl = new FormControl(0, [Validators.required, Validators.min(0)])
|
||||
startDate: FormControl = new FormControl(Date.now(), [Validators.required])
|
||||
|
||||
finishable: boolean = true;
|
||||
endDate: FormControl = new FormControl('');
|
||||
constructor(private dialog: MatDialogRef<TaskEditorComponent>,
|
||||
private taskService: TaskService,
|
||||
@ -49,13 +51,21 @@ export class TaskEditorComponent implements OnInit {
|
||||
}
|
||||
|
||||
createTask() {
|
||||
console.log(this.startDate.value)
|
||||
console.log(this.endDate.value)
|
||||
let endDate_formatted: string|undefined = undefined;
|
||||
let startDate_formatted: string|undefined = undefined;
|
||||
if(this.endDate.value !== "") {
|
||||
endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
||||
}
|
||||
|
||||
if(this.startDate.value !== "") {
|
||||
startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
||||
}
|
||||
this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
|
||||
taskName: this.nameCtrl.value,
|
||||
eta: this.etaCtrl.value,
|
||||
startDate: moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
||||
deadline: moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
|
||||
startDate: startDate_formatted,
|
||||
deadline: endDate_formatted,
|
||||
finishable: this.finishable,
|
||||
}).subscribe({
|
||||
next: resp => {
|
||||
this.dialog.close(resp);
|
||||
@ -75,13 +85,21 @@ export class TaskEditorComponent implements OnInit {
|
||||
}
|
||||
|
||||
editTask() {
|
||||
const startingDate = this.startDate.value.length == 0? null:this.startDate.value
|
||||
const deadline = this.endDate.value.length == 0? null:this.endDate.value
|
||||
let endDate_formatted: string|undefined = undefined;
|
||||
let startDate_formatted: string|undefined = undefined;
|
||||
if(this.endDate.value !== "") {
|
||||
endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
||||
}
|
||||
|
||||
if(this.startDate.value !== "") {
|
||||
startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
||||
}
|
||||
this.taskService.tasksTaskIDPost(this.editorData.task!.taskID, {
|
||||
taskName: this.nameCtrl.value,
|
||||
eta: this.etaCtrl.value,
|
||||
startDate: startingDate,
|
||||
deadline: deadline
|
||||
startDate: startDate_formatted,
|
||||
deadline: endDate_formatted,
|
||||
finishable: this.finishable
|
||||
}).subscribe({
|
||||
next: resp => {
|
||||
this.editorData.task!.taskName = this.nameCtrl.value;
|
||||
|
26
openapi.yaml
26
openapi.yaml
@ -2147,6 +2147,8 @@ components:
|
||||
- overdue
|
||||
- finished
|
||||
- workTime
|
||||
- finishable
|
||||
- hasActiveSchedules
|
||||
additionalProperties: false
|
||||
properties:
|
||||
taskID:
|
||||
@ -2182,6 +2184,12 @@ components:
|
||||
type: number
|
||||
description: number in minutes that was already worked on this task
|
||||
example: 10
|
||||
finishable:
|
||||
type: boolean
|
||||
description: determines whether the task can be finished
|
||||
hasActiveSchedules:
|
||||
type: boolean
|
||||
description: determines whether the task has active schedules
|
||||
TaskTaskgroupInfo:
|
||||
required:
|
||||
- taskID
|
||||
@ -2193,6 +2201,7 @@ components:
|
||||
- finished
|
||||
- workTime
|
||||
- taskgroups
|
||||
- finishable
|
||||
additionalProperties: false
|
||||
properties:
|
||||
taskID:
|
||||
@ -2232,12 +2241,14 @@ components:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/TaskgroupEntityInfo'
|
||||
finishable:
|
||||
type: boolean
|
||||
description: determines whether the task can be finished
|
||||
TaskFieldInfo:
|
||||
required:
|
||||
- taskName
|
||||
- eta
|
||||
- startDate
|
||||
- deadline
|
||||
- finishable
|
||||
additionalProperties: false
|
||||
properties:
|
||||
taskName:
|
||||
@ -2257,6 +2268,9 @@ components:
|
||||
type: string
|
||||
format: date
|
||||
description: date until the task has to be finished
|
||||
finishable:
|
||||
type: boolean
|
||||
description: determines whether the task can be finished
|
||||
BasicScheduleEntityInfo:
|
||||
required:
|
||||
- scheduleID
|
||||
@ -2349,6 +2363,7 @@ components:
|
||||
required:
|
||||
- taskID
|
||||
- taskName
|
||||
- finishable
|
||||
additionalProperties: false
|
||||
properties:
|
||||
taskID:
|
||||
@ -2359,6 +2374,9 @@ components:
|
||||
type: string
|
||||
description: name of task
|
||||
example: "Vorlesung zusammenfassen"
|
||||
finishable:
|
||||
type: boolean
|
||||
description: determines whether the task can be finished
|
||||
ScheduleActivateInfo:
|
||||
required:
|
||||
- startTime
|
||||
@ -2422,6 +2440,7 @@ components:
|
||||
- limit
|
||||
- overdue
|
||||
- taskgroupPath
|
||||
- finishable
|
||||
additionalProperties: false
|
||||
properties:
|
||||
taskID:
|
||||
@ -2453,6 +2472,9 @@ components:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/TaskgroupEntityInfo'
|
||||
finishable:
|
||||
type: boolean
|
||||
description: determines whether the task can be finished
|
||||
ScheduleStatus:
|
||||
required:
|
||||
- activeMinutes
|
||||
|
Loading…
Reference in New Issue
Block a user