diff --git a/analytics/tests/test_support_views.py b/analytics/tests/test_support_views.py index 1ad13d6c38..1c31d3f057 100644 --- a/analytics/tests/test_support_views.py +++ b/analytics/tests/test_support_views.py @@ -198,7 +198,7 @@ class TestSupportEndpoint(ZulipTestCase): '', 'scrub-realm-button">', 'data-string-id="lear"', - "Name: Zulip Cloud Standard", + "Plan name: Zulip Cloud Standard", "Status: Active", "Billing schedule: Annual", "Licenses: 2/10 (Manual)", diff --git a/corporate/lib/support.py b/corporate/lib/support.py index 4263ad4d08..26775db226 100644 --- a/corporate/lib/support.py +++ b/corporate/lib/support.py @@ -18,6 +18,7 @@ class PlanData: current_plan: Optional["CustomerPlan"] = None licenses: Optional[int] = None licenses_used: Optional[int] = None + is_legacy_plan: bool = False def get_support_url(realm: Realm) -> str: @@ -55,5 +56,9 @@ def get_current_plan_data_for_support_view(billing_session: BillingSession) -> P plan_data.current_plan = new_plan # nocoverage plan_data.licenses = last_ledger_entry.licenses plan_data.licenses_used = billing_session.current_count_for_billed_licenses() + assert plan_data.current_plan is not None # for mypy + plan_data.is_legacy_plan = ( + plan_data.current_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY + ) return plan_data diff --git a/templates/analytics/current_plan_details.html b/templates/analytics/current_plan_details.html new file mode 100644 index 0000000000..d123670915 --- /dev/null +++ b/templates/analytics/current_plan_details.html @@ -0,0 +1,15 @@ +

📅 Current plan information:

+Plan name: {{ plan_data.current_plan.name }}
+Status: {{ plan_data.current_plan.get_plan_status_as_text() }}
+{% if plan_data.is_legacy_plan %} + End date: {{ plan_data.current_plan.end_date.strftime('%d %B %Y') }}
+{% else %} + Billing schedule: {% if plan_data.current_plan.billing_schedule == plan_data.current_plan.BILLING_SCHEDULE_ANNUAL %}Annual{% else %}Monthly{% endif %}
+ Licenses: {{ plan_data.licenses_used }}/{{ plan_data.licenses }} ({% if plan_data.current_plan.automanage_licenses %}Automatic{% else %}Manual{% endif %})
+ {% if plan_data.current_plan.price_per_license %} + Price per license: ${{ plan_data.current_plan.price_per_license/100 }}
+ {% elif plan_data.current_plan.fixed_price %} + Fixed price: ${{ plan_data.current_plan.fixed_price/100 }}
+ {% endif %} + Next invoice date: {{ plan_data.current_plan.next_invoice_date.strftime('%d %B %Y') }}
+{% endif %} diff --git a/templates/analytics/realm_details.html b/templates/analytics/realm_details.html index a18e1d1224..9cc589818b 100644 --- a/templates/analytics/realm_details.html +++ b/templates/analytics/realm_details.html @@ -108,19 +108,13 @@ {% endif %} + {% if plan_data[realm.id].current_plan %}
-

📅 Current plan

- Name: {{ plan_data[realm.id].current_plan.name }}
- Status: {{plan_data[realm.id].current_plan.get_plan_status_as_text()}}
- Billing schedule: {% if plan_data[realm.id].current_plan.billing_schedule == plan_data[realm.id].current_plan.BILLING_SCHEDULE_ANNUAL %}Annual{% else %}Monthly{% endif %}
- Licenses: {{ plan_data[realm.id].licenses_used }}/{{ plan_data[realm.id].licenses }} ({% if plan_data[realm.id].current_plan.automanage_licenses %}Automatic{% else %}Manual{% endif %})
- {% if plan_data[realm.id].current_plan.price_per_license %} - Price per license: ${{ plan_data[realm.id].current_plan.price_per_license/100 }}
- {% else %} - Fixed price: ${{ plan_data[realm.id].current_plan.fixed_price/100 }}
- {% endif %} - Next invoice date: {{ plan_data[realm.id].current_plan.next_invoice_date.strftime('%d %B %Y') }}
+ {% with %} + {% set plan_data = plan_data[realm.id] %} + {% include 'analytics/current_plan_details.html' %} + {% endwith %}
diff --git a/templates/analytics/remote_server_support.html b/templates/analytics/remote_server_support.html index 1d95be10cf..d03b42c4c7 100644 --- a/templates/analytics/remote_server_support.html +++ b/templates/analytics/remote_server_support.html @@ -93,21 +93,10 @@ {% if plan_data[remote_server.id].current_plan %}
-

📅 Current plan information:

- Plan name: {{ plan_data[remote_server.id].current_plan.name }}
- Status: {{plan_data[remote_server.id].current_plan.get_plan_status_as_text()}}
- {% if plan_data[remote_server.id].current_plan.tier != 101 %} - Billing schedule: {% if plan_data[remote_server.id].current_plan.billing_schedule == plan_data[remote_server.id].current_plan.BILLING_SCHEDULE_ANNUAL %}Annual{% else %}Monthly{% endif %}
- Licenses: {{ plan_data[remote_server.id].licenses_used }}/{{ plan_data[remote_server.id].licenses }} ({% if plan_data[remote_server.id].current_plan.automanage_licenses %}Automatic{% else %}Manual{% endif %})
- {% if plan_data[remote_server.id].current_plan.price_per_license %} - Price per license: ${{ plan_data[remote_server.id].current_plan.price_per_license/100 }}
- {% elif plan_data[remote_server.id].current_plan.fixed_price %} - Fixed price: ${{ plan_data[remote_server.id].current_plan.fixed_price/100 }}
- {% endif %} - Next invoice date: {{ plan_data[remote_server.id].current_plan.next_invoice_date.strftime('%d %B %Y') }}
- {% else %} - End date: {{ plan_data[remote_server.id].current_plan.end_date.strftime('%d %B %Y') }}
- {% endif %} + {% with %} + {% set plan_data = plan_data[remote_server.id] %} + {% include 'analytics/current_plan_details.html' %} + {% endwith %}
diff --git a/web/styles/portico/activity.css b/web/styles/portico/activity.css index 9d8d9eb4bf..12e99c1bfe 100644 --- a/web/styles/portico/activity.css +++ b/web/styles/portico/activity.css @@ -189,7 +189,7 @@ tr.admin td:first-child { .current-plan-details { position: relative; - top: -15px; + top: -45px; } .approve-sponsorship-form {