Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
support: Show discount information on remote support views.
Lauryn Menard391c52639fe7
diff --git a/corporate/lib/support.py b/corporate/lib/support.pyindex cfc0211d9c2..cb008d992e5 100644--- a/corporate/lib/support.py+++ b/corporate/lib/support.py@@ -58,6 +58,7 @@ class SponsorshipRequestDict(TypedDict):@dataclassclass SponsorshipData:sponsorship_pending: bool = False+ has_discount: bool = Falsemonthly_discounted_price: int | None = Noneannual_discounted_price: int | None = Noneoriginal_monthly_plan_price: int | None = None@@ -132,14 +133,17 @@ def get_customer_sponsorship_data(customer: Customer) -> SponsorshipData:pending = customer.sponsorship_pendinglicenses = customer.minimum_licensesplan_tier = customer.required_plan_tier+ has_discount = Falsesponsorship_request = Nonemonthly_discounted_price = Noneannual_discounted_price = Noneoriginal_monthly_plan_price = Noneoriginal_annual_plan_price = Noneif customer.monthly_discounted_price:+ has_discount = Truemonthly_discounted_price = customer.monthly_discounted_priceif customer.annual_discounted_price:+ has_discount = Trueannual_discounted_price = customer.annual_discounted_priceif plan_tier is not None:original_monthly_plan_price = get_price_per_license(@@ -173,6 +177,7 @@ def get_customer_sponsorship_data(customer: Customer) -> SponsorshipData:return SponsorshipData(sponsorship_pending=pending,+ has_discount=has_discount,monthly_discounted_price=monthly_discounted_price,annual_discounted_price=annual_discounted_price,original_monthly_plan_price=original_monthly_plan_price,diff --git a/templates/corporate/support/remote_realm_details.html b/templates/corporate/support/remote_realm_details.htmlindex a1618d2508c..96219c83bf7 100644--- a/templates/corporate/support/remote_realm_details.html+++ b/templates/corporate/support/remote_realm_details.html@@ -14,7 +14,7 @@{% if remote_realm.plan_type == SPONSORED_PLAN_TYPE %}<p class="support-section-header">On 100% sponsored Zulip Community plan 🎉</p>{% endif %}- {% if support_data[remote_realm.id].sponsorship_data.default_discount %}+ {% if support_data[remote_realm.id].sponsorship_data.has_discount %}<p class="support-section-header">Has a discount 💸</p>{% endif %}<b>Remote realm host:</b> {{ remote_realm.host }}<br />@@ -48,6 +48,7 @@<div class="remote-support-sponsorship-container">{% with %}{% set sponsorship_data = support_data[remote_realm.id].sponsorship_data %}+ {% set dollar_amount = dollar_amount %}{% include 'corporate/support/sponsorship_details.html' %}{% endwith %}</div>diff --git a/templates/corporate/support/remote_server_support.html b/templates/corporate/support/remote_server_support.htmlindex 488ac457d70..3bcf39603f1 100644--- a/templates/corporate/support/remote_server_support.html+++ b/templates/corporate/support/remote_server_support.html@@ -46,7 +46,7 @@{% if remote_server.plan_type == SPONSORED_PLAN_TYPE %}<p class="support-section-header">On 100% sponsored Zulip Community plan 🎉</p>{% endif %}- {% if remote_servers_support_data[remote_server.id].sponsorship_data.default_discount %}+ {% if remote_servers_support_data[remote_server.id].sponsorship_data.has_discount %}<p class="support-section-header">Has a discount 💸</p>{% endif %}<b>Contact email</b>: {{ remote_server.contact_email }}diff --git a/templates/corporate/support/sponsorship_details.html b/templates/corporate/support/sponsorship_details.htmlindex 3f442893a65..a35a005252e 100644--- a/templates/corporate/support/sponsorship_details.html+++ b/templates/corporate/support/sponsorship_details.html@@ -1,10 +1,15 @@<div class="remote-sponsorship-details"><p class="support-section-header">💸 Discount and sponsorship information:</p><b>Sponsorship pending</b>: {{ sponsorship_data.sponsorship_pending }}<br />- {% if sponsorship_data.default_discount %}- <b>Discount</b>: {{ sponsorship_data.default_discount }}%<br />+ {% if sponsorship_data.has_discount %}+ {% if sponsorship_data.monthly_discounted_price %}+ <b>Discounted price (monthly)</b>: {{ dollar_amount(sponsorship_data.monthly_discounted_price) }}%<br />+ {% endif %}+ {% if sponsorship_data.annual_discounted_price %}+ <b>Discounted price (annual)</b>: {{ dollar_amount(sponsorship_data.monthly_discounted_price) }}%<br />+ {% endif %}{% else %}- <b>Discount</b>: None<br />+ <b>Discounted price</b>: None<br />{% endif %}<b>Minimum licenses</b>: {{ sponsorship_data.minimum_licenses }}<br />{% if sponsorship_data.required_plan_tier %}