OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
add event listener for calendar widget
Klaus Zandersdabb81e3e4d0
diff --git a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.tsindex 5f11bf178f8..c7fcdb6a7a3 100644--- a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts+++ b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts@@ -1,10 +1,12 @@import {+ AfterViewInit,ChangeDetectionStrategy,Component,ElementRef,EventEmitter,Injector,Input,+ OnDestroy,Output,SecurityContext,ViewChild,@@ -109,7 +111,7 @@ const ADD_ENTRY_PROHIBITED_CLASS_NAME = '-prohibited';PathHelperService,],})-export class TimeEntryCalendarComponent {+export class TimeEntryCalendarComponent implements AfterViewInit, OnDestroy {@ViewChild(FullCalendarComponent) ucCalendar:FullCalendarComponent;@Input() projectIdentifier:string;@@ -148,6 +150,8 @@ export class TimeEntryCalendarComponent {public nonWorkingDays:IDay[] = [];+ private closeDialogHandler:EventListener = this.handleDialogClose.bind(this);+public additionalOptions:CalendarOptionsWithDayGrid = {editable: false,locales: allLocales,@@ -220,6 +224,14 @@ export class TimeEntryCalendarComponent {readonly pathHelper:PathHelperService,) { }+ ngAfterViewInit():void {+ document.addEventListener('dialog:close', this.closeDialogHandler);+ }++ ngOnDestroy():void {+ document.removeEventListener('dialog:close', this.closeDialogHandler);+ }+async requireNonWorkingDays(start:Date | string, end:Date | string) {this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYears$(start, end));}@@ -747,4 +759,15 @@ export class TimeEntryCalendarComponent {return null;}).filter((value) => value !== null) as number[];}++ private handleDialogClose(event:CustomEvent):void {+ const { detail: { dialog } } = event as { detail:{ dialog:HTMLDialogElement } };+ if (dialog.id === 'time-entry-dialog') {+ void this.fetchTimeEntries(this.memoizedTimeEntries.start, this.memoizedTimeEntries.end)+ .then(async (collection) => {+ this.entries.emit(collection);+ this.ucCalendar.getApi().refetchEvents();+ });+ }+ }}