This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
:search-input.sync="searchEntry"
|
||||
:filter="customFilter"
|
||||
hide-no-data
|
||||
:clearable="!readonly"
|
||||
:clearable="!readonly && canClear"
|
||||
:no-filter="isTagFilter"
|
||||
:append-icon="errorIcon"
|
||||
@click:append="handleErrorClick"
|
||||
@@ -76,8 +76,12 @@ export default {
|
||||
showEditIcon: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
allowNoSelection: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
|
||||
canClear:{type: Boolean, default: true},
|
||||
label: { type: String, default: "" }
|
||||
},
|
||||
watch: {
|
||||
@@ -166,9 +170,11 @@ export default {
|
||||
e = window.$gz.form.getNoSelectionItem(true);
|
||||
}
|
||||
|
||||
this.lastSelection = e;
|
||||
|
||||
//this is required for the control to update and parent form to detect it
|
||||
this.$emit("input", e.id);
|
||||
this.lastSelection = e;
|
||||
|
||||
},
|
||||
fetchValueIfNotPresent() {
|
||||
//is there a value that might require fetching?
|
||||
@@ -274,7 +280,9 @@ export default {
|
||||
return Promise.reject(res);
|
||||
}
|
||||
vm.searchResults = res.data;
|
||||
if(vm.allowNoSelection){
|
||||
window.$gz.form.addNoSelectionItem(vm.searchResults, true);
|
||||
}
|
||||
vm.replaceLastSelection();
|
||||
} catch (err) {
|
||||
window.$gz.errorHandler.handleFormError(err);
|
||||
|
||||
@@ -33,6 +33,32 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<!-- </v-col>
|
||||
<v-col cols="12"> -->
|
||||
<v-select
|
||||
:items="selectedUsers"
|
||||
:value="selectedUsers"
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
multiple
|
||||
chips
|
||||
deletable-chips
|
||||
:label="$ay.t('MemoToID')"
|
||||
data-cy="selectedUsersInput"
|
||||
></v-select>
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().User"
|
||||
v-model="selectedUser"
|
||||
:allowNoSelection="false"
|
||||
:canClear="false"
|
||||
:label="$ay.t('User')"
|
||||
ref="userid"
|
||||
data-cy="userid"
|
||||
@input="userSelected"
|
||||
></gz-pick-list>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="obj.name"
|
||||
@@ -139,13 +165,12 @@ export default {
|
||||
await initForm(vm);
|
||||
|
||||
vm.rights = window.$gz.role.getRights(window.$gz.type.Memo);
|
||||
// vm.formState.readOnly = !vm.rights.change;
|
||||
vm.formState.readOnly = false; //can always do things with your own memos
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
|
||||
//id 0 means create a new record don't load one
|
||||
if (vm.$route.params.recordid != 0) {
|
||||
vm.composing = false;
|
||||
vm.formState.readOnly = true;
|
||||
//is there already an obj from a prior operation?
|
||||
if (this.$route.params.obj) {
|
||||
//yes, no need to fetch it
|
||||
@@ -160,7 +185,6 @@ export default {
|
||||
} else {
|
||||
//NEW MEMO, set defaults
|
||||
vm.composing = true;
|
||||
vm.formState.readOnly = false;
|
||||
vm.obj.fromId = window.$gz.store.state.userId;
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
@@ -230,7 +254,9 @@ export default {
|
||||
},
|
||||
rights: window.$gz.role.defaultRightsObject(),
|
||||
ayaType: window.$gz.type.Memo,
|
||||
composing: false
|
||||
composing: false,
|
||||
selectedUsers: [],
|
||||
selectedUser: null
|
||||
};
|
||||
},
|
||||
//WATCHERS
|
||||
@@ -261,6 +287,17 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
userSelected(e) {
|
||||
let vm = this;
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
let user = vm.$refs.userid.getFullSelectionValue();
|
||||
if (vm.selectedUsers.find(z => z.id == user.id)) {
|
||||
return;
|
||||
}
|
||||
vm.selectedUsers.push(user);
|
||||
},
|
||||
canSave: function() {
|
||||
return this.formState.valid && this.formState.dirty;
|
||||
},
|
||||
@@ -508,7 +545,7 @@ function generateMenu(vm) {
|
||||
menuItems: []
|
||||
};
|
||||
|
||||
if (vm.rights.change) {
|
||||
if (vm.composing) {
|
||||
menuOptions.menuItems.push({
|
||||
title: "Save",
|
||||
icon: "$ayiSave",
|
||||
@@ -518,7 +555,7 @@ function generateMenu(vm) {
|
||||
});
|
||||
}
|
||||
|
||||
if (vm.rights.delete && vm.$route.params.recordid != 0) {
|
||||
if (!vm.composing) {
|
||||
menuOptions.menuItems.push({
|
||||
title: "Delete",
|
||||
icon: "$ayiTrashAlt",
|
||||
@@ -600,6 +637,7 @@ async function fetchTranslatedText(vm) {
|
||||
"MemoSubject",
|
||||
"MemoMessage",
|
||||
"MemoToID",
|
||||
"User",
|
||||
"MemoFromID",
|
||||
"MemoSent",
|
||||
"MemoForward",
|
||||
|
||||
Reference in New Issue
Block a user