Adds header manager to calendar
Adds a header manager to handle header related functionality within the calendar. Removes unused methods from CalendarManager.
This commit is contained in:
parent
4bd94d3be2
commit
020d5c3efc
3 changed files with 10 additions and 73 deletions
|
|
@ -113,31 +113,7 @@ export class CalendarManager {
|
|||
view: this.currentView
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Genindlæs calendar data
|
||||
*/
|
||||
public refresh(): void {
|
||||
|
||||
this.eventBus.emit(CoreEvents.REFRESH_REQUESTED, {
|
||||
view: this.currentView,
|
||||
date: this.currentDate
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ryd calendar og nulstil til standard tilstand
|
||||
*/
|
||||
public reset(): void {
|
||||
|
||||
this.currentView = 'week';
|
||||
this.currentDate = new Date();
|
||||
|
||||
this.eventBus.emit(CoreEvents.REFRESH_REQUESTED, {
|
||||
view: this.currentView,
|
||||
date: this.currentDate
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup event listeners for at håndtere events fra andre managers
|
||||
|
|
@ -147,54 +123,12 @@ export class CalendarManager {
|
|||
this.eventBus.on(CoreEvents.WORKWEEK_CHANGED, (event: Event) => {
|
||||
|
||||
const customEvent = event as CustomEvent;
|
||||
this.handleWorkweekChange();
|
||||
// this.handleWorkweekChange();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Beregn næste dato baseret på aktuel view
|
||||
*/
|
||||
private calculateNextDate(): Date {
|
||||
const nextDate = new Date(this.currentDate);
|
||||
|
||||
switch (this.currentView) {
|
||||
case 'day':
|
||||
nextDate.setDate(nextDate.getDate() + 1);
|
||||
break;
|
||||
case 'week':
|
||||
const workWeekSettings = calendarConfig.getWorkWeekSettings();
|
||||
nextDate.setDate(nextDate.getDate() + 7); // Move to next calendar week regardless of work days
|
||||
break;
|
||||
case 'month':
|
||||
nextDate.setMonth(nextDate.getMonth() + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
return nextDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Beregn forrige dato baseret på aktuel view
|
||||
*/
|
||||
private calculatePreviousDate(): Date {
|
||||
const previousDate = new Date(this.currentDate);
|
||||
|
||||
switch (this.currentView) {
|
||||
case 'day':
|
||||
previousDate.setDate(previousDate.getDate() - 1);
|
||||
break;
|
||||
case 'week':
|
||||
const workWeekSettings = calendarConfig.getWorkWeekSettings();
|
||||
previousDate.setDate(previousDate.getDate() - 7); // Move to previous calendar week regardless of work days
|
||||
break;
|
||||
case 'month':
|
||||
previousDate.setMonth(previousDate.getMonth() - 1);
|
||||
break;
|
||||
}
|
||||
|
||||
return previousDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the current period based on view and date
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue