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"
>
<template slot="main">
<div>
<v-calendar
color="primary"
type="day"
hide-header
interval-height="30"
:interval-count="intervalCount"
:first-time="startAt"
:events="events"
:event-color="getEventColor"
:locale="languageName"
@click:event="showEvent"
>
<template v-slot:event="{ event, eventSummary }">
<div>
<!-- eslint-disable vue/no-v-html -->
<span
:class="event.textColor + '--text'"
v-html="eventSummary()"
/><v-icon
v-if="!event.editable"
x-small
:color="event.textColor"
class="ml-n3"
>
$ayiLock</v-icon
>
</div>
</template>
</v-calendar>
</div>
<v-calendar
ref="calendar"
color="primary"
type="day"
hide-header
:now="now"
:interval-count="intervalCount"
:first-time="startAt"
:events="events"
:event-color="getEventColor"
:locale="languageName"
@click:event="showEvent"
>
<template v-slot:event="{ event, eventSummary }">
<div>
<!-- eslint-disable vue/no-v-html -->
<span
:class="event.textColor + '--text'"
v-html="eventSummary()"
/><v-icon v-if="!event.editable" x-small :color="event.textColor">
$ayiLock</v-icon
>
</div>
</template>
</v-calendar>
</template>
</gz-dash>
</template>
@@ -65,7 +59,8 @@ export default {
hour12: window.$gz.locale.getHour12(),
formUserOptions: {},
startAt: "00:00",
intervalCount: 24
intervalCount: 24,
now: null
};
},
computed: {},
@@ -88,13 +83,27 @@ export default {
if (!this.initialized) {
await initialize(this);
}
let hour = new Date().getHours() - 1;
if (hour < 0) {
hour = 0;
}
this.startAt = `${hour}:00`;
this.intervalCount = 24 - hour;
let now = new Date();
//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 {
this.errorMessage = null;
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);