This commit is contained in:
2022-02-23 16:25:23 +00:00
parent 10d794ec5a
commit f58730212e

View File

@@ -10,37 +10,31 @@
v-on="$listeners" v-on="$listeners"
> >
<template slot="main"> <template slot="main">
<div> <v-calendar
<v-calendar ref="calendar"
color="primary" color="primary"
type="day" type="day"
hide-header hide-header
interval-height="30" :now="now"
:interval-count="intervalCount" :interval-count="intervalCount"
:first-time="startAt" :first-time="startAt"
:events="events" :events="events"
:event-color="getEventColor" :event-color="getEventColor"
:locale="languageName" :locale="languageName"
@click:event="showEvent" @click:event="showEvent"
> >
<template v-slot:event="{ event, eventSummary }"> <template v-slot:event="{ event, eventSummary }">
<div> <div>
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<span <span
:class="event.textColor + '--text'" :class="event.textColor + '--text'"
v-html="eventSummary()" v-html="eventSummary()"
/><v-icon /><v-icon v-if="!event.editable" x-small :color="event.textColor">
v-if="!event.editable" $ayiLock</v-icon
x-small >
:color="event.textColor" </div>
class="ml-n3" </template>
> </v-calendar>
$ayiLock</v-icon
>
</div>
</template>
</v-calendar>
</div>
</template> </template>
</gz-dash> </gz-dash>
</template> </template>
@@ -65,7 +59,8 @@ export default {
hour12: window.$gz.locale.getHour12(), hour12: window.$gz.locale.getHour12(),
formUserOptions: {}, formUserOptions: {},
startAt: "00:00", startAt: "00:00",
intervalCount: 24 intervalCount: 24,
now: null
}; };
}, },
computed: {}, computed: {},
@@ -88,13 +83,27 @@ export default {
if (!this.initialized) { if (!this.initialized) {
await initialize(this); await initialize(this);
} }
let hour = new Date().getHours() - 1;
if (hour < 0) {
hour = 0;
}
this.startAt = `${hour}:00`; let now = new Date();
this.intervalCount = 24 - hour;
//set now for the calendar to trigger a refresh
this.now = now.toLocaleString("sv-SE", {
timeZone: this.timeZoneName
});
this.$refs.calendar.scrollToTime({
hour: now.getHours(),
minute: 0
});
// //calc where to scroll and set
// let hour = now.getHours() - 1;
// if (hour < 0) {
// hour = 0;
// }
// this.startAt = `${hour}:00`;
// this.intervalCount = 24 - hour;
try { try {
this.errorMessage = null; this.errorMessage = null;
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName); const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);