mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-08 19:18:02 +01:00
[PM-16664] Fix annual pricing for billable providers (#12662)
This commit is contained in:
parent
aeba2b3c73
commit
b0f5971287
@ -38,12 +38,14 @@
|
|||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td bitCell class="tw-text-right tw-py-3">
|
<td bitCell class="tw-text-right tw-py-3">
|
||||||
{{ ((100 - subscription.discountPercentage) / 100) * i.cost | currency: "$" }} /{{
|
{{
|
||||||
"month" | i18n
|
((100 - subscription.discountPercentage) / 100) * getMonthlyCost(i)
|
||||||
|
| currency: "$"
|
||||||
}}
|
}}
|
||||||
|
/ {{ "month" | i18n }}
|
||||||
<div *ngIf="subscription.discountPercentage">
|
<div *ngIf="subscription.discountPercentage">
|
||||||
<bit-hint class="tw-text-sm tw-line-through">
|
<bit-hint class="tw-text-sm tw-line-through">
|
||||||
{{ i.cost | currency: "$" }} /{{ "month" | i18n }}
|
{{ getMonthlyCost(i) | currency: "$" }} / {{ "month" | i18n }}
|
||||||
</bit-hint>
|
</bit-hint>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -52,9 +54,8 @@
|
|||||||
<tr bitRow>
|
<tr bitRow>
|
||||||
<td bitCell class="tw-pl-0 tw-py-3"></td>
|
<td bitCell class="tw-pl-0 tw-py-3"></td>
|
||||||
<td bitCell class="tw-text-right">
|
<td bitCell class="tw-text-right">
|
||||||
<span class="tw-font-bold">Total:</span> {{ totalCost | currency: "$" }} /{{
|
<span class="tw-font-bold">Total:</span>
|
||||||
"month" | i18n
|
{{ getTotalMonthlyCost() | currency: "$" }} / {{ "month" | i18n }}
|
||||||
}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -113,4 +113,20 @@ export class ProviderSubscriptionComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getMonthlyCost(plan: ProviderPlanResponse): number {
|
||||||
|
return plan.cadence === "Monthly" ? plan.cost : plan.cost / 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getDiscountedMonthlyCost(plan: ProviderPlanResponse): number {
|
||||||
|
return ((100 - this.subscription.discountPercentage) / 100) * this.getMonthlyCost(plan);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getTotalMonthlyCost(): number {
|
||||||
|
let totalCost: number = 0;
|
||||||
|
for (const plan of this.subscription.plans) {
|
||||||
|
totalCost += this.getDiscountedMonthlyCost(plan);
|
||||||
|
}
|
||||||
|
return totalCost;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user