This commit is contained in:
2020-09-22 20:29:56 +00:00
parent 557e6c1e43
commit 34c9f4e485
4 changed files with 126 additions and 42 deletions

View File

@@ -22,6 +22,10 @@
{{ $ay.t("ReportEditorProperties") }}
</v-btn>
<v-btn value="pdfoptions">
{{ $ay.t("ReportPdfOptions") }}
</v-btn>
<v-btn value="template">
{{ $ay.t("ReportTemplate") }}
</v-btn>
@@ -114,6 +118,25 @@
</v-row>
</v-form>
</v-col>
<v-col cols="12" v-show="view == 'pdfoptions'">
<v-form ref="formPDF">
<v-row>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
v-model="obj.active"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:label="$ay.t('Active')"
ref="active"
:data-cy="!!$ay.dev ? 'active' : false"
:error-messages="form().serverErrors(this, 'active')"
@change="fieldValueChanged('active', 'formPDF')"
></v-checkbox>
</v-col>
</v-row>
</v-form>
</v-col>
</v-row>
</div>
</template>
@@ -320,7 +343,20 @@ export default {
Handlebars.registerHelper('loud', function (aString) {
return aString.toUpperCase()
})`,
renderType: 0
renderType: 0,
headerTemplate: null,
footerTemplate: null,
displayHeaderFooter: false,
paperFormat: 0,
landscape: false,
marginOptionsBottom: null,
marginOptionsLeft: null,
marginOptionsRight: null,
marginOptionsTop: null,
pageRanges: null,
preferCSSPageSize: false,
printBackground: false,
scale: 1
},
formState: {
ready: false,
@@ -337,6 +373,16 @@ Handlebars.registerHelper('loud', function (aString) {
rendering: false
};
},
/*{"data":{"id":10,"concurrency":19494847,"name":"test basic","active":true,"notes":"",
"roles":124927,"objectType":2,
"template":"<html>\n\n<body>\n\t{{#each ayReportData}}\n\t<h2>{{ Name }}</h2>\n\t<div>Notes: <span class='example'>{{ Notes }}</span></div>\n\t{{/each}}\n</body>\n\n</html>","style":".example {\n color: blue;\n}","jsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","jsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})",
"renderType":0,
"headerTemplate":null,"footerTemplate":null,"displayHeaderFooter":false,
"paperFormat":0,"landscape":false,"marginOptionsBottom":null,
"marginOptionsLeft":null,"marginOptionsRight":null,
"marginOptionsTop":null,"pageRanges":null,"preferCSSPageSize":false,
"printBackground":false,"scale":1}}
*/
//WATCHERS
watch: {
formState: {
@@ -403,6 +449,9 @@ Handlebars.registerHelper('loud', function (aString) {
case "properties":
//no state to save here
break;
case "pdfoptions":
//no state to save here
break;
case "template":
vm.editData.template.state = currentState;
break;
@@ -427,6 +476,10 @@ Handlebars.registerHelper('loud', function (aString) {
vm.view = "properties";
return;
break;
case "pdfoptions":
vm.view = "pdfoptions";
return;
break;
case "template":
editor.setModel(vm.editData.template.model);
editor.restoreViewState(vm.editData.template.state);
@@ -487,13 +540,13 @@ Handlebars.registerHelper('loud', function (aString) {
form() {
return window.$gz.form;
},
fieldValueChanged(ref) {
fieldValueChanged(ref, formReference) {
if (
this.formState.ready &&
!this.formState.loading &&
!this.formState.readOnly
) {
window.$gz.form.fieldValueChanged(this, ref);
window.$gz.form.fieldValueChanged(this, ref, formReference);
}
},
async getDataFromApi(recordId) {
@@ -919,6 +972,7 @@ async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([
"ReportDesignReport",
"ReportName",
"ReportPdfOptions",
"ReportEditorProperties",
"ReportEditorData",
"ReportEditorMobileWarning",