From c1b1db071d9def6a293fb6860a1c664d737fed74 Mon Sep 17 00:00:00 2001 From: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:57:47 +0100 Subject: [PATCH] [AC-3029][Defect] Organization storage count is not carried over to the Upgrade dialog Total section (#10965) * Resolve the ui changes issues * Resolve the storage ui issue --- .../change-plan-dialog.component.html | 24 ++++++++++++------- .../change-plan-dialog.component.ts | 21 ++++++++++++++-- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/apps/web/src/app/billing/organizations/change-plan-dialog.component.html b/apps/web/src/app/billing/organizations/change-plan-dialog.component.html index 02071f5aa8..1c92cbf663 100644 --- a/apps/web/src/app/billing/organizations/change-plan-dialog.component.html +++ b/apps/web/src/app/billing/organizations/change-plan-dialog.component.html @@ -389,17 +389,21 @@ bitTypography="body2" *ngIf=" selectedPlan.PasswordManager.hasAdditionalStorageOption && - !organization.useSecretsManager + !organization.useSecretsManager && + organization.maxStorageGb > 0 " > - {{ 0 }} + {{ organization.maxStorageGb }} {{ "additionalStorageGbMessage" | i18n }} × - {{ selectedPlan.PasswordManager.additionalStoragePricePerGb | currency: "$" }} + {{ additionalStoragePriceMonthly(selectedPlan) | currency: "$" }} /{{ "year" | i18n }} - {{ 0 | currency: "$" }} + {{ + organization.maxStorageGb * selectedPlan.PasswordManager.additionalStoragePricePerGb + | currency: "$" + }}

@@ -505,17 +509,21 @@ bitTypography="body2" *ngIf=" selectedPlan.PasswordManager.hasAdditionalStorageOption && - !organization.useSecretsManager + !organization.useSecretsManager && + organization.maxStorageGb > 0 " > - {{ 0 }} + {{ organization.maxStorageGb }} {{ "additionalStorageGbMessage" | i18n }} × - {{ selectedPlan.PasswordManager.additionalStoragePricePerGb | currency: "$" }} + {{ additionalStoragePriceMonthly(selectedPlan) | currency: "$" }} /{{ "month" | i18n }} - {{ 0 | currency: "$" }} + {{ + organization.maxStorageGb * selectedPlan.PasswordManager.additionalStoragePricePerGb + | currency: "$" + }}

diff --git a/apps/web/src/app/billing/organizations/change-plan-dialog.component.ts b/apps/web/src/app/billing/organizations/change-plan-dialog.component.ts index a359c281eb..9492b51fcb 100644 --- a/apps/web/src/app/billing/organizations/change-plan-dialog.component.ts +++ b/apps/web/src/app/billing/organizations/change-plan-dialog.component.ts @@ -477,6 +477,13 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { ); } + additionalStoragePriceMonthly(selectedPlan: PlanResponse) { + if (!selectedPlan.isAnnual) { + return selectedPlan.PasswordManager.additionalStoragePricePerGb; + } + return selectedPlan.PasswordManager.additionalStoragePricePerGb / 12; + } + additionalServiceAccountTotal(plan: PlanResponse): number { if (!plan.SecretsManager.hasAdditionalServiceAccountOption || this.additionalServiceAccount) { return 0; @@ -525,9 +532,18 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { get total() { if (this.organization.useSecretsManager) { - return this.passwordManagerSubtotal + this.secretsManagerSubtotal + this.taxCharges || 0; + return ( + this.passwordManagerSubtotal + + this.additionalStorageTotal(this.selectedPlan) + + this.secretsManagerSubtotal + + this.taxCharges || 0 + ); } - return this.passwordManagerSubtotal + this.taxCharges || 0; + return ( + this.passwordManagerSubtotal + + this.additionalStorageTotal(this.selectedPlan) + + this.taxCharges || 0 + ); } get teamsStarterPlanIsAvailable() { @@ -639,6 +655,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { if (this.selectedPlan.productTier !== ProductTierType.Families) { request.additionalSeats = this.organization.seats; } + request.additionalStorageGb = this.organization.maxStorageGb; request.premiumAccessAddon = this.selectedPlan.PasswordManager.hasPremiumAccessOption && this.formGroup.controls.premiumAccessAddon.value;