Reset select task in forgotten task scheduler
All checks were successful
Java CI with Maven / test (push) Successful in 37s
Java CI with Maven / build-and-push-frontend (push) Successful in 7s
Java CI with Maven / build-and-push-backend (push) Successful in 7s

This commit is contained in:
Sebastian Böckelmann 2023-11-18 18:45:38 +01:00
parent edcd0f6c77
commit 5f60470e2a

View File

@ -12,7 +12,7 @@ import {DialogRef} from "@angular/cdk/dialog";
import {MatDialogRef} from "@angular/material/dialog"; import {MatDialogRef} from "@angular/material/dialog";
import {filter, map, Observable, startWith, Subject} from "rxjs"; import {filter, map, Observable, startWith, Subject} from "rxjs";
import {FormControl} from "@angular/forms"; import {FormControl} from "@angular/forms";
import {CalendarEvent, CalendarEventTimesChangedEvent} from "angular-calendar"; import {CalendarEvent, CalendarEventAction, CalendarEventTimesChangedEvent} from "angular-calendar";
import * as moment from "moment/moment"; 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";
@ -55,6 +55,17 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
taskgroupSelected: boolean = false; taskgroupSelected: boolean = false;
actions: CalendarEventAction[] = [
{
label: '<i class="fas fa-fw fa-trash-alt"></i>',
a11yLabel: 'Delete',
onClick: ({ event }: { event: CalendarEvent }): void => {
this.events = this.events.filter((iEvent) => iEvent !== event);
this.eventClicked('Deleted', event);
},
},
];
constructor(private router: Router, constructor(private router: Router,
private scheduleService: ScheduleService) { private scheduleService: ScheduleService) {
@ -64,8 +75,6 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
this.scheduleService.schedulesDateStartableGet(moment().format("yyyy-MM-DD"), false).subscribe({ this.scheduleService.schedulesDateStartableGet(moment().format("yyyy-MM-DD"), false).subscribe({
next: resp => { next: resp => {
resp.forEach(schedule => { resp.forEach(schedule => {
console.log(schedule.startTime)
console.log(schedule.finishedTime)
this.events.push({ this.events.push({
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task), title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: colors['red'], color: colors['red'],
@ -75,7 +84,12 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
resizable: { resizable: {
beforeStart: false, beforeStart: false,
afterEnd: false afterEnd: false
} },
meta: {
taskID: schedule.task.taskID,
scheduleID: schedule.scheduleID,
taskgroupID: schedule.taskgroupPath[schedule.taskgroupPath.length-1].taskgroupID
},
}) })
}) })
this.refresh.next() this.refresh.next()
@ -132,7 +146,7 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
scheduleID: undefined, scheduleID: undefined,
taskgroupID: taskgroup.taskgroupID taskgroupID: taskgroup.taskgroupID
}, },
//actions: this.actions actions: this.actions
}) })
}) })
this.taskgroupID = taskgroup.taskgroupID; this.taskgroupID = taskgroup.taskgroupID;
@ -148,7 +162,10 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
} }
eventClicked(click: string, event: CalendarEvent) { eventClicked(click: string, event: CalendarEvent) {
if(click == 'Deleted') {
this.events = this.events.filter(se => se !== event);
this.taskgroupSelected = false;
}
} }
register() { register() {