This commit is contained in:
@@ -732,6 +732,29 @@ export default {
|
||||
sessionStorage.setItem(formKey, JSON.stringify(formSettings.temp));
|
||||
}
|
||||
}, ////////////////////////////////////
|
||||
// Get last report used from form settings
|
||||
//
|
||||
getLastReport(formKey) {
|
||||
let fs = window.$gz.store.state.formSettings[formKey];
|
||||
if (fs == null || fs.lastReport == null) {
|
||||
return null;
|
||||
}
|
||||
return fs.lastReport;
|
||||
}, ////////////////////////////////////
|
||||
// Set last report used in form settings
|
||||
//
|
||||
setLastReport(formKey, reportSelected) {
|
||||
let fs = window.$gz.store.state.formSettings[formKey];
|
||||
if (fs == null || fs.lastReport == null) {
|
||||
fs = {};
|
||||
}
|
||||
fs.lastReport = reportSelected;
|
||||
|
||||
window.$gz.store.commit("setFormSettings", {
|
||||
formKey: formKey,
|
||||
formSettings: fs
|
||||
});
|
||||
}, ////////////////////////////////////
|
||||
// Add no selection item
|
||||
// Used by forms that need the option of an unselected
|
||||
// item in a pick list
|
||||
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
//get report list from server
|
||||
//for now we'll fake it
|
||||
let fakeReportList = [];
|
||||
for (let i = 0; i < 255; i++) {
|
||||
for (let i = 0; i < 25; i++) {
|
||||
fakeReportList.push({
|
||||
name: "Fake report with the number " + i,
|
||||
id: i
|
||||
|
||||
@@ -585,14 +585,12 @@ function clickHandler(menuItem) {
|
||||
if (res == null) {
|
||||
return;
|
||||
}
|
||||
alert("STUB: view report " + res.name);
|
||||
|
||||
//if not null then persist this choice in formstate in vuex
|
||||
//res.id = report id
|
||||
//res.name = report name
|
||||
//DON"T NEED to regenerate menu because we're leaving this form anyway and it will generate on return
|
||||
//persist last report selected
|
||||
window.$gz.form.setLastReport(FORM_KEY, res);
|
||||
|
||||
//Now open the report viewer...
|
||||
alert("STUB: view report " + res.name);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -650,15 +648,20 @@ function generateMenu(vm) {
|
||||
vm: vm
|
||||
});
|
||||
|
||||
//get last report selected
|
||||
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
||||
if (lastReport != null) {
|
||||
menuOptions.menuItems.push({
|
||||
title: lastReport.name,
|
||||
icon: "fa-file-alt",
|
||||
key: FORM_KEY + ":report:" + lastReport.id,
|
||||
vm: vm
|
||||
});
|
||||
}
|
||||
|
||||
//todo: get the last used report from the vuex form state and
|
||||
//insert it here if it exists.
|
||||
//was going to do multiple but that's a lot of fuckery and space eating
|
||||
menuOptions.menuItems.push({
|
||||
title: "stub: Last report used",
|
||||
icon: "fa-file-alt",
|
||||
key: FORM_KEY + ":report:STUBlastusedreportid",
|
||||
vm: vm
|
||||
});
|
||||
|
||||
if (vm.rights.change) {
|
||||
menuOptions.menuItems.push({
|
||||
|
||||
Reference in New Issue
Block a user