From 57e966826e95c7e3d9b532e65a6117f773184b6f Mon Sep 17 00:00:00 2001 From: Arona Jones Date: Sat, 29 May 2021 21:11:38 +0100 Subject: [PATCH] Redesign invoice detail page Closes #431 --- RIGS/finance.py | 8 +- RIGS/templates/event_detail.html | 47 +---- RIGS/templates/invoice_detail.html | 178 +++++++++---------- RIGS/templates/partials/contact_details.html | 47 +++++ 4 files changed, 137 insertions(+), 143 deletions(-) create mode 100644 RIGS/templates/partials/contact_details.html diff --git a/RIGS/finance.py b/RIGS/finance.py index 0f6f8fbf..70c723c3 100644 --- a/RIGS/finance.py +++ b/RIGS/finance.py @@ -55,7 +55,13 @@ class InvoiceDetail(generic.DetailView): def get_context_data(self, **kwargs): context = super(InvoiceDetail, self).get_context_data(**kwargs) - context['page_title'] = "Invoice {} ({})".format(self.object.display_id, self.object.invoice_date.strftime("%d/%m/%Y")) + context['page_title'] = "Invoice {} ({}) ".format(self.object.display_id, self.object.invoice_date.strftime("%d/%m/%Y")) + if self.object.void: + context['page_title'] += "VOID" + elif self.object.is_closed: + context['page_title'] += "PAID" + else: + context['page_title'] += "OUTSTANDING" return context diff --git a/RIGS/templates/event_detail.html b/RIGS/templates/event_detail.html index d9182e3d..a5b6ecb3 100644 --- a/RIGS/templates/event_detail.html +++ b/RIGS/templates/event_detail.html @@ -1,6 +1,4 @@ {% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %} -{% load linkornone from filters %} -{% load namewithnotes from filters %} {% block content %}
@@ -14,50 +12,7 @@ {% if object.is_rig and perms.RIGS.view_event %} {# only need contact details for a rig #}
- {% if event.person %} -
-
Contact Details
-
-
-
Person
-
- {% if object.person %} - - {{ object.person|namewithnotes:'person_detail' }} - - {% endif %} -
-
Email
-
{{ object.person.email|linkornone:'mailto' }}
-
Phone Number
-
{{ object.person.phone|linkornone:'tel' }}
-
-
-
- {% endif %} - {% if event.organisation %} -
-
Organisation
-
-
-
Organisation
-
- {% if object.organisation %} - - {{ object.organisation|namewithnotes:'organisation_detail' }} - - {% endif %} -
-
Email
-
{{ object.organisation.email|linkornone:'mailto' }}
-
Phone Number
-
{{ object.organisation.phone|linkornone:'tel' }}
-
Has SU Account
-
{{ event.organisation.union_account|yesno|capfirst }}
-
-
-
- {% endif %} + {% include 'partials/contact_details.html' %}
{% endif %}
diff --git a/RIGS/templates/invoice_detail.html b/RIGS/templates/invoice_detail.html index ad65a2f8..d59e8d83 100644 --- a/RIGS/templates/invoice_detail.html +++ b/RIGS/templates/invoice_detail.html @@ -2,102 +2,88 @@ {% load button from filters %} {% block content %} -
-
-
-
- - Delete - - - Void - - {% button 'print' url='invoice_print' pk=object.pk %} -
-
-
- -
-
-
-
Invoice Details - {% if object.void %}(VOID){% elif object.is_closed %}(PAID){% else %}(OUTSTANDING){% endif %} -
-
- {% if object.event.organisation %} - {{ object.event.organisation.name }}
- {{ object.event.organisation.address|linebreaksbr }} - {% else %} - {{ object.event.person.name }}
- {{ object.event.person.address|linebreaksbr }} - {% endif %} -
-
-
-
- {% include 'partials/event_details.html' %} -
- {% if object.event.internal %} -
- {% include 'partials/auth_details.html' %} -
- {% endif %} -
- -
-
-
-
- - - - - - - - - - - - {% for payment in object.payment_set.all %} - - - - - - - {% endfor %} - - - - - - -
DateAmountMethod
{{ payment.date }}{{ payment.amount|floatformat:2 }}{{ payment.get_method_display }} - -
Balance:{{ object.balance|floatformat:2 }}
-
-
-
- -
-
- {% with object.event as object %} - {% include 'item_table.html' %} - {% endwith %} -
-
-
-
- {% include 'partials/last_edited.html' with target="invoice_history" %} +
+
+
+ Open Event Page + + Delete + + + Void + + {% button 'print' url='invoice_print' pk=object.pk %}
+
+
+ {% with object.event as object %} +
+ {% include 'partials/contact_details.html' %} +
+
+ {% include 'partials/event_details.html' %} +
+ {% if object.event.internal %} +
+ {% include 'partials/auth_details.html' %} +
+ {% endif %} + {% endwith %} +
+
+
+
+
+ + + + + + + + + + + + {% for payment in object.payment_set.all %} + + + + + + + {% endfor %} + + + + + + +
DateAmountMethod
{{ payment.date }}{{ payment.amount|floatformat:2 }}{{ payment.get_method_display }} + +
Balance:{{ object.balance|floatformat:2 }}
+
+
+
+ +
+
+ {% with object.event as object %} + {% include 'item_table.html' %} + {% endwith %} +
+
+
+
+ {% include 'partials/last_edited.html' with target="invoice_history" %} +
{% endblock %} diff --git a/RIGS/templates/partials/contact_details.html b/RIGS/templates/partials/contact_details.html new file mode 100644 index 00000000..049967a2 --- /dev/null +++ b/RIGS/templates/partials/contact_details.html @@ -0,0 +1,47 @@ +{% load linkornone from filters %} +{% load namewithnotes from filters %} + +{% if object.person %} +
+
Person Details
+
+
+
Person
+
+ {% if object.person %} + + {{ object.person|namewithnotes:'person_detail' }} + + {% endif %} +
+
Email
+
{{ object.person.email|linkornone:'mailto' }}
+
Phone Number
+
{{ object.person.phone|linkornone:'tel' }}
+
+
+
+{% endif %} +{% if object.organisation %} +
+
Organisation Details
+
+
+
Organisation
+
+ {% if object.organisation %} + + {{ object.organisation|namewithnotes:'organisation_detail' }} + + {% endif %} +
+
Email
+
{{ object.organisation.email|linkornone:'mailto' }}
+
Phone Number
+
{{ object.organisation.phone|linkornone:'tel' }}
+
Has SU Account
+
{{ event.organisation.union_account|yesno|capfirst }}
+
+
+
+{% endif %}