subscription and billing templates
This commit is contained in:
parent
8264930e92
commit
55f4592033
|
@ -2,7 +2,9 @@ export default {
|
|||
resource: "user",
|
||||
path: "users/:username",
|
||||
map() {
|
||||
this.route("billing");
|
||||
this.route("subscriptions");
|
||||
this.route("billing", function() {
|
||||
this.route("payments");
|
||||
this.route("subscriptions");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
import Route from "@ember/routing/route";
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
console.log(999);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,9 @@
|
|||
import Route from "@ember/routing/route";
|
||||
|
||||
export default Route.extend({
|
||||
templateName: "user/billing/index",
|
||||
|
||||
redirect() {
|
||||
this.transitionTo("user.billing.subscriptions");
|
||||
}
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import Invoice from "discourse/plugins/discourse-subscriptions/discourse/models/invoice";
|
||||
|
||||
export default Route.extend({
|
||||
templateName: "user/billing/payments",
|
||||
|
||||
model() {
|
||||
return Invoice.findAll();
|
||||
}
|
||||
});
|
|
@ -2,18 +2,12 @@ import Route from "@ember/routing/route";
|
|||
import UserSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/user-subscription";
|
||||
|
||||
export default Route.extend({
|
||||
templateName: "user/billing/subscriptions",
|
||||
|
||||
model() {
|
||||
return UserSubscription.findAll();
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
if (this.currentUser.id !== this.modelFor("user").id) {
|
||||
this.replaceWith("userActivity");
|
||||
} else {
|
||||
controller.setProperties({ model });
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
cancelSubscription(subscription) {
|
||||
bootbox.confirm(
|
|
@ -1,10 +1,7 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import Invoice from "discourse/plugins/discourse-subscriptions/discourse/models/invoice";
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
return Invoice.findAll();
|
||||
},
|
||||
templateName: "user/billing",
|
||||
|
||||
setupController(controller, model) {
|
||||
if (this.currentUser.id !== this.modelFor("user").id) {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{{#if (user-viewing-self model)}}
|
||||
{{#link-to 'user.billing'}}{{d-icon "credit-card"}}{{I18n 'discourse_subscriptions.navigation.billing'}}{{/link-to}}
|
||||
{{/if}}
|
|
@ -1,3 +0,0 @@
|
|||
{{#if (user-viewing-self model)}}
|
||||
{{#link-to 'user.subscriptions'}}{{d-icon "credit-card"}}{{I18n 'discourse_subscriptions.navigation.subscriptions'}}{{/link-to}}
|
||||
{{/if}}
|
|
@ -1,27 +1,22 @@
|
|||
{{#d-section pageClass="user-billing" class="user-secondary-navigation" scrollTop="false"}}
|
||||
{{#mobile-nav
|
||||
class='activity-nav'
|
||||
desktopClass='action-list nav-stacked'
|
||||
currentPath=router._router.currentPath
|
||||
}}
|
||||
<li>
|
||||
{{#link-to 'user.billing.subscriptions'}}
|
||||
{{i18n 'discourse_subscriptions.navigation.subscriptions'}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
<li>
|
||||
{{#link-to 'user.billing.payments'}}
|
||||
{{i18n 'discourse_subscriptions.navigation.payments'}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
{{/mobile-nav}}
|
||||
{{/d-section}}
|
||||
|
||||
<h3>{{i18n 'discourse_subscriptions.user.billing.title'}}</h3>
|
||||
|
||||
{{#if model}}
|
||||
<table class="topic-list">
|
||||
<thead>
|
||||
<th>{{i18n 'discourse_subscriptions.user.billing.invoices.amount'}}</th>
|
||||
<th>{{i18n 'discourse_subscriptions.user.billing.invoices.number'}}</th>
|
||||
<th>{{i18n 'discourse_subscriptions.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-unix-date invoice.created}}</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_subscriptions.user.billing_help'}}</p>
|
||||
{{/if}}
|
||||
<section class='user-content'>
|
||||
{{outlet}}
|
||||
</section>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
|
||||
|
||||
BILLING INDEX
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
<h3>{{i18n 'discourse_subscriptions.user.billing.title'}}</h3>
|
||||
|
||||
{{#if model}}
|
||||
<table class="topic-list">
|
||||
<thead>
|
||||
|
@ -23,5 +21,7 @@
|
|||
{{/each}}
|
||||
</table>
|
||||
{{else}}
|
||||
<p>{{i18n 'discourse_subscriptions.user.billing_help'}}</p>
|
||||
<div class="alert alert-info">
|
||||
{{i18n 'discourse_subscriptions.user.payments_help'}}
|
||||
</div>
|
||||
{{/if}}
|
|
@ -1,7 +1,4 @@
|
|||
|
||||
{{#d-section pageClass="user-subscriptions" class="user-content"}}
|
||||
<h2>{{i18n 'discourse_subscriptions.user.subscriptions.title'}}</h2>
|
||||
|
||||
{{#if model}}
|
||||
<table class="table discourse-subscriptions-user-table">
|
||||
<thead>
|
||||
|
@ -30,6 +27,8 @@
|
|||
{{/each}}
|
||||
</table>
|
||||
{{else}}
|
||||
<p>{{i18n 'discourse_subscriptions.user.subscriptions_help'}}</p>
|
||||
<div class="alert alert-info">
|
||||
{{i18n 'discourse_subscriptions.user.subscriptions_help'}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/d-section}}
|
|
@ -19,6 +19,8 @@ en:
|
|||
admin_navigation: Subscriptions
|
||||
optional: Optional
|
||||
navigation:
|
||||
billing: Billing
|
||||
payments: Payments
|
||||
subscriptions: Subscriptions
|
||||
subscribe: Subscribe
|
||||
user_activity:
|
||||
|
@ -61,12 +63,12 @@ en:
|
|||
amount: Amount
|
||||
payment_intent_id: Payment ID
|
||||
user:
|
||||
payments_help: There are no payments
|
||||
plans:
|
||||
rate: Rate
|
||||
product: Name
|
||||
subscriptions_help: You have no subscriptions.
|
||||
subscriptions_help: You have no active subscriptions.
|
||||
subscriptions:
|
||||
title: Subscriptions
|
||||
id: Subscription ID
|
||||
status: Status
|
||||
created_at: Created
|
||||
|
|
|
@ -36,7 +36,7 @@ Discourse::Application.routes.append do
|
|||
get '/admin/plugins/discourse-subscriptions/plans' => 'admin/plugins#index'
|
||||
get '/admin/plugins/discourse-subscriptions/plans/:plan_id' => 'admin/plugins#index'
|
||||
get 'u/:username/billing' => 'users#show', constraints: { username: USERNAME_ROUTE_FORMAT }
|
||||
get 'u/:username/subscriptions' => 'users#show', constraints: { username: USERNAME_ROUTE_FORMAT }
|
||||
get 'u/:username/billing/:id' => 'users#show', constraints: { username: USERNAME_ROUTE_FORMAT }
|
||||
end
|
||||
|
||||
after_initialize do
|
||||
|
|
Loading…
Reference in New Issue