Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

support: Add forms for current plan actions to remote realms.

Lauryn Menard144b2a9988d1
diff --git a/templates/analytics/current_plan_forms_support.html b/templates/analytics/current_plan_forms_support.html
new file mode 100644
index 00000000000..ecd2ff9ac25
--- /dev/null
+++ b/templates/analytics/current_plan_forms_support.html
@@ -0,0 +1,23 @@
+<form method="POST" class="remote-form">
+ <b>Billing collection method</b><br />
+ {{ csrf_input }}
+ <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
+ <select name="billing_modality" class="billing-modality-select" required>
+ <option value="charge_automatically" {% if current_plan.charge_automatically %}selected{% endif %}>Charge automatically</option>
+ <option value="send_invoice" {% if not current_plan.charge_automatically %}selected{% endif %}>Pay by invoice</option>
+ </select>
+ <button type="submit" class="btn btn-default support-submit-button">Update</button>
+</form>
+
+<form method="POST" class="remote-form">
+ <b>Modify current plan</b><br />
+ {{ csrf_input }}
+ <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
+ <select name="modify_plan" class="modify-plan-method-select" required>
+ <option disabled value="" selected>-- select --</option>
+ <option value="downgrade_at_billing_cycle_end">Downgrade at the end of current billing cycle</option>
+ <option value="downgrade_now_without_additional_licenses">Downgrade now without creating additional invoices</option>
+ <option value="downgrade_now_void_open_invoices">Downgrade now and void open invoices</option>
+ </select>
+ <button type="submit" class="btn btn-default support-submit-button">Modify</button>
+</form>
diff --git a/templates/analytics/remote_realm_details.html b/templates/analytics/remote_realm_details.html
index bf6fe84e94e..481cd0df533 100644
--- a/templates/analytics/remote_realm_details.html
+++ b/templates/analytics/remote_realm_details.html
@@ -27,4 +27,11 @@
{% include 'analytics/current_plan_details.html' %}
{% endwith %}
</div>
+
+{% with %}
+ {% set current_plan = plan_data[remote_server.id].current_plan %}
+ {% set remote_id = remote_realm.id %}
+ {% set remote_type = "remote_realm_id" %}
+ {% include 'analytics/current_plan_forms_support.html' %}
+{% endwith %}
{% endif %}
diff --git a/templates/analytics/remote_server_support.html b/templates/analytics/remote_server_support.html
index e1d989b7614..9bc23548635 100644
--- a/templates/analytics/remote_server_support.html
+++ b/templates/analytics/remote_server_support.html
@@ -71,29 +71,12 @@
{% endwith %}
</div>
- <form method="POST" class="remote-form">
- <b>Billing collection method</b><br />
- {{ csrf_input }}
- <input type="hidden" name="remote_server_id" value="{{ remote_server.id }}" />
- <select name="billing_modality" class="billing-modality-select" required>
- <option value="charge_automatically" {% if remote_servers_plan_data[remote_server.id].current_plan.charge_automatically %}selected{% endif %}>Charge automatically</option>
- <option value="send_invoice" {% if not remote_servers_plan_data[remote_server.id].current_plan.charge_automatically %}selected{% endif %}>Pay by invoice</option>
- </select>
- <button type="submit" class="btn btn-default support-submit-button">Update</button>
- </form>
-
- <form method="POST" class="remote-form">
- <b>Modify current plan</b><br />
- {{ csrf_input }}
- <input type="hidden" name="remote_server_id" value="{{ remote_server.id }}" />
- <select name="modify_plan" class="modify-plan-method-select" required>
- <option disabled value="" selected>-- select --</option>
- <option value="downgrade_at_billing_cycle_end">Downgrade at the end of current billing cycle</option>
- <option value="downgrade_now_without_additional_licenses">Downgrade now without creating additional invoices</option>
- <option value="downgrade_now_void_open_invoices">Downgrade now and void open invoices</option>
- </select>
- <button type="submit" class="btn btn-default support-submit-button">Modify</button>
- </form>
+ {% with %}
+ {% set current_plan = remote_servers_plan_data[remote_server.id].current_plan %}
+ {% set remote_id = remote_server.id %}
+ {% set remote_type = "remote_server_id" %}
+ {% include 'analytics/current_plan_forms_support.html' %}
+ {% endwith %}
{% endif %}
{% for remote_realm in remote_realms[remote_server.id] %}