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