This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().User"
|
||||
:showEditIcon="false"
|
||||
v-model="userId"
|
||||
v-model="pickListSelectedUserId"
|
||||
:label="$ay.t('UserList')"
|
||||
ref="userPickList"
|
||||
@input="checkSave()"
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
userId: null,
|
||||
pickListSelectedUserId: null,
|
||||
items: [],
|
||||
toUsers: [],
|
||||
message: null,
|
||||
@@ -147,7 +147,9 @@ export default {
|
||||
methods: {
|
||||
checkSave() {
|
||||
let hasSelection =
|
||||
this.toUsers.length > 0 || (this.userId != null && this.userId != 0);
|
||||
this.toUsers.length > 0 ||
|
||||
(this.pickListSelectedUserId != null &&
|
||||
this.pickListSelectedUserId != 0);
|
||||
let hasText = this.message != null && this.message != "";
|
||||
|
||||
this.formState.dirty = hasSelection && hasText;
|
||||
@@ -177,7 +179,7 @@ export default {
|
||||
}
|
||||
|
||||
this.toUsers.push(selected);
|
||||
this.userId = 0;
|
||||
this.pickListSelectedUserId = 0;
|
||||
this.checkSave();
|
||||
},
|
||||
ayaTypes: function() {
|
||||
@@ -194,12 +196,24 @@ export default {
|
||||
vm.formState.loading = true;
|
||||
|
||||
//always submit from this form for the current logged in user id
|
||||
let url = API_BASE_URL;
|
||||
let url = "notify/direct-message";
|
||||
|
||||
//clear any errors vm might be around from previous submit
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
try {
|
||||
let res = await window.$gz.api.upsert(url, vm.obj);
|
||||
let userIdList = [];
|
||||
if (vm.toUsers.length > 0) {
|
||||
vm.toUsers.forEach(z => {
|
||||
userIdList.push(z.id);
|
||||
});
|
||||
} else {
|
||||
//just accept the single userid in the pickLkist
|
||||
userIdList.push(vm.pickListSelectedUserId);
|
||||
}
|
||||
let res = await window.$gz.api.upsert(url, {
|
||||
users: userIdList,
|
||||
message: this.message
|
||||
});
|
||||
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
|
||||
@@ -422,6 +422,7 @@ export default {
|
||||
vm.formState.loading = false;
|
||||
} else {
|
||||
vm.obj = res.data;
|
||||
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm);
|
||||
|
||||
@@ -430,7 +431,8 @@ export default {
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
loading: false
|
||||
loading: false,
|
||||
readOnly: res.data.eventType == 27 && res.data.deliveryMethod == 1 //default in-app notification is read only
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user