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.
This commit is contained in:
Joel Addison 2020-01-05 00:34:17 +10:00
parent 0420fa6b1a
commit d4b0b52253
9 changed files with 79 additions and 23 deletions

View file

@ -4,4 +4,6 @@
<li>{{ item.quantity }} &times; {{ item.product }} {{ suffix }}</li>
{% endfor %}
</ul>
{% else %}
<p>No items.</p>
{% endif %}

View file

@ -41,6 +41,20 @@
<br />
<h3>Currently applied vouchers</h3>
{% if vouchers %}
<ul>
{% for voucher in vouchers %}
<li>{{ voucher.code }}</li>
{% endfor %}
</ul>
{% else %}
<p>No vouchers applied.</p>
{% endif %}
<br />
<h3>Apply voucher</h3>
<form class="form-horizontal" method="POST">

View file

@ -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 %}
<h1>Your Profile</h1>
<p>These details will appear on your badge, your invoices, and will be used to order catered food at the conference.</p>
<form class="form-horizontal" method="post" action="">

View file

@ -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 %}
<h1 class="mb-4">Order Review</h1>
<h2 class="mb-4">Order Review</h2>
{% items_pending as pending %}
{% if pending %}
<div class="my-4">
<h2>Current selection</h2>
<h3>Current selection</h3>
<p>You've selected the following items, which will be in your invoice when you check out:<p>
{% include "registrasion/_items_list.html" with items=pending %}
</div>
@ -29,14 +30,14 @@
{% items_purchased as purchased %}
{% if purchased %}
<div class="my-4">
<h2>Previously purchased</h2>
<h3>Previously purchased</h3>
<p>You've already paid for the following items:</p>
{% include "registrasion/_items_list.html" with items=purchased suffix="<em>(PAID)</em>" %}
</div>
{% endif %}
<div class="my-4">
<h2>Modify your selection</h2>
<h3>Modify your selection</h3>
{% missing_categories as missing %}
{% if missing %}
@ -51,21 +52,21 @@
</div>
{% endif %}
<p>
<strong>You can change your selection from these categories:</strong>
{% available_categories as available %}
{% include "registrasion/_category_list.html" with categories=available exclude=missing %}
</p>
{% available_categories as available %}
{% if available|contains_items_not_in:missing %}
<p><strong>You can change your selection from these categories:</strong></p>
{% include "registrasion/_category_list.html" with categories=available exclude=missing %}
{% endif %}
</div>
<div class="my-4">
<h2>Voucher</h2>
<h3>Voucher</h3>
<p>If you have been given a voucher, please <a id="voucher-form-button" href="{% url "voucher_code" %}">enter your voucher code</a> now.
</p>
</div>
<div class="my-4">
<h2>What next?</h2>
<h3>What next?</h3>
{% if pending %}
<p>You can either check out an invoice and pay for your selections, or return to
the dashboard.</p>

View file

@ -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 %}
<form method="post" action="">
{% csrf_token %}

View file

@ -6,6 +6,7 @@
{% load lca2018_tags %}
{% load lca2019_tags %}
{% load staticfiles %}
{% load waffle_tags %}
{% if user.is_staff %}
<div class="mb-4">
@ -46,6 +47,9 @@
<p>If you would like to change the details on your badge or your attendee statistics, you may edit your attendee profile here.</p>
<div>
<a class="btn btn-primary" role="button" href="{% url "attendee_edit" %}">Edit attendee profile</a>
{% flag "badge_preview" %}
<a class="btn btn-info" role="button" href="{% url "user_badge" %}">Preview my badge</a>
{% endflag %}
</div>
</div>
<div class="col-md-6 mb-3 mb-md-0">
@ -66,29 +70,51 @@
<div class="row">
{% if pending %}
<div class="col-md-6 mb-3 mb-md-0">
<div class="col-md-6 mb-3">
<h4>Items pending payment</h4>
{% include "registrasion/_items_list.html" with items=pending %}
<a class="btn btn-lg btn-primary" role="button" href="{% url "checkout" %}">Check out and pay</a>
<a class="btn btn-primary" role="button" href="{% url "checkout" %}"><i class="fa fa-credit-card"></i> Check out and pay</a>
<a class="btn btn-secondary" role="button" href="{% url "voucher_code" %}">Apply voucher</a>
</div>
{% endif %}
{% items_purchased as purchased %}
{% if purchased %}
<div class="col-md-6 mb-3 mb-md-0">
<div class="col-md-6 mb-3">
<h4>Paid Items</h4>
{% include "registrasion/_items_list.html" with items=purchased %}
{% if not pending %}
<a class="btn btn-secondary" role="button" href="{% url "voucher_code" %}">Apply voucher</a>
{% endif %}
</div>
{% endif %}
<div class="col-md-6 mb-3 mb-md-0">
<div class="col-md-6 mb-3">
<h4>Add/Update Items</h4>
{% include "registrasion/_category_list.html" with categories=categories %}
{% missing_categories as missing %}
{% if missing %}
<div class="alert alert-warning my-4 pb-4">
<h5 class="alert-heading">You have empty categories</h5>
<p>You have <em>not</em> selected anything from the following
categories. If your ticket includes any of these, you still need to
make a selection:
</p>
{% include "registrasion/_category_list.html" with categories=missing %}
</div>
{% endif %}
{% available_categories as available %}
{% if available|contains_items_not_in:missing %}
<p><strong>You can change your selection from these categories:</strong></p>
{% include "registrasion/_category_list.html" with categories=available exclude=missing %}
{% endif %}
</div>
{% invoices as invoices %}
{% if invoices %}
<div class="col-md-6 mb-3 mb-md-0">
<div class="col-md-6 mb-3">
<h4>Invoices</h4>
<ul>
{% for invoice in invoices %}
@ -99,14 +125,14 @@
</ul>
{% if invoices|any_is_void %}
<div class="mt-auto">
<button id="toggle-void-invoices" onclick="toggleVoidInvoices();" class="btn btn-lg btn-default">Show void invoices</button>
<button type="button" class="btn btn-sm btn-outline-dark" id="toggle-void-invoices" onclick="toggleVoidInvoices();">Show void invoices</button>
</div>
{% endif %}
</div>
{% endif %}
{% if false %}
<div class="col-md-6 mb-3 mb-md-0">
<div class="col-md-6 mb-3">
<h4>Raffle Tickets</h4>
<p><a href="/raffle/tickets/">View all my raffle tickets</a></p>
@ -117,7 +143,7 @@
{% available_credit as credit %}
{% if credit %}
<div class="col-md-6 mb-3 mb-md-0">
<div class="col-md-6 mb-3">
<h4>Credit</h4>
<p>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.</p>
</div>

View file

@ -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:

View file

@ -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(

View file

@ -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)