list plans

This commit is contained in:
Rimian Perkins
2019-09-25 11:18:11 +10:00
parent bfdc8a5691
commit 1b232a1bd4
12 changed files with 73 additions and 28 deletions
@@ -0,0 +1,5 @@
export default Ember.Controller.extend({
actions: {
deletePlan(plan) {}
}
});
@@ -0,0 +1,7 @@
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
model() {
return ajax("/patrons/admin/plans", { method: "get" });
}
});
@@ -1 +1,2 @@
export default Discourse.Route.extend({});
@@ -1,13 +1,7 @@
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
// model(params) {
// return ajax("/patrons/admin/subscriptions", {
// method: "get",
// data: {
// order: params.order,
// descending: params.descending
// }
// }).then(results => results);
// }
model(params) {
return ajax("/patrons/admin/subscriptions", { method: "get" });
}
});
@@ -0,0 +1,22 @@
<h3>{{i18n 'discourse_patrons.admin.plans.title'}}</h3>
<table class="table discourse-patrons-admin">
<thead>
<th>{{i18n 'discourse_patrons.admin.plans.plan.plan_id'}}</th>
<th>{{i18n 'discourse_patrons.admin.plans.plan.nickname'}}</th>
<th>{{i18n 'discourse_patrons.admin.plans.plan.interval'}}</th>
<th>{{i18n 'discourse_patrons.admin.plans.plan.amount'}}</th>
</thead>
{{#each model.plans as |plan|}}
<tr>
<td>{{plan.id}}</td>
<td>{{plan.nickname}}</td>
<td>{{plan.interval}}</td>
<td>{{plan.amount}}</td>
<td>
{{d-button action=(action "deletePlan" plan) icon="trash" class="btn-danger btn no-text btn-icon"}}
</td>
</tr>
{{/each}}
</table>
@@ -1,5 +1,4 @@
<h3>{{i18n 'discourse_patrons.admin.plans.title'}}</h3>
{{#link-to 'adminPlugins.discourse-patrons.plans.show' 'new' class="btn btn-primary"}}
@@ -1,5 +1,5 @@
<h3>Subscription Plans</h3>
<h3>{{i18n 'discourse_patrons.admin.plans'}}</h3>
<table class="table discourse-patrons-admin">
<thead>
@@ -10,7 +10,7 @@
<th>Amount</th>
</tr>
</thead>
{{#each model as |plan|}}
{{#each model as |subscription|}}
<tr>
</tr>