Skip to content

Commit 0bb7418

Browse files
authored
Merge pull request #621 from nottinghamtec/jb3/bunch-o-fixes
Bunch o' Fixes
2 parents 1f22470 + 30a053b commit 0bb7418

File tree

13 files changed

+832
-461
lines changed

13 files changed

+832
-461
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,6 @@ crashlytics.properties
101101
crashlytics-build.properties
102102
.vscode/
103103
screenshots/
104+
105+
# Virutal Environments
106+
.venv/

PyRIGS/decorators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def api_key_required(function):
7979
"""
8080
Decorator for views that checks api_pk and api_key.
8181
Failed users will be given a 403 error.
82-
Should only be used for urls which include <api_pk> and <api_key> kwargs
82+
Should only be used for urls which include <api_pk> and <api_key> kwargs.
83+
84+
Will update the kwargs to include the user object if successful (under the key 'user').
8385
"""
8486

8587
def wrap(request, *args, **kwargs):
@@ -97,6 +99,7 @@ def wrap(request, *args, **kwargs):
9799

98100
try:
99101
user_object = models.Profile.objects.get(pk=userid)
102+
kwargs = {**kwargs, 'user': user_object}
100103
except models.Profile.DoesNotExist:
101104
return error_resp
102105

RIGS/templates/event_detail.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
{% load markdown_tags %}
44
{% load static %}
55

6+
{% block js %}
7+
{{ block.super }}
8+
9+
<script>
10+
$(document).keydown(function(e) {
11+
if (e.ctrlKey && e.keyCode == 80) {
12+
window.open("{% url 'event_print' object.pk %}", '_blank');
13+
return false;
14+
}
15+
});
16+
</script>
17+
{% endblock %}
18+
619
{% block content %}
720
<div class="row my-3 py-3">
821
{% if not request.is_ajax %}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{% load namewithnotes from filters %}
2+
{% load markdown_tags %}
3+
4+
<div class="card h-100 border-3 {{ border_class }}">
5+
<div class="card-header {{ header_bg }} {{ header_text }} py-3">
6+
<div class="d-flex justify-content-between align-items-center">
7+
<span class="d-flex align-items-center">
8+
<h5 class="mb-0 mr-3">
9+
<a href="{% url 'event_detail' event.pk %}"
10+
class="{{ header_text }} text-decoration-underline fw-bold">
11+
<strong>{{ event.display_id }}</strong> - {{ event.name }}
12+
</a>
13+
</h5>
14+
{% if event.dry_hire %}
15+
<span class="badge px-3 py-2 rounded-pill fs-6 text-dark bg-light">Dry Hire</span>
16+
{% endif %}
17+
</span>
18+
<span class="badge fs-6 px-3 py-2 bg-light text-dark rounded-pill">{{ event.get_status_display }}</span>
19+
</div>
20+
</div>
21+
<div class="card-body">
22+
<div class="row align-items-start">
23+
24+
<div class="col-md-2 border-end">
25+
<div class="mb-2">
26+
<small class="text-muted">Meet at:</small>
27+
{% if event.meet_at %}
28+
<p class="mb-1">{{ event.meet_at|date:"j M Y, H:i" }}</p>
29+
{% else %}
30+
<p class="mb-1">Not specified</p>
31+
{% endif %}
32+
</div>
33+
<div class="mb-2">
34+
<small class="text-muted">Access from:</small>
35+
{% if event.access_at %}
36+
<p class="mb-1">{{ event.access_at|date:"j M Y, H:i" }}</p>
37+
{% else %}
38+
<p class="mb-1">Not specified</p>
39+
{% endif %}
40+
</div>
41+
<div class="mb-2">
42+
<small class="text-muted">Start:</small>
43+
<p class="mb-1">
44+
{% if event.start_date and event.start_time %}
45+
{{ event.start_date|date:"j M Y" }}, {{ event.start_time|date:"H:i" }}
46+
{% elif event.start_date %}
47+
{{ event.start_date|date:"j M Y" }}
48+
{% elif event.start_time %}
49+
{{ event.start_time|date:"H:i" }}
50+
{% else %}
51+
Not specified
52+
{% endif %}
53+
</p>
54+
</div>
55+
<div class="mb-2">
56+
<small class="text-muted">End:</small>
57+
<p class="mb-1">
58+
{% if event.end_date and event.end_time %}
59+
{{ event.end_date|date:"j M Y" }}, {{ event.end_time|date:"H:i" }}
60+
{% elif event.end_date %}
61+
{{ event.end_date|date:"j M Y" }}
62+
{% elif event.end_time %}
63+
{{ event.end_time|date:"H:i" }}
64+
{% else %}
65+
Not specified
66+
{% endif %}
67+
</p>
68+
</div>
69+
</div>
70+
71+
72+
<div class="col-md-10">
73+
<div class="row">
74+
75+
<div class="col-md-6">
76+
77+
{% if event.venue %}
78+
<div class="mb-3">
79+
<small class="text-muted">Venue:</small>
80+
<p class="mb-1">{{ event.venue|namewithnotes:'venue_detail' }}</p>
81+
</div>
82+
{% endif %}
83+
84+
85+
<div class="mb-3">
86+
<small class="text-muted">Client:</small>
87+
<p class="mb-1">
88+
{% if event.person %}
89+
<a href="{{ event.person.get_absolute_url }}">{{ event.person.name }}</a>
90+
{% if event.organisation %}
91+
for <a href="{{ event.organisation.get_absolute_url }}">{{ event.organisation }}</a>
92+
{% endif %}
93+
{% elif event.organisation %}
94+
<a href="{{ event.organisation.get_absolute_url }}">{{ event.organisation }}</a>
95+
{% else %}
96+
No client specified
97+
{% endif %}
98+
</p>
99+
</div>
100+
101+
102+
<div class="mb-3">
103+
<small class="text-muted">Member in Charge (MIC):</small>
104+
<div class="d-flex align-items-center mt-1">
105+
{% if event.mic %}
106+
<img src="{{ event.mic.profile_picture }}" alt="{{ event.mic.name }}"
107+
class="rounded-circle mr-1" width="32" height="32">
108+
<span>
109+
{% if perms.RIGS.view_profile %}
110+
<a href="{% url 'profile_detail' event.mic.pk %}" class="modal-href">
111+
{% endif %}
112+
{{ event.mic.name }}
113+
{% if perms.RIGS.view_profile %}
114+
</a>
115+
{% endif %}
116+
</span>
117+
{% else %}
118+
<span class="text-danger">No MIC assigned</span>
119+
{% endif %}
120+
</div>
121+
</div>
122+
</div>
123+
124+
125+
<div class="col-md-6">
126+
127+
<div class="mb-3">
128+
<small class="text-muted">Description:</small>
129+
<p class="mb-1">{{ event.description|markdown }}</p>
130+
</div>
131+
132+
133+
<div class="mb-3">
134+
<small class="text-muted">Status:</small>
135+
<div class="mt-1">
136+
{% include "partials/event_status.html" with status=event.status %}
137+
</div>
138+
</div>
139+
</div>
140+
</div>
141+
</div>
142+
</div>
143+
</div>
144+
</div>

RIGS/templates/partials/event_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% if event.is_rig %}
44
{% if event.sum_total > 0 %}
55
{% if event.purchase_order %}
6-
<span class="badge badge-success">PO: {{ event.purchase_order }}</span>
6+
<span class="badge badge-success">PO: Received</span>
77
{% elif event.authorised %}
88
<span class="badge badge-success">Authorisation: Complete <span class="fas fa-check"></span></span>
99
{% elif event.authorisation and event.authorisation.amount != event.total and event.authorisation.last_edited_at > event.auth_request_at %}

0 commit comments

Comments
 (0)