From f6fcb280fca6b544b143acb81d08cbdfb7b03f64 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 20 Mar 2019 10:11:51 -0400 Subject: [PATCH] sub out change plan component --- src/app/app.module.ts | 2 ++ .../settings/change-plan.component.html | 14 ++++++++ .../settings/change-plan.component.ts | 34 +++++++++++++++++++ .../organization-subscription.component.html | 4 ++- .../organization-subscription.component.ts | 9 +++++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/app/organizations/settings/change-plan.component.html create mode 100644 src/app/organizations/settings/change-plan.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 92dccc99b9..92e7930fb0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -57,6 +57,7 @@ import { UserGroupsComponent as OrgUserGroupsComponent } from './organizations/m import { AccountComponent as OrgAccountComponent } from './organizations/settings/account.component'; import { AdjustSeatsComponent } from './organizations/settings/adjust-seats.component'; import { ApiKeyComponent as OrgApiKeyComponent } from './organizations/settings/api-key.component'; +import { ChangePlanComponent } from './organizations/settings/change-plan.component'; import { DeleteOrganizationComponent } from './organizations/settings/delete-organization.component'; import { DownloadLicenseComponent } from './organizations/settings/download-license.component'; import { OrganizationBillingComponent } from './organizations/settings/organization-billing.component'; @@ -250,6 +251,7 @@ registerLocaleData(localeZhTw, 'zh-TW'); ChangeEmailComponent, ChangeKdfComponent, ChangePasswordComponent, + ChangePlanComponent, CiphersComponent, CollectionsComponent, ColorPasswordPipe, diff --git a/src/app/organizations/settings/change-plan.component.html b/src/app/organizations/settings/change-plan.component.html new file mode 100644 index 0000000000..8aef7f8186 --- /dev/null +++ b/src/app/organizations/settings/change-plan.component.html @@ -0,0 +1,14 @@ +
+
+ +

{{'changeBillingPlan' | i18n}}

+ + +
+
diff --git a/src/app/organizations/settings/change-plan.component.ts b/src/app/organizations/settings/change-plan.component.ts new file mode 100644 index 0000000000..46fc2ec4d3 --- /dev/null +++ b/src/app/organizations/settings/change-plan.component.ts @@ -0,0 +1,34 @@ +import { + Component, + EventEmitter, + Input, + Output, +} from '@angular/core'; + +import { ApiService } from 'jslib/abstractions/api.service'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; + +@Component({ + selector: 'app-change-plan', + templateUrl: 'change-plan.component.html', +}) +export class ChangePlanComponent { + @Input() organizationId: string; + @Output() onChanged = new EventEmitter(); + @Output() onCanceled = new EventEmitter(); + + formPromise: Promise; + + constructor(private apiService: ApiService, private platformUtilsService: PlatformUtilsService) { } + + async submit() { + try { + this.platformUtilsService.eventTrack('Changed Plan'); + this.onChanged.emit(); + } catch { } + } + + cancel() { + this.onCanceled.emit(); + } +} diff --git a/src/app/organizations/settings/organization-subscription.component.html b/src/app/organizations/settings/organization-subscription.component.html index 83ec618a23..1e7a9c8b0c 100644 --- a/src/app/organizations/settings/organization-subscription.component.html +++ b/src/app/organizations/settings/organization-subscription.component.html @@ -85,7 +85,7 @@
-
+
diff --git a/src/app/organizations/settings/organization-subscription.component.ts b/src/app/organizations/settings/organization-subscription.component.ts index 31451b9753..1467caf248 100644 --- a/src/app/organizations/settings/organization-subscription.component.ts +++ b/src/app/organizations/settings/organization-subscription.component.ts @@ -31,6 +31,7 @@ export class OrganizationSubscriptionComponent implements OnInit { showAdjustStorage = false; showUpdateLicense = false; showDownloadLicense = false; + showChangePlan = false; sub: OrganizationSubscriptionResponse; selfHosted = false; @@ -102,6 +103,10 @@ export class OrganizationSubscriptionComponent implements OnInit { } async changePlan() { + if (this.subscription == null) { + this.showChangePlan = !this.showChangePlan; + return; + } const contactSupport = await this.platformUtilsService.showDialog(this.i18nService.t('changeBillingPlanDesc'), this.i18nService.t('changeBillingPlan'), this.i18nService.t('contactSupport'), this.i18nService.t('close')); if (contactSupport) { @@ -109,6 +114,10 @@ export class OrganizationSubscriptionComponent implements OnInit { } } + closeChangePlan(changed: boolean) { + this.showChangePlan = false; + } + downloadLicense() { this.showDownloadLicense = !this.showDownloadLicense; }