upgrade: Add a dropdown to select billing cycle.

This commit is contained in:
Aman Agrawal 2023-11-10 11:50:17 +00:00 committed by Tim Abbott
parent 2570f7ce23
commit d3363bab96
2 changed files with 12 additions and 24 deletions

View File

@ -59,34 +59,19 @@
<hr />
<h2>Zulip Cloud Standard free trial</h2>
{% endif %}
<div class="payment-schedule">
<div class="payment-schedule input-box">
<div id="autopay-error" class="alert alert-danger"></div>
<h3>{{ _("Payment schedule") }}</h3>
{% if free_trial_days %}
<p>
You won't be charged during the free trial. You can also downgrade to
Zulip Cloud Free, our forever free plan, at any time.
</p>
{% endif %}
<label>
<input type="radio" name="schedule" value="monthly" checked/>
<div class="box">
<div class="schedule-time">{{ _("Pay monthly") }}</div>
<div class="schedule-amount">$<span id="autopay_monthly_price"></span>/user/month</div>
</div>
</label>
<label>
<input type="radio" name="schedule" value="annual"/>
<div class="box">
<div class="schedule-time annually">{{ _("Pay annually") }}</div>
<div class="schedule-amount">
$<span id="autopay_annual_price_per_month"></span>/user/month
<div class="schedule-amount-2">
($<span id="autopay_annual_price"></span>/user/year)
</div>
</div>
</div>
</label>
<select name="payment-schedule" id="payment-schedule-select">
<option value="monthly" id="autopay_monthly_price"></option>
<option value="annually" id="autopay_annual_price_per_month"></option>
</select>
<label for="payment-schedule-select">Payment schedule</label>
</div>
{% if not manual_license_management %}

View File

@ -40,9 +40,12 @@ export const initialize = (): void => {
helpers.update_charged_amount(prices, helpers.schedule_schema.parse(this.value));
});
$("#autopay_annual_price").text(helpers.format_money(prices.annual));
$("#autopay_annual_price_per_month").text(helpers.format_money(prices.annual / 12));
$("#autopay_monthly_price").text(helpers.format_money(prices.monthly));
$("#autopay_annual_price_per_month").text(
`Pay annually ($${helpers.format_money(prices.annual / 12)}/user/month)`,
);
$("#autopay_monthly_price").text(
`Pay monthly ($${helpers.format_money(prices.monthly)}/user/month)`,
);
$("#invoice_annual_price").text(helpers.format_money(prices.annual));
$("#invoice_annual_price_per_month").text(helpers.format_money(prices.annual / 12));