2022-11-24 01:00:30 +01:00
|
|
|
<template lang="pug">
|
2024-01-23 09:11:54 +01:00
|
|
|
#navsearch.mt-2.mt-sm-4(v-if='showCollectionsBar || showSearchBar || showCalendar')
|
|
|
|
div.mx-2
|
|
|
|
client-only(v-if='showSearchBar')
|
|
|
|
v-menu(offset-y :close-on-content-click='false' tile)
|
|
|
|
template(v-slot:activator="{on ,attrs}")
|
|
|
|
v-text-field(hide-details outlined v-model='query'
|
|
|
|
:placeholder='$t("common.search")' @click:clear="setFilter(['query', null])"
|
|
|
|
@keypress.enter="setFilter(['query', query])" clearable :clear-icon='mdiClose')
|
|
|
|
template(v-slot:append)
|
|
|
|
v-icon.mr-2(v-if='query' v-text='mdiMagnify' @click="setFilter(['query', query])")
|
|
|
|
v-icon(v-if='settings.allow_recurrent_event || settings.allow_multidate_event' v-text='mdiCog' v-bind='attrs' v-on='on')
|
|
|
|
v-card(outlined :rounded='"0"')
|
|
|
|
v-card-text
|
|
|
|
v-row(dense)
|
|
|
|
v-col(v-if='settings.allow_recurrent_event')
|
|
|
|
v-switch.mt-0(v-model='show_recurrent' @change="v => setFilter(['show_recurrent', v])"
|
|
|
|
hide-details :label="$t('event.show_recurrent')" inset)
|
|
|
|
v-col(v-if='settings.allow_multidate_event')
|
|
|
|
v-switch.mt-0(v-model='show_multidate' @change="v => setFilter(['show_multidate', v])"
|
|
|
|
hide-details :label="$t('event.show_multidate')" inset)
|
|
|
|
v-row(v-if='!showCalendar')
|
|
|
|
v-col
|
|
|
|
Calendar.mt-2
|
|
|
|
v-text-field(slot='placeholder' outlined hide-details :placeholder="$t('common.search')" :append-icon='mdiCog')
|
2023-01-09 17:02:15 +01:00
|
|
|
|
2024-01-23 09:11:54 +01:00
|
|
|
span(v-if='showCollectionsBar')
|
|
|
|
v-btn.mr-2.mt-2(small outlined v-for='collection in collections'
|
|
|
|
color='primary' :key='collection.id'
|
|
|
|
:to='`/collection/${encodeURIComponent(collection.name)}`') {{collection.name}}
|
2023-01-09 17:02:15 +01:00
|
|
|
|
2024-01-23 09:11:54 +01:00
|
|
|
Calendar.mt-2(v-if='showCalendar')
|
2023-01-09 17:02:15 +01:00
|
|
|
|
|
|
|
|
2022-11-24 01:00:30 +01:00
|
|
|
</template>
|
|
|
|
<script>
|
2023-01-09 17:02:15 +01:00
|
|
|
import { mapState, mapActions } from 'vuex'
|
2022-11-24 01:00:30 +01:00
|
|
|
import Calendar from '@/components/Calendar'
|
2023-03-19 23:26:57 +01:00
|
|
|
import { mdiClose, mdiCog, mdiMagnify } from '@mdi/js'
|
2022-11-24 01:00:30 +01:00
|
|
|
|
|
|
|
export default {
|
2023-01-09 17:02:15 +01:00
|
|
|
data: ({ $store }) => ({
|
2022-12-23 01:19:04 +01:00
|
|
|
oldRoute: '',
|
2023-03-19 23:26:57 +01:00
|
|
|
mdiClose, mdiCog, mdiMagnify,
|
2024-05-16 17:59:30 +02:00
|
|
|
collections: $store.state.collections,
|
2023-01-09 17:02:15 +01:00
|
|
|
show_recurrent: $store.state.settings.recurrent_event_visible,
|
|
|
|
show_multidate: true,
|
|
|
|
query: ''
|
2022-11-24 01:00:30 +01:00
|
|
|
}),
|
|
|
|
components: { Calendar },
|
2022-11-25 09:21:22 +01:00
|
|
|
computed: {
|
|
|
|
showSearchBar () {
|
2024-02-28 22:36:43 +01:00
|
|
|
return ['index'].includes(this.$route.name)
|
2022-11-25 09:21:22 +01:00
|
|
|
},
|
2023-01-09 17:02:15 +01:00
|
|
|
showCalendar () {
|
2024-02-28 22:36:43 +01:00
|
|
|
return (!this.settings.hide_calendar &&
|
|
|
|
['index'].includes(this.$route.name))
|
2023-01-09 17:02:15 +01:00
|
|
|
},
|
2022-11-25 09:21:22 +01:00
|
|
|
showCollectionsBar () {
|
2022-12-23 01:19:04 +01:00
|
|
|
const show = ['index', 'collection-collection'].includes(this.$route.name)
|
|
|
|
if (show && this.oldRoute !== this.$route.name) {
|
|
|
|
this.oldRoute = this.$route.name
|
|
|
|
}
|
|
|
|
return show
|
2022-11-25 09:21:22 +01:00
|
|
|
},
|
2023-01-09 17:02:15 +01:00
|
|
|
...mapState(['settings', 'filter'])
|
2022-11-25 09:21:22 +01:00
|
|
|
},
|
2022-11-24 17:28:00 +01:00
|
|
|
methods: {
|
2023-01-09 17:02:15 +01:00
|
|
|
...mapActions(['setFilter']),
|
2022-11-24 17:28:00 +01:00
|
|
|
}
|
2022-11-24 01:00:30 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
#navsearch {
|
|
|
|
margin: 0 auto;
|
2023-01-09 17:02:15 +01:00
|
|
|
max-width: 700px;
|
2022-11-24 01:00:30 +01:00
|
|
|
}
|
2023-01-09 17:02:15 +01:00
|
|
|
</style>
|