issue-14 #74
@ -24,6 +24,8 @@ public class TaskEntityInfo {
|
|||||||
|
|
||||||
private boolean finishable;
|
private boolean finishable;
|
||||||
|
|
||||||
|
private boolean hasActiveSchedules;
|
||||||
|
|
||||||
public TaskEntityInfo(Task task) {
|
public TaskEntityInfo(Task task) {
|
||||||
this.taskID = task.getTaskID();
|
this.taskID = task.getTaskID();
|
||||||
this.taskName = task.getTaskName();
|
this.taskName = task.getTaskName();
|
||||||
@ -36,6 +38,7 @@ public class TaskEntityInfo {
|
|||||||
this.finished = task.isFinished();
|
this.finished = task.isFinished();
|
||||||
this.workTime = task.getWorkTime();
|
this.workTime = task.getWorkTime();
|
||||||
this.finishable = task.isFinishable();
|
this.finishable = task.isFinishable();
|
||||||
|
this.hasActiveSchedules = task.hasActiveSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTaskID() {
|
public long getTaskID() {
|
||||||
@ -109,4 +112,12 @@ public class TaskEntityInfo {
|
|||||||
public void setFinishable(boolean finishable) {
|
public void setFinishable(boolean finishable) {
|
||||||
this.finishable = finishable;
|
this.finishable = finishable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isHasActiveSchedules() {
|
||||||
|
return hasActiveSchedules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasActiveSchedules(boolean hasActiveSchedules) {
|
||||||
|
this.hasActiveSchedules = hasActiveSchedules;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,5 +48,9 @@ export interface TaskEntityInfo {
|
|||||||
* determines whether the task can be finished
|
* determines whether the task can be finished
|
||||||
*/
|
*/
|
||||||
finishable: boolean;
|
finishable: boolean;
|
||||||
|
/**
|
||||||
|
* determines whether the task has active schedules
|
||||||
|
*/
|
||||||
|
hasActiveSchedules: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,9 @@ export class ScheduleDashboardComponent implements OnInit{
|
|||||||
|
|
||||||
@Input('taskgroup') taskgroup: TaskgroupEntityInfo | undefined
|
@Input('taskgroup') taskgroup: TaskgroupEntityInfo | undefined
|
||||||
@Input('task') task: TaskEntityInfo | undefined
|
@Input('task') task: TaskEntityInfo | undefined
|
||||||
|
@Input('schedules') schedules: ScheduleInfo[] = []
|
||||||
|
|
||||||
|
|
||||||
schedules: ScheduleInfo[] = []
|
|
||||||
|
|
||||||
constructor(private scheduleService: ScheduleService,
|
constructor(private scheduleService: ScheduleService,
|
||||||
private snackbar: MatSnackBar) {
|
private snackbar: MatSnackBar) {
|
||||||
@ -28,11 +29,7 @@ export class ScheduleDashboardComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.scheduleService.schedulesTaskIDGet(this.task!.taskID).subscribe({
|
|
||||||
next: resp => {
|
|
||||||
this.schedules = resp;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reschedule() {
|
reschedule() {
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<ng-container matColumnDef="status">
|
<ng-container matColumnDef="status">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||||
<td mat-cell *matCellDef="let task">
|
<td mat-cell *matCellDef="let task">
|
||||||
<div class="status-indicator" [style.background-color]="getStatusOfTask(task)"></div>
|
<p>{{getStatusOfTask(task)}}</p>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container matColumnDef="edit">
|
<ng-container matColumnDef="edit">
|
||||||
|
@ -8,6 +8,7 @@ import {TaskEditorData} from "../task-editor/TaskEditorData";
|
|||||||
import {MatDialog} from "@angular/material/dialog";
|
import {MatDialog} from "@angular/material/dialog";
|
||||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
import {ClearTaskDialogComponent, ClearTaskDialogData} from "../clear-task-dialog/clear-task-dialog.component";
|
import {ClearTaskDialogComponent, ClearTaskDialogData} from "../clear-task-dialog/clear-task-dialog.component";
|
||||||
|
import * as moment from "moment/moment";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-task-dashboard',
|
selector: 'app-task-dashboard',
|
||||||
@ -52,7 +53,13 @@ export class TaskDashboardComponent implements OnChanges{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getStatusOfTask(task: TaskEntityInfo) {
|
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) {
|
deleteTask(deletedTask: TaskEntityInfo) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<mat-card-title>
|
<mat-card-title>
|
||||||
<div class="task-header-container">
|
<div class="task-header-container">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div>🟢 {{task!.taskName}}</div>
|
<div>{{taskStatus + " " + task!.taskName}}</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="right lightBlueBtn" mat-raised-button style="margin-left: auto">Add Subtask</button>
|
<button class="right lightBlueBtn" mat-raised-button style="margin-left: auto">Add Subtask</button>
|
||||||
</div>
|
</div>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
<mat-expansion-panel *ngIf="taskgroup != undefined && task != undefined" style="margin-top: 20px" expanded>
|
<mat-expansion-panel *ngIf="taskgroup != undefined && task != undefined" style="margin-top: 20px" expanded>
|
||||||
<mat-expansion-panel-header>Schedules</mat-expansion-panel-header>
|
<mat-expansion-panel-header>Schedules</mat-expansion-panel-header>
|
||||||
<div>
|
<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>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
|
import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
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 {TaskDashboardComponent} from "../task-dashboard/task-dashboard.component";
|
||||||
import {MatDialog} from "@angular/material/dialog";
|
import {MatDialog} from "@angular/material/dialog";
|
||||||
import {TaskEditorComponent} from "../task-editor/task-editor.component";
|
import {TaskEditorComponent} from "../task-editor/task-editor.component";
|
||||||
import {TaskEditorData} from "../task-editor/TaskEditorData";
|
import {TaskEditorData} from "../task-editor/TaskEditorData";
|
||||||
|
import * as moment from "moment";
|
||||||
|
import {ScheduleDashboardComponent} from "../../schedules/schedule-dashboard/schedule-dashboard.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-task-detail-overview',
|
selector: 'app-task-detail-overview',
|
||||||
@ -31,6 +40,9 @@ export class TaskDetailOverviewComponent implements OnInit {
|
|||||||
@ViewChild('navLinkList') navLinkListComponent: NavigationLinkListComponent | undefined
|
@ViewChild('navLinkList') navLinkListComponent: NavigationLinkListComponent | undefined
|
||||||
|
|
||||||
task: TaskEntityInfo | undefined
|
task: TaskEntityInfo | undefined
|
||||||
|
schedules: ScheduleInfo[] = []
|
||||||
|
|
||||||
|
taskStatus: string = "🟢"
|
||||||
|
|
||||||
constructor(private activatedRoute: ActivatedRoute,
|
constructor(private activatedRoute: ActivatedRoute,
|
||||||
private taskgroupService: TaskgroupService,
|
private taskgroupService: TaskgroupService,
|
||||||
@ -70,15 +82,26 @@ export class TaskDetailOverviewComponent implements OnInit {
|
|||||||
this.taskService.tasksTaskIDGet(Number(params.get('taskID'))).subscribe({
|
this.taskService.tasksTaskIDGet(Number(params.get('taskID'))).subscribe({
|
||||||
next: resp => {
|
next: resp => {
|
||||||
this.task = 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) {
|
getStatusOfTask(task: TaskEntityInfo ) {
|
||||||
return "green";
|
if(moment(task.deadline, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isBefore(moment())) {
|
||||||
|
return "🔴";
|
||||||
|
} else if(this.schedules.length == 0){
|
||||||
|
return "🟠";
|
||||||
|
} else {
|
||||||
|
return "🟢";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openTaskEditor() {
|
openTaskEditor() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {TaskEntityInfo} from "../../../api";
|
import {TaskEntityInfo, TaskTaskgroupInfo} from "../../../api";
|
||||||
|
|
||||||
export interface TaskEditorData {
|
export interface TaskEditorData {
|
||||||
taskgroupID: number;
|
taskgroupID: number;
|
||||||
task: TaskEntityInfo | undefined
|
task: TaskTaskgroupInfo | TaskEntityInfo | undefined
|
||||||
}
|
}
|
||||||
|
@ -53,11 +53,11 @@ export class TaskEditorComponent implements OnInit {
|
|||||||
createTask() {
|
createTask() {
|
||||||
let endDate_formatted: string|undefined = undefined;
|
let endDate_formatted: string|undefined = undefined;
|
||||||
let startDate_formatted: string|undefined = undefined;
|
let startDate_formatted: string|undefined = undefined;
|
||||||
if(this.endDate.value.length > 0) {
|
if(this.endDate.value !== "") {
|
||||||
endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.startDate.value.length > 0) {
|
if(this.startDate.value !== "") {
|
||||||
startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
||||||
}
|
}
|
||||||
this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
|
this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
|
||||||
@ -65,7 +65,7 @@ export class TaskEditorComponent implements OnInit {
|
|||||||
eta: this.etaCtrl.value,
|
eta: this.etaCtrl.value,
|
||||||
startDate: startDate_formatted,
|
startDate: startDate_formatted,
|
||||||
deadline: endDate_formatted,
|
deadline: endDate_formatted,
|
||||||
finishable: this.finishable
|
finishable: this.finishable,
|
||||||
}).subscribe({
|
}).subscribe({
|
||||||
next: resp => {
|
next: resp => {
|
||||||
this.dialog.close(resp);
|
this.dialog.close(resp);
|
||||||
@ -85,13 +85,20 @@ export class TaskEditorComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editTask() {
|
editTask() {
|
||||||
const startingDate = this.startDate.value.length == 0? null:this.startDate.value
|
let endDate_formatted: string|undefined = undefined;
|
||||||
const deadline = this.endDate.value.length == 0? null:this.endDate.value
|
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, {
|
this.taskService.tasksTaskIDPost(this.editorData.task!.taskID, {
|
||||||
taskName: this.nameCtrl.value,
|
taskName: this.nameCtrl.value,
|
||||||
eta: this.etaCtrl.value,
|
eta: this.etaCtrl.value,
|
||||||
startDate: startingDate,
|
startDate: startDate_formatted,
|
||||||
deadline: deadline,
|
deadline: endDate_formatted,
|
||||||
finishable: this.finishable
|
finishable: this.finishable
|
||||||
}).subscribe({
|
}).subscribe({
|
||||||
next: resp => {
|
next: resp => {
|
||||||
|
@ -2148,6 +2148,7 @@ components:
|
|||||||
- finished
|
- finished
|
||||||
- workTime
|
- workTime
|
||||||
- finishable
|
- finishable
|
||||||
|
- hasActiveSchedules
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
properties:
|
properties:
|
||||||
taskID:
|
taskID:
|
||||||
@ -2186,6 +2187,9 @@ components:
|
|||||||
finishable:
|
finishable:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: determines whether the task can be finished
|
description: determines whether the task can be finished
|
||||||
|
hasActiveSchedules:
|
||||||
|
type: boolean
|
||||||
|
description: determines whether the task has active schedules
|
||||||
TaskTaskgroupInfo:
|
TaskTaskgroupInfo:
|
||||||
required:
|
required:
|
||||||
- taskID
|
- taskID
|
||||||
|
Loading…
Reference in New Issue
Block a user