Skip to content

Commit

Permalink
added reports view. Still has issues with rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Walsh committed Mar 15, 2017
1 parent 10c879c commit b1c644a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/entities/accounting/report.js
Expand Up @@ -40,7 +40,11 @@ var Report = Entity.extend(ReportSchema, {
initialize: function(data, options) {},
fromXmlObj: function(obj) {
var self = this;
Object.assign(self, _.omit(obj, 'Rows', 'Cells'));
Object.assign(self, _.omit(obj, 'Rows', 'Cells', 'ReportTitles'));

if (obj.ReportTitles) {
this.extractArray(obj.ReportTitles.ReportTitle, this.ReportTitles);
}

if (hasMoreRows(obj)) {
//Loop through the rows to find the next level down
Expand Down
1 change: 1 addition & 0 deletions sample_app/index.js
Expand Up @@ -466,6 +466,7 @@ app.get('/reports', function(req, res) {
id: selectedReport
})
.then(function(report) {
console.log(report);
data.report = report;
res.render('reports', data);
})
Expand Down
20 changes: 20 additions & 0 deletions sample_app/views/reports.handlebars
@@ -1 +1,21 @@
<h3>{{report.ReportName}}</h3>

{{#each report.ReportTitles as |reportTitle|}}
<h5>{{reportTitle}}</h5>
{{/each}}
<br/>
{{#if report.Rows}}
<table class="table table-bordered table-striped table-collapsed">
{{#each report.Rows}}
<tr>
{{#if this.Cells}}
{{#each this.Cells}}
<td>{{this.Value}}</td>
{{/each}}
{{else}}
<td/>
{{/if}}
</tr>
{{/each}}
</table>
{{/if}}

0 comments on commit b1c644a

Please sign in to comment.