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

View File

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