Major improvements/fixes to authorisation templates

This commit is contained in:
2020-09-25 21:29:00 +01:00
parent 2a1bb57c74
commit 143b654210
9 changed files with 234 additions and 252 deletions

View File

@@ -1,78 +0,0 @@
<div class="row my-3">
<div class="col-sm-6">
<div class="card mb-3">
<div class="card-header">Contact Details</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-5">Person</dt>
<dd class="col-sm-7">
{% if event.person %}
{{ event.person.name }}
{% endif %}
</dd>
<dt class="col-sm-5">Email</dt>
<dd class="col-sm-7">
<span class="overflow-ellipsis">{{ event.person.email }}</span>
</dd>
<dt class="col-sm-5">Phone Number</dt>
<dd class="col-sm-7">{{ event.person.phone }}</dd>
</dl>
</div>
</div>
{% if event.organisation %}
<div class="card mt-3">
<div class="card-header">Organisation Details</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-5">Organisation</dt>
<dd class="col-sm-7">
{{ event.organisation.name }}
</dd>
<dt class="col-sm-5">Phone Number</dt>
<dd class="col-sm-7">{{ object.organisation.phone }}</dd>
</dl>
</div>
</div>
{% endif %}
</div>
<div class="col-sm-6">
<div class="card border-info">
<div class="card-header">Event Info</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-5">Event Venue</dt>
<dd class="col-sm-7">
{% if object.venue %}
<a href="{% url 'venue_detail' object.venue.pk %}" class="modal-href">
{{ object.venue }}
</a>
{% endif %}
</dd>
<dt class="col-sm-5">Status</dt>
<dd class="col-sm-7">{{ event.get_status_display }}</dd>
<dd class="col-sm-12">&nbsp;</dd>
<dt class="col-sm-5">Access From</dt>
<dd class="col-sm-7">{{ event.access_at|date:"D d M Y H:i"|default:"" }}</dd>
<dt class="col-sm-5">Event Starts</dt>
<dd class="col-sm-7">{{ event.start_date|date:"D d M Y" }} {{ event.start_time|date:"H:i" }}</dd>
<dt class="col-sm-5">Event Ends</dt>
<dd class="col-sm-7">{{ event.end_date|date:"D d M Y" }} {{ event.end_time|date:"H:i" }}</dd>
<dd class="col-sm-12">&nbsp;</dd>
<dt class="col-sm-5">Event Description</dt>
<dd class="col-sm-12">{{ event.description|linebreaksbr }}</dd>
</dl>
</div>
</div>
</div>
</div>

View File

@@ -1,5 +1,5 @@
<div class="btn-group py-3"> <div class="btn-group py-3">
<a href="{% url 'event_update' event.pk %}" class="btn btn-secondary"><span <a href="{% url 'event_update' event.pk %}" class="btn btn-warning"><span
class="fas fa-edit"></span> <span class="fas fa-edit"></span> <span
class="hidden-xs">Edit</span></a> class="hidden-xs">Edit</span></a>
{% if event.is_rig %} {% if event.is_rig %}
@@ -7,7 +7,7 @@
class="fas fa-print"></i> <span class="fas fa-print"></i> <span
class="hidden-xs">Print</span></a> class="hidden-xs">Print</span></a>
{% endif %} {% endif %}
<a href="{% url 'event_duplicate' event.pk %}" class="btn btn-secondary" title="Duplicate Rig"><span <a href="{% url 'event_duplicate' event.pk %}" class="btn btn-info" title="Duplicate Rig"><span
class="fas fa-copy"></span> <span class="fas fa-copy"></span> <span
class="hidden-xs">Duplicate</span></a> class="hidden-xs">Duplicate</span></a>
{% if event.is_rig %} {% if event.is_rig %}
@@ -19,6 +19,8 @@
btn-warning btn-warning
{% elif event.auth_request_to %} {% elif event.auth_request_to %}
btn-info btn-info
{% else %}
btn-secondary
{% endif %} {% endif %}
" "
href="{% url 'event_authorise_request' object.pk %}"> href="{% url 'event_authorise_request' object.pk %}">

View File

@@ -0,0 +1,48 @@
{% extends 'base_client.html' %}
{% load widget_tweaks %}
{% load static %}
{% block js %}
<script src="{% static 'js/tooltip.js' %}"></script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
$('form').on('submit', function () {
$('#loading-modal').modal({
backdrop: 'static',
show: true
});
});
</script>
{% endblock %}
{% block title %}
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %} | {{ event.name }}
{% endblock %}
{% block content %}
<div class="page-header my-3">
<h1>
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %}
| {{ event.name }} {% if event.dry_hire %}<span class="badge badge-secondary align-top">Dry Hire</span>{% endif %}
</h1>
</div>
<div class="row my-3">
{% include 'partials/client_eventdetails.html' %}
</div>
<div class="row mb-3">
<div class="col-sm-12">
<div class="card">
{% with object=event %}
{% include 'item_table.html' %}
{% endwith %}
</div>
</div>
</div>
{% block authorisation %}
{% endblock %}
{% endblock %}

View File

@@ -9,13 +9,7 @@
by <b>{{ object.name }}</b> as of <b>{{ object.event.last_edited_at }}</b>. by <b>{{ object.name }}</b> as of <b>{{ object.event.last_edited_at }}</b>.
</p> </p>
<p> <p>Your event is now fully booked and payment will be processed by the finance department automatically.</p>
{% if object.event.organisation and object.event.organisation.union_account %}{# internal #}
Your event is now fully booked and payment will be processed by the finance department automatically.
{% else %}{# external #}
Your event is now fully booked and our finance department will be contact to arrange payment.
{% endif %}
</p>
<p>TEC PA &amp; Lighting</p> <p>TEC PA &amp; Lighting</p>
{% endblock %} {% endblock %}

View File

@@ -2,10 +2,6 @@ Hi {{ to_name|default_if_none:"there" }},
Your event N{{object.event.pk|stringformat:"05d"}} has been successfully authorised for £{{object.amount}} by {{object.name}} as of {{object.event.last_edited_at}}. Your event N{{object.event.pk|stringformat:"05d"}} has been successfully authorised for £{{object.amount}} by {{object.name}} as of {{object.event.last_edited_at}}.
{% if object.event.organisation and object.event.organisation.union_account %}{# internal #}
Your event is now fully booked and payment will be processed by the finance department automatically. Your event is now fully booked and payment will be processed by the finance department automatically.
{% else %}{# external #}
Your event is now fully booked and our finance department will be contact to arrange payment.
{% endif %}
TEC PA & Lighting TEC PA & Lighting

View File

@@ -1,130 +1,94 @@
{% extends 'base_client.html' %} {% extends 'eventauthorisation.html' %}
{% load widget_tweaks %} {% load widget_tweaks %}
{% load static %}
{% block js %} {% block js %}
<script src="{% static 'js/tooltip.js' %}"></script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
$('form').on('submit', function () {
$('#loading-modal').modal({
backdrop: 'static',
show: true
});
});
</script>
{% endblock %} {% endblock %}
{% block title %} {% block authorisation %}
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %} | {{ event.name }} <div class="row">
{% endblock %} <div class="col-sm-12">
<div class="card border-primary">
<div class="card-header" id="eventauth">Event Authorisation</div>
{% block content %} <div class="card-body">
<div class="page-header my-3"> <form class="form-horizontal itemised_form" role="form" method="POST" action="#eventauth">
<h1> {% csrf_token %}
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %} {% include 'form_errors.html' %}
| {{ event.name }} {% if event.dry_hire %}<span class="badge">Dry Hire</span>{% endif %} <div class="row">
</h1> <div class="col-sm-12">
</div> <p>
I agree that I am authorised to approve this event. I agree that I am the
<strong>President/Treasurer or account holder</strong> of the hirer, or that I
have the written permission of the
<strong>President/Treasurer or account holder</strong> of the hirer stating that
I can authorise this event.
</p>
</div>
<div class="row"> <div class="col-sm-12 col-md-6">
{% include 'client_eventdetails.html' %} <div class="col-sm-12 form-group" data-toggle="tooltip"
</div> title="Your name as the person authorising the event.">
<label for="{{ form.name.id_for_label }}"
class="col-sm-4 control-label">{{ form.name.label }}</label>
<div class="row"> <div class="col-sm-8">
<div class="col-sm-12"> {% render_field form.name class+="form-control" %}
{% with object=event %}
{% include 'item_table.html' %}
{% endwith %}
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="card border-primary">
<div class="card-header" id="eventauth">Event Authorisation</div>
<div class="card-body">
<form class="form-horizontal itemised_form" role="form" method="POST" action="#eventauth">
{% csrf_token %}
{% include 'form_errors.html' %}
<div class="row">
<div class="col-sm-12">
<p>
I agree that I am authorised to approve this event. I agree that I am the
<strong>President/Treasurer or account holder</strong> of the hirer, or that I
have the written permission of the
<strong>President/Treasurer or account holder</strong> of the hirer stating that
I can authorise this event.
</p>
</div>
<div class="col-sm-12 col-md-6">
<div class="col-sm-12 form-group" data-toggle="tooltip"
title="Your name as the person authorising the event.">
<label for="{{ form.name.id_for_label }}"
class="col-sm-4 control-label">{{ form.name.label }}</label>
<div class="col-sm-8">
{% render_field form.name class+="form-control" %}
</div>
</div>
<div class="col-sm-12 form-group" data-toggle="tooltip"
title="Your Student ID or Staff username as the person authorising the event.">
<label for="{{ form.uni_id.id_for_label }}"
class="col-sm-4 control-label">{{ form.uni_id.label }}</label>
<div class="col-sm-8">
{% render_field form.uni_id class+="form-control" %}
</div>
</div> </div>
</div> </div>
<div class="col-sm-12 col-md-6"> <div class="col-sm-12 form-group" data-toggle="tooltip"
<div class="col-sm-12 form-group" data-toggle="tooltip" title="Your Student ID or Staff username as the person authorising the event.">
title="The Students' Union account code you wish this event to be charged to."> <label for="{{ form.uni_id.id_for_label }}"
<label for="{{ form.account_code.id_for_label }}" class="col-sm-4 control-label">{{ form.uni_id.label }}</label>
class="col-sm-4 control-label">{{ form.account_code.label }}</label> <div class="col-sm-8">
<div class="col-sm-8"> {% render_field form.uni_id class+="form-control" %}
{% render_field form.account_code class+="form-control" %}
</div>
</div>
<div class="col-sm-12 form-group" data-toggle="tooltip"
title="The full amount chargable for this event as displayed above, including VAT.">
<label for="{{ form.amount.id_for_label }}"
class="col-sm-4 control-label">{{ form.amount.label }}</label>
<div class="col-sm-8">
{% render_field form.amount class+="form-control" %}
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-12 col-md-8 form-group">
<div class="col-sm-offset-4 col-sm-8 col-md-offset-3" data-toggle="tooltip"
title="In order to book an event you must agree to the TEC Terms of Hire.">
<div class="checkbox">
<label>
{% render_field form.tos %} I have read and agree to the TEC
<a href="{{ tos_url }}">Terms of Hire</a>. E&OE.
</label>
</div>
</div>
</div>
<div class="col-sm-12 col-md-4 text-right">
<div class="btn-group">
<button class="btn btn-primary btn-lg" type="submit">Authorise</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</form>
</div> <div class="col-sm-12 col-md-6">
<div class="col-sm-12 form-group" data-toggle="tooltip"
title="The Students' Union account code you wish this event to be charged to.">
<label for="{{ form.account_code.id_for_label }}"
class="col-sm-4 control-label">{{ form.account_code.label }}</label>
<div class="col-sm-8">
{% render_field form.account_code class+="form-control" %}
</div>
</div>
<div class="col-sm-12 form-group" data-toggle="tooltip"
title="The full amount chargable for this event as displayed above, including VAT.">
<label for="{{ form.amount.id_for_label }}"
class="col-sm-4 control-label">{{ form.amount.label }}</label>
<div class="col-sm-8">
{% render_field form.amount class+="form-control" %}
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-12 col-md-8 form-group">
<div class="col-sm-offset-4 col-sm-8 col-md-offset-3" data-toggle="tooltip"
title="In order to book an event you must agree to the TEC Terms of Hire.">
<div class="checkbox">
<label>
{% render_field form.tos %} I have read and agree to the TEC
<a href="{{ tos_url }}">Terms of Hire</a>. E&OE.
</label>
</div>
</div>
</div>
<div class="text-right">
<div class="btn-group">
<button class="btn btn-primary btn-lg" type="submit">Authorise</button>
</div>
</div>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
</div>
{% endblock %} {% endblock %}

View File

@@ -1,64 +1,42 @@
{% extends 'base_client.html' %} {% extends 'eventauthorisation.html' %}
{% load widget_tweaks %} {% load widget_tweaks %}
{% block title %} {% block js %}
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %} | {{ event.name }}
{% endblock %} {% endblock %}
{% block content %} {% block authorisation %}
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<h1> <div class="card">
{% if event.is_rig %}N{{ event.pk|stringformat:"05d" }}{% else %}{{ event.pk }}{% endif %} <div class="card-header">Event Authorisation</div>
| {{ event.name }} {% if event.dry_hire %}<span class="badge">Dry Hire</span>{% endif %}
</h1>
</div>
</div>
{% include 'client_eventdetails.html' %} <div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-6">
<dl class="dl row">
<dt class="col-6">Name</dt>
<dd class="col-6">{{ object.name }}</dd>
<div class="row"> <dt class="col-6">Email</dt>
<div class="col-sm-12"> <dd class="col-6">{{ object.email }}</dd>
{% with object=event %}
{% include 'item_table.html' %}
{% endwith %}
</div>
</div>
<div class="row"> <dt class="col-6">University ID</dt>
<div class="col-sm-12"> <dd class="col-6">{{ object.uni_id }}</dd>
<div class="card card-default"> </dl>
<div class="card-header">Event Authorisation</div> </div>
<div class="card-body"> <div class="col-sm-12 col-md-6">
<div class="row"> <dl class="dl row">
<div class="col-sm-12 col-md-6"> <dt class="col-6">Account code</dt>
<dl class="dl-horizontal"> <dd class="col-6">{{ object.account_code }}</dd>
<dt>Name</dt>
<dd>{{ object.name }}</dd>
<dt>Email</dt> <dt class="col-6">Authorised amount</dt>
<dd>{{ object.email }}</dd> <dd class="col-6">£ {{ object.amount|floatformat:2 }}</dd>
</dl>
{% if internal %}
<dt>University ID</dt>
<dd>{{ object.uni_id }}</dd>
{% endif %}
</dl>
</div>
<div class="col-sm-12 col-md-6">
<dl class="dl-horizontal">
<dt>Account code</dt>
<dd>{{ object.account_code }}</dd>
<dt>Authorised amount</dt>
<dd>£ {{ object.amount|floatformat:2 }}</dd>
</dl>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
{% endblock %} {% endblock %}

View File

@@ -0,0 +1,76 @@
<div class="col-sm-6">
<div class="card mb-3">
<div class="card-header">Contact Details</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-5">Person</dt>
<dd class="col-sm-7">
{% if event.person %}
{{ event.person.name }}
{% endif %}
</dd>
<dt class="col-sm-5">Email</dt>
<dd class="col-sm-7">
<span class="overflow-ellipsis">{{ event.person.email }}</span>
</dd>
<dt class="col-sm-5">Phone Number</dt>
<dd class="col-sm-7">{{ event.person.phone }}</dd>
</dl>
</div>
</div>
{% if event.organisation %}
<div class="card mt-3">
<div class="card-header">Organisation Details</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-5">Organisation</dt>
<dd class="col-sm-7">
{{ event.organisation.name }}
</dd>
<dt class="col-sm-5">Phone Number</dt>
<dd class="col-sm-7">{{ object.organisation.phone }}</dd>
</dl>
</div>
</div>
{% endif %}
</div>
<div class="col-sm-6">
<div class="card border-info">
<div class="card-header">Event Info</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-5">Event Venue</dt>
<dd class="col-sm-7">
{% if object.venue %}
<a href="{% url 'venue_detail' object.venue.pk %}" class="modal-href">
{{ object.venue }}
</a>
{% endif %}
</dd>
<dt class="col-sm-5">Status</dt>
<dd class="col-sm-7">{{ event.get_status_display }}</dd>
<dd class="col-sm-12">&nbsp;</dd>
<dt class="col-sm-5">Access From</dt>
<dd class="col-sm-7">{{ event.access_at|date:"D d M Y H:i"|default:"" }}</dd>
<dt class="col-sm-5">Event Starts</dt>
<dd class="col-sm-7">{{ event.start_date|date:"D d M Y" }} {{ event.start_time|date:"H:i" }}</dd>
<dt class="col-sm-5">Event Ends</dt>
<dd class="col-sm-7">{{ event.end_date|date:"D d M Y" }} {{ event.end_time|date:"H:i" }}</dd>
<dd class="col-sm-12">&nbsp;</dd>
<dt class="col-sm-5">Event Description</dt>
<dd class="col-sm-12">{{ event.description|linebreaksbr }}</dd>
</dl>
</div>
</div>
</div>

View File

@@ -208,6 +208,8 @@ class TestEventCreate(BaseRigboardTest):
self.page.person_selector.toggle() self.page.person_selector.toggle()
self.assertFalse(self.page.person_selector.is_open) self.assertFalse(self.page.person_selector.is_open)
self.page.name = "Test Date Validation 2"
# end time before start # end time before start
self.page.start_date = datetime.date(2020, 1, 1) self.page.start_date = datetime.date(2020, 1, 1)
self.page.start_time = datetime.time(10, 00) self.page.start_time = datetime.time(10, 00)