From bdb5668180fefc6232cb482a315473491d22d470 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 2 Sep 2020 18:53:07 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 1 + ayanova/src/views/ay-report-edit.vue | 79 ++++++++++++++++++++-------- 2 files changed, 57 insertions(+), 23 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index eb118017..fec48161 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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 diff --git a/ayanova/src/views/ay-report-edit.vue b/ayanova/src/views/ay-report-edit.vue index 6d4b8105..2770876e 100644 --- a/ayanova/src/views/ay-report-edit.vue +++ b/ayanova/src/views/ay-report-edit.vue @@ -34,18 +34,12 @@ {{ $ay.t("ReportEditorData") }} - - - {{ $ay.t("ReportEditorTestRun") }} -
- -
test
-
+ @@ -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"); -}