-
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.
feat: Implemented event invoices for organizers
- Loading branch information
1 parent
2fe0e0c
commit aa2ad13
Showing
9 changed files
with
286 additions
and
33 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,4 @@ | ||
import Controller from '@ember/controller'; | ||
|
||
export default class extends Controller { | ||
} |
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,118 @@ | ||
import Controller from '@ember/controller'; | ||
import EmberTableControllerMixin from 'open-event-frontend/mixins/ember-table-controller'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default class extends Controller.extend(EmberTableControllerMixin) { | ||
@computed() | ||
get upcomingInvoiceColumns() { | ||
return [ | ||
{ | ||
name : 'Invoice ID', | ||
valuePath : 'id' | ||
}, | ||
{ | ||
name : 'Name', | ||
valuePath : 'event', | ||
cellComponent : 'ui-table/cell/events/cell-event-invoice' | ||
}, | ||
{ | ||
name : 'Date Issued', | ||
valuePath : 'createdAt' | ||
}, | ||
{ | ||
name : 'Outstanding Amount', | ||
valuePath : 'amount' | ||
}, | ||
{ | ||
name : 'View Invoice', | ||
valuePath : 'invoicePdfUrl' | ||
} | ||
]; | ||
} | ||
|
||
@computed() | ||
get paidInvoiceColumns() { | ||
return [ | ||
{ | ||
name : 'Invoice ID', | ||
valuePath : 'id' | ||
}, | ||
{ | ||
name : 'Name', | ||
valuePath : 'event', | ||
cellComponent : 'ui-table/cell/events/cell-event-invoice' | ||
}, | ||
{ | ||
name : 'Date Issued', | ||
valuePath : 'createdAt' | ||
}, | ||
{ | ||
name : 'Amount', | ||
valuePath : 'amount' | ||
}, | ||
{ | ||
name : 'Date Paid', | ||
valuePath : 'completedAt' | ||
}, | ||
{ | ||
name : 'View Invoice', | ||
valuePath : 'invoicePdfUrl' | ||
} | ||
|
||
]; | ||
|
||
|
||
} | ||
@computed() | ||
get dueInvoiceColumns() { | ||
return [ | ||
{ | ||
name : 'Invoice ID', | ||
valuePath : 'id' | ||
}, | ||
{ | ||
name : 'Name', | ||
valuePath : 'event', | ||
cellComponent : 'ui-table/cell/events/cell-event-invoice' | ||
|
||
}, | ||
{ | ||
name : 'Date Issued', | ||
valuePath : 'createdAt' | ||
}, | ||
{ | ||
name : 'Amount Due', | ||
valuePath : 'amount' | ||
}, | ||
{ | ||
name : 'View Invoice', | ||
valuePath : 'invoicePdfUrl' | ||
} | ||
|
||
]; | ||
} | ||
|
||
@computed() | ||
get allInvoiceColumns() { | ||
return [ | ||
{ | ||
name : 'Invoice ID', | ||
valuePath : 'id' | ||
}, | ||
{ | ||
name : 'Name', | ||
valuePath : 'event', | ||
cellComponent : 'ui-table/cell/events/cell-event-invoice' | ||
}, | ||
{ | ||
name : 'Amount', | ||
valuePath : 'amount' | ||
}, | ||
{ | ||
name : 'Status', | ||
valuePath : 'status' | ||
} | ||
|
||
]; | ||
} | ||
} |
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
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
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,72 @@ | ||
import Route from '@ember/routing/route'; | ||
import moment from 'moment'; | ||
import EmberTableRouteMixin from 'open-event-frontend/mixins/ember-table-route'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class extends Route.extend(EmberTableRouteMixin) { | ||
titleToken() { | ||
switch (this.params.invoice_status) { | ||
case 'paid': | ||
return this.l10n.t('Paid'); | ||
case 'due': | ||
return this.l10n.t('Due'); | ||
case 'upcoming': | ||
return this.l10n.t('Upcoming'); | ||
case 'all': | ||
return this.l10n.t('All'); | ||
} | ||
} | ||
async model(params) { | ||
this.set('params', params); | ||
const searchField = 'name'; | ||
let filterOptions = []; | ||
if (params.invoice_status === 'paid' || params.invoice_status === 'due') { | ||
filterOptions = [ | ||
{ | ||
name : 'status', | ||
op : 'eq', | ||
val : params.invoice_status | ||
} | ||
]; | ||
} else if (params.invoice_status === 'upcoming') { | ||
filterOptions = [ | ||
{ | ||
and: [ | ||
{ | ||
name : 'deleted-at', | ||
op : 'eq', | ||
val : null | ||
}, | ||
{ | ||
name : 'created-at', | ||
op : 'ge', | ||
val : moment().subtract(30, 'days').toISOString() | ||
} | ||
] | ||
} | ||
]; | ||
} | ||
|
||
filterOptions = this.applySearchFilters(filterOptions, params, searchField); | ||
|
||
let queryString = { | ||
include : 'event', | ||
filter : filterOptions, | ||
'page[size]' : params.per_page || 10, | ||
'page[number]' : params.page || 1 | ||
}; | ||
|
||
queryString = this.applySortFilters(queryString, params); | ||
|
||
return { | ||
eventInvoices: (await this.store.query('event-invoice', queryString)).toArray(), | ||
params | ||
|
||
}; | ||
|
||
} | ||
@action | ||
refreshRoute() { | ||
this.refresh(); | ||
} | ||
} |
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,23 @@ | ||
<div class="ui grid stackable"> | ||
<div class="thirteen wide column"> | ||
<h2 class="ui header column">{{t 'Due Invoices'}}</h2> | ||
<div class="row"> | ||
<div class="eight wide column"> | ||
{{#tabbed-navigation isNonPointing=true}} | ||
{{#link-to 'account.billing.invoices.list' 'all' class='item'}} | ||
{{t 'All'}} | ||
{{/link-to}} | ||
{{#link-to 'account.billing.invoices.list' 'due' class='item'}} | ||
{{t 'Due'}} | ||
{{/link-to}} | ||
{{#link-to 'account.billing.invoices.list' 'paid' class='item'}} | ||
{{t 'Paid'}} | ||
{{/link-to}} | ||
{{#link-to 'account.billing.invoices.list' 'upcoming' class='item'}} | ||
{{t 'Upcoming'}} | ||
{{/link-to}} | ||
{{/tabbed-navigation}} | ||
</div> | ||
</div> | ||
<div class="ui hidden divider"></div> | ||
<div class="thirteen wide column"> | ||
<h2 class="ui header column">{{t 'Upcoming Invoices'}}</h2> | ||
<div class="row"> | ||
{{outlet}} | ||
</div> | ||
<div class="ui hidden divider"></div> | ||
<div class="thirteen wide column"> | ||
<h2 class="ui header column">{{t 'Paid Invoices'}}</h2> | ||
</div> | ||
<div class="ui hidden divider"></div> | ||
</div> | ||
</div> |
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,65 @@ | ||
{{#if (eq model.params.invoice_status 'due') }} | ||
<div class="sixteen wide column"> | ||
{{tables/default columns=dueInvoiceColumns | ||
rows=model.eventInvoices | ||
currentPage=page | ||
pageSize=per_page | ||
searchQuery=search | ||
sortBy=sort_by | ||
sortDir=sort_dir | ||
metaData=model.eventInvoices.meta | ||
filterOptions=filterOptions | ||
widthConstraint="eq-container" | ||
resizeMode="fluid" | ||
fillMode="equal-column" | ||
}} | ||
</div> | ||
{{else if (eq model.params.invoice_status 'paid') }} | ||
<div class="sixteen wide column"> | ||
{{tables/default columns=paidInvoiceColumns | ||
rows=model.eventInvoices | ||
currentPage=page | ||
pageSize=per_page | ||
searchQuery=search | ||
sortBy=sort_by | ||
sortDir=sort_dir | ||
metaData=model.eventInvoices.meta | ||
filterOptions=filterOptions | ||
widthConstraint="eq-container" | ||
resizeMode="fluid" | ||
fillMode="equal-column" | ||
}} | ||
</div> | ||
{{else if (eq model.params.invoice_status 'upcoming') }} | ||
<div class="sixteen wide column"> | ||
{{tables/default columns=upcomingInvoiceColumns | ||
rows=model.eventInvoices | ||
currentPage=page | ||
pageSize=per_page | ||
searchQuery=search | ||
sortBy=sort_by | ||
sortDir=sort_dir | ||
metaData=model.eventInvoices.meta | ||
filterOptions=filterOptions | ||
widthConstraint="eq-container" | ||
resizeMode="fluid" | ||
fillMode="equal-column" | ||
}} | ||
</div> | ||
{{else if (eq model.params.invoice_status 'all') }} | ||
<div class="sixteen wide column"> | ||
{{tables/default columns=allInvoiceColumns | ||
rows=model.eventInvoices | ||
currentPage=page | ||
pageSize=per_page | ||
searchQuery=search | ||
sortBy=sort_by | ||
sortDir=sort_dir | ||
metaData=model.eventInvoices.meta | ||
filterOptions=filterOptions | ||
widthConstraint="eq-container" | ||
resizeMode="fluid" | ||
fillMode="equal-column" | ||
}} | ||
</div> | ||
{{/if}} |
3 changes: 3 additions & 0 deletions
3
app/templates/components/ui-table/cell/events/cell-event-invoice.hbs
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,3 @@ | ||
<div class="ui header weight-400"> | ||
<img src="{{if record.logoUrl record.logoUrl '/images/placeholders/Other.jpg'}}" alt="Event Logo" class="ui image"> <br> {{record.name}} | ||
</div> |
This file was deleted.
Oops, something went wrong.