Add a display alert that shows when the trial period ends (if applicable). Also change the name of the Subscribe buttons to "Start Trial" when no existing subscription is found
This commit is contained in:
parent
189903ffe9
commit
a5c2fc7185
3 changed files with 23 additions and 7 deletions
|
@ -17,13 +17,17 @@ def carderror_response(exc):
|
|||
|
||||
|
||||
def subscription_view(stripe_subscription, used_repos):
|
||||
return {
|
||||
view = {
|
||||
'currentPeriodStart': stripe_subscription.current_period_start,
|
||||
'currentPeriodEnd': stripe_subscription.current_period_end,
|
||||
'plan': stripe_subscription.plan.id,
|
||||
'usedPrivateRepos': used_repos,
|
||||
'trialStart': stripe_subscription.trial_start,
|
||||
'trialEnd': stripe_subscription.trial_end
|
||||
}
|
||||
|
||||
return view
|
||||
|
||||
|
||||
def subscribe(user, plan, token, require_business_plan):
|
||||
if not features.BILLING:
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
You are nearing the number of allowed private repositories. It might be time to think about
|
||||
upgrading your subscription to avoid future disruptions in your <span ng-show="organization">organization's</span> service.
|
||||
</div>
|
||||
|
||||
<!-- Trial info -->
|
||||
<div class="alert alert-success" ng-show="subscription.trialEnd != null" style="font-size: 125%">
|
||||
Free trial until <strong>{{ parseDate(subscription.trialEnd) | date }}</strong>
|
||||
</div>
|
||||
|
||||
<!-- Chart -->
|
||||
<div>
|
||||
|
@ -24,6 +29,11 @@
|
|||
<span class="usage-caption" ng-show="chart">Repository Usage</span>
|
||||
</div>
|
||||
|
||||
<!-- Next billing info -->
|
||||
<div class="alert alert-info" ng-show="subscription.trialEnd == null && subscription.currentPeriodEnd != null">
|
||||
Next billing period: <strong>{{ parseDate(subscription.currentPeriodEnd) | date }}</strong>
|
||||
</div>
|
||||
|
||||
<!-- Plans Table -->
|
||||
<table class="table table-hover plans-list-table" ng-show="!planLoading">
|
||||
<thead>
|
||||
|
@ -57,7 +67,8 @@
|
|||
ng-click="changeSubscription(plan.stripeId)">
|
||||
<span class="quay-spinner" ng-show="planChanging"></span>
|
||||
<span ng-show="!planChanging && subscribedPlan.price != 0">Change</span>
|
||||
<span ng-show="!planChanging && subscribedPlan.price == 0">Subscribe</span>
|
||||
<span ng-show="!planChanging && subscribedPlan.price == 0 && !hasSubscription">Start Trial</span>
|
||||
<span ng-show="!planChanging && subscribedPlan.price == 0 && hasSubscription">Subscribe</span>
|
||||
</button>
|
||||
<button class="btn btn-danger" ng-show="subscription.plan === plan.stripeId && plan.price > 0"
|
||||
ng-click="cancelSubscription()">
|
||||
|
|
|
@ -3331,8 +3331,12 @@ quayApp.directive('planManager', function () {
|
|||
'planChanged': '&planChanged'
|
||||
},
|
||||
controller: function($scope, $element, PlanService, ApiService) {
|
||||
var hasSubscription = false;
|
||||
$scope.hasSubscription = false;
|
||||
|
||||
$scope.parseDate = function(timestamp) {
|
||||
return new Date(timestamp * 1000);
|
||||
};
|
||||
|
||||
$scope.isPlanVisible = function(plan, subscribedPlan) {
|
||||
if (plan['deprecated']) {
|
||||
return plan == subscribedPlan;
|
||||
|
@ -3368,10 +3372,7 @@ quayApp.directive('planManager', function () {
|
|||
|
||||
var subscribedToPlan = function(sub) {
|
||||
$scope.subscription = sub;
|
||||
|
||||
if (sub.plan != PlanService.getFreePlan()) {
|
||||
hasSubscription = true;
|
||||
}
|
||||
$scope.hasSubscription = true;
|
||||
|
||||
PlanService.getPlanIncludingDeprecated(sub.plan, function(subscribedPlan) {
|
||||
$scope.subscribedPlan = subscribedPlan;
|
||||
|
|
Reference in a new issue