Thank you so much - it is working now!
Posts made by John Backer
-
RE: Trying to get an API call to work using JSReport Online
-
RE: Trying to get an API call to work using JSReport Online
ok, I figured that one out - it was my directory structure. I think my last error is:
Mixed Content: The page at '.......' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://jsreportonline.net/sign'. This request has been blocked; the content must be served over HTTPS. Was I supposed to remove the login lines?
-
RE: Trying to get an API call to work using JSReport Online
Thanks, I really appreciate all the help.
I believe I made the changes you indicated, but I'm getting this in the console:
https://qtis.jsreportonline.net/api/report 404 (Not Found)
(anonymous) @ VM292:1
(anonymous) @ jsreport.min.js:2
_renderAsync @ jsreport.min.js:2
renderAsync @ jsreport.min.js:2
generateReport @ TestJSReport.html:123
onclick @ TestJSReport.html:6
TestJSReport.html:139 Error while executing render request -
RE: Trying to get an API call to work using JSReport Online
I cleared by browser cache and added a new user with read access to the template...
Error: Unable to find specified template or user doesnt have permissions to read it: TimeSheet
at module.exports (/usr/src/app/node_modules/jsreport-core/lib/util/createError.js:11:13)
at Reporter.createError (/usr/src/app/node_modules/jsreport-core/lib/reporter.js:332:12)
at AsyncFunction.<anonymous> (/usr/src/app/node_modules/jsreport-templates/lib/templates.js:134:20)It looks like I have a folder of TimeSheet and inside that there is another TimeSheet with all the parts of the project...but it won't let me copy all the components up to the first level...
-
RE: Trying to get an API call to work using JSReport Online
This thread will give all newbies all they need :)
That worked, but when it presented an authentication dialog and I provided my admin credentials from my admin account I get:
Error: Unable to find specified template or user doesnt have permissions to read it: TimeSheet
at module.exports (/usr/src/app/node_modules/jsreport-core/lib/util/createError.js:11:13)
at Reporter.createError (/usr/src/app/node_modules/jsreport-core/lib/reporter.js:332:12)
at AsyncFunction.<anonymous> (/usr/src/app/node_modules/jsreport-templates/lib/templates.js:134:20)I imagine I need to clear my browser cache because it isn't give me a chance to enter new credentials...
-
RE: Trying to get an API call to work using JSReport Online
Ok, getting further, but now I'm getting an error that the $ is undefined...
jsreport.render($("#placeholder"), request); -
RE: Trying to get an API call to work using JSReport Online
The console is saying that jsreport is not defined.
-
RE: Trying to get an API call to work using JSReport Online
Thanks for the feedback. I tried implementing what you suggested, but it still doing the same thing...nothing. How do we debug this?
-
Trying to get an API call to work using JSReport Online
Having trouble understanding what I'm missing here - when I show the page from a subdomain of ours and click the button nothing happens. Is the URL correct - does it always look like this and the template name is used to choose what report is to be ran. Is there any way to authenticate access to the report? Just using same example Json - just trying to get the API call to work. I removed [our-unique-code] to share this publically. Do I need to include some code for "jsreport.render" to work?
Thank you for your time!
'''
<html>
<head></head>
<body>
<input type="button" title="test" onclick="generateReport();" value="Get PDF Report"/>
<div id="placeholder" style="height:900px;"></div>
<script>
jsreport.serverUrl = 'https://[our-unique-code].jsreportonline.net/api/report';
//URL path in which jsreport server runs
/* For the sample purpose, the below JSON can be used. But in real time this data should come from Web API calls */var outputJSON = { "employee": "john", "address": { "streetaddress": "101 E Main Ave", "address2": " ", "citystzip": "Tucson, AZ 85701" }, "employeephone": "(520)360-1217", "employeeemail": "john@zinatt.com", "payperiodending": "10/29/2021", "rows": [{ "day": "Week# 44, Mon 10/18/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 44, Tue 10/19/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 44, Wed 10/20/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 44, Thu 10/21/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 },{ "day": "Week# 44, Fri 10/22/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 45, Mon 10/25/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 45, Tue 10/26/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 45, Wed 10/27/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 45, Thu 10/28/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }, { "day": "Week# 45, Fri 10/29/21", "regularhours": 8, "travel": 100, "expense": 25.00, "casenumber": "John Demo", "total": 425.00 }], "rateperhour": 50.00, "milecost": 0.52, "totalhours": 80, "totaltravel": 800, "totalexpenses":200.00, "totalpay": 4000.00, "travelcost": 416.00, "grandtotal": 4616.00
}
function generateReport() { var request = { template: { name: 'TimeSheet' }, data: outputJSON }; jsreport.render($("#placeholder"), request); // here ”placeholder” is div tag name in html page }
</script>
</body>
</html>
''' -
RE: local copy (which works fine) imported into JSReportOnline - results in errors
Thanks for your help - this got me over that hump!
-
local copy (which works fine) imported into JSReportOnline - results in errors
Newbie question here. I was using the downloaded version of JSReport for a while. I just started with JSReportOnline. When I take my first project (that is working fine) and export it from my local install and upload it online, I'm getting errors. I'm assuming it might have something to do with changes brought about by version 3 being released.
Error messages being shown below:
Error while executing templating engine. Missing helper: "asset"
Error: Missing helper: "asset"
at Object.<anonymous> (/app/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19:13)
at Object.wrapper (/app/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
at Object.eval [as main] (eval at createFunctionContext (/app/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:262:23), <anonymous>:9:100)
at main (/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
at ret (/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
at ret (/app/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
at /app/node_modules/jsreport-handlebars/lib/handlebarsEngine.js:33:20
at Object.base.apply (/app/node_modules/vm2/lib/contextify.js:469:32)
at evaluate-template-engine.js:1:64
at Script.runInContext (vm.js:131:20)What am I missing?
Code below:
'''
<html>
<head>
<style>
{{asset ./timesheet-styles.css}}
</style>
</head>
<body><table>
<tr>
<td width="30%"><img src="{{asset ./logo.jpg "dataURI"}}" style="width:100%; max-width:200px;" /></td>
<td width="10%" style="text-align:right"><h2>Time Card</h2></td>
</tr>
</table>
<br>
<table>
<tr>
<td>Employee: </td>
<td>{{employee}}</td>
<td width="25%"></td>
<td>Manager:</td>
<td>Brian A</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Street Address:</td>
<td>{{address.streetaddress}}</td>
<td width="25%"></td>
<td>Employee Phone:</td>
<td>{{employeephone}}</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Address 2:</td>
<td>{{address.address2}}</td>
<td></td>
<td>Employee Email:</td>
<td>{{employeeemail}}</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>City, ST Zip Code:</td>
<td>{{address.citystzip}}</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Pay Period Ending:</td>
<td>{{payperiodending}}</td>
</tr>
</table>
<br>
<br>
<table id="list" width="100%">
<tr>
<th style="text-align:center">Day</th>
<th style="text-align:left">Regular Hours</th>
<th style="text-align:center">Travel</th>
<th style="text-align:center">Expense</th>
<th style="text-align:center">Case #</th>
<th style="text-align:center">Total</th>
</tr>
{{#each rows}}
<tr width="100%">
<td width="20%">{{day}}</td>
<td width="10%" style="text-align:center">{{regularhours}}</td>
<td width="10%" style="text-align:center">{{travel}}</td>
<td width="10%" style="text-align:center">${{expense}}</td>
<td width="10%" style="text-align:center">{{casenumber}}</td>
<td width="10%" style="text-align:center">${{total}}</td>
</tr>
{{/each}}
</table>
<table id="totals" width="100%">
<tr>
<td width="20%">Totals</td>
<td width="10%" style="text-align:center">{{totalhours}}</td>
<td width="10%" style="text-align:center">{{totaltravel}}</td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
<tr>
<td>Rate Per Hour/Mile</td>
<td style="text-align:center">${{rateperhour}}</td>
<td style="text-align:center">${{milecost}}</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Total Pay</td>
<td style="text-align:center">${{totalpay}}</td>
<td style="text-align:center">${{travelcost}}</td>
<td style="text-align:center">${{totalexpenses}}</td>
<td></td>
<td style="text-align:center">${{grandtotal}}</td>
</tr>
</table>
<br>
<table>
<tr>
<td>Employee Signature:</td>
<td></td>
<td>Date</td>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Manager Signature:</td>
<td></td>
<td>Date</td>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Comments: </td>
<td class="special">For direct deposit to be in your account by the 15th of each month and the 30th of each month, time sheets must be turned in on the 10th of each month and the 25th of each month. (Example)Your time sheet should reflect the 25th of each month through the 10th of each month and the 11th of each month to the 24th of each month. Please make all times in half our increments (ie. 1.5, 3.0, etc.). This timesheet will allow you e-sign under signature and fill in date. I will fill in travel hours, so all you will need to fill in is date, hours, case number.</td>
</tr>
</table>
</body>
</html>
'''