issue-112 #115

Merged
sebastian merged 7 commits from issue-112 into master 2024-04-18 20:20:22 +02:00
8 changed files with 59 additions and 8 deletions

View File

@ -6,16 +6,18 @@
</mat-card>
<mat-card *ngIf="activeSchedule != undefined">
<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-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>
</mat-card-content>
<mat-card-actions>
<button class="btn btn-secondary" (click)="stopTask(false)">Stop</button>
<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">
<span class="visually-hidden">Toggle Dropdown</span>
</button>

View File

@ -1,5 +1,11 @@
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 {TaskOverviewComponent} from "../task-overview/task-overview.component";
import {MatDialog} from "@angular/material/dialog";
@ -19,6 +25,7 @@ export interface StopActiveScheduleEmitterInfo {
})
export class ActiveScheduleComponent implements OnInit{
activeSchedule: ScheduleInfo | undefined
taskgroupID: number | undefined
startTime: number = 0;
currentTime: number = 0;
@ -56,11 +63,15 @@ export class ActiveScheduleComponent implements OnInit{
next: resp => {
if(resp.scheduleID >= 0) {
this.activateSchedule(resp);
this.taskgroupID = resp.taskgroupPath[resp.taskgroupPath.length-1].taskgroupID
console.log(this.taskgroupID)
}
},
})
}
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() {
const dialogRef = this.dialog.open(StopScheduleManuallyComponent, {
data: this.activeSchedule,

View File

@ -23,16 +23,18 @@
<mat-card *ngFor="let schedule of schedules">
<mat-card-header>
<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-header>
<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>
</mat-card-content>
<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 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>
</div>

View File

@ -5,6 +5,11 @@
justify-content: space-between;
}
.navi-link-container {
margin: 20px auto;
width: 80%;
}
.spacer {
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="calendar-container">
<h1 mat-dialog-title>Register forgotten activity</h1>
<mwl-calendar-day-view

View File

@ -17,6 +17,7 @@ import * as moment from "moment/moment";
import {EventColor} from "calendar-utils";
import {TaskOverviewData} from "../taskgroup-overview/taskgroup-overview.component";
import {Router} from "@angular/router";
import {NavigationLink} from "../../navigation-link-list/navigation-link-list.component";
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,

View File

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

View File

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