2019-04-03 00:25:12 +02:00
|
|
|
<template lang="pug">
|
2019-05-30 12:04:14 +02:00
|
|
|
#calendar
|
|
|
|
v-calendar(
|
2019-04-29 00:27:29 +02:00
|
|
|
title-position='left'
|
|
|
|
locale='it'
|
|
|
|
is-dark
|
2019-04-03 00:25:12 +02:00
|
|
|
:attributes='attributes'
|
|
|
|
:from-page.sync='page'
|
2019-05-30 12:04:14 +02:00
|
|
|
is-expanded
|
|
|
|
is-inline
|
|
|
|
@dayclick='click')
|
|
|
|
|
2019-04-03 00:25:12 +02:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-05-30 12:04:14 +02:00
|
|
|
import { mapState, mapActions, mapGetters } from 'vuex'
|
2019-04-03 00:25:12 +02:00
|
|
|
import moment from 'dayjs'
|
2019-05-30 12:12:51 +02:00
|
|
|
import { intersection, sample, get } from 'lodash'
|
2019-04-03 00:25:12 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Calendar',
|
|
|
|
data () {
|
|
|
|
const month = moment().month()+1
|
|
|
|
const year = moment().year()
|
|
|
|
return {
|
|
|
|
page: { month, year},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2019-06-10 00:40:37 +02:00
|
|
|
// month selected
|
2019-04-03 00:25:12 +02:00
|
|
|
page () {
|
|
|
|
this.updateEvents(this.page)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(['updateEvents']),
|
2019-05-30 12:04:14 +02:00
|
|
|
click (day) {
|
|
|
|
const element = document.getElementById(day.day)
|
|
|
|
if (element) element.scrollIntoView(); //Even IE6 supports this
|
2019-04-29 00:27:29 +02:00
|
|
|
},
|
2019-04-03 00:25:12 +02:00
|
|
|
},
|
|
|
|
computed: {
|
2019-05-30 12:04:14 +02:00
|
|
|
...mapGetters(['filteredEvents']),
|
2019-04-03 00:25:12 +02:00
|
|
|
attributes () {
|
|
|
|
return [
|
2019-04-29 00:27:29 +02:00
|
|
|
{ key: 'today', dates: new Date(),
|
2019-06-12 23:41:19 +02:00
|
|
|
highlight: { color: 'red' },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'event',
|
|
|
|
dates: this.filteredEvents
|
|
|
|
.filter(e => !e.multidate)
|
|
|
|
.map(e => e.start_datetime ),
|
|
|
|
dot: { }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'multidays',
|
|
|
|
dates: this.filteredEvents
|
|
|
|
.filter(e => e.multidate)
|
|
|
|
.map( e => ({ start: e.start_datetime, end: e.end_datetime })),
|
|
|
|
highlight: { color: 'green' }
|
|
|
|
}
|
2019-04-03 00:25:12 +02:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#calendar {
|
2019-05-30 12:04:14 +02:00
|
|
|
margin: 0 auto;
|
|
|
|
max-width: 500px;
|
|
|
|
align-self: center;
|
2019-04-03 00:25:12 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 17:24:48 +02:00
|
|
|
.vc-opacity-0 {
|
|
|
|
opacity: 0.2 !important;
|
|
|
|
}
|
2019-06-09 00:45:50 +02:00
|
|
|
/* .vc-highlight {
|
|
|
|
color: red;
|
2019-05-30 12:12:51 +02:00
|
|
|
height: 22px !important;
|
|
|
|
opacity: 0.4;
|
|
|
|
border-radius: 15px;
|
2019-06-09 00:45:50 +02:00
|
|
|
} */
|
2019-05-30 12:12:51 +02:00
|
|
|
|
2019-04-03 00:25:12 +02:00
|
|
|
</style>
|