2020-12-03 01:05:26 +01:00
|
|
|
<template lang="pug">
|
2022-11-24 01:00:30 +01:00
|
|
|
client-only
|
|
|
|
vc-date-picker(
|
|
|
|
ref='cal'
|
|
|
|
v-model='selectedDate'
|
|
|
|
title-position='left'
|
2023-02-03 21:55:33 +01:00
|
|
|
:is-dark="is_dark"
|
2022-11-24 01:00:30 +01:00
|
|
|
:columns="!$vuetify.breakpoint.smAndDown ? 2 : 1"
|
|
|
|
@input='click'
|
|
|
|
@update:from-page='updatePage'
|
|
|
|
:locale='$i18n.locale'
|
2022-11-24 17:27:30 +01:00
|
|
|
:popover="{ visibility: 'click' }"
|
2022-11-24 01:00:30 +01:00
|
|
|
:attributes='attributes'
|
|
|
|
transition='fade'
|
|
|
|
aria-label='Calendar'
|
|
|
|
is-expanded
|
|
|
|
is-inline)
|
2023-01-09 16:56:01 +01:00
|
|
|
.calh.d-flex.justify-center.align-center(slot='placeholder')
|
|
|
|
v-progress-circular(indeterminate)
|
2022-11-24 01:00:30 +01:00
|
|
|
|
|
|
|
</template>
|
2020-12-03 01:05:26 +01:00
|
|
|
|
|
|
|
</template>
|
|
|
|
<script>
|
2023-02-03 21:55:33 +01:00
|
|
|
import { mapState, mapGetters } from 'vuex'
|
2020-12-03 01:05:26 +01:00
|
|
|
import dayjs from 'dayjs'
|
2022-11-24 01:00:30 +01:00
|
|
|
import { mdiChevronDown, mdiClose } from '@mdi/js'
|
2021-03-10 16:09:35 +01:00
|
|
|
import { attributesFromEvents } from '../assets/helper'
|
2020-12-03 01:05:26 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Calendar',
|
|
|
|
data () {
|
2022-04-27 11:58:58 +02:00
|
|
|
const month = dayjs.tz().month() + 1
|
|
|
|
const year = dayjs.tz().year()
|
2020-12-03 01:05:26 +01:00
|
|
|
return {
|
2022-11-24 01:00:30 +01:00
|
|
|
mdiChevronDown, mdiClose,
|
2022-02-26 21:28:08 +01:00
|
|
|
selectedDate: null,
|
2022-11-24 01:00:30 +01:00
|
|
|
page: { month, year },
|
2020-12-03 01:05:26 +01:00
|
|
|
}
|
|
|
|
},
|
2021-03-08 14:38:47 +01:00
|
|
|
computed: {
|
2022-11-24 01:00:30 +01:00
|
|
|
...mapState(['settings', 'events']),
|
2023-02-03 21:55:33 +01:00
|
|
|
...mapGetters(['is_dark']),
|
2021-03-08 14:38:47 +01:00
|
|
|
attributes () {
|
2022-05-31 15:14:54 +02:00
|
|
|
return attributesFromEvents(this.events)
|
2021-03-08 14:38:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2020-12-03 01:05:26 +01:00
|
|
|
updatePage (page) {
|
2022-10-12 12:45:09 +02:00
|
|
|
if (page.month !== this.page.month || page.year !== this.page.year) {
|
2022-11-24 17:27:30 +01:00
|
|
|
this.$root.$emit('monthchange', page)
|
2022-10-12 12:45:09 +02:00
|
|
|
this.page.month = page.month
|
|
|
|
this.page.year = page.year
|
|
|
|
}
|
2020-12-03 01:05:26 +01:00
|
|
|
},
|
|
|
|
click (day) {
|
2022-11-24 17:27:30 +01:00
|
|
|
this.$root.$emit('dayclick', day)
|
2020-12-03 01:05:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2023-01-10 17:58:19 +01:00
|
|
|
.vc-container.vc-is-dark {
|
|
|
|
--gray-900: #111;
|
|
|
|
--gray-700: #333;
|
|
|
|
}
|
|
|
|
|
|
|
|
.vc-container {
|
|
|
|
--gray-400: #999 !important;
|
|
|
|
--rounded-lg: 4px !important;
|
|
|
|
}
|
|
|
|
|
2020-12-03 01:05:26 +01:00
|
|
|
.vc-opacity-0 {
|
|
|
|
opacity: 0.3 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.past-event {
|
|
|
|
opacity: 0.3;
|
|
|
|
}
|
2022-11-24 01:00:30 +01:00
|
|
|
|
|
|
|
#calendarButton {
|
|
|
|
margin-top: -6px;
|
|
|
|
margin-left: -10px;
|
|
|
|
}
|
2020-12-03 01:05:26 +01:00
|
|
|
</style>
|