From d5964f8d14f68f072f8e3ca4b180c2cb54d20f76 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 27 Jul 2020 21:52:00 +0000 Subject: [PATCH] --- ayanova/src/views/home-notify-direct.vue | 26 ++++++++++++++----- .../src/views/home-notify-subscription.vue | 4 ++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ayanova/src/views/home-notify-direct.vue b/ayanova/src/views/home-notify-direct.vue index aa1825ee..821f8c43 100644 --- a/ayanova/src/views/home-notify-direct.vue +++ b/ayanova/src/views/home-notify-direct.vue @@ -10,7 +10,7 @@ 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; diff --git a/ayanova/src/views/home-notify-subscription.vue b/ayanova/src/views/home-notify-subscription.vue index 33f4ab58..480400f9 100644 --- a/ayanova/src/views/home-notify-subscription.vue +++ b/ayanova/src/views/home-notify-subscription.vue @@ -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) {