mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-03-03 10:38:23 +00:00
Merge pull request #621 from nottinghamtec/jb3/bunch-o-fixes
Bunch o' Fixes
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -101,3 +101,6 @@ crashlytics.properties
|
|||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
.vscode/
|
.vscode/
|
||||||
screenshots/
|
screenshots/
|
||||||
|
|
||||||
|
# Virutal Environments
|
||||||
|
.venv/
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ def api_key_required(function):
|
|||||||
"""
|
"""
|
||||||
Decorator for views that checks api_pk and api_key.
|
Decorator for views that checks api_pk and api_key.
|
||||||
Failed users will be given a 403 error.
|
Failed users will be given a 403 error.
|
||||||
Should only be used for urls which include <api_pk> and <api_key> kwargs
|
Should only be used for urls which include <api_pk> and <api_key> kwargs.
|
||||||
|
|
||||||
|
Will update the kwargs to include the user object if successful (under the key 'user').
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def wrap(request, *args, **kwargs):
|
def wrap(request, *args, **kwargs):
|
||||||
@@ -97,6 +99,7 @@ def api_key_required(function):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
user_object = models.Profile.objects.get(pk=userid)
|
user_object = models.Profile.objects.get(pk=userid)
|
||||||
|
kwargs = {**kwargs, 'user': user_object}
|
||||||
except models.Profile.DoesNotExist:
|
except models.Profile.DoesNotExist:
|
||||||
return error_resp
|
return error_resp
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,19 @@
|
|||||||
{% load markdown_tags %}
|
{% load markdown_tags %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).keydown(function(e) {
|
||||||
|
if (e.ctrlKey && e.keyCode == 80) {
|
||||||
|
window.open("{% url 'event_print' object.pk %}", '_blank');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row my-3 py-3">
|
<div class="row my-3 py-3">
|
||||||
{% if not request.is_ajax %}
|
{% if not request.is_ajax %}
|
||||||
|
|||||||
144
RIGS/templates/partials/event_row.html
Normal file
144
RIGS/templates/partials/event_row.html
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
{% load namewithnotes from filters %}
|
||||||
|
{% load markdown_tags %}
|
||||||
|
|
||||||
|
<div class="card h-100 border-3 {{ border_class }}">
|
||||||
|
<div class="card-header {{ header_bg }} {{ header_text }} py-3">
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<span class="d-flex align-items-center">
|
||||||
|
<h5 class="mb-0 mr-3">
|
||||||
|
<a href="{% url 'event_detail' event.pk %}"
|
||||||
|
class="{{ header_text }} text-decoration-underline fw-bold">
|
||||||
|
<strong>{{ event.display_id }}</strong> - {{ event.name }}
|
||||||
|
</a>
|
||||||
|
</h5>
|
||||||
|
{% if event.dry_hire %}
|
||||||
|
<span class="badge px-3 py-2 rounded-pill fs-6 text-dark bg-light">Dry Hire</span>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
<span class="badge fs-6 px-3 py-2 bg-light text-dark rounded-pill">{{ event.get_status_display }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row align-items-start">
|
||||||
|
|
||||||
|
<div class="col-md-2 border-end">
|
||||||
|
<div class="mb-2">
|
||||||
|
<small class="text-muted">Meet at:</small>
|
||||||
|
{% if event.meet_at %}
|
||||||
|
<p class="mb-1">{{ event.meet_at|date:"j M Y, H:i" }}</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="mb-1">Not specified</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="mb-2">
|
||||||
|
<small class="text-muted">Access from:</small>
|
||||||
|
{% if event.access_at %}
|
||||||
|
<p class="mb-1">{{ event.access_at|date:"j M Y, H:i" }}</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="mb-1">Not specified</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="mb-2">
|
||||||
|
<small class="text-muted">Start:</small>
|
||||||
|
<p class="mb-1">
|
||||||
|
{% if event.start_date and event.start_time %}
|
||||||
|
{{ event.start_date|date:"j M Y" }}, {{ event.start_time|date:"H:i" }}
|
||||||
|
{% elif event.start_date %}
|
||||||
|
{{ event.start_date|date:"j M Y" }}
|
||||||
|
{% elif event.start_time %}
|
||||||
|
{{ event.start_time|date:"H:i" }}
|
||||||
|
{% else %}
|
||||||
|
Not specified
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="mb-2">
|
||||||
|
<small class="text-muted">End:</small>
|
||||||
|
<p class="mb-1">
|
||||||
|
{% if event.end_date and event.end_time %}
|
||||||
|
{{ event.end_date|date:"j M Y" }}, {{ event.end_time|date:"H:i" }}
|
||||||
|
{% elif event.end_date %}
|
||||||
|
{{ event.end_date|date:"j M Y" }}
|
||||||
|
{% elif event.end_time %}
|
||||||
|
{{ event.end_time|date:"H:i" }}
|
||||||
|
{% else %}
|
||||||
|
Not specified
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-md-10">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
{% if event.venue %}
|
||||||
|
<div class="mb-3">
|
||||||
|
<small class="text-muted">Venue:</small>
|
||||||
|
<p class="mb-1">{{ event.venue|namewithnotes:'venue_detail' }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<small class="text-muted">Client:</small>
|
||||||
|
<p class="mb-1">
|
||||||
|
{% if event.person %}
|
||||||
|
<a href="{{ event.person.get_absolute_url }}">{{ event.person.name }}</a>
|
||||||
|
{% if event.organisation %}
|
||||||
|
for <a href="{{ event.organisation.get_absolute_url }}">{{ event.organisation }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% elif event.organisation %}
|
||||||
|
<a href="{{ event.organisation.get_absolute_url }}">{{ event.organisation }}</a>
|
||||||
|
{% else %}
|
||||||
|
No client specified
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<small class="text-muted">Member in Charge (MIC):</small>
|
||||||
|
<div class="d-flex align-items-center mt-1">
|
||||||
|
{% if event.mic %}
|
||||||
|
<img src="{{ event.mic.profile_picture }}" alt="{{ event.mic.name }}"
|
||||||
|
class="rounded-circle mr-1" width="32" height="32">
|
||||||
|
<span>
|
||||||
|
{% if perms.RIGS.view_profile %}
|
||||||
|
<a href="{% url 'profile_detail' event.mic.pk %}" class="modal-href">
|
||||||
|
{% endif %}
|
||||||
|
{{ event.mic.name }}
|
||||||
|
{% if perms.RIGS.view_profile %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-danger">No MIC assigned</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<small class="text-muted">Description:</small>
|
||||||
|
<p class="mb-1">{{ event.description|markdown }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<small class="text-muted">Status:</small>
|
||||||
|
<div class="mt-1">
|
||||||
|
{% include "partials/event_status.html" with status=event.status %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
{% if event.is_rig %}
|
{% if event.is_rig %}
|
||||||
{% if event.sum_total > 0 %}
|
{% if event.sum_total > 0 %}
|
||||||
{% if event.purchase_order %}
|
{% if event.purchase_order %}
|
||||||
<span class="badge badge-success">PO: {{ event.purchase_order }}</span>
|
<span class="badge badge-success">PO: Received</span>
|
||||||
{% elif event.authorised %}
|
{% elif event.authorised %}
|
||||||
<span class="badge badge-success">Authorisation: Complete <span class="fas fa-check"></span></span>
|
<span class="badge badge-success">Authorisation: Complete <span class="fas fa-check"></span></span>
|
||||||
{% elif event.authorisation and event.authorisation.amount != event.total and event.authorisation.last_edited_at > event.auth_request_at %}
|
{% elif event.authorisation and event.authorisation.amount != event.total and event.authorisation.last_edited_at > event.auth_request_at %}
|
||||||
|
|||||||
@@ -1,195 +1,70 @@
|
|||||||
{% load namewithnotes from filters %}
|
{% load namewithnotes from filters %}
|
||||||
{% load markdown_tags %}
|
{% load markdown_tags %}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#event_table {
|
.light-link {
|
||||||
display: grid;
|
color: #80c0ff !important;
|
||||||
grid-template-columns: max-content min-content minmax(max-content, 1fr) max-content;
|
|
||||||
column-gap: 1em;
|
|
||||||
}
|
}
|
||||||
.eventgrid {
|
|
||||||
display: inherit;
|
.dark-link {
|
||||||
grid-column: 1/5;
|
color: #377bc3 !important;
|
||||||
grid-template-columns: subgrid;
|
|
||||||
padding: 1em;
|
|
||||||
dt, dd { display: block; float: left; }
|
|
||||||
dt { clear: both; }
|
|
||||||
dd { float: right; }
|
|
||||||
}
|
|
||||||
.grid-header {
|
|
||||||
border-bottom: 1px solid grey;
|
|
||||||
border-top: 1px solid grey;
|
|
||||||
}
|
|
||||||
#event_status {
|
|
||||||
grid-column-start: 3;
|
|
||||||
}
|
|
||||||
#event_mic {
|
|
||||||
grid-row-start: 1;
|
|
||||||
grid-column-start: 4;
|
|
||||||
}
|
|
||||||
.c-none {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.c-inline {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
@container (width <= 500px) {
|
|
||||||
#event_table {
|
|
||||||
grid-template-columns: 1fr !important;
|
|
||||||
}
|
|
||||||
.eventgrid {
|
|
||||||
grid-column: 1/1 !important;
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
|
||||||
.grid-header {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#event_dates {
|
|
||||||
order: 2;
|
|
||||||
}
|
|
||||||
#event_status {
|
|
||||||
order: 3;
|
|
||||||
}
|
|
||||||
#event_mic {
|
|
||||||
grid-row-start: auto;
|
|
||||||
grid-column-start: 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@container (width <= 700px) {
|
|
||||||
#event_table {
|
|
||||||
grid-template-columns: max-content;
|
|
||||||
column-gap: 0.5em;
|
|
||||||
}
|
|
||||||
.eventgrid {
|
|
||||||
grid-column: 1/3;
|
|
||||||
border: 1px solid grey;
|
|
||||||
}
|
|
||||||
#event_dates {
|
|
||||||
grid-row: 2;
|
|
||||||
grid-column: 1;
|
|
||||||
}
|
|
||||||
#event_number {
|
|
||||||
grid-row: 1;
|
|
||||||
grid-column: 1;
|
|
||||||
}
|
|
||||||
#event_mic {
|
|
||||||
grid-column: 2;
|
|
||||||
}
|
|
||||||
#event_status {
|
|
||||||
grid-column: span 2;
|
|
||||||
}
|
|
||||||
.grid-header, .c-md-none {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@container (width > 700px) {
|
|
||||||
.c-lg-block {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.c-lg-inline {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.c-lg-none, .c-md-none {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.link-on-green {
|
||||||
|
color: #ffffff !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div id="event_table">
|
|
||||||
<div class="eventgrid grid-header font-weight-bold">
|
<div class="row">
|
||||||
<div id="event_number">#</div>
|
|
||||||
<div id="event_dates">Dates & Times</div>
|
|
||||||
<div>Event Details</div>
|
|
||||||
<div id="event_mic">MIC</div>
|
|
||||||
</div>
|
|
||||||
{% for event in events %}
|
{% for event in events %}
|
||||||
<div class="eventgrid {% if event.cancelled %}
|
<div class="col-12 mb-4">
|
||||||
table-secondary
|
{% comment %} Determine card style based on event status {% endcomment %}
|
||||||
|
{% if event.cancelled %}
|
||||||
|
|
||||||
|
{% with border_class="border-secondary" header_bg="bg-secondary" header_text="light-link" %}
|
||||||
|
{% include "partials/event_row.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% elif not event.is_rig %}
|
{% elif not event.is_rig %}
|
||||||
table-info
|
|
||||||
|
{% with border_class="border-primary" header_bg="bg-primary" header_text="light-link" %}
|
||||||
|
{% include "partials/event_row.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% elif not event.mic %}
|
{% elif not event.mic %}
|
||||||
table-danger
|
|
||||||
|
{% with border_class="border-danger" header_bg="bg-danger" header_text="light-link" %}
|
||||||
|
{% include "partials/event_row.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% elif event.confirmed and event.authorised %}
|
{% elif event.confirmed and event.authorised %}
|
||||||
|
|
||||||
{% if event.dry_hire or event.riskassessment %}
|
{% if event.dry_hire or event.riskassessment %}
|
||||||
table-success
|
|
||||||
|
{% with border_class="border-success" header_bg="bg-success" header_text="link-on-green" %}
|
||||||
|
{% include "partials/event_row.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
table-warning
|
|
||||||
|
{% with border_class="border-warning" header_bg="bg-warning" header_text="dark-link" %}
|
||||||
|
{% include "partials/event_row.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
table-warning
|
|
||||||
{% endif %}" {% if event.cancelled %}style="opacity: 50% !important;"{% endif %} id="event_row">
|
{% with border_class="border-warning" header_bg="bg-warning" header_text="dark-link" %}
|
||||||
<!---Number-->
|
{% include "partials/event_row.html" %}
|
||||||
<div class="font-weight-bold c-none c-lg-block" id="event_number">{{ event.display_id }}</div>
|
{% endwith %}
|
||||||
<!--Dates & Times-->
|
|
||||||
<div id="event_dates" style="min-width: 180px;">
|
|
||||||
<dl>
|
|
||||||
{% if not event.cancelled %}
|
|
||||||
{% if event.meet_at %}
|
|
||||||
<dt class="font-weight-normal">Meet:</dt>
|
|
||||||
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.meet_at|date:"D d/m/Y H:i" }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
{% if event.access_at %}
|
|
||||||
<dt class="font-weight-normal">Access:</dt>
|
|
||||||
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.access_at|date:"D d/m/Y H:i" }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
<dt class="font-weight-normal">Start:</dt>
|
|
||||||
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.start_date|date:"D d/m/Y" }}
|
|
||||||
{% if event.has_start_time %}
|
|
||||||
{{ event.start_time|date:"H:i" }}
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
{% if event.end_date %}
|
|
||||||
<dt class="font-weight-normal">End:</dt>
|
|
||||||
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.end_date|date:"D d/m/Y" }}
|
|
||||||
{% if event.has_end_time %}
|
|
||||||
{{ event.end_time|date:"H:i" }}
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
{% endif %}
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
<!---Details-->
|
|
||||||
<div id="event_details" class="w-100">
|
|
||||||
<h4>
|
|
||||||
<a href="{% url 'event_detail' event.pk %}">
|
|
||||||
<span class="c-inline c-lg-none">{{ event }}</span><span class="c-none c-lg-inline">{{ event.name }}</span>
|
|
||||||
</a>
|
|
||||||
{% if event.dry_hire %}
|
|
||||||
<span class="badge badge-secondary">Dry Hire</span>
|
|
||||||
{% endif %}
|
|
||||||
<br class="c-none c-lg-inline">
|
|
||||||
{% if event.venue %}
|
|
||||||
<small>at {{ event.venue|namewithnotes:'venue_detail' }}</small>
|
|
||||||
{% endif %}
|
|
||||||
</h4>
|
|
||||||
{% if event.is_rig and not event.cancelled %}
|
|
||||||
<h5>
|
|
||||||
<a href="{{ event.person.get_absolute_url }}">{{ event.person.name }}</a>
|
|
||||||
{% if event.organisation %}
|
|
||||||
for <a href="{{ event.organisation.get_absolute_url }}">{{ event.organisation.name }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</h5>
|
|
||||||
{% endif %}
|
|
||||||
{% if not event.cancelled and event.description %}
|
|
||||||
<p>{{ event.description|markdown }}</p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% include 'partials/event_status.html' %}
|
{% empty %}
|
||||||
<!---MIC-->
|
<div class="col-12">
|
||||||
<div id="event_mic" class="text-nowrap">
|
<div class="alert alert-info">
|
||||||
<span class="c-md-none align-middle">MIC:</span>
|
No events currently scheduled.
|
||||||
{% if event.mic %}
|
|
||||||
{% if perms.RIGS.view_profile %}
|
|
||||||
<a href="{% url 'profile_detail' event.mic.pk %}" class="modal-href">
|
|
||||||
{% endif %}
|
|
||||||
<img src="{{ event.mic.profile_picture }}" class="event-mic-photo"/>
|
|
||||||
{{ event.mic }}
|
|
||||||
{% if perms.RIGS.view_profile %}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% elif event.is_rig %}
|
|
||||||
<span class="fas fa-exclamation"></span>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
|
||||||
|
|||||||
195
RIGS/templates/partials/legacy_event_table.html
Normal file
195
RIGS/templates/partials/legacy_event_table.html
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
{% load namewithnotes from filters %}
|
||||||
|
{% load markdown_tags %}
|
||||||
|
<style>
|
||||||
|
#event_table {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: max-content min-content minmax(max-content, 1fr) max-content;
|
||||||
|
column-gap: 1em;
|
||||||
|
}
|
||||||
|
.eventgrid {
|
||||||
|
display: inherit;
|
||||||
|
grid-column: 1/5;
|
||||||
|
grid-template-columns: subgrid;
|
||||||
|
padding: 1em;
|
||||||
|
dt, dd { display: block; float: left; }
|
||||||
|
dt { clear: both; }
|
||||||
|
dd { float: right; }
|
||||||
|
}
|
||||||
|
.grid-header {
|
||||||
|
border-bottom: 1px solid grey;
|
||||||
|
border-top: 1px solid grey;
|
||||||
|
}
|
||||||
|
#event_status {
|
||||||
|
grid-column-start: 3;
|
||||||
|
}
|
||||||
|
#event_mic {
|
||||||
|
grid-row-start: 1;
|
||||||
|
grid-column-start: 4;
|
||||||
|
}
|
||||||
|
.c-none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.c-inline {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
@container (width <= 500px) {
|
||||||
|
#event_table {
|
||||||
|
grid-template-columns: 1fr !important;
|
||||||
|
}
|
||||||
|
.eventgrid {
|
||||||
|
grid-column: 1/1 !important;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
.grid-header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#event_dates {
|
||||||
|
order: 2;
|
||||||
|
}
|
||||||
|
#event_status {
|
||||||
|
order: 3;
|
||||||
|
}
|
||||||
|
#event_mic {
|
||||||
|
grid-row-start: auto;
|
||||||
|
grid-column-start: 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@container (width <= 700px) {
|
||||||
|
#event_table {
|
||||||
|
grid-template-columns: max-content;
|
||||||
|
column-gap: 0.5em;
|
||||||
|
}
|
||||||
|
.eventgrid {
|
||||||
|
grid-column: 1/3;
|
||||||
|
border: 1px solid grey;
|
||||||
|
}
|
||||||
|
#event_dates {
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column: 1;
|
||||||
|
}
|
||||||
|
#event_number {
|
||||||
|
grid-row: 1;
|
||||||
|
grid-column: 1;
|
||||||
|
}
|
||||||
|
#event_mic {
|
||||||
|
grid-column: 2;
|
||||||
|
}
|
||||||
|
#event_status {
|
||||||
|
grid-column: span 2;
|
||||||
|
}
|
||||||
|
.grid-header, .c-md-none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@container (width > 700px) {
|
||||||
|
.c-lg-block {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.c-lg-inline {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.c-lg-none, .c-md-none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="event_table">
|
||||||
|
<div class="eventgrid grid-header font-weight-bold">
|
||||||
|
<div id="event_number">#</div>
|
||||||
|
<div id="event_dates">Dates & Times</div>
|
||||||
|
<div>Event Details</div>
|
||||||
|
<div id="event_mic">MIC</div>
|
||||||
|
</div>
|
||||||
|
{% for event in events %}
|
||||||
|
<div class="eventgrid {% if event.cancelled %}
|
||||||
|
table-secondary
|
||||||
|
{% elif not event.is_rig %}
|
||||||
|
table-info
|
||||||
|
{% elif not event.mic %}
|
||||||
|
table-danger
|
||||||
|
{% elif event.confirmed and event.authorised %}
|
||||||
|
{% if event.dry_hire or event.riskassessment %}
|
||||||
|
table-success
|
||||||
|
{% else %}
|
||||||
|
table-warning
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
table-warning
|
||||||
|
{% endif %}" {% if event.cancelled %}style="opacity: 50% !important;"{% endif %} id="event_row">
|
||||||
|
<!---Number-->
|
||||||
|
<div class="font-weight-bold c-none c-lg-block" id="event_number">{{ event.display_id }}</div>
|
||||||
|
<!--Dates & Times-->
|
||||||
|
<div id="event_dates" style="min-width: 180px;">
|
||||||
|
<dl>
|
||||||
|
{% if not event.cancelled %}
|
||||||
|
{% if event.meet_at %}
|
||||||
|
<dt class="font-weight-normal">Meet:</dt>
|
||||||
|
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.meet_at|date:"D d/m/Y H:i" }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
{% if event.access_at %}
|
||||||
|
<dt class="font-weight-normal">Access:</dt>
|
||||||
|
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.access_at|date:"D d/m/Y H:i" }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<dt class="font-weight-normal">Start:</dt>
|
||||||
|
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.start_date|date:"D d/m/Y" }}
|
||||||
|
{% if event.has_start_time %}
|
||||||
|
{{ event.start_time|date:"H:i" }}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
{% if event.end_date %}
|
||||||
|
<dt class="font-weight-normal">End:</dt>
|
||||||
|
<dd class="text-nowrap font-weight-bold text-lg-right">{{ event.end_date|date:"D d/m/Y" }}
|
||||||
|
{% if event.has_end_time %}
|
||||||
|
{{ event.end_time|date:"H:i" }}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
{% endif %}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<!---Details-->
|
||||||
|
<div id="event_details" class="w-100">
|
||||||
|
<h4>
|
||||||
|
<a href="{% url 'event_detail' event.pk %}">
|
||||||
|
<span class="c-inline c-lg-none">{{ event }}</span><span class="c-none c-lg-inline">{{ event.name }}</span>
|
||||||
|
</a>
|
||||||
|
{% if event.dry_hire %}
|
||||||
|
<span class="badge badge-secondary">Dry Hire</span>
|
||||||
|
{% endif %}
|
||||||
|
<br class="c-none c-lg-inline">
|
||||||
|
{% if event.venue %}
|
||||||
|
<small>at {{ event.venue|namewithnotes:'venue_detail' }}</small>
|
||||||
|
{% endif %}
|
||||||
|
</h4>
|
||||||
|
{% if event.is_rig and not event.cancelled %}
|
||||||
|
<h5>
|
||||||
|
<a href="{{ event.person.get_absolute_url }}">{{ event.person.name }}</a>
|
||||||
|
{% if event.organisation %}
|
||||||
|
for <a href="{{ event.organisation.get_absolute_url }}">{{ event.organisation.name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</h5>
|
||||||
|
{% endif %}
|
||||||
|
{% if not event.cancelled and event.description %}
|
||||||
|
<p>{{ event.description|markdown }}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% include 'partials/event_status.html' %}
|
||||||
|
<!---MIC-->
|
||||||
|
<div id="event_mic" class="text-nowrap">
|
||||||
|
<span class="c-md-none align-middle">MIC:</span>
|
||||||
|
{% if event.mic %}
|
||||||
|
{% if perms.RIGS.view_profile %}
|
||||||
|
<a href="{% url 'profile_detail' event.mic.pk %}" class="modal-href">
|
||||||
|
{% endif %}
|
||||||
|
<img src="{{ event.mic.profile_picture }}" class="event-mic-photo"/>
|
||||||
|
{{ event.mic }}
|
||||||
|
{% if perms.RIGS.view_profile %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% elif event.is_rig %}
|
||||||
|
<span class="fas fa-exclamation"></span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
@@ -4,15 +4,37 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row align-items-center justify-content-between py-2 align-middle">
|
<div class="row align-items-center justify-content-between py-2 align-middle">
|
||||||
<div class="col-sm-12 col-md align-middle d-flex flex-wrap">
|
<div class="col-sm-12 col-md align-middle d-flex flex-wrap">
|
||||||
Key: <span class="table-success mr-1 px-2 rounded">Ready</span><span class="table-warning mr-1 px-2 rounded text-nowrap">Action Required</span><span class="table-danger mr-1 px-2 rounded text-nowrap">Needs MIC</span><span class="table-secondary mr-1 px-2 rounded">Cancelled</span><span class="table-info px-2 rounded text-nowrap">Non-Rig</span>
|
Key: <span class="table-success mr-1 px-2 rounded">Ready</span><span
|
||||||
|
class="table-warning mr-1 px-2 rounded text-nowrap">Action Required</span><span
|
||||||
|
class="table-danger mr-1 px-2 rounded text-nowrap">Needs MIC</span><span
|
||||||
|
class="table-secondary mr-1 px-2 rounded">Cancelled</span><span
|
||||||
|
class="table-info px-2 rounded text-nowrap">Non-Rig</span>
|
||||||
</div>
|
</div>
|
||||||
{% if perms.RIGS.add_event %}
|
{% if perms.RIGS.add_event %}
|
||||||
<div class="col text-right">
|
<div class="col text-right">
|
||||||
{% button 'new' 'event_create' %}
|
{% button 'new' 'event_create' %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if not request.GET.legacy %}
|
||||||
|
<a href="?legacy=true" class="btn btn-secondary">View legacy rigboard</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="." class="btn btn-secondary">Go to new rigboard</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if request.GET.legacy %}
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<strong>Warning:</strong> The legacy rigboard is being deprecated and will be removed in the future. Please use the
|
||||||
|
new rigboard.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div style="container-type: inline-size;">
|
<div style="container-type: inline-size;">
|
||||||
|
{% if request.GET.legacy %}
|
||||||
|
{% include 'partials/legacy_event_table.html' %}
|
||||||
|
{% else %}
|
||||||
{% include 'partials/event_table.html' %}
|
{% include 'partials/event_table.html' %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -530,10 +530,11 @@ class TestCalendar(BaseRigboardTest):
|
|||||||
self.page.toggle_filter('cancelled')
|
self.page.toggle_filter('cancelled')
|
||||||
self.page.toggle_filter('provisional')
|
self.page.toggle_filter('provisional')
|
||||||
self.page.toggle_filter('confirmed')
|
self.page.toggle_filter('confirmed')
|
||||||
|
self.page.toggle_filter('only_mic')
|
||||||
|
|
||||||
# and then check the url is correct
|
# and then check the url is correct
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"rigs.ics?rig=false&non-rig=false&dry-hire=false&cancelled=true&provisional=false&confirmed=false",
|
"rigs.ics?rig=false&non-rig=false&dry-hire=false&cancelled=true&provisional=false&confirmed=false&only_mic=true",
|
||||||
self.page.cal_url)
|
self.page.cal_url)
|
||||||
|
|
||||||
# Awesome - all seems to work
|
# Awesome - all seems to work
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class CalendarICS(ICalFeed):
|
|||||||
# Rig = 'rig' = True
|
# Rig = 'rig' = True
|
||||||
# Provisional = 'provisional' = True
|
# Provisional = 'provisional' = True
|
||||||
# Confirmed/Booked = 'confirmed' = True
|
# Confirmed/Booked = 'confirmed' = True
|
||||||
|
# Only MIC = 'mic' = False
|
||||||
|
|
||||||
def get_object(self, request, *args, **kwargs):
|
def get_object(self, request, *args, **kwargs):
|
||||||
params = {}
|
params = {}
|
||||||
@@ -35,6 +36,9 @@ class CalendarICS(ICalFeed):
|
|||||||
params['cancelled'] = request.GET.get('cancelled', 'false') == 'true'
|
params['cancelled'] = request.GET.get('cancelled', 'false') == 'true'
|
||||||
params['provisional'] = request.GET.get('provisional', 'true') == 'true'
|
params['provisional'] = request.GET.get('provisional', 'true') == 'true'
|
||||||
params['confirmed'] = request.GET.get('confirmed', 'true') == 'true'
|
params['confirmed'] = request.GET.get('confirmed', 'true') == 'true'
|
||||||
|
params['only_mic'] = request.GET.get('only_mic', 'false') == 'true'
|
||||||
|
|
||||||
|
params['user'] = kwargs['user']
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
@@ -73,6 +77,9 @@ class CalendarICS(ICalFeed):
|
|||||||
|
|
||||||
filter = filter & typeFilters & statusFilters
|
filter = filter & typeFilters & statusFilters
|
||||||
|
|
||||||
|
if params['only_mic']:
|
||||||
|
filter = filter & Q(mic=params['user'])
|
||||||
|
|
||||||
return models.Event.objects.filter(filter).order_by('-start_date').select_related('person', 'organisation',
|
return models.Event.objects.filter(filter).order_by('-start_date').select_related('person', 'organisation',
|
||||||
'venue', 'mic')
|
'venue', 'mic')
|
||||||
|
|
||||||
|
|||||||
648
package-lock.json
generated
648
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,9 @@
|
|||||||
<label for="supervisor" class="col-sm-2 col-form-label">Supervisor</label>
|
<label for="supervisor" class="col-sm-2 col-form-label">Supervisor</label>
|
||||||
<select name="supervisor" id="supervisor_id" class="selectpicker col-sm-10" data-live-search="true" data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials" required data-noclear="true">
|
<select name="supervisor" id="supervisor_id" class="selectpicker col-sm-10" data-live-search="true"
|
||||||
|
data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials" required
|
||||||
|
data-noclear="true">
|
||||||
{% if supervisor %}
|
{% if supervisor %}
|
||||||
<option value="{{form.supervisor.value}}" selected>{{ supervisor }}</option>
|
<option value="{{form.supervisor.value}}" selected>{{ supervisor }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<option value="{{request.user.pk}}" selected>{{ request.user }}</option>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -126,6 +126,9 @@
|
|||||||
<label class="checkbox-inline ml-lg-2">
|
<label class="checkbox-inline ml-lg-2">
|
||||||
<input type="checkbox" value="confirmed" data-default="true" checked> Confirmed/Booked
|
<input type="checkbox" value="confirmed" data-default="true" checked> Confirmed/Booked
|
||||||
</label>
|
</label>
|
||||||
|
<label class="checkbox-inline ml-lg-2">
|
||||||
|
<input type="checkbox" value="only_mic" data-default="false" > Only MIC
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
Reference in New Issue
Block a user