fixed set last report menu item making save icon appear available

This commit is contained in:
2022-01-03 21:17:03 +00:00
parent 52866a4af8
commit 98af909019
97 changed files with 171 additions and 208 deletions

View File

@@ -914,7 +914,7 @@ export default {
}, ////////////////////////////////////
// Set last report used in form settings
//
setLastReport(formKey, reportSelected) {
setLastReportMenuItem(formKey, reportSelected, vm) {
let fs = window.$gz.store.state.formSettings[formKey];
if (fs == null) {
fs = {};
@@ -925,6 +925,14 @@ export default {
formKey: formKey,
formSettings: fs
});
window.$gz.eventBus.$emit("menu-upsert-last-report", {
title: reportSelected.name,
notrans: true,
icon: "$ayiFileAlt",
key: formKey + ":report:" + reportSelected.id,
vm: vm
});
}, ////////////////////////////////////
// Add no selection item
// Used by forms that need the option of an unselected

View File

@@ -200,25 +200,61 @@ export default {
});
}
},
///////////////////////////////
// CHANGE HANDLER
//Unused to date of beta 0.9
// ///////////////////////////////
// // CHANGE HANDLER
// //
// // Deal with a menu item update request
// // called from App.vue
// handleReplaceMenuItem(vm, newItem) {
// if (!vm.appBar.menuItems || !newItem) {
// return;
// }
// //Find the key that is in the collection and replace it
// for (let i = 0; i < vm.appBar.menuItems.length; i++) {
// if (vm.appBar.menuItems[i].key == newItem.key) {
// //NOTE: since we are adding a new object, it has no reactivity in it so we need to use the Vue.Set to set it which
// //automatically adds the setters and getters that trigger reactivity
// //If it was set directly on the array it wouldn't update the UI
// vm.$set(vm.appBar.menuItems, i, newItem);
// return;
// }
// }
// },
//////////////////////////////////////////////
// LAST REPORT CHANGE HANDLER
// update / add last report menu item
//
// Deal with a menu item update request
// called from App.vue
handleReplaceMenuItem(vm, newItem) {
handleUpsertLastReport(vm, newItem) {
if (!vm.appBar.menuItems || !newItem) {
return;
}
//Find the key that is in the collection and replace it
/*
window.$gz.eventBus.$emit("menu-upsert-last-report", {
title: reportSelected.name,
notrans: true,
icon: "$ayiFileAlt",
key: formKey + ":report:" + reportSelected.id,
vm: vm
});
*/
//Find the last report key and update it if present
for (let i = 0; i < vm.appBar.menuItems.length; i++) {
if (vm.appBar.menuItems[i].key == newItem.key) {
//NOTE: since we are adding a new object, it has no reactivity in it so we need to use the Vue.Set to set it which
//automatically adds the setters and getters that trigger reactivity
//If it was set directly on the array it wouldn't update the UI
vm.$set(vm.appBar.menuItems, i, newItem);
var key = vm.appBar.menuItems[i].key;
if (key && key.includes(":report:")) {
vm.appBar.menuItems[i].key = newItem.key;
vm.appBar.menuItems[i].title = newItem.title;
return;
}
}
//No prior last report so slot it in under the report one
for (let i = 0; i < vm.appBar.menuItems.length; i++) {
var key = vm.appBar.menuItems[i].key;
if (key && key.endsWith(":report")) {
vm.appBar.menuItems.splice(i + 1, 0, newItem);
}
}
},
///////////////////////////////
// ENABLE / DISABLE HANDLER
@@ -355,11 +391,19 @@ export default {
that.handleMenuChange(vm, ctx);
});
window.$gz.eventBus.$on("menu-replace-item", function handleReplaceMenuItem(
newItem
) {
that.handleReplaceMenuItem(vm, newItem);
});
//currently as of beta 0.9 unused anywhere
// window.$gz.eventBus.$on("menu-replace-item", function handleReplaceMenuItem(
// newItem
// ) {
// that.handleReplaceMenuItem(vm, newItem);
// });
window.$gz.eventBus.$on(
"menu-upsert-last-report",
function handleUpsertLastReport(newItem) {
that.handleUpsertLastReport(vm, newItem);
}
);
window.$gz.eventBus.$on("menu-disable-item", function handleDisableMenuItem(
key