From c598515899b8297371aa837043248c3293c3f1c9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 23 Oct 2023 20:34:39 +0200 Subject: [PATCH] Complete Basic Task Visualization in CalendarScheduler --- .../scheduler/scheduler.component.html | 2 +- .../scheduler/scheduler.component.ts | 37 ++++++++++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/frontend/src/app/schedules/scheduler/scheduler.component.html b/frontend/src/app/schedules/scheduler/scheduler.component.html index df2a7db..ae24991 100644 --- a/frontend/src/app/schedules/scheduler/scheduler.component.html +++ b/frontend/src/app/schedules/scheduler/scheduler.component.html @@ -15,7 +15,7 @@ diff --git a/frontend/src/app/schedules/scheduler/scheduler.component.ts b/frontend/src/app/schedules/scheduler/scheduler.component.ts index ee1abf5..0f274fd 100644 --- a/frontend/src/app/schedules/scheduler/scheduler.component.ts +++ b/frontend/src/app/schedules/scheduler/scheduler.component.ts @@ -7,7 +7,7 @@ import { TaskgroupService, TaskService } from "../../../api"; -import {ActivatedRoute} from "@angular/router"; +import {ActivatedRoute, Router} from "@angular/router"; import {CalendarDateFormatter, CalendarEvent, CalendarView} from "angular-calendar"; import { Subject } from 'rxjs'; import {CalendarDatePipe} from "angular-calendar/modules/common/calendar-date/calendar-date.pipe"; @@ -62,26 +62,15 @@ export class SchedulerComponent implements OnInit{ viewDate = new Date(); daysInWeek = 7; refresh: Subject = new Subject() - events: CalendarEvent[] = [ - { - title: 'An all day event', - color: colors['yellow'], - start: new Date(), - allDay: true, - }, - { - title: 'A non all day event', - color: colors['blue'], - start: new Date(), - }, - ] + events: CalendarEvent[] = [] @ViewChild('basicScheduler') basicScheduler: BasicSchedulerComponent | undefined constructor(private activatedRoute: ActivatedRoute, private taskgroupService: TaskgroupService, private taskService: TaskService, - private scheduleService: ScheduleService) { + private scheduleService: ScheduleService, + private router: Router) { } ngOnInit(): void { @@ -145,9 +134,9 @@ export class SchedulerComponent implements OnInit{ resp.forEach(basicSchedule => { this.events.push({ start: new Date(basicSchedule.scheduleDate), - title: this.task!.taskName, + title: this.computeTaskPath(), color: colors['red'], - allDay: true + allDay: true, }) }) this.refresh.next(); @@ -155,4 +144,18 @@ export class SchedulerComponent implements OnInit{ }) } + + eventClicked({ event }: { event: CalendarEvent }): void { + this.router.navigateByUrl("/taskgroups/" + this.taskgroupID.toString() + "/tasks/" + this.task!.taskID ) + } + + computeTaskPath() { + let result = ""; + this.taskgroupPath.forEach(taskgroupPathPart => { + result += taskgroupPathPart.taskgroupName + "/" + }); + result += this.taskgroup!.taskgroupName + "/" + result += this.task!.taskName + return result; + } }