From a132ebebe9f518d5692e726ff303563003aeaf89 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 28 Jul 2020 17:45:57 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 1 - ayanova/src/router.js | 2 +- ayanova/src/views/home-notify-direct.vue | 25 +++++++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index d6489e7f..54917ac1 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -11,7 +11,6 @@ ____________ ## CURRENT STAGE: -todo: subject for direct notification? (old quick notify had subject line and would substitute "QuickNotification" if no subject was typed) todo: direct notification edit form accept array of user id's to preselect This way other forms can prepopulate userlist based on their requirements and status diff --git a/ayanova/src/router.js b/ayanova/src/router.js index 3e5c3c2c..a38725b4 100644 --- a/ayanova/src/router.js +++ b/ayanova/src/router.js @@ -106,7 +106,7 @@ export default new Router({ ) }, { - path: "/home-notify-direct", + path: "/home-notify-direct/:userIdList?", name: "home-notify-direct", component: () => import( diff --git a/ayanova/src/views/home-notify-direct.vue b/ayanova/src/views/home-notify-direct.vue index 92c0b51f..c87839d0 100644 --- a/ayanova/src/views/home-notify-direct.vue +++ b/ayanova/src/views/home-notify-direct.vue @@ -3,7 +3,7 @@ - + {{ toUsers }} @@ -68,6 +68,7 @@ export default { vm.rights = window.$gz.role.fullRightsObject(); generateMenu(vm); + vm.formState.ready = true; window.$gz.form.setFormState({ vm: vm, @@ -294,6 +295,11 @@ function generateMenu(vm) { // async function initForm(vm) { await fetchTranslatedText(vm); + console.log("userIdList is ", vm.$route.params.userIdList); + if (vm.$route.params.userIdList != undefined) { + //userIdList is 1,2,3,4 + await preFillSelection(vm); + } } ////////////////////////////////////////////////////////// @@ -308,4 +314,21 @@ async function fetchTranslatedText(vm) { "MemoToID" ]); } + +////////////////////////////////////////////////////////// +// +// Pre fill if pre-selected users +// +async function preFillSelection(vm) { + //iterate the list + //vm.$route.params.userIdList; + // let temp = new Array(); + // temp = vm.$route.params.userIdList.split(","); + // for (a in temp) { + // temp[a] = parseInt(temp[a], 10); // Explicitly include base as per Álvaro's comment + // } + + let t = vm.$route.params.userIdList.split(",").map(z => parseInt(z, 10)); + console.log("Prefill selection array is", t); +}