From d4b0b52253aea7b618a7c2e3b6a7c24e3f3d0667 Mon Sep 17 00:00:00 2001 From: Joel Addison Date: Sun, 5 Jan 2020 00:34:17 +1000 Subject: [PATCH] Registrasion updates Show applied vouchers on attendee registration admin page. Add head title and page title to more areas. Update the dashboard to show warning for empty categories and have button to open voucher page. Fix exception on attendee page when user does not have attendee object. --- .../templates/registrasion/_items_list.html | 2 + .../registrasion/amend_registration.html | 14 ++++++ .../templates/registrasion/profile_form.html | 4 +- pinaxcon/templates/registrasion/review.html | 23 +++++----- .../templates/registrasion/voucher_code.html | 3 ++ .../symposion/dashboard/_categories.html | 44 +++++++++++++++---- pinaxcon/templatetags/lca2019_tags.py | 5 +++ .../registrasion/reporting/views.py | 6 ++- vendor/registrasion/registrasion/views.py | 1 + 9 files changed, 79 insertions(+), 23 deletions(-) diff --git a/pinaxcon/templates/registrasion/_items_list.html b/pinaxcon/templates/registrasion/_items_list.html index 9926bc44..d659bef4 100644 --- a/pinaxcon/templates/registrasion/_items_list.html +++ b/pinaxcon/templates/registrasion/_items_list.html @@ -4,4 +4,6 @@
  • {{ item.quantity }} × {{ item.product }} {{ suffix }}
  • {% endfor %} +{% else %} +

    No items.

    {% endif %} diff --git a/pinaxcon/templates/registrasion/amend_registration.html b/pinaxcon/templates/registrasion/amend_registration.html index c27d58ec..78860fbf 100644 --- a/pinaxcon/templates/registrasion/amend_registration.html +++ b/pinaxcon/templates/registrasion/amend_registration.html @@ -41,6 +41,20 @@
    +

    Currently applied vouchers

    + +{% if vouchers %} + +{% else %} +

    No vouchers applied.

    +{% endif %} + +
    +

    Apply voucher

    diff --git a/pinaxcon/templates/registrasion/profile_form.html b/pinaxcon/templates/registrasion/profile_form.html index 3cac963b..fcd9b469 100644 --- a/pinaxcon/templates/registrasion/profile_form.html +++ b/pinaxcon/templates/registrasion/profile_form.html @@ -1,7 +1,8 @@ {% extends "registrasion/base.html" %} {% load lca2018_tags %} - +{% block head_title %}Your Profile{% endblock %} +{% block page_title %}Your Profile{% endblock %} {% block scripts_extra %} {{ form.media.js }} @@ -22,7 +23,6 @@ {% endblock %} {% block proposals_body %} -

    Your Profile

    These details will appear on your badge, your invoices, and will be used to order catered food at the conference.

    diff --git a/pinaxcon/templates/registrasion/review.html b/pinaxcon/templates/registrasion/review.html index da2f5dbc..b6d92cbf 100644 --- a/pinaxcon/templates/registrasion/review.html +++ b/pinaxcon/templates/registrasion/review.html @@ -1,6 +1,7 @@ {% extends "registrasion/base.html" %} {% load registrasion_tags %} {% load lca2018_tags %} +{% load lca2019_tags %} {% block page_title %}Review your selection{% endblock %} {% block page_lead %} @@ -15,12 +16,12 @@ {% block proposals_body %} -

    Order Review

    +

    Order Review

    {% items_pending as pending %} {% if pending %}
    -

    Current selection

    +

    Current selection

    You've selected the following items, which will be in your invoice when you check out:

    {% include "registrasion/_items_list.html" with items=pending %}

    @@ -29,14 +30,14 @@ {% items_purchased as purchased %} {% if purchased %}
    -

    Previously purchased

    +

    Previously purchased

    You've already paid for the following items:

    {% include "registrasion/_items_list.html" with items=purchased suffix="(PAID)" %}
    {% endif %}
    -

    Modify your selection

    +

    Modify your selection

    {% missing_categories as missing %} {% if missing %} @@ -51,21 +52,21 @@
    {% endif %} -

    - You can change your selection from these categories: - {% available_categories as available %} - {% include "registrasion/_category_list.html" with categories=available exclude=missing %} -

    + {% available_categories as available %} + {% if available|contains_items_not_in:missing %} +

    You can change your selection from these categories:

    + {% include "registrasion/_category_list.html" with categories=available exclude=missing %} + {% endif %}
    -

    Voucher

    +

    Voucher

    If you have been given a voucher, please enter your voucher code now.

    -

    What next?

    +

    What next?

    {% if pending %}

    You can either check out an invoice and pay for your selections, or return to the dashboard.

    diff --git a/pinaxcon/templates/registrasion/voucher_code.html b/pinaxcon/templates/registrasion/voucher_code.html index 1e6209c8..34703046 100644 --- a/pinaxcon/templates/registrasion/voucher_code.html +++ b/pinaxcon/templates/registrasion/voucher_code.html @@ -1,6 +1,9 @@ {% extends "registrasion/base.html" %} {% load crispy_forms_tags %} +{% block head_title %}Apply Voucher{% endblock %} +{% block page_title %}Apply Voucher{% endblock %} + {% block proposals_body %} {% csrf_token %} diff --git a/pinaxcon/templates/symposion/dashboard/_categories.html b/pinaxcon/templates/symposion/dashboard/_categories.html index db69f5d9..057309ae 100644 --- a/pinaxcon/templates/symposion/dashboard/_categories.html +++ b/pinaxcon/templates/symposion/dashboard/_categories.html @@ -6,6 +6,7 @@ {% load lca2018_tags %} {% load lca2019_tags %} {% load staticfiles %} +{% load waffle_tags %} {% if user.is_staff %}
    @@ -46,6 +47,9 @@

    If you would like to change the details on your badge or your attendee statistics, you may edit your attendee profile here.

    Edit attendee profile + {% flag "badge_preview" %} + Preview my badge + {% endflag %}
    @@ -66,29 +70,51 @@
    {% if pending %} -
    +

    Items pending payment

    {% include "registrasion/_items_list.html" with items=pending %} - Check out and pay + Check out and pay + Apply voucher
    {% endif %} {% items_purchased as purchased %} {% if purchased %} -
    +

    Paid Items

    {% include "registrasion/_items_list.html" with items=purchased %} + + {% if not pending %} + Apply voucher + {% endif %}
    {% endif %} -
    +

    Add/Update Items

    - {% include "registrasion/_category_list.html" with categories=categories %} + {% missing_categories as missing %} + {% if missing %} +
    +
    You have empty categories
    +

    You have not selected anything from the following + categories. If your ticket includes any of these, you still need to + make a selection: +

    + + {% include "registrasion/_category_list.html" with categories=missing %} +
    + {% endif %} + + {% available_categories as available %} + {% if available|contains_items_not_in:missing %} +

    You can change your selection from these categories:

    + {% include "registrasion/_category_list.html" with categories=available exclude=missing %} + {% endif %}
    {% invoices as invoices %} {% if invoices %} -
    +

    Invoices

      {% for invoice in invoices %} @@ -99,14 +125,14 @@
    {% if invoices|any_is_void %}
    - +
    {% endif %}
    {% endif %} {% if false %} -
    +

    Raffle Tickets

    View all my raffle tickets

    @@ -117,7 +143,7 @@ {% available_credit as credit %} {% if credit %} -
    +

    Credit

    You have ${{ credit }} leftover from refunded invoices. This credit will be automatically applied to new invoices. Contact the conference organisers if you wish to arrange a refund to your original payment source.

    diff --git a/pinaxcon/templatetags/lca2019_tags.py b/pinaxcon/templatetags/lca2019_tags.py index c82bf67d..d971373a 100644 --- a/pinaxcon/templatetags/lca2019_tags.py +++ b/pinaxcon/templatetags/lca2019_tags.py @@ -48,6 +48,11 @@ def any_is_void(invoices): return False +@register.filter +def contains_items_not_in(list1, list2): + return len(set(list1).difference(list2)) > 0 + + @register.filter def listlookup(lookup, target): try: diff --git a/vendor/registrasion/registrasion/reporting/views.py b/vendor/registrasion/registrasion/reporting/views.py index 5f0d867f..88e8cbbc 100644 --- a/vendor/registrasion/registrasion/reporting/views.py +++ b/vendor/registrasion/registrasion/reporting/views.py @@ -562,9 +562,13 @@ def attendee(request, form, user_id=None): reports = [] - profile_data = [] try: attendee = people.Attendee.objects.get(user__id=user_id) + except people.DoesNotExist: + return reports + + profile_data = [] + try: name = attendee.attendeeprofilebase.attendee_name() profile = people.AttendeeProfileBase.objects.get_subclass( diff --git a/vendor/registrasion/registrasion/views.py b/vendor/registrasion/registrasion/views.py index f92a6dbf..af47185d 100644 --- a/vendor/registrasion/registrasion/views.py +++ b/vendor/registrasion/registrasion/views.py @@ -1077,6 +1077,7 @@ def amend_registration(request, user_id): "cancelled": ic.items_released(), "form": formset, "voucher_form": voucher_form, + "vouchers": current_cart.cart.vouchers.all(), } return render(request, "registrasion/amend_registration.html", data)