Merge pull request 'issue-112' (#115) from issue-112 into master
All checks were successful
Java CI with Maven / build-and-push-frontend (push) Successful in 2m56s
Java CI with Maven / build-and-push-backend (push) Successful in 1m39s

Reviewed-on: #115
This commit is contained in:
sebastian 2024-04-18 20:20:22 +02:00
commit 2bc3b3ab63
8 changed files with 59 additions and 8 deletions

View File

@ -6,16 +6,18 @@
</mat-card> </mat-card>
<mat-card *ngIf="activeSchedule != undefined"> <mat-card *ngIf="activeSchedule != undefined">
<mat-card-header> <mat-card-header>
<mat-card-title><a routerLink="/" class="link-no-deco">{{activeSchedule!.task.taskName}}</a></mat-card-title> <mat-card-title><a [routerLink]="['/taskgroups', taskgroupID, 'tasks', activeSchedule!.task.taskID]" class="link-no-deco">{{activeSchedule!.task.taskName}}</a></mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<span *ngFor="let taskgroupPath of activeSchedule!.taskgroupPath">{{taskgroupPath.taskgroupName}} /</span> <span *ngFor="let taskgroupPath of activeSchedule!.taskgroupPath">
<a class="link-no-deco" [routerLink]="['/taskgroups', taskgroupPath.taskgroupID]"> {{taskgroupPath.taskgroupName}} </a>/
</span>
<p class="gray-text">Running for {{displayTime}}</p> <p class="gray-text">Running for {{displayTime}}</p>
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>
<button class="btn btn-secondary" (click)="stopTask(false)">Stop</button> <button class="btn btn-secondary" (click)="stopTask(false)">Stop</button>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-success">Finish</button> <button type="button" class="btn btn-success" (click)="finishSchedule()">Finish</button>
<button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"> <button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
<span class="visually-hidden">Toggle Dropdown</span> <span class="visually-hidden">Toggle Dropdown</span>
</button> </button>

View File

@ -1,5 +1,11 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {ScheduleInfo, ScheduleService, TaskOverviewInfo, TaskScheduleStopResponse} from "../../../api"; import {
ScheduleInfo,
ScheduleService,
TaskgroupEntityInfo,
TaskOverviewInfo,
TaskScheduleStopResponse
} from "../../../api";
import {StopActiveScheduleInfo} from "./StopActiveScheduleInfo"; import {StopActiveScheduleInfo} from "./StopActiveScheduleInfo";
import {TaskOverviewComponent} from "../task-overview/task-overview.component"; import {TaskOverviewComponent} from "../task-overview/task-overview.component";
import {MatDialog} from "@angular/material/dialog"; import {MatDialog} from "@angular/material/dialog";
@ -19,6 +25,7 @@ export interface StopActiveScheduleEmitterInfo {
}) })
export class ActiveScheduleComponent implements OnInit{ export class ActiveScheduleComponent implements OnInit{
activeSchedule: ScheduleInfo | undefined activeSchedule: ScheduleInfo | undefined
taskgroupID: number | undefined
startTime: number = 0; startTime: number = 0;
currentTime: number = 0; currentTime: number = 0;
@ -56,11 +63,15 @@ export class ActiveScheduleComponent implements OnInit{
next: resp => { next: resp => {
if(resp.scheduleID >= 0) { if(resp.scheduleID >= 0) {
this.activateSchedule(resp); this.activateSchedule(resp);
this.taskgroupID = resp.taskgroupPath[resp.taskgroupPath.length-1].taskgroupID
console.log(this.taskgroupID)
} }
}, },
}) })
} }
stopTask(finish: boolean) { stopTask(finish: boolean) {
@ -99,6 +110,14 @@ export class ActiveScheduleComponent implements OnInit{
} }
finishSchedule() {
this.scheduleService.schedulesScheduleIDStopFinishPost(this.activeSchedule!.scheduleID, true).subscribe({
next: resp => {
this.activeSchedule = undefined;
}
})
}
finishManual() { finishManual() {
const dialogRef = this.dialog.open(StopScheduleManuallyComponent, { const dialogRef = this.dialog.open(StopScheduleManuallyComponent, {
data: this.activeSchedule, data: this.activeSchedule,

View File

@ -23,16 +23,18 @@
<mat-card *ngFor="let schedule of schedules"> <mat-card *ngFor="let schedule of schedules">
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
<a routerLink="/" class="link-no-deco">{{schedule.task.taskName}}</a> <a [routerLink]="['/taskgroups', schedule.taskgroupPath[schedule.taskgroupPath.length-1].taskgroupID, 'tasks', schedule.task.taskID]" class="link-no-deco">{{schedule.task.taskName}}</a>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<span *ngFor="let taskgroupPath of schedule.taskgroupPath">{{taskgroupPath.taskgroupName}} /</span> <span *ngFor="let taskgroupPath of schedule.taskgroupPath">
<a class="link-no-deco" [routerLink]="['/taskgroups', taskgroupPath.taskgroupID]"> {{taskgroupPath.taskgroupName}} /</a>
</span>
<p class="gray-text" *ngIf="schedule.scheduleType==='BASIC'">To be done sometime today</p> <p class="gray-text" *ngIf="schedule.scheduleType==='BASIC'">To be done sometime today</p>
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>
<button mat-raised-button color="primary" class="primaryBtn" (click)="startSchedule(schedule)" [disabled]="activeScheduleComponent!.activeSchedule != undefined">Start now</button> <button mat-raised-button color="primary" class="primaryBtn" (click)="startSchedule(schedule)" [disabled]="activeScheduleComponent!.activeSchedule != undefined">Start now</button>
<button mat-raised-button class="yellowBtn">Reschedule</button> <button mat-raised-button class="yellowBtn" [routerLink]="['/taskgroups', schedule.taskgroupPath[schedule.taskgroupPath.length-1].taskgroupID, 'tasks', schedule.task.taskID, 'schedule', schedule.scheduleID]">Reschedule</button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</div> </div>

View File

@ -5,6 +5,11 @@
justify-content: space-between; justify-content: space-between;
} }
.navi-link-container {
margin: 20px auto;
width: 80%;
}
.spacer { .spacer {
margin-bottom: 2.5%; margin-bottom: 2.5%;
} }

View File

@ -1,4 +1,8 @@
<div class="navi-link-container">
<app-navigation-link-list [navigationLinks]="defaultNavigationLinks"></app-navigation-link-list>
</div>
<div class="container"> <div class="container">
<div class="calendar-container"> <div class="calendar-container">
<h1 mat-dialog-title>Register forgotten activity</h1> <h1 mat-dialog-title>Register forgotten activity</h1>
<mwl-calendar-day-view <mwl-calendar-day-view

View File

@ -17,6 +17,7 @@ import * as moment from "moment/moment";
import {EventColor} from "calendar-utils"; import {EventColor} from "calendar-utils";
import {TaskOverviewData} from "../taskgroup-overview/taskgroup-overview.component"; import {TaskOverviewData} from "../taskgroup-overview/taskgroup-overview.component";
import {Router} from "@angular/router"; import {Router} from "@angular/router";
import {NavigationLink} from "../../navigation-link-list/navigation-link-list.component";
const colors: Record<string, EventColor> = { const colors: Record<string, EventColor> = {
@ -65,6 +66,16 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
}, },
}, },
]; ];
defaultNavigationLinks: NavigationLink[] = [
{
linkText: "Dashboard",
routerLink: ['/']
},
{
linkText: "Register Forgotten Activity",
routerLink: ["/forgotten"]
}
];
constructor(private router: Router, constructor(private router: Router,

View File

@ -34,7 +34,7 @@
</div> </div>
<div style="float:right;"> <div style="float:right;">
<button mat-raised-button color="warn">Delete</button> <button mat-raised-button color="warn" (click)="deleteTask()">Delete</button>
</div> </div>
</div> </div>

View File

@ -187,4 +187,12 @@ export class TaskDetailOverviewComponent implements OnInit {
minWidth: "400px" minWidth: "400px"
}) })
} }
deleteTask() {
this.taskService.tasksTaskIDDelete(this.task!.taskID).subscribe({
next: resp => {
this.router.navigateByUrl("/")
}
})
}
} }