update(Calendar Moodle): adds background color to full day events, adds the link to the moodle activity, sorts the events based on type

This commit is contained in:
SimonGschnell
2025-02-26 13:05:17 +01:00
parent bad19ccde7
commit fe1971a1d3
3 changed files with 35 additions and 5 deletions
+15 -1
View File
@@ -85,10 +85,22 @@
grid-template-columns:repeat(7,1fr);
width:100%;
z-index:3;
background-color:white;
}
.fhc-calendar-week-page .all-day-event-container::before {
position: absolute;
content:'';
top: 0;
bottom: 0;
left: -3em;
right: 100%;
background-color: white;
box-shadow: 1px 1px 0 #dee2e6;
}
.fhc-calendar-day-page .all-day-event-border {
box-shadow: 1px 1px 0 #dee2e6;
box-shadow: 0 0 0 1px #dee2e6;
}
.fhc-calendar-day-page .all-day-event {
@@ -104,6 +116,8 @@
grid-template-columns: 3em 1fr;
width: 100%;
z-index: 3;
background-color:white;
box-shadow: 1px 1px 0 #dee2e6;
}
/* grid hour lines of the Stundenplan use box-shadow instead of border because box-shadow renders consistently on different viewports*/
+4
View File
@@ -135,6 +135,10 @@ export default {
<td>{{event.organisationseinheit}}</td>
</template>
</tr>
<tr v-if="event.type == LV_TYPES.moodle">
<th>Link:</th>
<td><a :href="event?.url" target="_blank"><i class="fa fa-arrow-up-right-from-square me-1"></i></a></td>
</tr>
</tbody>
</table>
`
@@ -146,6 +146,17 @@ export const Stundenplan = {
promise_events = promise_events.concat(data);
}
})
promise_events.sort((a, b) => {
if(a.type=='moodle'){
return -1;
}
else if(b.type=='moodle'){
return 1;
}
else{
return 0;
}
});
this.events = promise_events;
});
},
@@ -155,12 +166,12 @@ export const Stundenplan = {
let date_end = Math.floor(new Date(end_date).getTime() / 1000);
return this.$fhcApi.factory.stundenplan.getMoodleEventsByUserid('io23m005', date_start, date_end).then((response) => response.events).then(events => {
let data =events.map(event =>{
const event_start_date = new Date(Number(event.timestart) * 1000);
const event_end_date = new Date(((Number(event.timestart) + Number(event.timeduration)) * 1000));
const event_start_date = new Date(event.timestart);
const event_end_date = new Date(event.timeend);
const formatted_date = `${event_start_date.getFullYear()}-${event_start_date.getMonth()+1}-${event_start_date.getDate()}`;
// to get the same date and time as in moodle, we use the default UTC time zone
const formatted_start_time = event_start_date.toLocaleTimeString(this.$p.user_locale, {hour:'2-digit',minute:'2-digit', second:'2-digit',hour12:false, timeZone:'UTC'});
const formatted_end_time = event_end_date.toLocaleTimeString(this.$p.user_locale, { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false, timeZone: 'UTC' });
const formatted_start_time = event_start_date.toLocaleTimeString(this.$p.user_locale, {hour:'2-digit',minute:'2-digit', second:'2-digit',hour12:false});
const formatted_end_time = event_end_date.toLocaleTimeString(this.$p.user_locale, { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false });
return {
type:'moodle',
@@ -184,6 +195,7 @@ export const Stundenplan = {
farbe:'00689E',
lehrveranstaltung_id:0,
ort_content_id:0,
url:event?.url,
}
});
return {