This commit is contained in:
2021-10-05 23:51:43 +00:00
parent 918b0040f9
commit 38ccc858af
2 changed files with 34 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<span class="text-caption"> <span class="text-caption" v-if="!noLabel">
{{ title }} {{ title }}
</span> </span>
<v-autocomplete <v-autocomplete
@@ -9,7 +9,7 @@
:readonly="readonly" :readonly="readonly"
:items="sourcetags" :items="sourcetags"
:loading="tagSearchUnderway" :loading="tagSearchUnderway"
:placeholder="$ay.t('TypeToSearchOrAdd')" :placeholder="placeHolderText"
:no-data-text="$ay.t('NoData')" :no-data-text="$ay.t('NoData')"
:search-input.sync="tagSearchEntry" :search-input.sync="tagSearchEntry"
hide-selected hide-selected
@@ -63,7 +63,13 @@ export default {
}, },
readonly: { type: Boolean, default: false }, readonly: { type: Boolean, default: false },
rules: { type: Array, default: undefined }, rules: { type: Array, default: undefined },
errorMessages: { type: Array, default: null } errorMessages: { type: Array, default: null },
selectOnly: { type: Boolean, default: false },
noLabel: { type: Boolean, default: false },
placeHolder: {
type: String,
default: null
}
}, },
watch: { watch: {
async tagSearchEntry(val) { async tagSearchEntry(val) {
@@ -93,11 +99,21 @@ export default {
return this.label; return this.label;
} }
return this.$ay.t("Tags"); return this.$ay.t("Tags");
},
placeHolderText() {
if (this.placeHolder) {
return this.placeHolder;
}
return this.$ay.t("TypeToSearchOrAdd");
} }
}, },
methods: { methods: {
offerAdd() { offerAdd() {
if (this.tagSearchEntry == null || this.tagSearchEntry == "") { if (
this.selectOnly ||
this.tagSearchEntry == null ||
this.tagSearchEntry == ""
) {
return false; return false;
} }
const searchTag = this.normalizeTag(this.tagSearchEntry); const searchTag = this.normalizeTag(this.tagSearchEntry);

View File

@@ -19,7 +19,16 @@
{{ $refs.calendar.title }}</v-btn {{ $refs.calendar.title }}</v-btn
> >
</v-toolbar-title> </v-toolbar-title>
<v-spacer v-if="!$vuetify.breakpoint.xs"></v-spacer> <v-spacer v-if="!$vuetify.breakpoint.xs"></v-spacer>
<template v-if="!$vuetify.breakpoint.xs">
<gz-tag-picker
place-holder="ph filter users"
no-label
select-only
v-model="tags"
></gz-tag-picker>
</template>
<v-btn <v-btn
class="mr-3" class="mr-3"
fab fab
@@ -394,7 +403,8 @@ export default {
formUserOptions: {}, formUserOptions: {},
tempFirstTime: null, tempFirstTime: null,
availableUsers: [], availableUsers: [],
lastMouseDownMS: null lastMouseDownMS: null,
tags: []
}; };
}, },
methods: { methods: {
@@ -994,18 +1004,19 @@ function getFormSettings(vm) {
let formSettings = window.$gz.form.getFormSettings(FORM_KEY); let formSettings = window.$gz.form.getFormSettings(FORM_KEY);
if (!formSettings || !formSettings.temp || !formSettings.temp.viewType) { if (!formSettings || !formSettings.temp || !formSettings.temp.viewType) {
//defaults //defaults
formSettings = { temp: { viewType: "month", focus: null } }; formSettings = { temp: { viewType: "month", focus: null, tags: [] } };
} }
vm.viewType = formSettings.temp.viewType; vm.viewType = formSettings.temp.viewType;
vm.focus = formSettings.temp.focus; vm.focus = formSettings.temp.focus;
vm.tags = formSettings.temp.tags;
return formSettings; return formSettings;
} }
function saveFormSettings(vm) { function saveFormSettings(vm) {
const formSettings = window.$gz.form.getFormSettings(FORM_KEY); const formSettings = window.$gz.form.getFormSettings(FORM_KEY);
formSettings.temp = { viewType: vm.viewType, focus: vm.focus }; formSettings.temp = { viewType: vm.viewType, focus: vm.focus, tags: vm.tags };
window.$gz.form.setFormSettings(FORM_KEY, formSettings); window.$gz.form.setFormSettings(FORM_KEY, formSettings);
} }