upgrade: Add required fields to upgrade a realm.

This commit is contained in:
Aman Agrawal 2023-11-11 05:14:16 +00:00 committed by Tim Abbott
parent 5f0969f52b
commit 7d10b3dcf7
2 changed files with 6 additions and 8 deletions

View File

@ -58,7 +58,7 @@
Zulip Cloud Free, our forever free plan, at any time. Zulip Cloud Free, our forever free plan, at any time.
</p> </p>
{% endif %} {% endif %}
<select name="payment-schedule" id="payment-schedule-select"> <select name="schedule" id="payment-schedule-select">
<option value="monthly" id="autopay_monthly_price"></option> <option value="monthly" id="autopay_monthly_price"></option>
<option value="annual" id="autopay_annual_price_per_month"></option> <option value="annual" id="autopay_annual_price_per_month"></option>
</select> </select>
@ -71,6 +71,9 @@
<input type="number" name="licenses" autocomplete="off" {% if not exempt_from_license_number_check %}min="{{ seat_count }}" value="{{ seat_count }}"{% endif %} autocomplete="off" id="manual_license_count" required/> <input type="number" name="licenses" autocomplete="off" {% if not exempt_from_license_number_check %}min="{{ seat_count }}" value="{{ seat_count }}"{% endif %} autocomplete="off" id="manual_license_count" required/>
<div id="upgrade-licenses-change-error" class="alert alert-danger upgrade-page-error"></div> <div id="upgrade-licenses-change-error" class="alert alert-danger upgrade-page-error"></div>
</div> </div>
<input type="hidden" name="license_management" value="manual" />
{% else %}
<input type="hidden" name="license_management" value="automatic" />
{% endif %} {% endif %}
<div class="input-box upgrade-page-field no-validation"> <div class="input-box upgrade-page-field no-validation">

View File

@ -8,13 +8,7 @@ let selected_schedule = "monthly";
let current_license_count = page_params.seat_count; let current_license_count = page_params.seat_count;
export const initialize = (): void => { export const initialize = (): void => {
$("#add-card-button").on("click", (e) => { $("#org-upgrade-button").on("click", (e) => {
const license_management = $<HTMLInputElement>(
"input[type=radio][name=license_management]:checked",
).val()!;
if (!helpers.is_valid_input($(`#${CSS.escape(license_management)}_license_count`))) {
return;
}
e.preventDefault(); e.preventDefault();
helpers.create_ajax_request("/json/billing/upgrade", "autopay", [], "POST", (response) => { helpers.create_ajax_request("/json/billing/upgrade", "autopay", [], "POST", (response) => {
@ -22,6 +16,7 @@ export const initialize = (): void => {
window.location.replace(response_data.stripe_session_url); window.location.replace(response_data.stripe_session_url);
}); });
}); });
const prices: Prices = { const prices: Prices = {
annual: page_params.annual_price * (1 - page_params.percent_off / 100), annual: page_params.annual_price * (1 - page_params.percent_off / 100),
monthly: page_params.monthly_price * (1 - page_params.percent_off / 100), monthly: page_params.monthly_price * (1 - page_params.percent_off / 100),