2020-02-12 17:04:50 +01:00
|
|
|
<template>
|
2020-09-25 23:36:11 +02:00
|
|
|
<form-wrapper>
|
2020-02-28 12:05:27 +01:00
|
|
|
<form @submit.prevent="handleSubmit" @change="handleSubmit" @keydown="form.onKeydown($event)">
|
2020-05-02 17:55:41 +02:00
|
|
|
<form-select :options="langs" :form="form" fieldName="lang" :label="$t('settings.forms.language.label')" :help="$t('settings.forms.language.help')" />
|
|
|
|
<form-select :options="layouts" :form="form" fieldName="displayMode" :label="$t('settings.forms.display_mode.label')" :help="$t('settings.forms.display_mode.help')" />
|
2020-10-02 14:17:10 +02:00
|
|
|
<form-checkbox :form="form" fieldName="showTokenAsDot" :label="$t('settings.forms.show_token_as_dot.label')" :help="$t('settings.forms.show_token_as_dot.help')" />
|
|
|
|
<form-checkbox :form="form" fieldName="closeTokenOnCopy" :label="$t('settings.forms.close_token_on_copy.label')" :help="$t('settings.forms.close_token_on_copy.help')" />
|
|
|
|
<form-checkbox :form="form" fieldName="useBasicQrcodeReader" :label="$t('settings.forms.use_basic_qrcode_reader.label')" :help="$t('settings.forms.use_basic_qrcode_reader.help')" />
|
2020-10-03 19:29:14 +02:00
|
|
|
<form-checkbox :form="form" fieldName="showAccountsIcons" :label="$t('settings.forms.show_accounts_icons.label')" :help="$t('settings.forms.show_accounts_icons.help')" />
|
2020-02-12 23:24:35 +01:00
|
|
|
</form>
|
|
|
|
</form-wrapper>
|
2020-02-12 17:04:50 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
2020-02-12 23:24:35 +01:00
|
|
|
import Form from './../../components/Form'
|
|
|
|
|
2020-02-12 17:04:50 +01:00
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
2020-02-12 23:24:35 +01:00
|
|
|
form: new Form({
|
2020-02-27 21:58:07 +01:00
|
|
|
lang: this.$root.$i18n.locale,
|
2020-03-23 17:25:53 +01:00
|
|
|
showTokenAsDot: this.$root.appSettings.showTokenAsDot,
|
2020-03-23 21:41:59 +01:00
|
|
|
closeTokenOnCopy: this.$root.appSettings.closeTokenOnCopy,
|
2020-04-02 10:43:05 +02:00
|
|
|
useBasicQrcodeReader: this.$root.appSettings.useBasicQrcodeReader,
|
2020-10-03 19:29:14 +02:00
|
|
|
showAccountsIcons: this.$root.appSettings.showAccountsIcons,
|
2020-05-02 17:55:41 +02:00
|
|
|
displayMode: this.$root.appSettings.displayMode,
|
2020-02-26 22:26:26 +01:00
|
|
|
}),
|
2020-05-02 17:55:41 +02:00
|
|
|
langs: [
|
2020-02-27 09:37:23 +01:00
|
|
|
{ text: this.$t('languages.en'), value: 'en' },
|
|
|
|
{ text: this.$t('languages.fr'), value: 'fr' },
|
2020-05-02 17:55:41 +02:00
|
|
|
],
|
|
|
|
layouts: [
|
|
|
|
{ text: this.$t('settings.forms.grid'), value: 'grid' },
|
|
|
|
{ text: this.$t('settings.forms.list'), value: 'list' },
|
2020-03-18 14:54:23 +01:00
|
|
|
]
|
2020-02-12 17:04:50 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods : {
|
2020-02-27 12:18:46 +01:00
|
|
|
handleSubmit(e) {
|
|
|
|
e.preventDefault()
|
|
|
|
|
2020-03-09 20:24:25 +01:00
|
|
|
this.form.post('/api/settings/options', {returnError: true})
|
2020-02-27 12:18:46 +01:00
|
|
|
.then(response => {
|
2020-02-28 12:05:27 +01:00
|
|
|
|
2020-09-25 23:36:11 +02:00
|
|
|
this.$notify({ type: 'is-success', text: response.data.message })
|
2020-02-28 12:05:27 +01:00
|
|
|
|
|
|
|
if(response.data.settings.lang !== this.$root.$i18n.locale) {
|
|
|
|
this.$router.go()
|
|
|
|
}
|
2020-02-28 22:21:48 +01:00
|
|
|
else {
|
2020-03-23 17:25:53 +01:00
|
|
|
this.$root.appSettings = response.data.settings
|
2020-02-28 22:21:48 +01:00
|
|
|
}
|
2020-02-27 12:18:46 +01:00
|
|
|
})
|
|
|
|
.catch(error => {
|
2020-02-28 22:21:48 +01:00
|
|
|
|
2020-09-25 23:36:11 +02:00
|
|
|
this.$notify({ type: 'is-danger', text: error.response.data.message })
|
2020-02-27 12:18:46 +01:00
|
|
|
});
|
|
|
|
}
|
2020-02-12 17:04:50 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|