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