Complete Basic Task Visualization in CalendarScheduler

This commit is contained in:
Sebastian 2023-10-23 20:34:39 +02:00
parent 40a8a5fa13
commit c598515899
2 changed files with 21 additions and 18 deletions

View File

@ -15,7 +15,7 @@
</div> </div>
<mwl-calendar-week-view [viewDate]="viewDate" [daysInWeek]="daysInWeek" [dayStartHour]="7" [dayEndHour]="21" [refresh]="refresh" <mwl-calendar-week-view [viewDate]="viewDate" [daysInWeek]="daysInWeek" [dayStartHour]="7" [dayEndHour]="21" [refresh]="refresh"
(dayHeaderClicked)="timeClick($event.day.date)" (dayHeaderClicked)="timeClick($event.day.date)"
(hourSegmentClicked)="timeClick($event.date)" [events]="events" (hourSegmentClicked)="timeClick($event.date)" [events]="events" (eventClicked)="eventClicked($event)"
> >
</mwl-calendar-week-view> </mwl-calendar-week-view>

View File

@ -7,7 +7,7 @@ import {
TaskgroupService, TaskgroupService,
TaskService TaskService
} from "../../../api"; } from "../../../api";
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {CalendarDateFormatter, CalendarEvent, CalendarView} from "angular-calendar"; import {CalendarDateFormatter, CalendarEvent, CalendarView} from "angular-calendar";
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import {CalendarDatePipe} from "angular-calendar/modules/common/calendar-date/calendar-date.pipe"; import {CalendarDatePipe} from "angular-calendar/modules/common/calendar-date/calendar-date.pipe";
@ -62,26 +62,15 @@ export class SchedulerComponent implements OnInit{
viewDate = new Date(); viewDate = new Date();
daysInWeek = 7; daysInWeek = 7;
refresh: Subject<void> = new Subject<void>() refresh: Subject<void> = new Subject<void>()
events: CalendarEvent[] = [ 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(),
},
]
@ViewChild('basicScheduler') basicScheduler: BasicSchedulerComponent | undefined @ViewChild('basicScheduler') basicScheduler: BasicSchedulerComponent | undefined
constructor(private activatedRoute: ActivatedRoute, constructor(private activatedRoute: ActivatedRoute,
private taskgroupService: TaskgroupService, private taskgroupService: TaskgroupService,
private taskService: TaskService, private taskService: TaskService,
private scheduleService: ScheduleService) { private scheduleService: ScheduleService,
private router: Router) {
} }
ngOnInit(): void { ngOnInit(): void {
@ -145,9 +134,9 @@ export class SchedulerComponent implements OnInit{
resp.forEach(basicSchedule => { resp.forEach(basicSchedule => {
this.events.push({ this.events.push({
start: new Date(basicSchedule.scheduleDate), start: new Date(basicSchedule.scheduleDate),
title: this.task!.taskName, title: this.computeTaskPath(),
color: colors['red'], color: colors['red'],
allDay: true allDay: true,
}) })
}) })
this.refresh.next(); 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;
}
} }