mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
fix(Raum_information Calendar): passt die RaumInformations Seite auf die Aenderungen des Calenders an
This commit is contained in:
@@ -8,7 +8,6 @@ const app = Vue.createApp({
|
|||||||
name: 'StundenplanApp',
|
name: 'StundenplanApp',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
stunden: [],
|
|
||||||
lv_id: null,
|
lv_id: null,
|
||||||
events: null,
|
events: null,
|
||||||
calendarDate: new CalendarDate(new Date()),
|
calendarDate: new CalendarDate(new Date()),
|
||||||
@@ -106,7 +105,7 @@ const app = Vue.createApp({
|
|||||||
created()
|
created()
|
||||||
{
|
{
|
||||||
this.loadEvents();
|
this.loadEvents();
|
||||||
this.getLvID()
|
this.getLvID();
|
||||||
},
|
},
|
||||||
//TODO: Stundenplan phrase
|
//TODO: Stundenplan phrase
|
||||||
template:/*html*/`
|
template:/*html*/`
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ export default{
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
stunden: [],
|
|
||||||
events: null,
|
events: null,
|
||||||
calendarWeek: new CalendarDate(new Date()),
|
calendarDate: new CalendarDate(new Date()),
|
||||||
|
currentlySelectedEvent: null,
|
||||||
|
currentDay: new Date(),
|
||||||
|
minimized: false,
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -24,38 +26,62 @@ export default{
|
|||||||
currentDate: function(){
|
currentDate: function(){
|
||||||
return new Date(this.calendarWeek.y, this.calendarWeek.m, this.calendarWeek.d);
|
return new Date(this.calendarWeek.y, this.calendarWeek.m, this.calendarWeek.d);
|
||||||
},
|
},
|
||||||
weekFirstDay: function(){
|
weekFirstDay: function () {
|
||||||
return this.calendarDateToString(this.calendarWeek.cdFirstDayOfWeek);
|
return this.calendarDateToString(this.calendarDate.cdFirstDayOfWeek);
|
||||||
},
|
},
|
||||||
weekLastDay: function(){
|
weekLastDay: function () {
|
||||||
return this.calendarDateToString(this.calendarWeek.cdLastDayOfWeek);
|
return this.calendarDateToString(this.calendarDate.cdLastDayOfWeek);
|
||||||
},
|
},
|
||||||
|
monthFirstDay: function () {
|
||||||
|
return this.calendarDateToString(this.calendarDate.cdFirstDayOfCalendarMonth);
|
||||||
|
},
|
||||||
|
monthLastDay: function () {
|
||||||
|
return this.calendarDateToString(this.calendarDate.cdLastDayOfCalendarMonth);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
updateRange: function(data){
|
getLvID: function () {
|
||||||
this.calendarWeek = new CalendarDate(data.start);
|
this.lv_id = window.location.pathname
|
||||||
|
},
|
||||||
|
selectDay: function (day) {
|
||||||
|
this.currentDay = day;
|
||||||
|
},
|
||||||
|
showModal: function (event) {
|
||||||
|
this.currentlySelectedEvent = event;
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
this.loadEvents();
|
this.$refs.lvmodal.show();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
updateRange: function ({ start, end }) {
|
||||||
|
|
||||||
// returns the string YYYY-MM-DD if param is instance of CalendarDate and null otherwise
|
let checkDate = (date) => {
|
||||||
calendarDateToString: function(calendarDate){
|
return date.m != this.calendarDate.m || date.y != this.calendarDate.y;
|
||||||
|
}
|
||||||
return calendarDate instanceof CalendarDate?
|
|
||||||
[calendarDate.y, calendarDate.m+1, calendarDate.d].join('-'):
|
|
||||||
null;
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
// only load month data if the month or year has changed
|
||||||
|
if (checkDate(new CalendarDate(start)) && checkDate(new CalendarDate(end))) {
|
||||||
|
// reset the events before querying the new events to activate the loading spinner
|
||||||
|
this.events = null;
|
||||||
|
this.calendarDate = new CalendarDate(end);
|
||||||
|
Vue.nextTick(() => {
|
||||||
|
this.loadEvents();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
calendarDateToString: function (calendarDate) {
|
||||||
|
return calendarDate instanceof CalendarDate ?
|
||||||
|
[calendarDate.y, calendarDate.m + 1, calendarDate.d].join('-') :
|
||||||
|
null;
|
||||||
|
|
||||||
|
},
|
||||||
loadEvents: function(){
|
loadEvents: function(){
|
||||||
|
|
||||||
// bundles the room_events and the reservierungen together into the this.events array
|
// bundles the room_events and the reservierungen together into the this.events array
|
||||||
Promise.allSettled([
|
Promise.allSettled([
|
||||||
this.$fhcApi.factory.stundenplan.getRoomInfo(this.ort_kurzbz, this.weekFirstDay, this.weekLastDay),
|
this.$fhcApi.factory.stundenplan.getRoomInfo(this.ort_kurzbz, this.monthFirstDay, this.monthLastDay),
|
||||||
this.$fhcApi.factory.stundenplan.getOrtReservierungen(this.ort_kurzbz, this.weekFirstDay, this.weekLastDay)
|
this.$fhcApi.factory.stundenplan.getOrtReservierungen(this.ort_kurzbz, this.monthFirstDay, this.monthLastDay)
|
||||||
]).then((result) => {
|
]).then((result) => {
|
||||||
let events = [];
|
let promise_events = [];
|
||||||
result.forEach((promise_result) => {
|
result.forEach((promise_result) => {
|
||||||
if(promise_result.status === 'fulfilled' && promise_result.value.meta.status === "success"){
|
if(promise_result.status === 'fulfilled' && promise_result.value.meta.status === "success"){
|
||||||
|
|
||||||
@@ -75,30 +101,46 @@ export default{
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
events = events.concat(data);
|
promise_events = promise_events.concat(data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.events = events;
|
this.events = promise_events;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.loadEvents();
|
||||||
|
},
|
||||||
template: /*html*/`
|
template: /*html*/`
|
||||||
<div>
|
<fhc-calendar :initial-date="currentDay" @change:range="updateRange" :events="events" initial-mode="week" show-weeks @select:day="selectDay" v-model:minimized="minimized">
|
||||||
<fhc-calendar @change:range="updateRange" v-slot="{event,day}" :initialDate="currentDate" :events="events" initial-mode="week" show-weeks>
|
<template #monthPage="{event,day,isSelected}">
|
||||||
<a class="text-decoration-none text-dark" href="#" :title="event.orig.title + ' - ' + event.orig.lehrfach_bez + ' [' + event.orig.ort_kurzbz+']'" >
|
<span class="fhc-entry" :class="{'selectedEvent':isSelected}" style="color:white" :style="{'background-color': event.color}">
|
||||||
<div type="button" class="d-flex flex-column align-items-center justify-content-evenly h-100" >
|
{{event.topic}}
|
||||||
|
</span>
|
||||||
<!-- render content for stundenplan -->
|
</template>
|
||||||
<span >{{event.orig.topic}}</span>
|
<template #weekPage="{event,day,isSelected}">
|
||||||
<span v-for="gruppe in event.orig.gruppe" >{{gruppe.kuerzel}} </span>
|
<div @click="showModal(event?.orig)" type="button" :class="{'selectedEvent':isSelected}" class="fhc-entry border border-secondary border d-flex flex-column align-items-center justify-content-evenly h-100">
|
||||||
<span v-for="lektor in event.orig.lektor" >{{lektor.kurzbz}}</span>
|
<span>{{event?.orig.topic}}</span>
|
||||||
<!-- add the beschreibung if the event is a reservierung
|
<span v-for="lektor in event?.orig.lektor">{{lektor.kurzbz}}</span>
|
||||||
<span v-if="event.orig.type === 'reservierung'">{{event.orig.beschreibung}}</span>-->
|
<span>{{event?.orig.ort_kurzbz}}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</a>
|
<template #dayPage="{event,day}">
|
||||||
|
<div type="button" class="fhc-entry border border-secondary border row h-100 justify-content-center align-items-center text-center">
|
||||||
|
<div class="col ">
|
||||||
|
<p>Lehrveranstaltung:</p>
|
||||||
|
<p class="m-0">{{event?.orig.topic}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="col ">
|
||||||
|
<p>Lektor:</p>
|
||||||
|
<p class="m-0" v-for="lektor in event?.orig.lektor">{{lektor.kurzbz}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="col ">
|
||||||
|
<p>Ort: </p>
|
||||||
|
<p class="m-0">{{event?.orig.ort_kurzbz}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</fhc-calendar>
|
</fhc-calendar>
|
||||||
</div>
|
|
||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user