add basic invoices page
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const Invoice = Discourse.Model.extend({
|
||||
@computed("created")
|
||||
createdFormatted(created) {
|
||||
return moment.unix(created).format();
|
||||
}
|
||||
});
|
||||
|
||||
Invoice.reopenClass({
|
||||
findAll() {
|
||||
return ajax("/patrons/invoices", { method: "get" }).then(result =>
|
||||
result.map(invoice => Invoice.create(invoice))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default Invoice;
|
||||
@@ -1,6 +1,8 @@
|
||||
import Invoice from "discourse/plugins/discourse-patrons/discourse/models/invoice";
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
model() {
|
||||
return {};
|
||||
return Invoice.findAll();
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
|
||||
<h3>{{i18n 'discourse_patrons.admin.dashboard.title'}}</h3>
|
||||
|
||||
{{#load-more selector=".discourse-patrons-admin tr" action=(action "loadMore")}}
|
||||
{{#load-more selector=".discourse-patrons-table tr" action=(action "loadMore")}}
|
||||
{{#if model}}
|
||||
<table class="table discourse-patrons-admin">
|
||||
<table class="table discourse-patrons-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{i18n 'discourse_patrons.admin.dashboard.table.head.user'}}</th>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
<table class="table discourse-patrons-admin">
|
||||
<table class="table discourse-patrons-table">
|
||||
<thead>
|
||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.plan_id'}}</th>
|
||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.nickname.title'}}</th>
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
</p>
|
||||
|
||||
{{#if model}}
|
||||
<table class="table discourse-patrons-admin">
|
||||
<table class="table discourse-patrons-table">
|
||||
<thead>
|
||||
<th>{{i18n 'discourse_patrons.admin.products.product.name'}}</th>
|
||||
<th>{{i18n 'discourse_patrons.admin.products.product.created_at'}}</th>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<h4>{{i18n 'discourse_patrons.admin.plans.title'}}</h4>
|
||||
|
||||
<p>
|
||||
<table class="table discourse-patrons-admin">
|
||||
<table class="table discourse-patrons-table">
|
||||
<thead>
|
||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.nickname'}}</th>
|
||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.interval'}}</th>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
<table class="table discourse-patrons-admin">
|
||||
<table class="table discourse-patrons-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{i18n 'discourse_patrons.admin.subscriptions.subscription.customer'}}</th>
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
|
||||
<h3>{{i18n 'discourse_patrons.user.billing.title'}}</h3>
|
||||
|
||||
user/billing
|
||||
{{#if model}}
|
||||
<table class="topic-list">
|
||||
<thead>
|
||||
<th>{{i18n 'discourse_patrons.user.billing.invoices.amount'}}</th>
|
||||
<th>{{i18n 'discourse_patrons.user.billing.invoices.number'}}</th>
|
||||
<th>{{i18n 'discourse_patrons.user.billing.invoices.created_at'}}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
{{#each model as |invoice|}}
|
||||
<tr>
|
||||
<td>{{invoice.amount_paid}}</td>
|
||||
<td>{{invoice.number}}</td>
|
||||
<td>{{format-date invoice.createdFormatted}}</td>
|
||||
<td class="td-right">
|
||||
<a href="{{invoice.invoice_pdf}}" class="btn btn-icon">
|
||||
{{d-icon "download"}}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
{{else}}
|
||||
<p>{{i18n 'discourse_patrons.user.billing_help'}}</p>
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user