From 84dddbd496edaa57dd83f5c318aceca80d4610bb Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Thu, 21 Nov 2024 18:36:18 +0100 Subject: [PATCH] support: Pass remote_support_view boolean in context for views. Many of the templates for the remote and Cloud support views are designed to be shared, but some features/actions have not yet been implemented for both types of support views. Adds a remote_support_view boolean to each type of support view context so that it's easy to add checks to existing templates. Updates the Cloud support view to use the current_plan_forms_support template, and fixes existing bug of offering the upgrade to Plus option for modifying a Cloud plan when the current plan is a fixed-price plan. Prep for implementing fixed-price plan offers in Cloud support view. --- corporate/views/support.py | 2 ++ .../support/current_plan_forms_support.html | 5 +++- .../support/next_plan_forms_support.html | 2 +- .../corporate/support/realm_details.html | 30 ++++--------------- 4 files changed, 13 insertions(+), 26 deletions(-) diff --git a/corporate/views/support.py b/corporate/views/support.py index 4b4fa726fa..9c8d1e0936 100644 --- a/corporate/views/support.py +++ b/corporate/views/support.py @@ -671,6 +671,7 @@ def support( context["ORGANIZATION_TYPES"] = sorted( Realm.ORG_TYPES.values(), key=lambda d: d["display_order"] ) + context["remote_support_view"] = False return render(request, "corporate/support/support.html", context=context) @@ -957,6 +958,7 @@ def remote_servers_support( ) context["get_remote_realm_billing_user_emails"] = get_remote_realm_billing_user_emails_as_string context["SPONSORED_PLAN_TYPE"] = RemoteZulipServer.PLAN_TYPE_COMMUNITY + context["remote_support_view"] = True return render( request, diff --git a/templates/corporate/support/current_plan_forms_support.html b/templates/corporate/support/current_plan_forms_support.html index d937e6dbe8..353f2ddf04 100644 --- a/templates/corporate/support/current_plan_forms_support.html +++ b/templates/corporate/support/current_plan_forms_support.html @@ -9,7 +9,7 @@ -{% if current_plan.status == current_plan.ACTIVE %} +{% if current_plan.status == current_plan.ACTIVE and remote_support_view %}
Plan end date
{{ csrf_input }} @@ -29,6 +29,9 @@ + {% if not remote_support_view and not current_plan.fixed_price %} + + {% endif %}
diff --git a/templates/corporate/support/next_plan_forms_support.html b/templates/corporate/support/next_plan_forms_support.html index e9f48d8d5f..6e39f388fe 100644 --- a/templates/corporate/support/next_plan_forms_support.html +++ b/templates/corporate/support/next_plan_forms_support.html @@ -12,7 +12,7 @@ {% endif %} -{% if not plan_data.current_plan %} +{% if not plan_data.current_plan and remote_support_view %}
Configure temporary courtesy plan:
Once created, the end date for the temporary courtesy plan can be extended.
diff --git a/templates/corporate/support/realm_details.html b/templates/corporate/support/realm_details.html index 7604e092b6..dbc9868728 100644 --- a/templates/corporate/support/realm_details.html +++ b/templates/corporate/support/realm_details.html @@ -126,30 +126,12 @@ {% include 'corporate/support/current_plan_details.html' %} {% endwith %} - - Billing collection method
- {{ csrf_input }} - - - -
- -
- Modify plan
- {{ csrf_input }} - - - -
+ {% with %} + {% set current_plan = realm_support_data[realm.id].plan_data.current_plan %} + {% set remote_id = realm.id %} + {% set remote_type = "realm_id" %} + {% include 'corporate/support/current_plan_forms_support.html' %} + {% endwith %} {% endif %}