This commit is contained in:
2020-09-02 18:53:07 +00:00
parent 899b7dfef4
commit bdb5668180
2 changed files with 57 additions and 23 deletions

View File

@@ -9,6 +9,7 @@ todo: chunk-vendors has fa-brands in it which is fucking huge, what else is in t
This could be a big breaking change so need to do it carefully and all at once as it's own project
Definitely need to do though, it will save a lot of size to just include the actual icons I'm using which is a handful
todo: Why is the delete button pushed to be exposed all the time, surely it's not that commonly used?
REPORTING

View File

@@ -34,18 +34,12 @@
<v-btn value="rawData" v-if="reportData != null">
{{ $ay.t("ReportEditorData") }}
</v-btn>
<v-btn value="test" v-if="reportData != null">
{{ $ay.t("ReportEditorTestRun") }}
</v-btn>
</v-btn-toggle>
</v-col>
<v-col cols="12" v-show="view == 'edit'">
<div id="editContainer"></div>
</v-col>
<v-col cols="12" v-show="view == 'test'">
<div id="testContainer">test</div>
</v-col>
<v-col cols="12" v-show="view == 'properties'">
<v-form ref="form">
<v-row>
@@ -125,6 +119,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import * as monaco from "monaco-editor";
//jsreport demo
//https://playground.jsreport.net/w/admin/hBfqC7af
//jsreport text editor source
@@ -408,9 +403,6 @@ Handlebars.registerHelper('loud', function (aString) {
case "properties":
//no state to save here
break;
case "testrun":
//no state to save here
break;
case "template":
vm.editData.template.state = currentState;
break;
@@ -433,11 +425,6 @@ Handlebars.registerHelper('loud', function (aString) {
case "properties":
vm.view = "properties";
break;
case "test":
//render to the div
testRender(vm);
vm.view = "test";
break;
case "template":
editor.setModel(vm.editData.template.model);
editor.restoreViewState(vm.editData.template.state);
@@ -672,6 +659,48 @@ Handlebars.registerHelper('loud', function (aString) {
});
let url = "report/duplicate/" + vm.$route.params.recordid;
try {
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.upsert(url);
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
//Navigate to new record
this.$router.push({
name: "ay-report-edit",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
}
});
}
} catch (ex) {
window.$gz.errorHandler.handleFormError(ex, vm);
} finally {
window.$gz.form.setFormState({
vm: vm,
loading: false
});
}
},
async render() {
let vm = this;
//test open new window for test url
window.open("http://localhost:7575/api/v8/report/poc", "_blank");
//
return;
if (vm.$route.params.recordid == 0) {
return;
}
window.$gz.form.setFormState({
vm: vm,
loading: true
});
let url = "report/duplicate/" + vm.$route.params.recordid;
try {
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.upsert(url);
@@ -726,6 +755,9 @@ async function clickHandler(menuItem) {
case "duplicate":
m.vm.duplicate();
break;
case "report":
m.vm.render();
break;
default:
window.$gz.eventBus.$emit(
@@ -762,11 +794,19 @@ function generateMenu(vm) {
});
}
menuOptions.menuItems.push({
title: "Report",
icon: "fa-file-alt",
key: FORM_KEY + ":report",
surface: true,
vm: vm
});
if (vm.rights.delete && vm.$route.params.recordid != 0) {
menuOptions.menuItems.push({
title: "Delete",
icon: "fa-trash-alt",
surface: true,
surface: false,
key: FORM_KEY + ":delete",
vm: vm
});
@@ -867,11 +907,4 @@ async function fetchReportData(vm) {
vm.reportData = res.data;
}
}
/////////////////////////////////
//
//
async function testRender(vm) {
alert("TEST RENDER");
}
</script>