2020-12-03 01:05:26 +01:00
|
|
|
<template lang="pug">
|
|
|
|
#calendar
|
2021-03-16 19:57:00 +01:00
|
|
|
vc-calendar(
|
2020-12-03 01:05:26 +01:00
|
|
|
title-position='left'
|
|
|
|
:is-dark="settings['theme.is_dark']"
|
2021-02-09 12:10:00 +01:00
|
|
|
:columns="$screens({ sm: 2 }, 1)"
|
2020-12-03 01:05:26 +01:00
|
|
|
@update:from-page='updatePage'
|
|
|
|
:locale='$i18n.locale'
|
|
|
|
:attributes='attributes'
|
|
|
|
transition='fade'
|
|
|
|
is-expanded
|
|
|
|
is-inline
|
|
|
|
@dayclick='click')
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<script>
|
2020-12-04 17:24:52 +01:00
|
|
|
import { mapState, mapActions } from 'vuex'
|
2020-12-03 01:05:26 +01:00
|
|
|
import dayjs from 'dayjs'
|
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',
|
|
|
|
props: {
|
2021-01-11 00:17:56 +01:00
|
|
|
events: { type: Array, default: () => [] }
|
2020-12-03 01:05:26 +01:00
|
|
|
},
|
|
|
|
data () {
|
|
|
|
const month = dayjs().month() + 1
|
|
|
|
const year = dayjs().year()
|
|
|
|
return {
|
2021-03-08 14:38:47 +01:00
|
|
|
page: { month, year }
|
2020-12-03 01:05:26 +01:00
|
|
|
}
|
|
|
|
},
|
2021-03-08 14:38:47 +01:00
|
|
|
computed: {
|
|
|
|
...mapState(['tags', 'filters', 'in_past', 'settings']),
|
|
|
|
attributes () {
|
2021-03-10 16:09:35 +01:00
|
|
|
return attributesFromEvents(this.events, this.tags)
|
2021-03-08 14:38:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(['updateEvents', 'showPastEvents']),
|
2020-12-03 01:05:26 +01:00
|
|
|
updatePage (page) {
|
2021-01-22 23:07:19 +01:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this.$emit('monthchange', page)
|
|
|
|
})
|
2020-12-03 01:05:26 +01:00
|
|
|
},
|
|
|
|
click (day) {
|
|
|
|
this.$emit('dayclick', day)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.vc-opacity-0 {
|
|
|
|
opacity: 0.3 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.past-event {
|
|
|
|
opacity: 0.3;
|
|
|
|
}
|
|
|
|
</style>
|