diff --git a/public/css/components/calendar.css b/public/css/components/calendar.css index 157836afc..720b79156 100644 --- a/public/css/components/calendar.css +++ b/public/css/components/calendar.css @@ -68,6 +68,21 @@ box-shadow: 0 0 0 1px #dee2e6 !important; } +.fhc-calendar-no-events-overlay{ + position: relative; +} + +.fhc-calendar-no-events-overlay::before { + content: ""; + position: absolute; + top: 0; + left: 0; + margin:auto; + width: 100%; + height: 100%; + background-image: linear-gradient(120deg, white, gray ); + opacity: .7; +} .fhc-calendar-day-page { /*aspect-ratio: 7/6;*/ min-height: 0; diff --git a/public/js/components/Calendar/Calendar.js b/public/js/components/Calendar/Calendar.js index 0d29c3eb7..761df49db 100644 --- a/public/js/components/Calendar/Calendar.js +++ b/public/js/components/Calendar/Calendar.js @@ -26,6 +26,7 @@ export default { focusDate: this.focusDate, size: Vue.computed({ get: () => this.size, set: v => this.size = v }), events: Vue.computed(() => this.eventsPerDay), + filteredEvents: Vue.computed(() => this.filteredEvents), minimized: Vue.computed({ get: () => this.minimized, set: v => this.$emit('update:minimized', v) }), showWeeks: this.showWeeks, noMonthView: this.noMonthView, @@ -126,31 +127,46 @@ export default { }, // returns the hour of the earliest event, used to scroll to the events in the calendar (week / day view) scrollTime: function () { - if (this.events && Array.isArray(this.events) && this.events.length > 0) { - let filteredEvents = this.events.filter(event => { - // week view filters the elements only for the same week - let eventDate = new CalendarDate(new Date(event.datum)); - if(this.mode == 'week'){ - return this.focusDate.w == eventDate.w; - } - // day view filters the elements for the same day and the same week - else if(this.mode == 'day'){ - - return this.focusDate.d == eventDate.d && this.focusDate.w == eventDate.w; - } - }) // return the first beginning time of the filtered events - if(filteredEvents.length > 0) + if(this.filteredEvents && Array.isArray(this.filteredEvents) && this.filteredEvents.length > 0) { - return parseInt(filteredEvents.sort((a, b) => parseInt(a.beginn) - parseInt(b.beginn))[0].beginn); + return parseInt(this.filteredEvents.sort((a, b) => parseInt(a.beginn) - parseInt(b.beginn))[0].beginn); } - // if there is not filtered event that matches the current week + // there is no event that matches the current view mode constraints else { return null; } + }, + // filters the events based on the current calendar view mode + // week view - filter events based on their week + // day view - filter events based on their day and week + // month view - does not filter the events + filteredEvents: function(){ + if (this.events && Array.isArray(this.events) && this.events.length > 0) { + let filteredEvents = this.events.filter(event => { + let eventDate = new CalendarDate(new Date(event.datum)); + if (this.mode == 'week') + { + // week view filters the elements only for the same week + return this.focusDate.w == eventDate.w; + } + else if (this.mode == 'day') + { + // day view filters the elements for the same day and the same week + return this.focusDate.d == eventDate.d && this.focusDate.w == eventDate.w; + } + else + { + // returns all the events, does not filter the events + return true; + } + }) + + return filteredEvents; } - else { + else + { return null; } }, @@ -190,7 +206,7 @@ export default { }, template: /*html*/` -
+