gancio-upstream/components/admin/Settings.vue

165 lines
5.3 KiB
Vue
Raw Normal View History

<template lang="pug">
2022-07-01 15:55:09 +02:00
v-container
v-card-title {{$t('common.settings')}}
v-card-text
2020-08-05 17:11:06 +02:00
2022-07-01 15:55:09 +02:00
v-text-field(v-model='title'
:label="$t('common.title')"
:hint="$t('admin.title_description')"
@blur='save("title", title)'
persistent-hint)
2021-09-27 10:06:03 +02:00
2022-07-01 15:55:09 +02:00
v-text-field.mt-5(v-model='description'
:label="$t('common.description')"
:hint="$t('admin.description_description')"
persistent-hint
@blur='save("description", description)')
2021-09-27 10:06:03 +02:00
2022-07-01 15:55:09 +02:00
//- select timezone
v-autocomplete.mt-5(v-model='instance_timezone'
:label="$t('admin.select_instance_timezone')"
:hint="$t('admin.instance_timezone_description')"
:items="filteredTimezones"
persistent-hint
placeholder='Timezone, type to search')
2020-07-25 21:41:22 +02:00
2022-07-01 15:55:09 +02:00
v-select.mt-5(
v-model='instance_locale'
:label="$t('admin.instance_locale')"
:hint="$t('admin.instance_locale_description')"
persistent-hint
:items='locales'
)
2020-07-25 21:41:22 +02:00
2022-07-01 15:55:09 +02:00
v-switch.mt-4(v-model='allow_registration'
inset
:label="$t('admin.allow_registration_description')")
2022-07-01 15:55:09 +02:00
v-switch.mt-1(v-model='allow_anon_event'
inset
:label="$t('admin.allow_anon_event')")
v-switch.mt-1(v-model='allow_multidate_event'
inset
:label="$t('admin.allow_multidate_event')")
2022-07-01 15:55:09 +02:00
v-switch.mt-1(v-model='allow_recurrent_event'
inset
:label="$t('admin.allow_recurrent_event')")
2022-07-01 15:55:09 +02:00
v-switch.mt-1(v-if='allow_recurrent_event'
v-model='recurrent_event_visible'
inset
:label="$t('admin.recurrent_event_visible')")
v-switch.mt-1(v-model='allow_geolocation'
2022-09-02 08:32:13 +02:00
inset
:label="$t('admin.allow_geolocation')")
2022-09-02 08:32:13 +02:00
v-switch.mt-1(v-model='allow_event_only_online'
inset
:label="$t('admin.allow_event_only_online')")
v-switch.mt-1(v-model='allow_event_also_online'
inset
:label="$t('admin.allow_event_also_online')")
2022-07-01 15:55:09 +02:00
v-dialog(v-model='showSMTP' destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly')
SMTP(@close='showSMTP = false')
2022-07-01 15:55:09 +02:00
v-card-actions
v-btn(text @click='showSMTP=true')
<v-icon v-if='!settings.admin_email' color='error' class="mr-2" v-text='mdiAlert'></v-icon> {{$t('admin.show_smtp_setup')}}
2021-10-18 15:43:29 +02:00
v-btn(text @click='$emit("complete")' color='primary' v-if='setup') {{$t('common.next')}}
v-icon(v-text='mdiArrowRight')
</template>
<script>
2021-10-18 15:43:29 +02:00
import SMTP from './SMTP.vue'
import Geolocation from './Geolocation.vue'
import { mapActions, mapState } from 'vuex'
2021-09-27 10:07:11 +02:00
import moment from 'dayjs'
import tzNames from './tz.json'
import { mdiAlert, mdiArrowRight, mdiMap } from '@mdi/js'
const locales = require('../../locales/index')
2020-02-17 10:59:46 +01:00
export default {
2021-10-18 15:43:29 +02:00
props: {
setup: { type: Boolean, default: false }
},
components: { SMTP, Geolocation },
name: 'Settings',
data ({ $store }) {
return {
mdiAlert, mdiArrowRight, mdiMap,
title: $store.state.settings.title,
2020-02-20 18:37:10 +01:00
description: $store.state.settings.description,
2021-10-18 15:43:29 +02:00
locales: Object.keys(locales).map(locale => ({ value: locale, text: locales[locale] })),
showSMTP: false,
showGeolocationConfigs: false,
}
},
computed: {
...mapState(['settings']),
2020-02-20 18:37:10 +01:00
instance_locale: {
get () { return this.settings.instance_locale },
set (value) { this.setSetting({ key: 'instance_locale', value }) }
},
instance_timezone: {
get () { return this.settings.instance_timezone },
set (value) { this.setSetting({ key: 'instance_timezone', value }) }
},
allow_registration: {
get () { return this.settings.allow_registration },
set (value) { this.setSetting({ key: 'allow_registration', value }) }
},
allow_anon_event: {
get () { return this.settings.allow_anon_event },
set (value) { this.setSetting({ key: 'allow_anon_event', value }) }
},
allow_recurrent_event: {
get () { return this.settings.allow_recurrent_event },
set (value) { this.setSetting({ key: 'allow_recurrent_event', value }) }
},
allow_multidate_event: {
get () { return this.settings.allow_multidate_event },
set (value) { this.setSetting({ key: 'allow_multidate_event', value }) }
},
recurrent_event_visible: {
get () { return this.settings.recurrent_event_visible },
set (value) { this.setSetting({ key: 'recurrent_event_visible', value }) }
2020-02-17 10:59:46 +01:00
},
allow_geolocation: {
get () { return this.settings.allow_geolocation },
set (value) { this.setSetting({ key: 'allow_geolocation', value }) }
2022-09-02 08:32:13 +02:00
},
allow_event_only_online: {
get () { return this.settings.allow_event_only_online },
set (value) { this.setSetting({ key: 'allow_event_only_online', value })
if (value == true) { this.allow_event_also_online = value }
}
},
allow_event_also_online: {
get () { return this.settings.allow_event_also_online },
set (value) { this.setSetting({ key: 'allow_event_also_online', value })
if (value == false) { this.setSetting({ key: 'allow_event_only_online', value }) }
}
},
2020-02-17 10:59:46 +01:00
filteredTimezones () {
const current_timezone = moment.tz.guess()
2021-09-27 10:07:11 +02:00
tzNames.unshift(current_timezone)
return tzNames
2019-10-28 17:33:20 +01:00
}
},
methods: {
...mapActions(['setSetting']),
save (key, value) {
if (this.settings[key] !== value) {
this.setSetting({ key, value })
}
}
}
}
2019-10-28 17:33:20 +01:00
</script>