Resolve the seat adjustment issue (#10265)

This commit is contained in:
cyprain-okeke 2024-08-13 12:36:40 +01:00 committed by GitHub
parent a559a113d3
commit cdc82f13b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View File

@ -5,8 +5,9 @@
<bit-label>{{ "subscriptionSeats" | i18n }}</bit-label>
<input bitInput formControlName="newSeatCount" type="number" min="0" step="1" />
<bit-hint>
<strong>{{ "total" | i18n }}:</strong> {{ additionalSeatCount || 0 }} &times;
{{ seatPrice | currency: "$" }} = {{ adjustedSeatTotal | currency: "$" }} /
<strong>{{ "total" | i18n }}:</strong>
{{ adjustSubscriptionForm.value.newSeatCount || 0 }} &times;
{{ seatPrice | currency: "$" }} = {{ seatTotalCost | currency: "$" }} /
{{ interval | i18n }}</bit-hint
>
</bit-form-field>
@ -43,7 +44,8 @@
step="1"
/>
<bit-hint>
<strong>{{ "maxSeatCost" | i18n }}:</strong> {{ additionalMaxSeatCount || 0 }} &times;
<strong>{{ "maxSeatCost" | i18n }}:</strong>
{{ adjustSubscriptionForm.value.newMaxSeats || 0 }} &times;
{{ seatPrice | currency: "$" }} = {{ maxSeatTotal | currency: "$" }} /
{{ interval | i18n }}</bit-hint
>

View File

@ -99,11 +99,12 @@ export class AdjustSubscription implements OnInit, OnDestroy {
: 0;
}
get adjustedSeatTotal(): number {
return this.additionalSeatCount * this.seatPrice;
get maxSeatTotal(): number {
return Math.abs((this.adjustSubscriptionForm.value.newMaxSeats ?? 0) * this.seatPrice);
}
get maxSeatTotal(): number {
return this.additionalMaxSeatCount * this.seatPrice;
get seatTotalCost(): number {
const totalSeat = Math.abs(this.adjustSubscriptionForm.value.newSeatCount * this.seatPrice);
return totalSeat;
}
}