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