Skip to content

Commit

Permalink
Semantic tables for invoices
Browse files Browse the repository at this point in the history
Added logic to fetch event-invoice data & filters

Fix eslint issues

Added date paid

Fixed ESlint issues
  • Loading branch information
mrsaicharan1 committed Jul 4, 2019
1 parent 928f7d1 commit b66aff9
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 5 deletions.
34 changes: 34 additions & 0 deletions app/controllers/account/billing-info/invoices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Controller from '@ember/controller';
import { filterBy } from '@ember/object/computed';
import moment from 'moment';
import { computed } from '@ember/object';

export default Controller.extend({
dueInvoices : filterBy('model', 'status', 'due'),
paidInvoices : filterBy('model', 'status', 'paid'),
upcomingInvoices : computed(function() {
let filterOptions = [];
filterOptions = [
{
and: [
{
name : 'deleted-at',
op : 'eq',
val : null
},
{
name : 'created-at',
op : 'ge',
val : moment().subtract(30, 'days').toISOString()
}
]
}
];
return this.store.query('event-invoice', {
filter : filterOptions,
include : 'event'
});

})

});
5 changes: 5 additions & 0 deletions app/routes/account/billing-info/invoices.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import Route from '@ember/routing/route';

export default Route.extend({
model() {
return this.store.query('event-invoice', {
include: 'event'
});
}
});
78 changes: 73 additions & 5 deletions app/templates/account/billing-info/invoices.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,82 @@
<div class="ui grid stackable">
<div class="thirteen wide column">
<div class="sixteen wide column">
<h2 class="ui header column">{{t 'Due Invoices'}}</h2>
<table class="ui stackable structured celled compact table">
<thead>
<tr>
<th>Invoice ID</th>
<th>Event Name</th>
<th>Date Issued</th>
<th>Amount</th>
<th>View Invoice</th>
</tr>
</thead>
<tbody>
{{#each dueInvoices as |dueInvoice|}}
<tr>
<td>{{dueInvoice.identifier}}</td>
<td>{{dueInvoice.event.name}}</td>
<td>{{dueInvoice.createdAt}}</td>
<td>{{dueInvoice.amount}}</td>
<td><button class="ui button primary">{{t 'View Invoice'}}</button></td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<div class="ui hidden divider"></div>
<div class="thirteen wide column">
<h2 class="ui header column">{{t 'Upcoming Invoices'}}</h2>
<div class="sixteen wide column">
<h2 class="ui header column">{{t 'Paid Invoices'}}</h2>
<table class="ui stackable structured celled compact table">
<thead>
<tr>
<th>Invoice ID</th>
<th>Event Name</th>
<th>Date Issued</th>
<th>Amount</th>
<th>Date Paid</th>
<th>View Invoice</th>
</tr>
</thead>
<tbody>
{{#each paidInvoices as |paidInvoice|}}
<tr>
<td>{{paidInvoice.identifier}}</td>
<td>{{paidInvoice.event.name}}</td>
<td>{{paidInvoice.createdAt}}</td>
<td>{{dueInvoice.amount}}</td>
<td><button class="ui button primary">{{t 'View Invoice'}}</button></td>
<td>{{paidInvoice.completedAt}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<div class="ui hidden divider"></div>
<div class="thirteen wide column">
<h2 class="ui header column">{{t 'Paid Invoices'}}</h2>
<div class="sixteen wide column">
<h2 class="ui header column">{{t 'Upcoming Invoices'}}</h2>
<table class="ui stackable structured celled compact table">
<thead>
<tr>
<th>Invoice ID</th>
<th>Event Name</th>
<th>Date Issued</th>
<th>Amount Due</th>
<th>View Invoice</th>
</tr>
</thead>
<tbody>
{{#each upcomingInvoices as |upcomingInvoice|}}
<tr>
<td>{{upcomingInvoice.identifier}}</td>
<td>{{upcomingInvoice.event.name}}</td>
<td>{{upcomingInvoice.createdAt}}</td>
<td>{{upcomingInvoice.amount}}</td>
<td><button class="ui button primary">{{t 'View Invoice'}}</button></td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<div class="ui hidden divider"></div>
</div>

0 comments on commit b66aff9

Please sign in to comment.