This commit is contained in:
2020-07-28 21:00:51 +00:00
parent 2c850d68ab
commit 65e3540b59
7 changed files with 59 additions and 29 deletions

View File

@@ -13,11 +13,10 @@ ____________
todo: Extensions from single edit forms??
todo: direct notification extension
todo: from User form be able to send a direct notification to that user
todo: from users list form extension for direct notification
todo: from adm-user form be able to send a direct notification to that user
todo: from adm-users list form extension (or just a menu link?) for direct notification
todo: notification system docs todo: notification system docs

View File

@@ -228,7 +228,8 @@ export default {
"TimeSpanDays", "TimeSpanDays",
"TimeSpanHours", "TimeSpanHours",
"TimeSpanMinutes", "TimeSpanMinutes",
"TimeSpanSeconds" "TimeSpanSeconds",
"DirectNotification"
], ],
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

View File

@@ -608,6 +608,19 @@ async function clickHandler(menuItem) {
}); });
} }
break; break;
case "directnotify":
//nav to direct notify with list of users appended to route
if (m.vm.obj.id == 0) {
m.vm.$router.push({
name: "home-notify-direct"
});
} else {
m.vm.$router.push({
name: "home-notify-direct",
params: { userIdList: m.vm.obj.id }
});
}
break;
default: default:
window.$gz.eventBus.$emit( window.$gz.eventBus.$emit(
"notify-warning", "notify-warning",
@@ -692,6 +705,13 @@ function generateMenu(vm) {
}); });
} }
menuOptions.menuItems.push({
title: "DirectNotification",
icon: "fa-comment-alt",
key: FORM_KEY + ":directnotify",
vm: vm
});
window.$gz.eventBus.$emit("menu-change", menuOptions); window.$gz.eventBus.$emit("menu-change", menuOptions);
} }

View File

@@ -66,6 +66,19 @@ async function clickHandler(menuItem) {
case "extensions": case "extensions":
let res = await m.vm.$refs.extensions.open(); let res = await m.vm.$refs.extensions.open();
break; break;
case "directnotify":
//nav to direct notify with list of users appended to route
if (m.vm.selectedItems.length == 0) {
m.vm.$router.push({
name: "home-notify-direct"
});
} else {
m.vm.$router.push({
name: "home-notify-direct",
params: { userIdList: m.vm.selectedItems.toString() }
});
}
break;
default: default:
window.$gz.eventBus.$emit( window.$gz.eventBus.$emit(
"notify-warning", "notify-warning",
@@ -123,6 +136,13 @@ function generateMenu(vm) {
vm: vm vm: vm
}); });
menuOptions.menuItems.push({
title: "DirectNotification",
icon: "fa-comment-alt",
key: FORM_KEY + ":directnotify",
vm: vm
});
window.$gz.eventBus.$emit("menu-change", menuOptions); window.$gz.eventBus.$emit("menu-change", menuOptions);
} }
</script> </script>

View File

@@ -314,8 +314,7 @@ async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([ await window.$gz.translation.cacheTranslations([
"NotifySubscription", "NotifySubscription",
"Server", "Server",
"Notifications", "Notifications"
"DirectNotification"
]); ]);
} }

View File

@@ -161,8 +161,6 @@ export default {
} }
}, },
closeChip(item) { closeChip(item) {
// console.log(item);
// debugger;
let i = this.toUsers.findIndex(z => z.id == item.id); let i = this.toUsers.findIndex(z => z.id == item.id);
if (i != -1) { if (i != -1) {
this.toUsers.splice(i, 1); this.toUsers.splice(i, 1);
@@ -318,7 +316,17 @@ async function fetchTranslatedText(vm) {
// Pre fill if pre-selected users // Pre fill if pre-selected users
// //
async function preFillSelection(vm) { async function preFillSelection(vm) {
let l = vm.$route.params.userIdList.split(",").map(z => parseInt(z, 10)); var idParam = vm.$route.params.userIdList;
let l = [];
if (idParam.includes(",")) {
//just a random list of user ids seperated by commas
l = idParam.split(",").map(z => parseInt(z, 10));
} else {
//single value
l.push(parseInt(idParam, 10));
}
//l = window.$gz._.uniq(l);
//iterate the array, fetch and store each user returned from //iterate the array, fetch and store each user returned from
//pick-list/List?ayaType=3&preId=[IDVALUE] //pick-list/List?ayaType=3&preId=[IDVALUE]
//into vm.toUsers //into vm.toUsers
@@ -327,7 +335,7 @@ async function preFillSelection(vm) {
continue; continue;
} }
let res = await window.$gz.api.get("pick-list/List?ayaType=3&preId=" + i); let res = await window.$gz.api.get("pick-list/List?ayaType=3&preId=" + i);
if (res.data) { if (res.data && res.data.length > 0) {
vm.toUsers.push(res.data[0]); vm.toUsers.push(res.data[0]);
} }
} }

View File

@@ -1,11 +1,5 @@
<template> <template>
<v-container fluid> <v-container fluid>
<gz-extensions
:ayaType="ayType"
:selectedItems="selectedItems"
ref="extensions"
>
</gz-extensions>
<gz-report-selector ref="reportSelector"></gz-report-selector> <gz-report-selector ref="reportSelector"></gz-report-selector>
<!-- {{ formState }} --> <!-- {{ formState }} -->
<v-row v-if="formState.ready"> <v-row v-if="formState.ready">
@@ -363,8 +357,7 @@ export default {
serverError: {} serverError: {}
}, },
rights: window.$gz.role.defaultRightsObject(), rights: window.$gz.role.defaultRightsObject(),
ayaType: window.$gz.type.Widget, ayaType: window.$gz.type.Widget
selectedItems: [$route.params.recordid]
}; };
}, },
//WATCHERS //WATCHERS
@@ -635,9 +628,6 @@ async function clickHandler(menuItem) {
case "duplicate": case "duplicate":
m.vm.duplicate(); m.vm.duplicate();
break; break;
case "extensions":
let res = await m.vm.$refs.extensions.open();
break;
case "report": case "report":
if (m.id != null) { if (m.id != null) {
//last report selected //last report selected
@@ -748,13 +738,6 @@ function generateMenu(vm) {
}); });
} }
menuOptions.menuItems.push({
title: "Extensions",
icon: "fa-puzzle-piece",
key: FORM_KEY + ":extensions",
vm: vm
});
window.$gz.eventBus.$emit("menu-change", menuOptions); window.$gz.eventBus.$emit("menu-change", menuOptions);
} }