From 93b36be42cac8c8abc79db691938838de801df4f Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Wed, 16 Apr 2025 12:44:06 +0200 Subject: [PATCH] Displaying correction Fixed Week selector --- pages/calendar/[mode].vue | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pages/calendar/[mode].vue b/pages/calendar/[mode].vue index 58a47b5..c8dad04 100644 --- a/pages/calendar/[mode].vue +++ b/pages/calendar/[mode].vue @@ -103,19 +103,23 @@ const calendarOptionsTimeline = ref({ views: { resourceTimeline3Hours: { type: 'resourceTimeline', + duration: {weeks: 1}, + weekends: false, slotDuration: {hours: 3}, slotMinTime: "06:00:00", slotMaxTime: "21:00:00", - /*duration: {days:7},*/ buttonText: "Woche", visibleRange: function(currentDate) { // Generate a new date for manipulating in the next step - var startDate = new Date(currentDate); - var endDate = new Date(currentDate); + var startDate = new Date(currentDate.valueOf()); + var endDate = new Date(currentDate.valueOf()); // Adjust the start & end dates, respectively - startDate.setDate(startDate.getDate() - startDate.getDay() +1); // One day in the past - endDate.setDate(startDate.getDate() + 5); // Two days into the future + + console.log(startDate.getDay()) + + startDate.setDate(startDate.getDate() - 1); // One day in the past + endDate.setDate(endDate.getDate() + 2); // Two days into the future return { start: startDate, end: endDate }; } @@ -249,8 +253,8 @@ const setupPage = async () => { let returnData = { title: title, borderColor: eventColor, - textColor: eventColor, - backgroundColor: "black", + textColor: "white", + backgroundColor: eventColor, start: event.startDate, end: event.endDate, resourceIds: [], @@ -292,10 +296,11 @@ const setupPage = async () => { absencerequests.forEach(absencerequest => { let returnData = { title: `${absencerequest.reason}`, - backgroundColor: "black", + backgroundColor: "red", + borderColor: "red", start: absencerequest.startDate, end: absencerequest.endDate, - resourceIds: [absencerequest.profile.id], + resourceIds: [`P-${absencerequest.profile.id}`], entrytype: "absencerequest", allDay: true, absencerequestId: absencerequest.id @@ -304,8 +309,12 @@ const setupPage = async () => { tempEvents.push(returnData) }) + console.log(tempEvents) + calendarOptionsTimeline.value.initialEvents = tempEvents + console.log(calendarOptionsTimeline.value) + loaded.value = true }