mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
stpl widget shows selected day + next 7 days
This commit is contained in:
@@ -124,7 +124,7 @@ export default {
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<fhc-searchbar @showSettings="toggleCollapsibles" ref="searchbar" id="nav-search" class="fhc-searchbar w-100" :searchoptions="searchbaroptions" :searchfunction="searchfunction" :selectedtypes="selectedtypes"></fhc-searchbar>
|
||||
<a id="nav-logo" class="d-none d-sm-block" :href="rootUrl">
|
||||
<a id="nav-logo" class="d-none d-lg-block" :href="rootUrl">
|
||||
<img :src="logoUrl" alt="Logo">
|
||||
</a>
|
||||
<div id="nav-user">
|
||||
|
||||
@@ -30,13 +30,14 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
allEventsGrouped() {
|
||||
// groups all events of all days until end of week together
|
||||
// groups all events of the next 7 days together
|
||||
const currentCalendarDate = new CalendarDate(this.currentDay)
|
||||
const mapArr = currentCalendarDate.wholeWorkWeek.map((d) => [new CalendarDate(d), []])
|
||||
const mapArr = currentCalendarDate.nextSevenDays.map((d) => [new CalendarDate(d), []])
|
||||
|
||||
return new Map((this.events || []).filter(evt => evt.end < currentCalendarDate.lastDayOfWeek && evt.start >= currentCalendarDate.firstDayOfWeek).reduce((acc, cur) => {
|
||||
return new Map((this.events || []).filter(evt => evt.start >= this.currentDay).reduce((acc, cur) => {
|
||||
const date = new CalendarDate(new Date(cur.datum))
|
||||
const arr = acc.find(el => el[0].compare(date))
|
||||
if(!arr) return acc
|
||||
arr[1].push(cur)
|
||||
|
||||
return acc
|
||||
@@ -54,7 +55,7 @@ export default {
|
||||
return this.calendarDateToString(this.calendarDate.cdFirstDayOfCalendarMonth);
|
||||
},
|
||||
monthLastDay: function () {
|
||||
return this.calendarDateToString(this.calendarDate.cdLastDayOfCalendarMonth);
|
||||
return this.calendarDateToString(this.calendarDate.cdLastDayOfNextCalendarMonth);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -96,6 +96,18 @@ class CalendarDate {
|
||||
let lastDayOfMonth = new Date(this.y, this.m+1, 0);
|
||||
return new CalendarDate(lastDayOfMonth.getFullYear(), lastDayOfMonth.getMonth(), lastDayOfMonth.getDate()+6-(lastDayOfMonth.getDay() + 7 - this.weekStart)%7);
|
||||
}
|
||||
get cdLastDayOfNextCalendarMonth() {
|
||||
let lastDayOfMonth = new Date(this.y, this.m+1, 0);
|
||||
return new CalendarDate(lastDayOfMonth.getFullYear(), lastDayOfMonth.getMonth() + 1, lastDayOfMonth.getDate()+6-(lastDayOfMonth.getDay() + 7 - this.weekStart)%7);
|
||||
}
|
||||
get nextSevenDays() {
|
||||
const days = []
|
||||
|
||||
for(let i = 0; i < 7; i++) {
|
||||
days[i] = new Date(this.y, this.m, this.d + i)
|
||||
}
|
||||
return days
|
||||
}
|
||||
get numWeeks() {
|
||||
return (new CalendarDate(this.y+1,0,this.weekStart == 1 ? -3 : 0)).w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user