From 5f0495035810a45ab9a19eb22cc8f5b40ed86c30 Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Wed, 12 Aug 2020 17:16:38 -0400 Subject: [PATCH] Price and Plan Updates (#598) * added the multi select checkbox to org ciphers * wired up select all/none * allowed for bulk delete of ciphers from the org vault * refactored bulk actions into a dedicated component * tweaked formatting settings and reformatted files * moved some shared code to jslib * some more formatting fixes * undid jslib connection changes * removed a function that was moved to jslib * reset jslib again? * set up delete many w/admin cipher methods * removed extra href tags * added organization id to bulk delete request model when coming from an org vault * fixed up some compiler warnings for formatting * updated organization create component to pull list of plans from static store * wired up the organization create page to new data struct * continued work on plan updates * accounted for the subscription screen in plan updates * adjusted for code review changes from server PR for plan updates * cleaned up linter errors * changed a few variable names * moved price information, added sales tax and subtotal labels * code review fixups for bulk delete from org vault * added back a removed parameter from the vault component * seperated some imports with newlines * updated jslib * resolved some build errors * updated names to reflect server name changes for plan updates * adjusted logic for using annual total for annual prices in server model * rearranged an import for the linter * broke up an async call * updated organization create component to pull list of plans from static store * wired up the organization create page to new data struct * continued work on plan updates * accounted for the subscription screen in plan updates * adjusted for code review changes from server PR for plan updates * cleaned up linter errors * changed a few variable names * moved price information, added sales tax and subtotal labels * updated names to reflect server name changes for plan updates * adjusted logic for using annual total for annual prices in server model * rearranged an import for the linter * broke up an async call * resolved merge fun * updated jslib * made plans a public variable * removed sales tax hooks * added a getter for selected plan interval * went a little too crazy with the interval getter * formatting * added a semicolon * updated jslib Co-authored-by: Addison Beck --- .../organization-subscription.component.html | 4 +- .../organization-subscription.component.ts | 31 +- .../organization-plans.component.html | 236 +++++++------- .../settings/organization-plans.component.ts | 300 +++++++++--------- 4 files changed, 280 insertions(+), 291 deletions(-) diff --git a/src/app/organizations/settings/organization-subscription.component.html b/src/app/organizations/settings/organization-subscription.component.html index 6aeaabb1304..6128f748330 100644 --- a/src/app/organizations/settings/organization-subscription.component.html +++ b/src/app/organizations/settings/organization-subscription.component.html @@ -24,7 +24,7 @@
{{'billingPlan' | i18n}}
-
{{sub.plan}}
+
{{sub.plan.name}}
{{'expiration' | i18n}}
{{sub.expiration | date:'mediumDate'}} @@ -39,7 +39,7 @@
{{'billingPlan' | i18n}}
-
{{sub.plan}}
+
{{sub.plan.name}}
{{'status' | i18n}}
diff --git a/src/app/organizations/settings/organization-subscription.component.ts b/src/app/organizations/settings/organization-subscription.component.ts index 84ab9974830..20cbb983e93 100644 --- a/src/app/organizations/settings/organization-subscription.component.ts +++ b/src/app/organizations/settings/organization-subscription.component.ts @@ -13,7 +13,6 @@ import { ApiService } from 'jslib/abstractions/api.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { MessagingService } from 'jslib/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; -import { TokenService } from 'jslib/abstractions/token.service'; import { PlanType } from 'jslib/enums/planType'; @@ -38,10 +37,10 @@ export class OrganizationSubscriptionComponent implements OnInit { cancelPromise: Promise; reinstatePromise: Promise; - constructor(private tokenService: TokenService, private apiService: ApiService, - private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, - private analytics: Angulartics2, private toasterService: ToasterService, - private messagingService: MessagingService, private route: ActivatedRoute) { + constructor(private apiService: ApiService, private platformUtilsService: PlatformUtilsService, + private i18nService: I18nService, private analytics: Angulartics2, + private toasterService: ToasterService, private messagingService: MessagingService, + private route: ActivatedRoute) { this.selfHosted = platformUtilsService.isSelfHost(); } @@ -192,34 +191,20 @@ export class OrganizationSubscriptionComponent implements OnInit { } get billingInterval() { - const monthly = this.sub.planType === PlanType.EnterpriseMonthly || - this.sub.planType === PlanType.TeamsMonthly; + const monthly = !this.sub.plan.isAnnual; return monthly ? 'month' : 'year'; } get storageGbPrice() { - return this.billingInterval === 'month' ? 0.5 : 4; + return this.sub.plan.additionalStoragePricePerGb; } get seatPrice() { - switch (this.sub.planType) { - case PlanType.EnterpriseMonthly: - return 4; - case PlanType.EnterpriseAnnually: - return 36; - case PlanType.TeamsMonthly: - return 2.5; - case PlanType.TeamsAnnually: - return 24; - default: - return 0; - } + return this.sub.plan.seatPrice; } get canAdjustSeats() { - return this.sub.planType === PlanType.EnterpriseMonthly || - this.sub.planType === PlanType.EnterpriseAnnually || - this.sub.planType === PlanType.TeamsMonthly || this.sub.planType === PlanType.TeamsAnnually; + return this.sub.plan.hasAdditionalSeatsOption; } get canDownloadLicense() { diff --git a/src/app/settings/organization-plans.component.html b/src/app/settings/organization-plans.component.html index 92285b6e0f1..fded4f7eeed 100644 --- a/src/app/settings/organization-plans.component.html +++ b/src/app/settings/organization-plans.component.html @@ -1,3 +1,7 @@ + + + {{'loading' | i18n}} +

{{'uploadLicenseFileOrg' | i18n}}

@@ -13,7 +17,8 @@
-
+

{{'generalInformation' | i18n}}

@@ -38,69 +43,53 @@

{{'chooseYourPlan' | i18n}}

-
- -