From 67eb78aa9fac8344cda22df893e1523f93acce6c Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 4 Sep 2020 15:19:30 +0000 Subject: [PATCH] --- .../components/report-selector-control.vue | 37 ++++++++++++++++++- ayanova/src/views/ay-report-edit.vue | 32 +++++----------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/ayanova/src/components/report-selector-control.vue b/ayanova/src/components/report-selector-control.vue index 2cb17508..4de15b2d 100644 --- a/ayanova/src/components/report-selector-control.vue +++ b/ayanova/src/components/report-selector-control.vue @@ -81,8 +81,41 @@ export default { } }); }, - renderReport(reportid) { - alert(`RENDER REPORT ${reportid}`); + async renderReport(reportId) { + let vm = this; + if (vm.$route.params.recordid == 0) { + return; + } + + /* + public class RenderReportParameter + { + public long ReportId { get; set; } + public long[] SelectedRowIds { get; set; } + public string DataListKey { get; set; } + public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList + } +*/ + let reportDataOptions = vm.reportDataOptions; + if (!reportDataOptions) { + throw "Missing report data unable to render report"; + } + reportDataOptions.ReportId = reportId; + + let url = "report/render"; + + let res = await window.$gz.api.upsert(url, reportDataOptions); + if (res.error) { + throw res.error; + } else { + let reportUrl = window.$gz.api.reportDownloadUrl(res.data); + //console.log("Report url:", reportUrl); + if (window.open(reportUrl, "Report") == null) { + throw "Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"; + } + } + this.isVisible = false; + this.resolve(null); }, async open(reportDataOptions) { let vm = this; diff --git a/ayanova/src/views/ay-report-edit.vue b/ayanova/src/views/ay-report-edit.vue index 66287f4f..242e6211 100644 --- a/ayanova/src/views/ay-report-edit.vue +++ b/ayanova/src/views/ay-report-edit.vue @@ -141,22 +141,26 @@ Immediately render last report code needs proper implementation for both widget "Design" translation should be "Report editor" diagnostic code that returns helpful information on render failure would be nice and cut way back on technical support hassles +(could actually render the errors to the page and still return it as a pdf?, though it's an api method that triggers it so can just return normal error style) need to modify reportData data object to accept meta data outside of the main data collection so can add all the bits that would appear on report potentially or be used on page like datalist name, filter options, what have you + also ayReportData object, should it be named something else? Does it even matter? need to ensure easy api access from report script, perhaps pass creds token into report along with report? creds as meta data? - - -ayReportData object, should it be named something else? Does it even matter? - +Ability to export / download and save entire report template as an independent object / file + and import again + .ayr8? Make up sample reports for widget that show off the basics including logo etc - make them auto generate with sample data in seeder + make them auto generate (import from files?) with sample data in seeder + +Make a working template with api methods being called + export as example Start thinking about currency formatting and date/time formatting etc. Maybe client can pass a function to server, or server can use exact same libs but can be initiated with specific locale from client? @@ -719,24 +723,6 @@ Handlebars.registerHelper('loud', function (aString) { }, async render() { let vm = this; - // //test open new window for test url - // // window.open("http://localhost:7575/api/v8/report/poc", "_blank"); - - // let pdf = await window.$gz.api.upsert("report/post-poc", { - // name: "TheSnatcher" - // }); - - // console.log("PDF: ", pdf); - // let reportUrl = window.$gz.api.reportDownloadUrl(pdf.data); - // console.log("Report url:", reportUrl); - // if (window.open(reportUrl, "ayreport") == null) { - // //window open failed, maybe popup blocker - // //show error to user - // //alert("ERROR OPENING REPORT WINDOW IN BROWSER"); - // } - // - // return; - if (vm.$route.params.recordid == 0) { return; }