premium access addon for orgs

This commit is contained in:
Kyle Spearrin 2018-11-20 16:38:00 -05:00
parent d88b23c42d
commit 9c7b7b0d75
5 changed files with 50 additions and 3 deletions

2
jslib

@ -1 +1 @@
Subproject commit 464bca8c4d745eb86bdb0b36e6e4a983caa3c891
Subproject commit 5d5200b12e36dc170d7d3ec7bd34f0e7f99cd422

View File

@ -124,6 +124,15 @@
<small class="text-muted form-text">{{'additionalStorageIntervalDesc' | i18n : '1 GB' : (storageGb.price | currency:'$') : ('month' | i18n)}}</small>
</div>
</div>
<div class="row">
<div class="form-group col-6" *ngIf="plans[plan].canBuyPremiumAccessAddon">
<div class="form-check">
<input id="premiumAccess" class="form-check-input" type="checkbox" name="PremiumAccessAddon" [(ngModel)]="premiumAccessAddon">
<label for="premiumAccess" class="form-check-label bold">{{'premiumAccess' | i18n}}</label>
</div>
<small class="text-muted form-text">{{'premiumAccessDesc' | i18n : (3.33 | currency:'$') : ('month' | i18n)}}</small>
</div>
</div>
<h2 class="spaced-header">{{'summary' | i18n}}</h2>
<div class="form-check form-check-block">
<input class="form-check-input" type="radio" name="BillingInterval" id="intervalAnnually" value="year" [(ngModel)]="interval">
@ -143,6 +152,10 @@
{{'additionalStorageGb' | i18n}}: {{additionalStorage || 0}} &times; {{storageGb.price | currency:'$'}} &times;12 {{'monthAbbr'
| i18n}} = {{additionalStorageTotal(true) | currency:'$'}} /{{'year' | i18n}}
</small>
<small *ngIf="plans[plan].canBuyPremiumAccessAddon && premiumAccessAddon">
{{'premiumAccess' | i18n}}:
{{3.33 | currency:'$'}} &times;12 {{'monthAbbr' | i18n}} = {{40 | currency:'$'}} /{{'year' | i18n}}
</small>
</label>
</div>
<div class="form-check form-check-block" *ngIf="plans[plan].monthlySeatPrice">

View File

@ -31,6 +31,7 @@ export class CreateOrganizationComponent implements OnInit {
selfHosted = false;
ownedBusiness = false;
premiumAccessAddon = false;
storageGbPriceMonthly = 0.33;
additionalStorage = 0;
additionalSeats = 0;
@ -58,6 +59,7 @@ export class CreateOrganizationComponent implements OnInit {
baseSeats: 5,
noAdditionalSeats: true,
annualPlanType: PlanType.FamiliesAnnually,
canBuyPremiumAccessAddon: true,
},
teams: {
basePrice: 5,
@ -144,6 +146,8 @@ export class CreateOrganizationComponent implements OnInit {
request.businessName = this.ownedBusiness ? this.businessName : null;
request.additionalSeats = this.additionalSeats;
request.additionalStorageGb = this.additionalStorage;
request.premiumAccessAddon = this.plans[this.plan].canBuyPremiumAccessAddon &&
this.premiumAccessAddon;
request.country = this.paymentComponent.getCountry();
if (this.interval === 'month') {
request.planType = this.plans[this.plan].monthPlanType;
@ -170,6 +174,10 @@ export class CreateOrganizationComponent implements OnInit {
}
changedPlan() {
if (!this.plans[this.plan].canBuyPremiumAccessAddon) {
this.premiumAccessAddon = false;
}
if (this.plans[this.plan].monthPlanType == null) {
this.interval = 'year';
}
@ -217,8 +225,18 @@ export class CreateOrganizationComponent implements OnInit {
}
}
premiumAccessTotal(annual: boolean): number {
if (this.plans[this.plan].canBuyPremiumAccessAddon && this.premiumAccessAddon) {
if (annual) {
return 40;
}
}
return 0;
}
get total(): number {
const annual = this.interval === 'year';
return this.baseTotal(annual) + this.seatTotal(annual) + this.additionalStorageTotal(annual);
return this.baseTotal(annual) + this.seatTotal(annual) + this.additionalStorageTotal(annual) +
this.premiumAccessTotal(annual);
}
}

View File

@ -1386,6 +1386,22 @@
"addons": {
"message": "Addons"
},
"premiumAccess": {
"message": "Premium Access"
},
"premiumAccessDesc": {
"message": "You can add premium access to all members of your organization for $PRICE$ /$INTERVAL$.",
"placeholders": {
"price": {
"content": "$1",
"example": "$3.33"
},
"interval": {
"content": "$2",
"example": "'month' or 'year'"
}
}
},
"additionalStorageGb": {
"message": "Additional Storage (GB)"
},

View File

@ -250,7 +250,7 @@ input, select, textarea {
@include border-radius($modal-content-border-radius);
}
label:not(.form-check-label):not(.btn) {
label:not(.form-check-label):not(.btn), label.bold {
font-weight: 600;
}