show discount rate on pricing page

This commit is contained in:
Henry Oswald 2015-11-17 12:23:27 +00:00
parent 631e84f5d6
commit b1c0dfb0e4
2 changed files with 7 additions and 1 deletions

View file

@ -41,7 +41,9 @@ block content
hr.thin
.row
.col-md-12.text-center
div(ng-if="trialLength") !{translate("first_few_days_free", {trialLen:'{{trialLength}}'})}
div(ng-if="trialLength")
span !{translate("first_few_days_free", {trialLen:'{{trialLength}}'})}
span(ng-if="discountMonths && discountRate")   - {{discountMonths}} #{translate("month")}s {{discountRate}}% Off
div(ng-if="price")
strong {{price.currency.symbol}}{{price.next.total}}
span(ng-if="monthlyBilling") #{translate("every")} #{translate("month")}

View file

@ -58,6 +58,10 @@ define [
if pricing.items?.coupon?.discount?.type == "percent"
basePrice = parseInt(pricing.price.base.plan.unit)
$scope.normalPrice = basePrice
if pricing.items.coupon.applies_for_months > 0 and pricing.items.coupon?.discount?.rate and pricing.items.coupon?.applies_for_months?
$scope.discountMonths = pricing.items.coupon?.applies_for_months
$scope.discountRate = pricing.items.coupon?.discount?.rate * 100
if pricing.price?.taxes[0]?.rate?
$scope.normalPrice += (basePrice * pricing.price.taxes[0].rate)
$scope.$apply()