-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added logic to fetch event-invoice data & filters Fix eslint issues Added date paid Fixed ESlint issues
- Loading branch information
1 parent
928f7d1
commit b66aff9
Showing
3 changed files
with
112 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
}); | ||
|
||
}) | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |