From e37e9644bad0215f15f59f6c6e349a7fb17127a2 Mon Sep 17 00:00:00 2001 From: anishTP Date: Thu, 28 Mar 2024 12:59:49 +0530 Subject: [PATCH 01/11] Rough template of the new cash receipt layout --- .../templates/cash_receipt_new.html.jinja2 | 481 ++++++++++++++++ boxoffice/templates/layout_email.html.jinja2 | 539 ++++++++++++++++++ 2 files changed, 1020 insertions(+) create mode 100644 boxoffice/templates/cash_receipt_new.html.jinja2 create mode 100644 boxoffice/templates/layout_email.html.jinja2 diff --git a/boxoffice/templates/cash_receipt_new.html.jinja2 b/boxoffice/templates/cash_receipt_new.html.jinja2 new file mode 100644 index 00000000..c5c44680 --- /dev/null +++ b/boxoffice/templates/cash_receipt_new.html.jinja2 @@ -0,0 +1,481 @@ +{%- extends "layout_email.html.jinja2" -%} +{%- from "macros_email.html.jinja2" import cta_button -%} +{%- block content -%} + +
+ + +

{%- trans %}Receipt no. {% endtrans -%}{{ order.receipt_no }}

+ + + + +

{%- trans %}Hasgeek Learning Private Limited {% endtrans -%}

+ + + + +

{%- trans %}Address {% endtrans -%}

+ + +

+ {%- if org.details.get('address') %} + {{ org.details.get('address')|safe }} + {%- endif %} +

+ + +

{%- trans %}CIN {% endtrans -%}

+

+ {%- if org.details.get('cin') %} +

{{ org.details.get('cin') }}

+ {%- endif %} +

+ + +

{%- trans %}LLPIN {% endtrans -%}

+

+ {%- if org.details.get('llpin') %} +

{{ org.details.get('llpin') }}

+ {%- endif %} +

+ + +

{%- trans %}PAN {% endtrans -%}

+

+ {%- if org.details.get('pan') %} +

{{ org.details.get('pan') }}

+ {%- endif %} +

+ + + + +

{%- trans %}Buyer Details{% endtrans -%}

+ + + + +

{%- trans %}Name {% endtrans -%}

+

{{ order.buyer_fullname }}

+ + +

{%- trans %}Phone {% endtrans -%}

+

{{ order.buyer_phone }}

+ + +

{%- trans %}Paid on {% endtrans -%}

+

{{ order.paid_at | longdate }}

+ + +

{%- trans %}Email {% endtrans -%}

+

{{ order.buyer_email }}

+ + + + +

{%- trans %}Order Summary{% endtrans -%}

+ + + + {% trans %}Item{% endtrans %} + + + {% trans %}Price{% endtrans %} + +
+ {% for line_item in line_items -%} + + + {{ line_item.ticket.title }}
+ {{ line_item.ticket.description }} + + +

{{ currency_symbol }} {{ line_item.base_amount }}

+ + + {%- endfor %} + +
+ + +

{{ currency_symbol }} {{ line_item.base_amount }}

+ + +

{{ currency_symbol }} {{ line_item.discounted_amount }}

+ {% if line_item.discount_policy %} +

{{ line_item.discount_policy.title }}

+ {% endif %} + + +

{{ currency_symbol }} {{ line_item.final_amount }}

+ + + {%- if order.refunded_amount %} +

{% trans %}Refunds{% endtrans %}

+ + + + + + + + + {% for transaction in order.refund_transactions -%} + + + + + {%- if transaction.refund_description %} + + {%- elif transaction.refunded_at %} + + {%- else %} + + {%- endif %} + + + {%- endfor %} + + + + + +
{% trans %}No.{% endtrans %}{% trans %}Receipt#{% endtrans %}{% trans %}Refund date{% endtrans %}{% trans %}Refund reason{% endtrans %}{% trans %}Amount{% endtrans %}
{{ loop.index }}{{ order.receipt_no }} + {% if transaction.refunded_at %} + {{ transaction.refunded_at | longdate }} + {%- endif %} + {{ transaction.refund_description }}{% trans date=transaction.refunded_at|longdate %}Refunded on {{ date }}{% endtrans %}{% trans %}Refund{% endtrans %}
{{ currency_symbol }} {{ transaction.amount }}
{% trans %}Total refund{% endtrans %}{{ currency_symbol }} {{ order.refunded_amount }}
+ {%- endif %} + + {# Button : BEGIN #} + {{ cta_button(url_for('assign_ticket'), gettext("Assign ticket") )}} + {{ cta_button(url_for('gst'), gettext("GST invoice") )}} + {# Button : END #} + + + + + + + {% if order.refunded_amount > 0 %} + + + + + + {% endif %} +
{% trans %}Total paid{% endtrans %}
{{ currency_symbol }} {{ order.paid_amount }}
{% trans %}Net paid (post refund){% endtrans %}
{{ currency_symbol }} {{ order.net_amount }}
+ +{%- endblock content -%} + + + + + + + + + {% trans %}Receipt{% endtrans %} + + + + + +
+

{% trans %}Cash Receipt{% endtrans %}

+ +
+ {%- if org.details.get('logo') %} + + {%- endif %} + +
+ {%- if org.details.get('address') %} + {{ org.details.get('address')|safe }} + {%- endif %} + {%- if org.details.get('cin') %} +

{% trans %}CIN:{% endtrans %} {{ org.details.get('cin') }}

+ {%- elif org.details.get('llpin') %} +

{% trans %}LLPIN:{% endtrans %} {{ org.details.get('llpin') }}

+ {%- endif %} + {%- if org.details.get('pan') %} +

{% trans %}PAN:{% endtrans %} {{ org.details.get('pan') }}

+ {%- endif %} + {%- if org.details.get('service_tax_no') %} +

{% trans %}Service Tax No:{% endtrans %} {{ org.details.get('service_tax_no') }}

+ {%- endif %} + {%- if org.details.get('website') %} +

{{ org.details.get('website') }}

+ {%- endif %} +

{{ org.contact_email }}

+
+
+ +
+ + + + + + + + + + + + + + + + +
{% trans %}Bill To{% endtrans %}
{% trans %}Name{% endtrans %}{{ order.buyer_fullname }}
{% trans %}Email{% endtrans %}{{ order.buyer_email }}
{% trans %}Phone{% endtrans %}{{ order.buyer_phone }}
+ + + + + + + + + + +
{% trans %}Receipt#{% endtrans %}{{ order.receipt_no }}
{% trans %}Date{% endtrans %}{{ order.paid_at | longdate }}
+
+ + + + + + + + + + {% for line_item in line_items -%} + + + + + + + + + + {%- endfor %} + + + + + + {% if order.refunded_amount > 0 %} + + + + + + {% endif %} +
{% trans %}Ticket No.{% endtrans %}{% trans %}Base Price{% endtrans %}{% trans %}Discount{% endtrans %}{% trans %}Final Price{% endtrans %}
{{ line_item.line_item_seq }} + {{ line_item.ticket.title }}
+ {{ line_item.ticket.description }} +
+

{{ currency_symbol }} {{ line_item.base_amount }}

+
+

{{ currency_symbol }} {{ line_item.discounted_amount }}

+ {% if line_item.discount_policy %} +

{{ line_item.discount_policy.title }}

+ {% endif %} +
+

{{ currency_symbol }} {{ line_item.final_amount }}

+
{% trans %}Total paid{% endtrans %}
{{ currency_symbol }} {{ order.paid_amount }}
{% trans %}Net paid (post refund){% endtrans %}
{{ currency_symbol }} {{ order.net_amount }}
+ + {%- if order.refunded_amount %} +

{% trans %}Refunds{% endtrans %}

+ + + + + + + + + {% for transaction in order.refund_transactions -%} + + + + + {%- if transaction.refund_description %} + + {%- elif transaction.refunded_at %} + + {%- else %} + + {%- endif %} + + + {%- endfor %} + + + + + +
{% trans %}No.{% endtrans %}{% trans %}Receipt#{% endtrans %}{% trans %}Refund date{% endtrans %}{% trans %}Refund reason{% endtrans %}{% trans %}Amount{% endtrans %}
{{ loop.index }}{{ order.receipt_no }} + {% if transaction.refunded_at %} + {{ transaction.refunded_at | longdate }} + {%- endif %} + {{ transaction.refund_description }}{% trans date=transaction.refunded_at|longdate %}Refunded on {{ date }}{% endtrans %}{% trans %}Refund{% endtrans %}
{{ currency_symbol }} {{ transaction.amount }}
{% trans %}Total refund{% endtrans %}{{ currency_symbol }} {{ order.refunded_amount }}
+ {%- endif %} + +
+
{{ org.details.get('refund_policy', '')|safe }}
+
+ +
+ + + diff --git a/boxoffice/templates/layout_email.html.jinja2 b/boxoffice/templates/layout_email.html.jinja2 new file mode 100644 index 00000000..6ba0208e --- /dev/null +++ b/boxoffice/templates/layout_email.html.jinja2 @@ -0,0 +1,539 @@ + + + + {# utf-8 works for most cases #} + + + + {# What it does: Makes background images in 72ppi Outlook render at correct size. #} + + + {# Outlook / @font-face : BEGIN #} + + {# Desktop Outlook chokes on web font references and defaults to Times New Roman, so we force a safe fallback font. #} + + + {# Outlook / @font-face : END #} + + {% block stylesheet -%} + {# CSS Reset : BEGIN #} + + {# CSS Reset : END #} + + {# Progressive Enhancements : BEGIN #} + + {# Progressive Enhancements : END #} + {%- endblock stylesheet %} + + {# Element styles : BEGIN #} + + + + + {# + The email background color (#f0f0f0) is defined in three places: + 1. body tag: for most email clients + 2. center tag: for Gmail and Inbox mobile apps and web versions of Gmail, GSuite, Inbox, Yahoo, AOL, Libero, Comcast, freenet, Mail.ru, Orange.fr + 3. mso conditional: For Windows 10 Mail + #} + + {%- block jsonld %}{%- if jsonld %} + + {%- endif %}{%- endblock jsonld %} + +
+ + + {# + Set the email width. Defined in two places: + 1. max-width for all clients except Desktop Windows Outlook, allowing the email to squish on narrow but never go wider than 600px. + 2. MSO tags for Desktop Windows Outlook enforce a 600px width. + #} + + {# Email Footer : BEGIN #} + {% block footer %} + + + + {% endblock footer %}
+ {# Email Footer : END #} + +
+ + From d098ae3c6b61b357781d8bb2138746faf895fa0b Mon Sep 17 00:00:00 2001 From: anishTP Date: Thu, 28 Mar 2024 15:15:22 +0530 Subject: [PATCH 02/11] Modified the order summary table --- .../templates/cash_receipt_new.html.jinja2 | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/boxoffice/templates/cash_receipt_new.html.jinja2 b/boxoffice/templates/cash_receipt_new.html.jinja2 index c5c44680..1dfb788a 100644 --- a/boxoffice/templates/cash_receipt_new.html.jinja2 +++ b/boxoffice/templates/cash_receipt_new.html.jinja2 @@ -97,20 +97,35 @@ {%- endfor %}
- - -

{{ currency_symbol }} {{ line_item.base_amount }}

- - -

{{ currency_symbol }} {{ line_item.discounted_amount }}

- {% if line_item.discount_policy %} -

{{ line_item.discount_policy.title }}

- {% endif %} - - -

{{ currency_symbol }} {{ line_item.final_amount }}

- - + + + + + + + + + + + + + +
+

Sub-total

+
+

{{ currency_symbol }} {{ line_item.base_amount }}

+
+

Discount

+
+

{{ currency_symbol }} {{ line_item.discounted_amount }}

+ {% if line_item.discount_policy %} +

{{ line_item.discount_policy.title }}

+ {% endif %} +
+

Total

+
+

{{ currency_symbol }} {{ line_item.final_amount }}

+
{%- if order.refunded_amount %}

{% trans %}Refunds{% endtrans %}

From 15ca933c6dc461851a8debe7b8d445da74b2e7de Mon Sep 17 00:00:00 2001 From: anishTP Date: Tue, 2 Apr 2024 16:40:22 +0530 Subject: [PATCH 03/11] Modified basic structure of cash receipt template --- .../templates/cash_receipt_new.html.jinja2 | 79 +++++++++++-------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/boxoffice/templates/cash_receipt_new.html.jinja2 b/boxoffice/templates/cash_receipt_new.html.jinja2 index 1dfb788a..094a8362 100644 --- a/boxoffice/templates/cash_receipt_new.html.jinja2 +++ b/boxoffice/templates/cash_receipt_new.html.jinja2 @@ -128,39 +128,54 @@
{%- if order.refunded_amount %}

{% trans %}Refunds{% endtrans %}

- - - - - - - - {% for transaction in order.refund_transactions -%} - - - - - {%- if transaction.refund_description %} - - {%- elif transaction.refunded_at %} - - {%- else %} - - {%- endif %} - - - {%- endfor %} - - - - - -
{% trans %}No.{% endtrans %}{% trans %}Receipt#{% endtrans %}{% trans %}Refund date{% endtrans %}{% trans %}Refund reason{% endtrans %}{% trans %}Amount{% endtrans %}
{{ loop.index }}{{ order.receipt_no }} - {% if transaction.refunded_at %} - {{ transaction.refunded_at | longdate }} - {%- endif %} - {{ transaction.refund_description }}{% trans date=transaction.refunded_at|longdate %}Refunded on {{ date }}{% endtrans %}{% trans %}Refund{% endtrans %}
{{ currency_symbol }} {{ transaction.amount }}
{% trans %}Total refund{% endtrans %}{{ currency_symbol }} {{ order.refunded_amount }}
+ + + + + + + + + + + + + + {%- elif transaction.refunded_at %} + + {%- else %} + + {%- endif %} + + + + + + + + + + {%- endfor %} + + + + + +
+

{% trans %}Receipt no.{% endtrans %}

+

{{ order.receipt_no }}

+
+

{% trans %}Refund date{% endtrans %}

+

+ {% if transaction.refunded_at %} + {{ transaction.refunded_at | longdate }} + {%- endif %} +

+
{% trans %}Refund reason{% endtrans %}{% trans %}Amount{% endtrans %}
+ {%- if transaction.refund_description %} + {{ transaction.refund_description }}{% trans date=transaction.refunded_at|longdate %}Refunded on {{ date }}{% endtrans %}{% trans %}Refund{% endtrans %}

{{ currency_symbol }} {{ transaction.amount }}

{{ loop.index }}{{ order.receipt_no }} +
{{ currency_symbol }} {{ transaction.amount }}
{% trans %}Total refund{% endtrans %}{{ currency_symbol }} {{ order.refunded_amount }}
{%- endif %} {# Button : BEGIN #} From 0f1fedaf20717d4726b76c4c1d8e97d2f051dd10 Mon Sep 17 00:00:00 2001 From: anishTP Date: Thu, 4 Apr 2024 15:22:52 +0530 Subject: [PATCH 04/11] Added sections torder summary and cancellation policy to the cash receipt template --- .../templates/cash_receipt_new.html.jinja2 | 274 ++++++++++-------- boxoffice/templates/layout_email.html.jinja2 | 71 +++++ boxoffice/templates/macros_email.html.jinja2 | 50 ++++ boxoffice/views/order.py | 2 +- 4 files changed, 282 insertions(+), 115 deletions(-) create mode 100644 boxoffice/templates/macros_email.html.jinja2 diff --git a/boxoffice/templates/cash_receipt_new.html.jinja2 b/boxoffice/templates/cash_receipt_new.html.jinja2 index 094a8362..42a0b07c 100644 --- a/boxoffice/templates/cash_receipt_new.html.jinja2 +++ b/boxoffice/templates/cash_receipt_new.html.jinja2 @@ -1,131 +1,185 @@ {%- extends "layout_email.html.jinja2" -%} {%- from "macros_email.html.jinja2" import cta_button -%} {%- block content -%} -
+
- +

{%- trans %}Receipt no. {% endtrans -%}{{ order.receipt_no }}

- +

{%- trans %}Hasgeek Learning Private Limited {% endtrans -%}

- - -

{%- trans %}Address {% endtrans -%}

- - -

- {%- if org.details.get('address') %} - {{ org.details.get('address')|safe }} - {%- endif %} -

- - -

{%- trans %}CIN {% endtrans -%}

-

- {%- if org.details.get('cin') %} -

{{ org.details.get('cin') }}

- {%- endif %} -

- - -

{%- trans %}LLPIN {% endtrans -%}

-

- {%- if org.details.get('llpin') %} -

{{ org.details.get('llpin') }}

- {%- endif %} -

- - -

{%- trans %}PAN {% endtrans -%}

-

- {%- if org.details.get('pan') %} -

{{ org.details.get('pan') }}

- {%- endif %} -

+ + + +
+ + + + + + + +
+

{%- trans %}Address {% endtrans -%}

+ {%- if org.details.get('address') %} +

{{ org.details.get('address')|safe }}

+ {%- endif %} +

+

{%- trans %}PAN{% endtrans -%}

+ {%- if org.details.get('pan') %} +

{{ org.details.get('pan') }}

+ {%- endif %} +
+
+ +
+ + + + + + + +
+

{%- trans %}CIN {% endtrans -%}

+ {%- if org.details.get('cin') %} +

{{ org.details.get('cin') }}

+ {%- endif %} +
+

{%- trans %}Email {% endtrans -%}

+

{{ org.contact_email }}

+
+
+ - -

{%- trans %}Buyer Details{% endtrans -%}

+ +

{%- trans %}Buyer details{% endtrans -%}

- - -

{%- trans %}Name {% endtrans -%}

-

{{ order.buyer_fullname }}

- - -

{%- trans %}Phone {% endtrans -%}

-

{{ order.buyer_phone }}

- - -

{%- trans %}Paid on {% endtrans -%}

-

{{ order.paid_at | longdate }}

- - -

{%- trans %}Email {% endtrans -%}

-

{{ order.buyer_email }}

+ + + +
+ + + + + + + +
+

{%- trans %}Name {% endtrans -%}

+

{{ order.buyer_fullname }}

+
+

{%- trans %}Phone {% endtrans -%}

+

{{ order.buyer_phone }}

+
+
+ +
+ + + + + + + +
+

{%- trans %}Paid on {% endtrans -%}

+

{{ order.paid_at | longdate }}

+
+

{%- trans %}Email {% endtrans -%}

+

{{ order.buyer_email }}

+
+
+ - +

{%- trans %}Order Summary{% endtrans -%}

- - {% trans %}Item{% endtrans %} - - - {% trans %}Price{% endtrans %} + + {% trans %}Item{% endtrans %} + {% trans %}Price{% endtrans %} -
{% for line_item in line_items -%} - - {{ line_item.ticket.title }}
- {{ line_item.ticket.description }} + +

{{ line_item.ticket.title }}

+

{{ line_item.ticket.description| safe}}

- +

{{ currency_symbol }} {{ line_item.base_amount }}

+ +

+ + + + + + + + + + + + + + + + +
+

{% trans %}Sub-total{% endtrans %}

+
+

{{ currency_symbol }} {{ line_item.base_amount }}

+
+

{% trans %}Discount{% endtrans %}

+
+

{{ currency_symbol }} {{ line_item.discounted_amount }}

+
+

{% trans %}Total Paid{% endtrans %}

+
+

{{ currency_symbol }} {{ line_item.final_amount }}

+
+ + {%- endfor %} - -
- - - - - - - - - - - -
-

Sub-total

-
-

{{ currency_symbol }} {{ line_item.base_amount }}

-
-

Discount

-
-

{{ currency_symbol }} {{ line_item.discounted_amount }}

- {% if line_item.discount_policy %} -

{{ line_item.discount_policy.title }}

- {% endif %} -
-

Total

-
-

{{ currency_symbol }} {{ line_item.final_amount }}

+
+

*To access the benefits of this ticket please ensure you are logged in to your Hasgeek account with this same email address.

{%- if order.refunded_amount %}

{% trans %}Refunds{% endtrans %}

{% for transaction in order.refund_transactions -%} @@ -177,28 +231,19 @@ {%- endif %} - - {# Button : BEGIN #} - {{ cta_button(url_for('assign_ticket'), gettext("Assign ticket") )}} - {{ cta_button(url_for('gst'), gettext("GST invoice") )}} - {# Button : END #} - - - - - - - {% if order.refunded_amount > 0 %} - - - - - - {% endif %} -
{% trans %}Total paid{% endtrans %}
{{ currency_symbol }} {{ order.paid_amount }}
{% trans %}Net paid (post refund){% endtrans %}
{{ currency_symbol }} {{ order.net_amount }}
- + {{ cta_button('{base_url}/order/{access_token}/ticket'.format(base_url=base_url, access_token=order.access_token), gettext("Assign ticket") )}} + {{ cta_button('{base_url}/order/{access_token}/invoice'.format(base_url=base_url, access_token=order.access_token), gettext("GST invoice") )}} + + +
+

Cancellation and transfer

+ {{ org.details.get('refund_policy')|safe }} +
+ + {%- endblock content -%} +{# @@ -509,3 +554,4 @@ +#} diff --git a/boxoffice/templates/layout_email.html.jinja2 b/boxoffice/templates/layout_email.html.jinja2 index 6ba0208e..e24176f9 100644 --- a/boxoffice/templates/layout_email.html.jinja2 +++ b/boxoffice/templates/layout_email.html.jinja2 @@ -336,6 +336,77 @@ text-decoration: underline; } + diff --git a/boxoffice/templates/macros_email.html.jinja2 b/boxoffice/templates/macros_email.html.jinja2 new file mode 100644 index 00000000..47534e48 --- /dev/null +++ b/boxoffice/templates/macros_email.html.jinja2 @@ -0,0 +1,50 @@ + +{%- macro hero_image(img_url, alt_text) -%} + + + {{ alt_text }} + + +{%- endmacro -%} + +{% macro cta_button(btn_url, btn_text) %} + +
+ + + +
+ + + + + + +
+ +
+ +
+ + +{% endmacro %} + +{% macro rsvp_footer(view, rsvp_linktext) %} + {%- if view %} + + + + + + + + + {%- endif %} +{% endmacro %} diff --git a/boxoffice/views/order.py b/boxoffice/views/order.py index 62827196..3fcd8a54 100644 --- a/boxoffice/views/order.py +++ b/boxoffice/views/order.py @@ -480,7 +480,7 @@ def receipt(order: Order): LineItem.order == order, LineItem.status == LineItemStatus.CONFIRMED ).all() return render_template( - 'cash_receipt.html.jinja2', + 'cash_receipt_new.html.jinja2', order=order, org=order.organization, line_items=line_items, From b0553f0b515345ea00ecdc78d764e3af3be06f55 Mon Sep 17 00:00:00 2001 From: anishTP Date: Fri, 5 Apr 2024 15:39:22 +0530 Subject: [PATCH 05/11] Resolved issues in the PR and fixed the buttons along with item-description styling --- .../templates/cash_receipt_new.html.jinja2 | 630 ++++++------------ boxoffice/templates/layout_email.html.jinja2 | 37 +- boxoffice/templates/macros_email.html.jinja2 | 59 +- 3 files changed, 259 insertions(+), 467 deletions(-) diff --git a/boxoffice/templates/cash_receipt_new.html.jinja2 b/boxoffice/templates/cash_receipt_new.html.jinja2 index 42a0b07c..f00793ee 100644 --- a/boxoffice/templates/cash_receipt_new.html.jinja2 +++ b/boxoffice/templates/cash_receipt_new.html.jinja2 @@ -1,16 +1,31 @@ {%- extends "layout_email.html.jinja2" -%} -{%- from "macros_email.html.jinja2" import cta_button -%} +{%- from "macros_email.html.jinja2" import cta_button, line_break -%} {%- block content -%}
-
+ + +

+ {%- trans %}Payment Receipt{% endtrans -%} +

+ + + + +
+ + - -

{%- trans %}Receipt no. {% endtrans -%}{{ order.receipt_no }}

+ +

+ {%- trans %}Receipt no. {% endtrans -%} + {{ order.receipt_no }} +

+ -

{%- trans %}Hasgeek Learning Private Limited {% endtrans -%}

+

{{ org.details.get('name') }}

@@ -22,22 +37,24 @@
+ {%- if org.details %} + {%- endif %}
-

{%- trans %}Address {% endtrans -%}

- {%- if org.details.get('address') %} -

{{ org.details.get('address')|safe }}

- {%- endif %} +

+ {%- trans %}Address{% endtrans -%} +

+

{{ org.details.get('address')|safe }}

-

{%- trans %}PAN{% endtrans -%}

- {%- if org.details.get('pan') %} -

{{ org.details.get('pan') }}

- {%- endif %} +

+ {%- trans %}PAN{% endtrans -%} +

+

{{ org.details.get('pan') }}

+ {%- if org.details %} + {%- endif %} @@ -68,9 +89,12 @@ + @@ -84,13 +108,17 @@
-

{%- trans %}CIN {% endtrans -%}

- {%- if org.details.get('cin') %} -

{{ org.details.get('cin') }}

- {%- endif %} +

+ {%- trans %}CIN{% endtrans -%} +

+

{{ org.details.get('cin') }}

-

{%- trans %}Email {% endtrans -%}

+

+ {%- trans %}Email{% endtrans -%} +

{{ org.contact_email }}

-

{%- trans %}Buyer details{% endtrans -%}

+

+ {%- trans %}Buyer details{% endtrans -%} +

@@ -103,13 +131,17 @@
-

{%- trans %}Name {% endtrans -%}

+

+ {%- trans -%}Name{%- endtrans -%} +

{{ order.buyer_fullname }}

-

{%- trans %}Phone {% endtrans -%}

+

+ {%- trans %}Phone{% endtrans -%} +

{{ order.buyer_phone }}

@@ -122,117 +154,177 @@ + - - - + + + + + {% for line_item in line_items -%} + + + - {% for line_item in line_items -%} - - - + + + + + + + + + {%- endfor %} + + {%- if order.refunded_amount %} + + - - - - + + + {{ line_break() }} + + + + {{ line_break() }} {%- endblock content -%} -{# - - - - - - - - {% trans %}Receipt{% endtrans %} - - - - - -
-

{% trans %}Cash Receipt{% endtrans %}

- -
- {%- if org.details.get('logo') %} - - {%- endif %} - -
- {%- if org.details.get('address') %} - {{ org.details.get('address')|safe }} - {%- endif %} - {%- if org.details.get('cin') %} -

{% trans %}CIN:{% endtrans %} {{ org.details.get('cin') }}

- {%- elif org.details.get('llpin') %} -

{% trans %}LLPIN:{% endtrans %} {{ org.details.get('llpin') }}

- {%- endif %} - {%- if org.details.get('pan') %} -

{% trans %}PAN:{% endtrans %} {{ org.details.get('pan') }}

- {%- endif %} - {%- if org.details.get('service_tax_no') %} -

{% trans %}Service Tax No:{% endtrans %} {{ org.details.get('service_tax_no') }}

- {%- endif %} - {%- if org.details.get('website') %} -

{{ org.details.get('website') }}

- {%- endif %} -

{{ org.contact_email }}

-
-
- -
-
-

{%- trans %}Paid on {% endtrans -%}

+

+ {%- trans %}Paid on{% endtrans -%} +

{{ order.paid_at | longdate }}

-

{%- trans %}Email {% endtrans -%}

+

+ {%- trans %}Email{% endtrans -%} +

{{ order.buyer_email }}

-

{%- trans %}Order Summary{% endtrans -%}

+

+ {%- trans %}Order Summary{% endtrans -%} +

{% trans %}Item{% endtrans %}{% trans %}Price{% endtrans %}
+ {%- trans %}Item{% endtrans -%} + + {%- trans %}Price{% endtrans -%} +
+

{{ loop.index }}{{ '. ' + line_item.ticket.title }}

+
+

{{ currency_symbol }} {{ line_item.base_amount }}

+
-

{{ line_item.ticket.title }}

-

{{ line_item.ticket.description| safe}}

-
-

{{ currency_symbol }} {{ line_item.base_amount }}

+
{{ line_item.ticket.description| safe}}


+ + + + + + + + + + + + + +
+

+ {%- trans %}Sub-total{% endtrans-%} +

+
+

{{ currency_symbol }} {{ line_item.base_amount }}

+
+

+ {%- trans %}Discount{% endtrans -%} +

+
+

{{ currency_symbol }} {{ line_item.discounted_amount }}

+
+

+ {%- trans %}Total Paid{% endtrans -%} +

+
+

{{ currency_symbol }} {{ line_item.final_amount }}

+
+
+

+ {%- trans %}Refunds{% endtrans -%} +



- - - - - - - - - - - - - + - {%- endfor %} - - - - {%- if order.refunded_amount %} -

{% trans %}Refunds{% endtrans %}

- {% for transaction in order.refund_transactions -%} + + + +
-

{% trans %}Sub-total{% endtrans %}

-
-

{{ currency_symbol }} {{ line_item.base_amount }}

-
-

{% trans %}Discount{% endtrans %}

-
-

{{ currency_symbol }} {{ line_item.discounted_amount }}

-
-

{% trans %}Total Paid{% endtrans %}

-
-

{{ currency_symbol }} {{ line_item.final_amount }}

-
+ +
+ + + + +
+

+ {%- trans -%}Refund receipt{%- endtrans -%} +

+

{{ order.receipt_no }}

+
+
+ {% if transaction.refunded_at %} + +
+ + + + +
+

+ {%- trans %}Refund date{% endtrans -%} +

+

+ {{ transaction.refunded_at | longdate }} +

+
+
+ + {%- endif %}
-

*To access the benefits of this ticket please ensure you are logged in to your Hasgeek account with this same email address.

-
+ {%- trans %}Refund reason{% endtrans -%} + + {%- trans %}Amount{% endtrans -%} +
- - - - - - - - - - - - {%- if transaction.refund_description %} {%- elif transaction.refunded_at %} - + {%- else %} - + {%- endif %} - - - + + + {%- endfor %} - - - - + - {%- endfor %} - - - - -
-

{% trans %}Receipt no.{% endtrans %}

-

{{ order.receipt_no }}

-
-

{% trans %}Refund date{% endtrans %}

-

- {% if transaction.refunded_at %} - {{ transaction.refunded_at | longdate }} - {%- endif %} -

-
{% trans %}Refund reason{% endtrans %}{% trans %}Amount{% endtrans %}
+ {% for transaction in order.refund_transactions -%} +
{{ transaction.refund_description }}{% trans date=transaction.refunded_at|longdate %}Refunded on {{ date }}{% endtrans %} + {%- trans date=transaction.refunded_at|longdate %}Refunded on{{ date }}{% endtrans -%} + {% trans %}Refund{% endtrans %} + {%- trans %}Refund{% endtrans -%} +

{{ currency_symbol }} {{ transaction.amount }}

{{ currency_symbol }} {{ transaction.amount }}

{{ loop.index }}{{ order.receipt_no }} + + {%- trans %}Total refund{% endtrans -%}
{{ currency_symbol }} {{ transaction.amount }}
{{ currency_symbol }} {{ order.refunded_amount }}
{% trans %}Total refund{% endtrans %}{{ currency_symbol }} {{ order.refunded_amount }}
- {%- endif %} - {{ cta_button('{base_url}/order/{access_token}/ticket'.format(base_url=base_url, access_token=order.access_token), gettext("Assign ticket") )}} - {{ cta_button('{base_url}/order/{access_token}/invoice'.format(base_url=base_url, access_token=order.access_token), gettext("GST invoice") )}} + {%- endif %} + {{ line_break() }} +
+

+ {%- trans %}To access the benefits of this ticket please ensure you are logged in to your Hasgeek account with this same email address.{% endtrans -%} +

+
+ {{ cta_button('{base_url}/order/{access_token}/ticket'.format(base_url=base_url, access_token=order.access_token), gettext("Assign ticket"), gettext("primary") )}} + {{ cta_button('{base_url}/order/{access_token}/invoice'.format(base_url=base_url, access_token=order.access_token), gettext("GST invoice"), gettext("dark") )}} +
@@ -243,315 +335,3 @@
- - - - - - - - - - - - - - - -
{% trans %}Bill To{% endtrans %}
{% trans %}Name{% endtrans %}{{ order.buyer_fullname }}
{% trans %}Email{% endtrans %}{{ order.buyer_email }}
{% trans %}Phone{% endtrans %}{{ order.buyer_phone }}
- - - - - - - - - - -
{% trans %}Receipt#{% endtrans %}{{ order.receipt_no }}
{% trans %}Date{% endtrans %}{{ order.paid_at | longdate }}
-
- - - - - - - - - - {% for line_item in line_items -%} - - - - - - - - - - {%- endfor %} - - - - - - {% if order.refunded_amount > 0 %} - - - - - - {% endif %} -
{% trans %}Ticket No.{% endtrans %}{% trans %}Base Price{% endtrans %}{% trans %}Discount{% endtrans %}{% trans %}Final Price{% endtrans %}
{{ line_item.line_item_seq }} - {{ line_item.ticket.title }}
- {{ line_item.ticket.description }} -
-

{{ currency_symbol }} {{ line_item.base_amount }}

-
-

{{ currency_symbol }} {{ line_item.discounted_amount }}

- {% if line_item.discount_policy %} -

{{ line_item.discount_policy.title }}

- {% endif %} -
-

{{ currency_symbol }} {{ line_item.final_amount }}

-
{% trans %}Total paid{% endtrans %}
{{ currency_symbol }} {{ order.paid_amount }}
{% trans %}Net paid (post refund){% endtrans %}
{{ currency_symbol }} {{ order.net_amount }}
- - {%- if order.refunded_amount %} -

{% trans %}Refunds{% endtrans %}

- - - - - - - - - {% for transaction in order.refund_transactions -%} - - - - - {%- if transaction.refund_description %} - - {%- elif transaction.refunded_at %} - - {%- else %} - - {%- endif %} - - - {%- endfor %} - - - - - -
{% trans %}No.{% endtrans %}{% trans %}Receipt#{% endtrans %}{% trans %}Refund date{% endtrans %}{% trans %}Refund reason{% endtrans %}{% trans %}Amount{% endtrans %}
{{ loop.index }}{{ order.receipt_no }} - {% if transaction.refunded_at %} - {{ transaction.refunded_at | longdate }} - {%- endif %} - {{ transaction.refund_description }}{% trans date=transaction.refunded_at|longdate %}Refunded on {{ date }}{% endtrans %}{% trans %}Refund{% endtrans %}
{{ currency_symbol }} {{ transaction.amount }}
{% trans %}Total refund{% endtrans %}{{ currency_symbol }} {{ order.refunded_amount }}
- {%- endif %} - -
-
{{ org.details.get('refund_policy', '')|safe }}
-
- - - - - -#} diff --git a/boxoffice/templates/layout_email.html.jinja2 b/boxoffice/templates/layout_email.html.jinja2 index e24176f9..6a50ca29 100644 --- a/boxoffice/templates/layout_email.html.jinja2 +++ b/boxoffice/templates/layout_email.html.jinja2 @@ -159,15 +159,31 @@ font-size: 15px; line-height: 15px; text-decoration: none; + width: 100%; } .button-a { - border: 1px solid #4d5763; padding: 13px 17px; color: #ffffff; display: block; + text-transform: uppercase; + } + .button-a-primary { + background-color: #0f73ed !important; + border-color: #0f73ed !important; + box-sizing: border-box; + } + .button-a-dark { + background-color: #4d5763 !important; + border-color: #4d5763 !important; + box-sizing: border-box; } .button-td-primary:hover, .button-a-primary:hover { + background-color: #0c55bf !important; + border-color: #0c55bf !important; + } + .button-td-secondary:hover, + .button-a-secondary:hover { background-color: #1f2d3d !important; border-color: #1f2d3d !important; } @@ -391,7 +407,7 @@ border-bottom: 1px solid #656565; } .order-description { - padding-bottom: 16px; + padding-bottom: 0; } .order-description > p:first-child { font-weight: 600; @@ -406,6 +422,23 @@ font-variant: all-small-caps; font-size: 21px !important; } + .receipt-title { + padding-bottom: 16px; + } + .receipt-subtitle { + padding-top: 8px; + } + .item-description > p { + margin-top: 0; + padding-left: 16px; + } + .item-description > ul { + list-style: outside; + padding-left: 16px; + margin-left: 12px; + font-size: 14px; + padding-bottom: 16px; + } diff --git a/boxoffice/templates/macros_email.html.jinja2 b/boxoffice/templates/macros_email.html.jinja2 index 47534e48..11fa7297 100644 --- a/boxoffice/templates/macros_email.html.jinja2 +++ b/boxoffice/templates/macros_email.html.jinja2 @@ -1,50 +1,29 @@ - -{%- macro hero_image(img_url, alt_text) -%} - - - {{ alt_text }} - - -{%- endmacro -%} - -{% macro cta_button(btn_url, btn_text) %} - -
- - - -
- - - - - - + +
+{% macro cta_button(btn_url, btn_text, btn_style) %} +
+ + + + + - -
- -
-
+ +
{% endmacro %} -{% macro rsvp_footer(view, rsvp_linktext) %} - {%- if view %} - - - +{% macro line_break() %} - +
- {%- endif %} {% endmacro %} From e7ce1764592f2be402eb2a285059bbf7f5af2511 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:10:47 +0000 Subject: [PATCH 06/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- boxoffice/templates/cash_receipt_new.html.jinja2 | 1 - 1 file changed, 1 deletion(-) diff --git a/boxoffice/templates/cash_receipt_new.html.jinja2 b/boxoffice/templates/cash_receipt_new.html.jinja2 index f00793ee..1dff2f57 100644 --- a/boxoffice/templates/cash_receipt_new.html.jinja2 +++ b/boxoffice/templates/cash_receipt_new.html.jinja2 @@ -334,4 +334,3 @@ {%- endblock content -%} - From e1c06573cf41d4ab5f163b8db0a9d52e16a9658f Mon Sep 17 00:00:00 2001 From: anishTP Date: Fri, 5 Apr 2024 16:24:02 +0530 Subject: [PATCH 07/11] Removed old files and references --- boxoffice/templates/cash_receipt.html.jinja2 | 310 ------------------ ...tml.jinja2 => payment_receipt.html.jinja2} | 0 boxoffice/views/order.py | 2 +- 3 files changed, 1 insertion(+), 311 deletions(-) delete mode 100644 boxoffice/templates/cash_receipt.html.jinja2 rename boxoffice/templates/{cash_receipt_new.html.jinja2 => payment_receipt.html.jinja2} (100%) diff --git a/boxoffice/templates/cash_receipt.html.jinja2 b/boxoffice/templates/cash_receipt.html.jinja2 deleted file mode 100644 index 464c7cfc..00000000 --- a/boxoffice/templates/cash_receipt.html.jinja2 +++ /dev/null @@ -1,310 +0,0 @@ - - - - - - - - {% trans %}Receipt{% endtrans %} - - - - - -
-

{% trans %}Cash Receipt{% endtrans %}

- -
- {%- if org.details.get('logo') %} - - {%- endif %} - -
- {%- if org.details.get('address') %} - {{ org.details.get('address')|safe }} - {%- endif %} - {%- if org.details.get('cin') %} -

{% trans %}CIN:{% endtrans %} {{ org.details.get('cin') }}

- {%- elif org.details.get('llpin') %} -

{% trans %}LLPIN:{% endtrans %} {{ org.details.get('llpin') }}

- {%- endif %} - {%- if org.details.get('pan') %} -

{% trans %}PAN:{% endtrans %} {{ org.details.get('pan') }}

- {%- endif %} - {%- if org.details.get('service_tax_no') %} -

{% trans %}Service Tax No:{% endtrans %} {{ org.details.get('service_tax_no') }}

- {%- endif %} - {%- if org.details.get('website') %} -

{{ org.details.get('website') }}

- {%- endif %} -

{{ org.contact_email }}

-
-
- -
- - - - - - - - - - - - - - - - -
{% trans %}Bill To{% endtrans %}
{% trans %}Name{% endtrans %}{{ order.buyer_fullname }}
{% trans %}Email{% endtrans %}{{ order.buyer_email }}
{% trans %}Phone{% endtrans %}{{ order.buyer_phone }}
- - - - - - - - - - -
{% trans %}Receipt#{% endtrans %}{{ order.receipt_no }}
{% trans %}Date{% endtrans %}{{ order.paid_at | longdate }}
-
- - - - - - - - - - {% for line_item in line_items -%} - - - - - - - - - - {%- endfor %} - - - - - - {% if order.refunded_amount > 0 %} - - - - - - {% endif %} -
{% trans %}Ticket No.{% endtrans %}{% trans %}Base Price{% endtrans %}{% trans %}Discount{% endtrans %}{% trans %}Final Price{% endtrans %}
{{ line_item.line_item_seq }} - {{ line_item.ticket.title }}
- {{ line_item.ticket.description }} -
-

{{ currency_symbol }} {{ line_item.base_amount }}

-
-

{{ currency_symbol }} {{ line_item.discounted_amount }}

- {% if line_item.discount_policy %} -

{{ line_item.discount_policy.title }}

- {% endif %} -
-

{{ currency_symbol }} {{ line_item.final_amount }}

-
{% trans %}Total paid{% endtrans %}
{{ currency_symbol }} {{ order.paid_amount }}
{% trans %}Net paid (post refund){% endtrans %}
{{ currency_symbol }} {{ order.net_amount }}
- - {%- if order.refunded_amount %} -

{% trans %}Refunds{% endtrans %}

- - - - - - - - - {% for transaction in order.refund_transactions -%} - - - - - {%- if transaction.refund_description %} - - {%- elif transaction.refunded_at %} - - {%- else %} - - {%- endif %} - - - {%- endfor %} - - - - - -
{% trans %}No.{% endtrans %}{% trans %}Receipt#{% endtrans %}{% trans %}Refund date{% endtrans %}{% trans %}Refund reason{% endtrans %}{% trans %}Amount{% endtrans %}
{{ loop.index }}{{ order.receipt_no }} - {% if transaction.refunded_at %} - {{ transaction.refunded_at | longdate }} - {%- endif %} - {{ transaction.refund_description }}{% trans date=transaction.refunded_at|longdate %}Refunded on {{ date }}{% endtrans %}{% trans %}Refund{% endtrans %}
{{ currency_symbol }} {{ transaction.amount }}
{% trans %}Total refund{% endtrans %}{{ currency_symbol }} {{ order.refunded_amount }}
- {%- endif %} - -
-
{{ org.details.get('refund_policy', '')|safe }}
-
- -
- - - diff --git a/boxoffice/templates/cash_receipt_new.html.jinja2 b/boxoffice/templates/payment_receipt.html.jinja2 similarity index 100% rename from boxoffice/templates/cash_receipt_new.html.jinja2 rename to boxoffice/templates/payment_receipt.html.jinja2 diff --git a/boxoffice/views/order.py b/boxoffice/views/order.py index 3fcd8a54..60a014eb 100644 --- a/boxoffice/views/order.py +++ b/boxoffice/views/order.py @@ -480,7 +480,7 @@ def receipt(order: Order): LineItem.order == order, LineItem.status == LineItemStatus.CONFIRMED ).all() return render_template( - 'cash_receipt_new.html.jinja2', + 'payment_receipt.html.jinja2', order=order, org=order.organization, line_items=line_items, From 26121287b1f707177826411fb3cb6d003212b06d Mon Sep 17 00:00:00 2001 From: anishTP Date: Fri, 5 Apr 2024 19:10:55 +0530 Subject: [PATCH 08/11] Replaced CSS padding and margin with linebreaks --- boxoffice/templates/layout_email.html.jinja2 | 24 ++++++++------- boxoffice/templates/macros_email.html.jinja2 | 4 +-- .../templates/payment_receipt.html.jinja2 | 30 ++++++++++++++----- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/boxoffice/templates/layout_email.html.jinja2 b/boxoffice/templates/layout_email.html.jinja2 index 6a50ca29..1d708fe4 100644 --- a/boxoffice/templates/layout_email.html.jinja2 +++ b/boxoffice/templates/layout_email.html.jinja2 @@ -371,7 +371,6 @@ .invoice-header > p { font-size: 18px; font-weight: 600; - margin-top: 32px; margin-bottom: 0 !important; font-variant: all-small-caps; } @@ -379,7 +378,6 @@ margin-bottom: 4px !important; } .invoice-label > p:first-child { - margin-top: 16px; font-size: 14px; font-weight: 600; color: #4d576398; @@ -400,10 +398,9 @@ } .order-summary > th { font-size: 14px; - line-height: 24px; + line-height: 40px; font-variant: all-small-caps; font-weight: 600; - padding: 8px 0; border-bottom: 1px solid #656565; } .order-description { @@ -411,10 +408,8 @@ } .order-description > p:first-child { font-weight: 600; - margin-top: 16px; } .base-price { - padding-top: 16px; font-weight: 600; } .total-price > p { @@ -422,11 +417,14 @@ font-variant: all-small-caps; font-size: 21px !important; } - .receipt-title { - padding-bottom: 16px; + .receipt-title > h1 { + line-height: 52px; + } + .receipt-subtitle > p { + line-height: 36px; } - .receipt-subtitle { - padding-top: 8px; + .item-description-container { + border-bottom: 1px solid #1f2d3d; } .item-description > p { margin-top: 0; @@ -439,6 +437,12 @@ font-size: 14px; padding-bottom: 16px; } + .linebreak { + line-height: 16px; + } + .double_linebreak { + line-height: 24px; + } diff --git a/boxoffice/templates/macros_email.html.jinja2 b/boxoffice/templates/macros_email.html.jinja2 index 11fa7297..636260f4 100644 --- a/boxoffice/templates/macros_email.html.jinja2 +++ b/boxoffice/templates/macros_email.html.jinja2 @@ -20,9 +20,9 @@ {% endmacro %} -{% macro line_break() %} +{% macro line_break(ln_break) %} - +
diff --git a/boxoffice/templates/payment_receipt.html.jinja2 b/boxoffice/templates/payment_receipt.html.jinja2 index 1dff2f57..09a25028 100644 --- a/boxoffice/templates/payment_receipt.html.jinja2 +++ b/boxoffice/templates/payment_receipt.html.jinja2 @@ -1,7 +1,6 @@ {%- extends "layout_email.html.jinja2" -%} {%- from "macros_email.html.jinja2" import cta_button, line_break -%} {%- block content -%} -

@@ -23,6 +22,8 @@ + {{ line_break(gettext('double_linebreak')) }} +

{{ org.details.get('name') }}

@@ -37,6 +38,7 @@
+ {{ line_break(gettext('linebreak')) }} {%- if org.details %} + {{ line_break(gettext('linebreak')) }} - + @@ -298,53 +304,84 @@ {%- trans %}Amount{% endtrans -%} -
@@ -46,6 +48,7 @@

{{ org.details.get('address')|safe }}

@@ -63,6 +66,7 @@

{%- if org.details %} + {{ line_break(gettext('linebreak')) }} {%- endif %} + {{ line_break(gettext('linebreak')) }} + {{ line_break(gettext('double_linebreak')) }} + - {%- endfor %} {%- if order.refunded_amount %} {{ line_break(gettext('double_linebreak')) }} diff --git a/boxoffice/views/order.py b/boxoffice/views/order.py index 60a014eb..5c80e21c 100644 --- a/boxoffice/views/order.py +++ b/boxoffice/views/order.py @@ -479,8 +479,14 @@ def receipt(order: Order): line_items = LineItem.query.filter( LineItem.order == order, LineItem.status == LineItemStatus.CONFIRMED ).all() + total_base_amount = sum([line_item.base_amount for line_item in line_items]) + total_item_discount = sum([line_item.discounted_amount for line_item in line_items]) + final_amount = sum([line_item.final_amount for line_item in line_items]) return render_template( 'payment_receipt.html.jinja2', + total_base_amount=total_base_amount, + total_item_discount = total_item_discount, + final_amount=final_amount, order=order, org=order.organization, line_items=line_items, From 29fae609e32b2e7fd5b69bd9f61d6bf9e56a7c85 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:13:24 +0000 Subject: [PATCH 10/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- boxoffice/views/order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boxoffice/views/order.py b/boxoffice/views/order.py index 5c80e21c..7dd9136a 100644 --- a/boxoffice/views/order.py +++ b/boxoffice/views/order.py @@ -485,7 +485,7 @@ def receipt(order: Order): return render_template( 'payment_receipt.html.jinja2', total_base_amount=total_base_amount, - total_item_discount = total_item_discount, + total_item_discount=total_item_discount, final_amount=final_amount, order=order, org=order.organization, From 0c43c9def2db4eec22ede3c70df2799c82f040ed Mon Sep 17 00:00:00 2001 From: anishTP Date: Tue, 16 Apr 2024 21:51:42 +0530 Subject: [PATCH 11/11] Added section for full refund of line-items in the payment receipt --- .../templates/payment_receipt.html.jinja2 | 149 +++++++++++------- boxoffice/views/order.py | 4 + 2 files changed, 97 insertions(+), 56 deletions(-) diff --git a/boxoffice/templates/payment_receipt.html.jinja2 b/boxoffice/templates/payment_receipt.html.jinja2 index 8f57d754..ea51b115 100644 --- a/boxoffice/templates/payment_receipt.html.jinja2 +++ b/boxoffice/templates/payment_receipt.html.jinja2 @@ -194,9 +194,11 @@

{{ currency_symbol }} {{ line_item.base_amount }}

-
- - + + {% if not refunds %} + + {% endif %} + {%- endfor %} {{ line_break(gettext('linebreak')) }} @@ -219,7 +221,11 @@

@@ -236,15 +242,17 @@ - {%- if order.refunded_amount %} {{ line_break(gettext('double_linebreak')) }} + {% if refunds %} + {{ line_break(gettext('linebreak')) }} + {% for refund in refunds -%} @@ -287,10 +294,9 @@

@@ -72,6 +76,7 @@

@@ -90,6 +95,8 @@

@@ -106,6 +113,7 @@

+ {{ line_break(gettext('linebreak')) }} + {{ line_break(gettext('linebreak')) }} + {%- endfor %} {{ line_break(gettext('linebreak')) }} @@ -218,7 +219,7 @@

@@ -228,13 +229,12 @@

@@ -114,6 +122,7 @@

{{ order.buyer_fullname }}

@@ -130,6 +139,7 @@

+ {{ line_break(gettext('linebreak')) }} + {{ line_break(gettext('linebreak')) }} + {{ line_break(gettext('linebreak')) }} + + {{ line_break(gettext('linebreak')) }} + {{ line_break(gettext('linebreak')) }} {% for line_item in line_items -%} - + - - - + {{ line_break(gettext('linebreak')) }} - {{ line_break() }} + {{ line_break(gettext('linebreak')) }} - {{ line_break() }} + {{ line_break(gettext('linebreak')) }} {% endblock footer %}

{%- trans %}Paid on{% endtrans -%} @@ -137,6 +147,7 @@

{{ order.paid_at | longdate }}

@@ -155,6 +166,8 @@

@@ -162,6 +175,7 @@

{%- trans %}Item{% endtrans -%} @@ -170,6 +184,7 @@ {%- trans %}Price{% endtrans -%}
@@ -179,12 +194,10 @@

{{ currency_symbol }} {{ line_item.base_amount }}

{{ line_item.ticket.description| safe}}


@@ -224,6 +237,7 @@ {%- endfor %} {%- if order.refunded_amount %} + {{ line_break(gettext('double_linebreak')) }}

@@ -309,7 +323,7 @@

{%- endif %} - {{ line_break() }} + {{ line_break(gettext('linebreak')) }}

@@ -317,14 +331,14 @@

{{ cta_button('{base_url}/order/{access_token}/ticket'.format(base_url=base_url, access_token=order.access_token), gettext("Assign ticket"), gettext("primary") )}} {{ cta_button('{base_url}/order/{access_token}/invoice'.format(base_url=base_url, access_token=order.access_token), gettext("GST invoice"), gettext("dark") )}}
From 8107da04d05b6cb34fb8061945f77a721f9efb31 Mon Sep 17 00:00:00 2001 From: anishTP Date: Wed, 10 Apr 2024 15:42:30 +0530 Subject: [PATCH 09/11] Fixed email footer and returned sum of base amount, discounted amount and final amount to the template --- boxoffice/templates/layout_email.html.jinja2 | 6 +----- boxoffice/templates/payment_receipt.html.jinja2 | 8 ++++---- boxoffice/views/order.py | 6 ++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/boxoffice/templates/layout_email.html.jinja2 b/boxoffice/templates/layout_email.html.jinja2 index 1d708fe4..7f2fb52c 100644 --- a/boxoffice/templates/layout_email.html.jinja2 +++ b/boxoffice/templates/layout_email.html.jinja2 @@ -628,11 +628,7 @@
diff --git a/boxoffice/templates/payment_receipt.html.jinja2 b/boxoffice/templates/payment_receipt.html.jinja2 index 09a25028..8f57d754 100644 --- a/boxoffice/templates/payment_receipt.html.jinja2 +++ b/boxoffice/templates/payment_receipt.html.jinja2 @@ -197,6 +197,7 @@
{{ line_item.ticket.description| safe}}
@@ -208,7 +209,7 @@

-

{{ currency_symbol }} {{ line_item.base_amount }}

+

{{ currency_symbol }} {{ total_base_amount }}

-

{{ currency_symbol }} {{ line_item.discounted_amount }}

+

{{ currency_symbol }} {{ total_discount_amount }}

-

{{ currency_symbol }} {{ line_item.final_amount }}

+

{{ currency_symbol }} {{ final_amount }}

{{ line_item.ticket.description| safe}}
{{ line_item.ticket.description| safe}}
+ {% if total_discount_amount %}

{{ currency_symbol }} {{ total_discount_amount }}

+ {% else %} +

{{ currency_symbol }} 0

+ {% endif %}

- {%- trans %}Refunds{% endtrans -%} + {%- trans %}Refund{% endtrans -%}

@@ -276,7 +283,7 @@ {%- trans %}Refund date{% endtrans -%}

- {{ transaction.refunded_at | longdate }} + {{ refund.refunded_at | longdate }}

- {%- endif %}
{%- trans %}Refund reason{% endtrans -%}
- {% for transaction in order.refund_transactions -%} - - {%- if transaction.refund_description %} - - {%- elif transaction.refunded_at %} - - {%- else %} - - {%- endif %} - - - {%- endfor %} - - - - -
{{ transaction.refund_description }} - {%- trans date=transaction.refunded_at|longdate %}Refunded on{{ date }}{% endtrans -%} - - {%- trans %}Refund{% endtrans -%} -

{{ currency_symbol }} {{ transaction.amount }}

- {%- trans %}Total refund{% endtrans -%} - {{ currency_symbol }} {{ order.refunded_amount }}
+ {{ line_break(gettext('linebreak')) }} + + + + + {%- if refund.refund_description %} + + {%- elif refund.refunded_at %} + + {%- else %} + + {%- endif %} + + + {{ line_break(gettext('linebreak')) }} + {%- endfor %} + + + + + + + + +
+

+ {{ loop.index }}{{ '. ' + refund.refund_description }} +

+
+

+ {%- trans date=refund.refunded_at|longdate %}Refunded on{{ date }}{% endtrans -%} +

+
+

+ {%- trans %}Refund{% endtrans -%} +

+

{{ currency_symbol }} {{ refund.amount }}

+

+ {%- trans %}Total Refund{% endtrans-%} +

+
+

{{ currency_symbol }} {{ order.refunded_amount }}

+
+

+ {%- trans %}Net Paid{% endtrans -%} +

+
+

+ {{ currency_symbol }} {{ order.refunded_amount }} +

+
+ + {%- endif %} {{ line_break(gettext('linebreak')) }} - - -

- {%- trans %}To access the benefits of this ticket please ensure you are logged in to your Hasgeek account with this same email address.{% endtrans -%} -

- - - {{ line_break(gettext('linebreak')) }} - - - {{ cta_button('{base_url}/order/{access_token}/ticket'.format(base_url=base_url, access_token=order.access_token), gettext("Assign ticket"), gettext("primary") )}} - {{ cta_button('{base_url}/order/{access_token}/invoice'.format(base_url=base_url, access_token=order.access_token), gettext("GST invoice"), gettext("dark") )}} - - - {{ line_break(gettext('linebreak')) }} - - -
-

Cancellation and transfer

- {{ org.details.get('refund_policy')|safe }} -
- - + {% if not refunds %} + + +

+ {%- trans %}To access the benefits of this ticket please ensure you are logged in to your Hasgeek account with this same email address.{% endtrans -%} +

+ + + {{ line_break(gettext('linebreak')) }} + + + {{ cta_button('{base_url}/order/{access_token}/ticket'.format(base_url=base_url, access_token=order.access_token), gettext("Assign ticket"), gettext("primary") )}} + {{ cta_button('{base_url}/order/{access_token}/invoice'.format(base_url=base_url, access_token=order.access_token), gettext("GST invoice"), gettext("dark") )}} + + + {{ line_break(gettext('linebreak')) }} + + +
+

Cancellation and transfer

+ {{ org.details.get('refund_policy')|safe }} +
+ + + {% endif %} {%- endblock content -%} diff --git a/boxoffice/views/order.py b/boxoffice/views/order.py index 7dd9136a..57185bb9 100644 --- a/boxoffice/views/order.py +++ b/boxoffice/views/order.py @@ -482,11 +482,15 @@ def receipt(order: Order): total_base_amount = sum([line_item.base_amount for line_item in line_items]) total_item_discount = sum([line_item.discounted_amount for line_item in line_items]) final_amount = sum([line_item.final_amount for line_item in line_items]) + refunds = [] + for transaction in order.refund_transactions: + refunds.append(transaction) return render_template( 'payment_receipt.html.jinja2', total_base_amount=total_base_amount, total_item_discount=total_item_discount, final_amount=final_amount, + refunds=refunds, order=order, org=order.organization, line_items=line_items,