fix toggle show recurrent

This commit is contained in:
les 2021-04-30 00:27:41 +02:00
parent f6ced324b6
commit 2f295571de
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -2,12 +2,10 @@
v-container.pt-0.pt-md-2 v-container.pt-0.pt-md-2
v-switch.mt-0( v-switch.mt-0(
v-if='recurrentFilter && settings.allow_recurrent_event' v-if='recurrentFilter && settings.allow_recurrent_event'
:value='filters.show_recurrent' v-model='showRecurrent'
inset color='primary' inset color='primary'
hide-details hide-details
:label="$t('event.show_recurrent')" :label="$t('event.show_recurrent')")
@change="toggleShowRecurrent")
v-autocomplete.mt-0( v-autocomplete.mt-0(
:label='$t("common.search")' :label='$t("common.search")'
:items='keywords' :items='keywords'
@ -51,6 +49,19 @@ export default {
}, },
computed: { computed: {
...mapState(['tags', 'places', 'settings']), ...mapState(['tags', 'places', 'settings']),
showRecurrent: {
get () {
return this.filters.show_recurrent
},
set (v) {
const filters = {
tags: this.filters.tags,
places: this.filters.places,
show_recurrent: v
}
this.$emit('update', filters)
}
},
selectedFilters () { selectedFilters () {
const tags = this.tags.filter(t => this.filters.tags.includes(t.tag)).map(t => ({ type: 'tag', label: t.tag, weigth: t.weigth, id: t.tag })) const tags = this.tags.filter(t => this.filters.tags.includes(t.tag)).map(t => ({ type: 'tag', label: t.tag, weigth: t.weigth, id: t.tag }))
const places = this.places.filter(p => this.filters.places.includes(p.id)) const places = this.places.filter(p => this.filters.places.includes(p.id))
@ -74,14 +85,6 @@ export default {
} }
this.$emit('update', filters) this.$emit('update', filters)
}, },
toggleShowRecurrent (v) {
const filters = {
tags: this.filters.tags,
places: this.filters.places,
show_recurrent: v
}
this.$emit('update', filters)
},
change (filters) { change (filters) {
filters = { filters = {
tags: filters.filter(t => t.type === 'tag').map(t => t.id), tags: filters.filter(t => t.type === 'tag').map(t => t.id),