mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-02-08 16:09:40 +00:00
Compare commits
49 Commits
estates-co
...
e32cc30141
| Author | SHA1 | Date | |
|---|---|---|---|
| e32cc30141 | |||
| 21dea6cc6a | |||
| 075c6f9365 | |||
|
|
e5c7e24941 | ||
|
|
55f45963a0 | ||
|
|
54e0c9ff9d | ||
|
|
6bb69ec8a1 | ||
|
|
c18d7a75b8 | ||
|
|
2d83dad44c | ||
| be7b595edb | |||
| 6d53df0c8b | |||
| 732a6e5c1e | |||
|
|
c6823bb9ac | ||
|
|
ec000beee8 | ||
|
|
6c8eb380fd | ||
|
3123d3899c
|
|||
|
|
c93c04ec6e | ||
| 6bf8d56ce8 | |||
|
8246071b8c
|
|||
|
06fa1a3b1b
|
|||
|
70abfaf2ae
|
|||
|
02a5a94fbb
|
|||
|
|
ddce9752c6 | ||
|
|
5a16e06bed | ||
|
|
5160a61a62 | ||
|
|
607f282ef6 | ||
|
|
d71bb81edf | ||
|
|
f46915233e | ||
|
|
0c900d2447 | ||
|
953b691cc2
|
|||
|
17fa447861
|
|||
|
|
409125c8a3 | ||
|
|
03d996eb66 | ||
|
|
1e40916a94 | ||
|
|
eae3f762b7 | ||
|
|
7a387e8724 | ||
|
|
4f42219821 | ||
|
d7d2f93295
|
|||
| 2a2ce742b0 | |||
|
|
68d3605230 | ||
|
1fff150566
|
|||
|
240ff25c63
|
|||
|
e265ad58a6
|
|||
|
1a32ef424b
|
|||
|
|
44c92fc859 | ||
|
|
1af182eaa1 | ||
|
|
425a697743 | ||
|
|
b7011e368b | ||
| 7d2f8d2dc8 |
13
.github/workflows/django.yml
vendored
13
.github/workflows/django.yml
vendored
@@ -14,11 +14,14 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PYTHONDONTWRITEBYTECODE: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt-get install libcairo2-dev
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.9
|
||||
python-version: "3.10"
|
||||
cache: 'pipenv'
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
@@ -27,7 +30,7 @@ jobs:
|
||||
# if: steps.pcache.outputs.cache-hit != 'true'
|
||||
- name: Cache Static Files
|
||||
id: static-cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: 'pipeline/built_assets'
|
||||
key: ${{ hashFiles('package-lock.json') }}-${{ hashFiles('pipeline/source_assets') }}
|
||||
@@ -43,7 +46,7 @@ jobs:
|
||||
pipenv run python3 manage.py collectstatic --noinput
|
||||
- name: Run Tests
|
||||
run: pipenv run pytest -n auto --cov
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: failure-screenshots ${{ matrix.test-group }}
|
||||
|
||||
12
Pipfile
12
Pipfile
@@ -28,13 +28,13 @@ django-reversion = "~=3.0.9"
|
||||
django-widget-tweaks = "~=1.4.8"
|
||||
django-htmlmin = "~=0.11.0"
|
||||
envparse = "*"
|
||||
gunicorn = "~=20.0.4"
|
||||
gunicorn = "~=22.0.0"
|
||||
icalendar = "~=4.0.7"
|
||||
idna = "~=2.10"
|
||||
idna = "~=3.7"
|
||||
Markdown = "~=3.3.3"
|
||||
msgpack = "~=1.0.2"
|
||||
pep517 = "~=0.9.1"
|
||||
Pillow = "~=9.3.0"
|
||||
Pillow = "~=10.0.1"
|
||||
premailer = "~=3.7.0"
|
||||
progress = "~=1.5"
|
||||
psutil = "~=5.8.0"
|
||||
@@ -47,17 +47,17 @@ python-dateutil = "~=2.8.1"
|
||||
pytoml = "~=0.1.21"
|
||||
pytz = "~=2020.5"
|
||||
reportlab = "*"
|
||||
requests = "~=2.31.0"
|
||||
requests = "~=2.32.3"
|
||||
retrying = "~=1.3.3"
|
||||
simplejson = "~=3.17.2"
|
||||
six = "~=1.15.0"
|
||||
soupsieve = "~=2.1"
|
||||
sqlparse = "~=0.4.2"
|
||||
sqlparse = "~=0.5.0"
|
||||
static3 = "~=0.7.0"
|
||||
svg2rlg = "~=0.3"
|
||||
tini = "~=3.0.1"
|
||||
tornado = "~=6.3"
|
||||
urllib3 = "~=1.26.5"
|
||||
urllib3 = "~=1.26.19"
|
||||
whitenoise = "~=5.2.0"
|
||||
yolk = "~=0.4.3"
|
||||
zipp = "~=3.4.0"
|
||||
|
||||
1545
Pipfile.lock
generated
1545
Pipfile.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -121,7 +121,3 @@ def nottinghamtec_address_required(function):
|
||||
return function(request, *args, **kwargs)
|
||||
|
||||
return wrap
|
||||
|
||||
|
||||
def not_estates():
|
||||
return user_passes_test_with_403(lambda u: not u.email.endswith('@nottingham.ac.uk'))
|
||||
0
PyRIGS/forms.py
Normal file
0
PyRIGS/forms.py
Normal file
@@ -35,9 +35,8 @@ if DEBUG:
|
||||
ALLOWED_HOSTS.append('localhost')
|
||||
ALLOWED_HOSTS.append('example.com')
|
||||
ALLOWED_HOSTS.append('127.0.0.1')
|
||||
ALLOWED_HOSTS.append('.github.dev')
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = ALLOWED_HOSTS
|
||||
ALLOWED_HOSTS.append('.app.github.dev')
|
||||
CSRF_TRUSTED_ORIGINS = ALLOWED_HOSTS
|
||||
|
||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
if not DEBUG:
|
||||
@@ -225,6 +224,8 @@ USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
USE_THOUSAND_SEPARATOR = True
|
||||
|
||||
# Need to allow seconds as datetime-local input type spits out a time that has seconds
|
||||
DATETIME_INPUT_FORMATS = ('%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S')
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
from django.urls import path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from PyRIGS.decorators import not_estates
|
||||
|
||||
from PyRIGS import views
|
||||
|
||||
urlpatterns = [
|
||||
@@ -16,17 +14,17 @@ urlpatterns = [
|
||||
path('assets/', include('assets.urls')),
|
||||
path('training/', include('training.urls')),
|
||||
|
||||
path('', not_estates()(views.Index.as_view()), name='index'),
|
||||
path('', login_required(views.Index.as_view()), name='index'),
|
||||
|
||||
# API
|
||||
path('api/<str:model>/', not_estates()(views.SecureAPIRequest.as_view()),
|
||||
path('api/<str:model>/', login_required(views.SecureAPIRequest.as_view()),
|
||||
name="api_secure"),
|
||||
path('api/<str:model>/<int:pk>/', not_estates()(views.SecureAPIRequest.as_view()),
|
||||
path('api/<str:model>/<int:pk>/', login_required(views.SecureAPIRequest.as_view()),
|
||||
name="api_secure"),
|
||||
|
||||
path('closemodal/', views.CloseModal.as_view(), name='closemodal'),
|
||||
path('search/', not_estates()(views.Search.as_view()), name='search'),
|
||||
path('search_help/', not_estates()(views.SearchHelp.as_view()), name='search_help'),
|
||||
path('search/', login_required(views.Search.as_view()), name='search'),
|
||||
path('search_help/', login_required(views.SearchHelp.as_view()), name='search_help'),
|
||||
|
||||
path('', include('users.urls')),
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import simplejson
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.core import serializers
|
||||
from django.utils import timezone
|
||||
from django.utils.html import format_html
|
||||
from reversion import revisions as reversion
|
||||
|
||||
from RIGS import models
|
||||
@@ -97,6 +98,9 @@ class EventForm(forms.ModelForm):
|
||||
raise forms.ValidationError(
|
||||
'You haven\'t provided any client contact details. Please add a person or organisation.',
|
||||
code='contact')
|
||||
access = self.cleaned_data.get("access_at")
|
||||
if 'warn-access' not in self.data and access is not None and access.date() < (self.cleaned_data.get("start_date") - timedelta(days=7)):
|
||||
raise forms.ValidationError(format_html("Are you sure about that? Your access time seems a bit optimistic. If you're sure, save again. <input type='hidden' id='warn-access' name='warn-access' value='0'/>"), code='access_sanity')
|
||||
return super().clean()
|
||||
|
||||
def save(self, commit=True):
|
||||
|
||||
@@ -254,7 +254,7 @@ class Command(BaseCommand):
|
||||
new_invoice.void = True
|
||||
elif random.randint(0, 2) > 1: # 1 in 3 have been paid
|
||||
models.Payment.objects.create(invoice=new_invoice, amount=new_invoice.balance,
|
||||
date=datetime.date.today())
|
||||
date=datetime.date.today(), method=random.choice(models.Payment.METHODS)[0])
|
||||
if i == 1 or random.randint(0, 5) > 0: # Event 1 and 1 in 5 have a RA
|
||||
models.RiskAssessment.objects.create(event=new_event, supervisor_consulted=bool(random.getrandbits(1)),
|
||||
nonstandard_equipment=bool(random.getrandbits(1)),
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Generated by Django 3.2.21 on 2023-09-05 22:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('RIGS', '0051_alter_payment_method'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='venue',
|
||||
name='on_campus',
|
||||
field=models.BooleanField(default=False, verbose_name='Is this venue on a UoN campus?'),
|
||||
),
|
||||
]
|
||||
@@ -77,7 +77,7 @@ class Profile(AbstractUser):
|
||||
@classmethod
|
||||
def users_awaiting_approval_count(cls):
|
||||
# last_login = None ensures we only pick up genuinely new users, not those that have been deactivated for inactivity
|
||||
return Profile.objects.filter(is_approved=False, last_login=None).count()
|
||||
return Profile.objects.filter(is_approved=False, last_login=None, date_joined_date=timezone.now().date()).count()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@@ -213,7 +213,6 @@ class Venue(models.Model, RevisionMixin):
|
||||
phone = models.CharField(max_length=15, blank=True, default='')
|
||||
email = models.EmailField(blank=True, default='')
|
||||
three_phase_available = models.BooleanField(default=False)
|
||||
on_campus = models.BooleanField(default=False, verbose_name="Is this venue on a UoN campus?")
|
||||
notes = models.TextField(blank=True, default='')
|
||||
address = models.TextField(blank=True, default='')
|
||||
|
||||
@@ -944,6 +943,10 @@ class PowerTestRecord(ReviewableModel, RevisionMixin):
|
||||
def activity_feed_string(self):
|
||||
return str(self.event)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return f"Power Test Record - {self.event}"
|
||||
|
||||
|
||||
class EventCheckIn(models.Model):
|
||||
event = models.ForeignKey('Event', related_name='crew', on_delete=models.CASCADE)
|
||||
|
||||
@@ -3,6 +3,7 @@ import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from io import BytesIO
|
||||
import datetime
|
||||
|
||||
from PyPDF2 import PdfFileReader, PdfFileMerger
|
||||
from django.conf import settings
|
||||
@@ -110,7 +111,7 @@ def send_admin_awaiting_approval_email(user, request, **kwargs):
|
||||
if admin.last_emailed is None or admin.last_emailed + settings.EMAIL_COOLDOWN <= timezone.now():
|
||||
context = {
|
||||
'request': request,
|
||||
'link_suffix': reverse("admin:RIGS_profile_changelist") + '?is_approved__exact=0',
|
||||
'link_suffix': reverse("admin:RIGS_profile_changelist") + f'?is_approved__exact=0&date_joined__date={timezone.now().date()}',
|
||||
'number_of_users': models.Profile.users_awaiting_approval_count(),
|
||||
'to_name': admin.first_name
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
<paraStyle name="center" alignment="center"/>
|
||||
<paraStyle name="page-head" alignment="center" fontName="OpenSans-Bold" fontSize="16" leading="18" spaceAfter="0"/>
|
||||
|
||||
{% block extrastyles %}
|
||||
{% endblock %}
|
||||
|
||||
<paraStyle name="style.event_description" fontName="OpenSans" textColor="DarkGray" />
|
||||
<paraStyle name="style.item_description" fontName="OpenSans" textColor="DarkGray" leftIndent="10" />
|
||||
<paraStyle name="style.specific_description" fontName="OpenSans" textColor="DarkGray" fontSize="10" />
|
||||
@@ -137,6 +140,7 @@
|
||||
<nextFrame/>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
<namedString id="lastPage"><pageNumber/></namedString>
|
||||
</story>
|
||||
|
||||
</document>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
Invoices <span class="badge {% if todo == 0 %}badge-success{% else %}badge-danger{% endif %} badge-pill">{{ todo }}</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownInvoices">
|
||||
<a class="dropdown-item" href="{% url 'invoice_dashboard' %}"><span class="fas fa-chart-line"></span> Dashboard</a>
|
||||
{% if perms.RIGS.add_invoice %}
|
||||
<a class="dropdown-item text-nowrap" href="{% url 'invoice_waiting' %}"><span class="fas fa-briefcase text-danger"></span> Waiting <span class="badge {% if waiting == 0 %}badge-success{% else %}badge-danger{% endif %} badge-pill">{{ waiting }}</span></a>
|
||||
{% endif %}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
|
||||
calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
firstDay: 1,
|
||||
themeSystem: 'bootstrap',
|
||||
aspectRatio: 1.5,
|
||||
eventTimeFormat: {
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{% extends 'base_client.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'estates/estates_event_table.html' %}
|
||||
{% endblock %}
|
||||
@@ -1,78 +0,0 @@
|
||||
{% load namewithnotes from filters %}
|
||||
{% load markdown_tags %}
|
||||
<div class="table-responsive">
|
||||
<table class="table mb-0" id="event_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Dates & Times</th>
|
||||
<th scope="col">Event Details</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Member In Charge</th>
|
||||
<th scope="col">Power Plan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for event in events %}
|
||||
<tr {% if event.cancelled %}style="opacity: 50% !important;"{% endif %} id="event_row">
|
||||
<!---Number-->
|
||||
<th scope="row" id="event_number">{{ event.display_id }}</th>
|
||||
<!--Dates & Times-->
|
||||
<td id="event_dates" style="text-align: justify;">
|
||||
<span class="text-nowrap">Start: <strong>{{ event.start_date|date:"D d/m/Y" }}
|
||||
{% if event.has_start_time %}
|
||||
{{ event.start_time|date:"H:i" }}
|
||||
{% endif %}</strong>
|
||||
</span>
|
||||
{% if event.end_date %}
|
||||
<br>
|
||||
<span class="text-nowrap">End: {% if event.end_date != event.start_date %}<strong>{{ event.end_date|date:"D d/m/Y" }}{% endif %}
|
||||
{% if event.has_end_time %}
|
||||
{{ event.end_time|date:"H:i" }}
|
||||
{% endif %}</strong>
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<!---Details-->
|
||||
<td id="event_details" class="w-100">
|
||||
<h4>
|
||||
{{ event.name }}
|
||||
{% if event.venue %}
|
||||
<small>at {{ event.venue }}</small>
|
||||
{% endif %}
|
||||
</h4>
|
||||
{% if event.is_rig and not event.cancelled %}
|
||||
<h5>
|
||||
{{ event.person.name }}
|
||||
{% if event.organisation %}
|
||||
for {{ event.organisation.name }}
|
||||
{% endif %}
|
||||
</h5>
|
||||
{% endif %}
|
||||
{% if not event.cancelled and event.description %}
|
||||
<p>{{ event.description|markdown }}</p>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ event.get_status_display }}
|
||||
</td>
|
||||
<!---MIC-->
|
||||
<td id="event_mic" class="text-nowrap">
|
||||
{% if event.mic %}
|
||||
{{ event.mic }}
|
||||
{% elif event.is_rig %}
|
||||
<span class="fas fa-user-slash"></span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ event.riskassessment.power_plan|default:"Pending" }}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr class="bg-warning">
|
||||
<td colspan="4">No events found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -46,7 +46,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="col-sm-12" style="container-type: inline-size;">
|
||||
{% with object_list as events %}
|
||||
{% include 'partials/event_table.html' %}
|
||||
{% endwith %}
|
||||
|
||||
@@ -165,6 +165,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-right">
|
||||
{% button 'print' 'pt_print' object.pk %}
|
||||
{% button 'edit' url='pt_edit' pk=object.pk %}
|
||||
{% button 'view' url='event_detail' pk=object.event.pk text="Event" %}
|
||||
{% include 'partials/review_status.html' with perm=perms.RIGS.review_power review='pt_review' %}
|
||||
|
||||
170
RIGS/templates/hs/power_print.xml
Normal file
170
RIGS/templates/hs/power_print.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
{% extends 'base_print.xml' %}
|
||||
{% load filters %}
|
||||
|
||||
{% block extrastyles %}
|
||||
<paraStyle name="style.powerReviewed" alignment="center" backColor="green" textColor="white"/>
|
||||
<paraStyle name="style.powerUnreviewed" alignment="center" backColor="red" textColor="white"/>
|
||||
|
||||
<blockTableStyle id="powerTable">
|
||||
<blockValign value="middle"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="black" thickness="1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="black" thickness="1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="black" thickness="1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="black" thickness="1"/>
|
||||
</blockTableStyle>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<spacer length="15"/>
|
||||
<h1>Power Test Record for <strong>{{ object.event }}</strong></h1>
|
||||
<spacer length="15"/>
|
||||
<h2>Client: {{ object.event.person|default:object.event.organisation }} | Venue: {{ object.event.venue }} | MIC: {{ object.event.mic }}</h2>
|
||||
<spacer length="15"/>
|
||||
<hr/>
|
||||
<spacer length="15"/>
|
||||
{% if object.reviewed_by %}
|
||||
<para style="style.powerReviewed"><strong>Reviewed by: {{ object.reviewed_by }} at {{ object.reviewed_at|date:"D d/m/Y" }}</strong></para>
|
||||
{% else %}
|
||||
<para style="style.powerUnreviewed"><strong>Power test results not yet reviewed</strong></para>
|
||||
{% endif %}
|
||||
<spacer length="15"/>
|
||||
<hr/>
|
||||
<spacer length="15"/>
|
||||
|
||||
<h2 fontSize="16">Power Plan Information</h2>
|
||||
<spacer length="15"/>
|
||||
|
||||
<blockTable colWidths="250,250">
|
||||
<tr>
|
||||
<td><para><strong>Power MIC:</strong> {{ object.power_mic }}</para></td>
|
||||
<td><para><strong>Venue:</strong> {{ object.event.venue }}</para></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para><strong>Event Date:</strong> {{ object.event.start_date |date:"D d/m/Y" }}</para></td>
|
||||
<td><para><strong>Generators:</strong> {{ object.event.riskassessment.generators|yesno|capfirst }}</para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para><strong>Power Test taken at:</strong> {{ object.date_created|date:"D d/m/Y H:i" }}</para></td>
|
||||
<td><para><strong>Other Companies Power:</strong> {{ object.event.riskassessment.other_companies_power|yesno|capfirst }}</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<spacer length="15"/>
|
||||
<hr/>
|
||||
<spacer length="15"/>
|
||||
|
||||
<condPageBreak height="10in"/>
|
||||
|
||||
<h2 fontSize="16">Power Test Results</h2>
|
||||
<spacer length="15"/>
|
||||
|
||||
<para><strong>Source RCD protected?</strong> {{ object.source_rcd|yesno|capfirst }}</para>
|
||||
<para><sub>(If cable is more than 3 metres long)</sub></para>
|
||||
|
||||
<spacer length="5"/>
|
||||
|
||||
<para><strong>Appropriate and clear labelling on distribution and cabling?</strong> {{ object.labelling|yesno|capfirst }}</para>
|
||||
|
||||
<spacer length="5"/>
|
||||
|
||||
<para><strong>Equipment appropriately earthed?</strong> {{ object.source_rcd|yesno|capfirst }}</para>
|
||||
<para><sub>(truss, stage, generators etc.)</sub></para>
|
||||
|
||||
<spacer length="5"/>
|
||||
|
||||
<para><strong>All equipment in PAT period?</strong> {{ object.pat|yesno|capfirst }}</para>
|
||||
|
||||
<spacer length="15"/>
|
||||
|
||||
<h2 fontSize="14">Tests at first distro</h2>
|
||||
<spacer length="5"/>
|
||||
|
||||
<blockTable colWidths="100,410">
|
||||
<tr>
|
||||
<td><para><strong>Voltage<br/><sub>(cube meter) / V</sub></strong></para></td>
|
||||
<td>
|
||||
<blockTable colWidths="100,100,100" style="powerTable">
|
||||
<tr>
|
||||
<td><para><strong>L1 - N</strong></para></td>
|
||||
<td><para><strong>L2 - N</strong></para></td>
|
||||
<td><para><strong>L3 - N</strong></para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ object.fd_voltage_l1}}</td>
|
||||
<td>{{ object.fd_voltage_l2}}</td>
|
||||
<td>{{ object.fd_voltage_l3}}</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<spacer length="15"/>
|
||||
|
||||
<blockTable colWidths="100,100,190,120">
|
||||
<tr>
|
||||
<td><para><strong>Phase Rotation<br/><sub>(if required)</sub></strong></para></td>
|
||||
<td><para>{{ object.fd_phase_rotation|yesno|capfirst }}</para></td>
|
||||
<td><para><strong>Earth Fault Loop Impedance (Z<sub>s</sub>) / Ω</strong></para></td>
|
||||
<td><para>{{ object.fd_earth_fault }}</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<spacer length="15"/>
|
||||
|
||||
<para><strong>Prospective Short Circuit Current / A</strong> {{ object.fd_pssc }}</para>
|
||||
|
||||
<spacer length="15"/>
|
||||
|
||||
<h2 fontSize="14">Tests 'Worst Case' points (at least 1 required)</h2>
|
||||
<spacer length="15"/>
|
||||
|
||||
<blockTable colWidths="100,100,190,120" style="powerTable">
|
||||
<tr>
|
||||
<td><para><strong>Description</strong></para></td>
|
||||
<td><para><strong>Polarity checked?</strong></para></td>
|
||||
<td><para><strong>Voltage / V</strong></para></td>
|
||||
<td><para><strong>Earth Fault Loop Impedance (Z<sub>s</sub>) / Ω</strong></para></td>
|
||||
</tr>
|
||||
{% if object.w1_description %}
|
||||
<tr>
|
||||
<td><para><strong>{{ object.w1_description }}</strong></para></td>
|
||||
<td><para>{{ object.w1_polarity|yesno|capfirst }}</para></td>
|
||||
<td><para>{{ object.w1_voltage }} V</para></td>
|
||||
<td><para>{{ object.w1_earth_fault }}</para></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if object.w2_description %}
|
||||
<tr>
|
||||
<td><para><strong>{{ object.w2_description }}</strong></para></td>
|
||||
<td><para>{{ object.w2_polarity|yesno|capfirst }}</para></td>
|
||||
<td><para>{{ object.w2_voltage }} V</para></td>
|
||||
<td><para>{{ object.w2_earth_fault }}</para></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if object.w3_description %}
|
||||
<tr>
|
||||
<td><para><strong>{{ object.w3_description }}</strong></para></td>
|
||||
<td><para>{{ object.w3_polarity|yesno|capfirst }}</para></td>
|
||||
<td><para>{{ object.w3_voltage }} V</para></td>
|
||||
<td><para>{{ object.w3_earth_fault }}</para></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</blockTable>
|
||||
|
||||
<spacer length="15"/>
|
||||
<h2 fontSize="14">Generic Tests</h2>
|
||||
<spacer length="15"/>
|
||||
|
||||
<blockTable colWidths="250,270" style="powerTable">
|
||||
<tr>
|
||||
<td><para><strong>All circuit RCDs tested?</strong><br/>(using test button)</para></td>
|
||||
<td><para>{{ object.all_rcds_tested|yesno|capfirst }}</para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para><strong>Public/performer accessible circuits tested?</strong><br/>(using socket tester)</para></td>
|
||||
<td><para>{{ object.public_sockets_tested|yesno|capfirst }}</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
{% endblock %}
|
||||
105
RIGS/templates/invoice_dashboard.html
Normal file
105
RIGS/templates/invoice_dashboard.html
Normal file
@@ -0,0 +1,105 @@
|
||||
{% extends 'base_rigs.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form method="GET" action="{% url 'invoice_dashboard' %}">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="time_filter">Time Filter</label>
|
||||
<select id="time_filter" name="time_filter" class="form-control">
|
||||
<option value="week" {% if time_filter == 'week' %}selected{% endif %}>Last Week (7 days)</option>
|
||||
<option value="month" {% if time_filter == 'month' %}selected{% endif %}>Last Month (30 days)</option>
|
||||
<option value="year" {% if time_filter == 'year' %}selected{% endif %}>Last Year</option>
|
||||
<option value="all" {% if time_filter == 'all' %}selected{% endif %}>All Time</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#time_filter').change(function () {
|
||||
$(this).closest('form').submit();
|
||||
});
|
||||
</script>
|
||||
|
||||
<h3>Overview</h3>
|
||||
|
||||
<!-- big cards in 2x2 grid with total_outstanding, total_events, total_invoices and total_payments, different backgrounds -->
|
||||
|
||||
<div class="card-deck">
|
||||
<div class="card">
|
||||
<a href="{% url 'invoice_waiting' %}" class="text-decoration-none text-white">
|
||||
<div class="card-body bg-primary">
|
||||
<h5 class="card-title text-center">Total Waiting</h5>
|
||||
<p class="card-text text-center h3"><strong>£{{ total_waiting|floatformat:2 }}</strong></p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="card">
|
||||
<a href="{% url 'invoice_list' %}" class="text-decoration-none text-dark">
|
||||
<div class="card-body bg-info">
|
||||
<h5 class="card-title text-center">Total Outstanding</h5>
|
||||
<p class="card-text text-center h3"><strong>£{{ total_outstanding|floatformat:2 }}</strong></p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body bg-danger">
|
||||
<h5 class="card-title text-center">Total Events</h5>
|
||||
<p class="card-text text-center h3"><strong>{{ total_events }}</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body bg-success">
|
||||
<h5 class="card-title text-center">Total Invoices</h5>
|
||||
<p class="card-text text-center h3"><strong>{{ total_invoices }}</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
<h3>Payments</h3>
|
||||
|
||||
<br/>
|
||||
|
||||
<h4>Sources</h4>
|
||||
|
||||
<br/>
|
||||
|
||||
{% for source in payment_methods %}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><strong>{{ source.method }}</strong></h5>
|
||||
<p class="card-text h3">£{{ source.total|floatformat:2 }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<br/>
|
||||
|
||||
<h4>Total</h4>
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-center">Total Income</h5>
|
||||
<p class="card-text text-center h3"><strong>£{{ total_income|floatformat:2 }}</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<h4>Invoice Payment Time</h4>
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-center">Average Time to Pay</h5>
|
||||
<p class="card-text text-center h3"><strong>{{ mean_invoice_to_payment|floatformat:2 }} days</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -31,7 +31,7 @@
|
||||
{% for event in object_list %}
|
||||
<tr class="{{event.status_color}}">
|
||||
<th scope="row"><a href="{% url 'event_detail' event.pk %}">{{ event.display_id }}</a><br>
|
||||
<span class="text-muted">{{ event.get_status_display }}</span></th>
|
||||
<span class="{% if event.get_status_display == 'Cancelled' %}text-danger{% endif %}">{{ event.get_status_display }}</span></th>
|
||||
<td>{{ event.start_date }}</td>
|
||||
<td>
|
||||
{{ event.name }}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h5 class="py-3"><a class="btn btn-info" data-toggle="collapse" href="#values" aria-expanded="false" aria-controls="values">View Threshold Values</a></h5>
|
||||
<div class="row collapse" id="values">
|
||||
<div class="table-responsive">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -33,17 +33,20 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="row">Distro</th>
|
||||
<th scope="row">Max PSSC (kA)</th>
|
||||
<th scope="row">Max PSCC with Single Phase Supply (kA)</th>
|
||||
<th scope="row">Max PSCC with Three Phase Supply (kA)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Intel & Toblerone distros</td>
|
||||
<td>6</td>
|
||||
<td>3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>All other distros</td>
|
||||
<td>10</td>
|
||||
<td>5</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div>
|
||||
<div id="event_status">
|
||||
<span class="badge badge-{% if event.confirmed %}success{% elif event.cancelled %}dark{% else %}warning{% endif %}">Status: {{ event.get_status_display }}</span>
|
||||
{% if event.is_rig %}
|
||||
{% if event.sum_total > 0 %}
|
||||
|
||||
@@ -1,105 +1,195 @@
|
||||
{% load namewithnotes from filters %}
|
||||
{% load markdown_tags %}
|
||||
<div class="table-responsive">
|
||||
<table class="table mb-0" id="event_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Dates & Times</th>
|
||||
<th scope="col">Event Details</th>
|
||||
<th scope="col">MIC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for event in events %}
|
||||
<tr class="{% 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-->
|
||||
<th scope="row" id="event_number">{{ event.display_id }}</th>
|
||||
<!--Dates & Times-->
|
||||
<td id="event_dates" style="text-align: justify;">
|
||||
{% if not event.cancelled %}
|
||||
{% if event.meet_at %}
|
||||
<span class="text-nowrap">Meet: <strong>{{ event.meet_at|date:"D d/m/Y H:i" }}</strong></span>
|
||||
{% endif %}
|
||||
{% if event.access_at %}
|
||||
<br><span class="text-nowrap">Access: <strong>{{ event.access_at|date:"D d/m/Y H:i" }}</strong></span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<span class="text-nowrap">Start: <strong>{{ event.start_date|date:"D d/m/Y" }}
|
||||
{% if event.has_start_time %}
|
||||
{{ event.start_time|date:"H:i" }}
|
||||
{% endif %}</strong>
|
||||
</span>
|
||||
{% if event.end_date %}
|
||||
<br>
|
||||
<span class="text-nowrap">End: {% if event.end_date != event.start_date %}<strong>{{ event.end_date|date:"D d/m/Y" }}{% endif %}
|
||||
{% if event.has_end_time %}
|
||||
{{ event.end_time|date:"H:i" }}
|
||||
{% endif %}</strong>
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<!---Details-->
|
||||
<td id="event_details" class="w-100">
|
||||
<h4>
|
||||
<a href="{% url 'event_detail' event.pk %}">
|
||||
{{ event.name }}
|
||||
</a>
|
||||
{% if event.venue %}
|
||||
<small>at {{ event.venue|namewithnotes:'venue_detail' }}</small>
|
||||
{% endif %}
|
||||
{% if event.dry_hire %}
|
||||
<span class="badge badge-secondary">Dry Hire</span>
|
||||
{% 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 %}
|
||||
{% include 'partials/event_status.html' %}
|
||||
</td>
|
||||
<!---MIC-->
|
||||
<td id="event_mic" class="text-nowrap">
|
||||
{% 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-user-slash"></span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr class="bg-warning">
|
||||
<td colspan="4">No events found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<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>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row align-items-center justify-content-between py-2 align-middle">
|
||||
<div class="col-sm-12 col-md align-middle">
|
||||
Key: <span class="table-success mr-1 px-2 rounded">Ready</span><span class="table-warning mr-1 px-2 rounded">Action Required</span><span class="table-danger mr-1 px-2 rounded">Needs MIC</span><span class="table-secondary mr-1 px-2 rounded">Cancelled</span><span class="table-info px-2 rounded">Non-Rig</span>
|
||||
<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>
|
||||
</div>
|
||||
{% if perms.RIGS.add_event %}
|
||||
<div class="col text-right">
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div style="container-type: inline-size;">
|
||||
{% include 'partials/event_table.html' %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -127,7 +127,7 @@ class TestEventCreate(BaseRigboardTest):
|
||||
|
||||
# Fix it
|
||||
self.page.end_date = datetime.date(2020, 1, 11)
|
||||
self.page.access_at = datetime.datetime(2020, 1, 1, 9)
|
||||
self.page.access_at = datetime.datetime(2020, 1, 8, 9)
|
||||
self.page.dry_hire = True
|
||||
self.page.status = "Booked"
|
||||
self.page.collected_by = "Fred"
|
||||
|
||||
31
RIGS/urls.py
31
RIGS/urls.py
@@ -4,7 +4,7 @@ from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from PyRIGS.decorators import (api_key_required, has_oembed,
|
||||
permission_required_with_403, not_estates)
|
||||
permission_required_with_403)
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
@@ -42,22 +42,21 @@ urlpatterns = [
|
||||
name='venue_update'),
|
||||
|
||||
# Rigboard
|
||||
path('rigboard/', not_estates()(views.RigboardIndex.as_view()), name='rigboard'),
|
||||
path('rigboard/calendar/', not_estates()(views.WebCalendar.as_view()),
|
||||
path('rigboard/', login_required(views.RigboardIndex.as_view()), name='rigboard'),
|
||||
path('rigboard/calendar/', login_required()(views.WebCalendar.as_view()),
|
||||
name='web_calendar'),
|
||||
re_path(r'^rigboard/calendar/(?P<view>(month|week|day))/$',
|
||||
not_estates()(views.WebCalendar.as_view()), name='web_calendar'),
|
||||
login_required()(views.WebCalendar.as_view()), name='web_calendar'),
|
||||
re_path(r'^rigboard/calendar/(?P<view>(month|week|day))/(?P<date>(\d{4}-\d{2}-\d{2}))/$',
|
||||
not_estates()(views.WebCalendar.as_view()), name='web_calendar'),
|
||||
login_required()(views.WebCalendar.as_view()), name='web_calendar'),
|
||||
path('rigboard/archive/', RedirectView.as_view(permanent=True, pattern_name='event_archive')),
|
||||
|
||||
path('estates/', login_required()(views.EstatesEventList.as_view()), name='estates'),
|
||||
|
||||
path('event/<int:pk>/', has_oembed(oembed_view="event_oembed")(views.EventDetail.as_view()),
|
||||
name='event_detail'),
|
||||
path('event/create/', permission_required_with_403('RIGS.add_event')(views.EventCreate.as_view()),
|
||||
name='event_create'),
|
||||
path('event/archive/', not_estates()(views.EventArchive.as_view()),
|
||||
path('event/archive/', login_required()(views.EventArchive.as_view()),
|
||||
name='event_archive'),
|
||||
path('event/<int:pk>/embed/',
|
||||
xframe_options_exempt(login_required(login_url='/user/login/embed/')(views.EventEmbed.as_view())),
|
||||
@@ -76,7 +75,7 @@ urlpatterns = [
|
||||
|
||||
path('event/<int:pk>/ra/', permission_required_with_403('RIGS.add_riskassessment')(views.EventRiskAssessmentCreate.as_view()),
|
||||
name='event_ra'),
|
||||
path('event/ra/<int:pk>/', not_estates()(views.EventRiskAssessmentDetail.as_view()),
|
||||
path('event/ra/<int:pk>/', login_required(views.EventRiskAssessmentDetail.as_view()),
|
||||
name='ra_detail'),
|
||||
path('event/ra/<int:pk>/edit/', permission_required_with_403('RIGS.change_riskassessment')(views.EventRiskAssessmentEdit.as_view()),
|
||||
name='ra_edit'),
|
||||
@@ -86,7 +85,7 @@ urlpatterns = [
|
||||
|
||||
path('event/<int:pk>/checklist/', permission_required_with_403('RIGS.add_eventchecklist')(views.EventChecklistCreate.as_view()),
|
||||
name='event_ec'),
|
||||
path('event/checklist/<int:pk>/', not_estates()(views.EventChecklistDetail.as_view()),
|
||||
path('event/checklist/<int:pk>/', login_required(views.EventChecklistDetail.as_view()),
|
||||
name='ec_detail'),
|
||||
path('event/checklist/<int:pk>/edit/', permission_required_with_403('RIGS.change_eventchecklist')(views.EventChecklistEdit.as_view()),
|
||||
name='ec_edit'),
|
||||
@@ -95,27 +94,29 @@ urlpatterns = [
|
||||
|
||||
path('event/<int:pk>/power/', permission_required_with_403('RIGS.add_powertestrecord')(views.PowerTestCreate.as_view()),
|
||||
name='event_pt'),
|
||||
path('event/power/<int:pk>/', not_estates()(views.PowerTestDetail.as_view()),
|
||||
path('event/power/<int:pk>/', login_required(views.PowerTestDetail.as_view()),
|
||||
name='pt_detail'),
|
||||
path('event/power/<int:pk>/edit/', permission_required_with_403('RIGS.change_powertestrecord')(views.PowerTestEdit.as_view()),
|
||||
name='pt_edit'),
|
||||
path('event/power/<int:pk>/review/', permission_required_with_403('RIGS.review_power')(views.MarkReviewed.as_view()),
|
||||
name='pt_review', kwargs={'model': 'PowerTestRecord'}),
|
||||
path('event/power/<int:pk>/print/', permission_required_with_403('RIGS.view_powertestrecord')(views.PowerPrint.as_view()), name='pt_print'),
|
||||
|
||||
path('event/<int:pk>/checkin/', not_estates()(views.EventCheckIn.as_view()),
|
||||
path('event/<int:pk>/checkin/', login_required(views.EventCheckIn.as_view()),
|
||||
name='event_checkin'),
|
||||
path('event/checkout/', not_estates()(views.EventCheckOut.as_view()),
|
||||
path('event/checkout/', login_required(views.EventCheckOut.as_view()),
|
||||
name='event_checkout'),
|
||||
path('event/<int:pk>/checkin/edit/', not_estates()(views.EventCheckInEdit.as_view()),
|
||||
path('event/<int:pk>/checkin/edit/', login_required(views.EventCheckInEdit.as_view()),
|
||||
name='edit_checkin'),
|
||||
path('event/<int:pk>/checkin/add/', not_estates()(views.EventCheckInOverride.as_view()),
|
||||
path('event/<int:pk>/checkin/add/', login_required(views.EventCheckInOverride.as_view()),
|
||||
name='event_checkin_override'),
|
||||
|
||||
path('event/<int:pk>/thread/', permission_required_with_403('RIGS.change_event')(views.CreateForumThread.as_view()), name='event_thread'),
|
||||
path('event/webhook/', views.RecieveForumWebhook.as_view(), name='webhook_recieve'),
|
||||
|
||||
# Finance
|
||||
path('invoice/', permission_required_with_403('RIGS.view_invoice')(views.InvoiceIndex.as_view()),
|
||||
path('invoice/', permission_required_with_403('RIGS.view_invoice')(views.InvoiceDashboard.as_view()), name='invoice_dashboard'),
|
||||
path('invoice/outstanding', permission_required_with_403('RIGS.view_invoice')(views.InvoiceOutstanding.as_view()),
|
||||
name='invoice_list'),
|
||||
path('invoice/archive/', permission_required_with_403('RIGS.view_invoice')(views.InvoiceArchive.as_view()),
|
||||
name='invoice_archive'),
|
||||
|
||||
@@ -115,7 +115,7 @@ class VenueDetail(GenericDetailView):
|
||||
|
||||
class VenueCreate(GenericCreateView, ModalURLMixin):
|
||||
model = models.Venue
|
||||
fields = ['name', 'phone', 'email', 'address', 'notes', 'three_phase_available', 'on_campus']
|
||||
fields = ['name', 'phone', 'email', 'address', 'notes', 'three_phase_available']
|
||||
|
||||
def get_success_url(self):
|
||||
return self.get_close_url('venue_update', 'venue_detail')
|
||||
@@ -123,7 +123,7 @@ class VenueCreate(GenericCreateView, ModalURLMixin):
|
||||
|
||||
class VenueUpdate(GenericUpdateView, ModalURLMixin):
|
||||
model = models.Venue
|
||||
fields = ['name', 'phone', 'email', 'address', 'notes', 'three_phase_available', 'on_campus']
|
||||
fields = ['name', 'phone', 'email', 'address', 'notes', 'three_phase_available']
|
||||
|
||||
def get_success_url(self):
|
||||
return self.get_close_url('venue_update', 'venue_detail')
|
||||
|
||||
@@ -5,7 +5,7 @@ import reversion
|
||||
from django import forms
|
||||
from django.contrib import messages
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
from django.db.models import Sum
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
@@ -18,8 +18,76 @@ from RIGS import models
|
||||
|
||||
forms.DateField.widget = forms.DateInput(attrs={'type': 'date'})
|
||||
|
||||
TIME_FILTERS = ["all", "year", "month", "week"]
|
||||
|
||||
class InvoiceIndex(generic.ListView):
|
||||
|
||||
def days_between(d1, d2):
|
||||
diff = d2 - d1
|
||||
return diff.total_seconds() / datetime.timedelta(days=1).total_seconds()
|
||||
|
||||
|
||||
class InvoiceDashboard(generic.TemplateView):
|
||||
template_name = 'invoice_dashboard.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = "Invoice Dashboard"
|
||||
context['description'] = "Overview of financial status of TEC rigs."
|
||||
|
||||
time_filter = self.request.GET.get('time_filter', 'all')
|
||||
|
||||
if time_filter not in TIME_FILTERS:
|
||||
time_filter = 'all'
|
||||
|
||||
if time_filter == 'all':
|
||||
context['events'] = models.Event.objects.all()
|
||||
context['invoices'] = models.Invoice.objects.all()
|
||||
context['payments'] = models.Payment.objects.all()
|
||||
elif time_filter == 'year':
|
||||
context['events'] = models.Event.objects.filter(start_date__gte=datetime.date.today() - datetime.timedelta(days=365))
|
||||
context['invoices'] = models.Invoice.objects.filter(invoice_date__gte=datetime.date.today() - datetime.timedelta(days=365))
|
||||
context['payments'] = models.Payment.objects.filter(date__gte=datetime.date.today() - datetime.timedelta(days=365))
|
||||
elif time_filter == 'month':
|
||||
context['events'] = models.Event.objects.filter(start_date__gte=datetime.date.today() - datetime.timedelta(days=30))
|
||||
context['invoices'] = models.Invoice.objects.filter(invoice_date__gte=datetime.date.today() - datetime.timedelta(days=30))
|
||||
context['payments'] = models.Payment.objects.filter(date__gte=datetime.date.today() - datetime.timedelta(days=30))
|
||||
elif time_filter == 'week':
|
||||
context['events'] = models.Event.objects.filter(start_date__gte=datetime.date.today() - datetime.timedelta(days=7))
|
||||
context['invoices'] = models.Invoice.objects.filter(invoice_date__gte=datetime.date.today() - datetime.timedelta(days=7))
|
||||
context['payments'] = models.Payment.objects.filter(date__gte=datetime.date.today() - datetime.timedelta(days=7))
|
||||
|
||||
context["time_filter"] = time_filter
|
||||
|
||||
context['total_outstanding'] = sum([i.balance for i in models.Invoice.objects.outstanding_invoices()])
|
||||
context['total_waiting'] = sum([i.sum_total for i in models.Event.objects.waiting_invoices()])
|
||||
context['total_events'] = len(context['events'])
|
||||
context['total_invoices'] = len(context['invoices'])
|
||||
context['total_payments'] = len(context['payments'])
|
||||
|
||||
payment_methods = dict(models.Payment.METHODS)
|
||||
|
||||
context['payment_methods'] = context["payments"].values('method').annotate(total=Sum('amount')).order_by('method')
|
||||
|
||||
for method in context['payment_methods']:
|
||||
method['method'] = payment_methods.get(method['method'], f"Unknown method ({method['method']})")
|
||||
|
||||
context["total_income"] = sum([i['total'] for i in context['payment_methods']])
|
||||
|
||||
payments = context['payments']
|
||||
mean_duration = 0
|
||||
|
||||
for payment in payments:
|
||||
mean_duration += days_between(payment.invoice.invoice_date, payment.date)
|
||||
|
||||
if len(payments) > 0:
|
||||
mean_duration /= len(payments)
|
||||
|
||||
context['mean_invoice_to_payment'] = mean_duration
|
||||
|
||||
return context
|
||||
|
||||
|
||||
class InvoiceOutstanding(generic.ListView):
|
||||
model = models.Invoice
|
||||
template_name = 'invoice_list.html'
|
||||
|
||||
|
||||
@@ -232,6 +232,16 @@ class RAPrint(PrintView):
|
||||
return context
|
||||
|
||||
|
||||
class PowerPrint(PrintView):
|
||||
model = models.PowerTestRecord
|
||||
template_name = 'hs/power_print.xml'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['filename'] = f"PowerTestRecord_for_{context['object'].event.display_id}.pdf"
|
||||
return context
|
||||
|
||||
|
||||
class EventCheckIn(generic.CreateView, ModalURLMixin):
|
||||
model = models.EventCheckIn
|
||||
template_name = 'hs/eventcheckin_form.html'
|
||||
|
||||
@@ -26,7 +26,6 @@ from django.utils import timezone
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import generic
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
|
||||
from PyRIGS import decorators
|
||||
from PyRIGS.views import OEmbedView, is_ajax, ModalURLMixin, PrintView, get_related
|
||||
@@ -423,17 +422,3 @@ class RecieveForumWebhook(generic.View):
|
||||
event.save()
|
||||
return HttpResponse(status=202)
|
||||
return HttpResponse(status=204)
|
||||
|
||||
class EstatesEventList(UserPassesTestMixin, generic.TemplateView):
|
||||
template_name = 'estates/estates_event_list.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
# get super context
|
||||
context = super().get_context_data(**kwargs)
|
||||
# call out method to get current events
|
||||
context['events'] = models.Event.objects.current_events().filter(venue__on_campus=True, dry_hire=False, is_rig=True)
|
||||
context['page_title'] = "Upcoming Campus Events"
|
||||
return context
|
||||
|
||||
def test_func(self):
|
||||
return self.request.user.email.endswith('@nottingham.ac.uk')
|
||||
4
app.json
4
app.json
@@ -4,7 +4,7 @@
|
||||
"scripts": {
|
||||
"postdeploy": "python manage.py migrate && python manage.py generateSampleData"
|
||||
},
|
||||
"stack": "heroku-20",
|
||||
"stack": "heroku-22",
|
||||
"env": {
|
||||
"DEBUG": {
|
||||
"required": true
|
||||
@@ -51,7 +51,7 @@
|
||||
"url": "heroku/nodejs"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nottinghamtec/heroku-buildpack-python"
|
||||
"url": "heroku/python"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.urls import path, register_converter
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
|
||||
from PyRIGS.decorators import has_oembed, permission_required_with_403, not_estates
|
||||
from PyRIGS.decorators import has_oembed, permission_required_with_403
|
||||
from PyRIGS.views import OEmbedView
|
||||
from . import views, converters
|
||||
|
||||
@@ -10,8 +10,8 @@ register_converter(converters.AssetIDConverter, 'asset')
|
||||
register_converter(converters.ListConverter, 'list')
|
||||
|
||||
urlpatterns = [
|
||||
path('', not_estates()(views.AssetList.as_view()), name='asset_index'),
|
||||
path('asset/list/', not_estates()(views.AssetList.as_view()), name='asset_list'),
|
||||
path('', login_required(views.AssetList.as_view()), name='asset_index'),
|
||||
path('asset/list/', login_required(views.AssetList.as_view()), name='asset_list'),
|
||||
path('asset/id/<asset:pk>/', has_oembed(oembed_view="asset_oembed")(views.AssetDetail.as_view()), name='asset_detail'),
|
||||
path('asset/create/', permission_required_with_403('assets.add_asset')
|
||||
(views.AssetCreate.as_view()), name='asset_create'),
|
||||
@@ -19,26 +19,26 @@ urlpatterns = [
|
||||
(views.AssetEdit.as_view()), name='asset_update'),
|
||||
path('asset/id/<asset:pk>/duplicate/', permission_required_with_403('assets.add_asset')
|
||||
(views.AssetDuplicate.as_view()), name='asset_duplicate'),
|
||||
path('asset/id/<asset:pk>/label', not_estates()(views.GenerateLabel.as_view()), name='generate_label'),
|
||||
path('asset/id/<asset:pk>/label', login_required(views.GenerateLabel.as_view()), name='generate_label'),
|
||||
path('asset/<list:ids>/list/label', views.GenerateLabels.as_view(), name='generate_labels'),
|
||||
|
||||
path('cables/list/', not_estates()(views.CableList.as_view()), name='cable_list'),
|
||||
path('cabletype/list/', not_estates()(views.CableTypeList.as_view()), name='cable_type_list'),
|
||||
path('cables/list/', login_required(views.CableList.as_view()), name='cable_list'),
|
||||
path('cabletype/list/', login_required(views.CableTypeList.as_view()), name='cable_type_list'),
|
||||
path('cabletype/create/', permission_required_with_403('assets.add_cable_type')(views.CableTypeCreate.as_view()), name='cable_type_create'),
|
||||
path('cabletype/<int:pk>/update/', permission_required_with_403('assets.change_cable_type')(views.CableTypeUpdate.as_view()), name='cable_type_update'),
|
||||
path('cabletype/<int:pk>/detail/', not_estates()(views.CableTypeDetail.as_view()), name='cable_type_detail'),
|
||||
path('cabletype/<int:pk>/detail/', login_required(views.CableTypeDetail.as_view()), name='cable_type_detail'),
|
||||
|
||||
path('asset/id/<str:pk>/embed/',
|
||||
xframe_options_exempt(
|
||||
login_required(login_url='/user/login/embed/')(views.AssetEmbed.as_view())),
|
||||
login_required(login_url='/user/login/embed/')(views.AssetEmbed.as_view())),
|
||||
name='asset_embed'),
|
||||
path('asset/id/<str:pk>/oembed_json/', views.AssetOEmbed.as_view(), name='asset_oembed'),
|
||||
|
||||
path('asset/audit/', permission_required_with_403('assets.change_asset')(views.AssetAuditList.as_view()), name='asset_audit_list'),
|
||||
path('asset/id/<str:pk>/audit/', permission_required_with_403('assets.change_asset')(views.AssetAudit.as_view()), name='asset_audit'),
|
||||
|
||||
path('supplier/list/', not_estates()(views.SupplierList.as_view()), name='supplier_list'),
|
||||
path('supplier/<int:pk>/', not_estates()(views.SupplierDetail.as_view()), name='supplier_detail'),
|
||||
path('supplier/list/', login_required(views.SupplierList.as_view()), name='supplier_list'),
|
||||
path('supplier/<int:pk>/', login_required(views.SupplierDetail.as_view()), name='supplier_detail'),
|
||||
path('supplier/create/', permission_required_with_403('assets.add_supplier')
|
||||
(views.SupplierCreate.as_view()), name='supplier_create'),
|
||||
path('supplier/<int:pk>/edit/', permission_required_with_403('assets.change_supplier')
|
||||
|
||||
@@ -16,7 +16,7 @@ const con = require('gulp-concat');
|
||||
const gulpif = require('gulp-if');
|
||||
|
||||
function fonts(done) {
|
||||
return gulp.src('node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.*')
|
||||
return gulp.src('node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.*', { encoding: false })
|
||||
.pipe(gulp.dest('pipeline/built_assets/fonts'))
|
||||
.pipe(browsersync.stream());
|
||||
}
|
||||
@@ -70,16 +70,16 @@ function scripts() {
|
||||
.pipe(gulpif(function(file) { return interaction.includes(file.relative);}, con('interaction.js')))
|
||||
.pipe(gulpif(function(file) { return jpop.includes(file.relative);}, con('jpop.js')))
|
||||
.pipe(flatten())
|
||||
.pipe(terser())
|
||||
// Only minify if filename does not already denote it as minified
|
||||
.pipe(gulpif(function(file) { return file.path.indexOf("min") == -1;},terser()))
|
||||
.pipe(gulp.dest(dest))
|
||||
.pipe(browsersync.stream());
|
||||
}
|
||||
|
||||
function browserSync(done) {
|
||||
spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'});
|
||||
// TODO Wait for Django server to come up before browsersync, it seems inconsistent
|
||||
browsersync.init({
|
||||
notify: false,
|
||||
notify: true,
|
||||
open: false,
|
||||
port: 8001,
|
||||
proxy: '127.0.0.1:8000'
|
||||
|
||||
9240
package-lock.json
generated
9240
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,6 @@
|
||||
"cssnano": "^5.0.13",
|
||||
"easymde": "^2.16.1",
|
||||
"fullcalendar": "^5.10.1",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-flatten": "^0.4.0",
|
||||
"gulp-if": "^3.0.0",
|
||||
@@ -30,11 +29,12 @@
|
||||
"moment": "^2.29.4",
|
||||
"node-sass": "^9.0.0",
|
||||
"popper.js": "^1.16.1",
|
||||
"postcss": "^8.4.5",
|
||||
"postcss": "^8.4.31",
|
||||
"uglify-js": "^3.14.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.27.11"
|
||||
"browser-sync": "^3.0.2",
|
||||
"gulp": "^5.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"gulp": "gulp",
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
function changeSelectedValue(obj,pk,text,update_url) { //Pass in JQuery object and new parameters
|
||||
//console.log('Changing selected value');
|
||||
obj.find('option').remove(); //Remove all the available options
|
||||
obj.append( //Add the new option
|
||||
$("<option></option>")
|
||||
.attr("value",pk)
|
||||
.text(text)
|
||||
.data('update_url',update_url)
|
||||
);
|
||||
obj.selectpicker('render'); //Re-render the UI
|
||||
obj.selectpicker('refresh'); //Re-render the UI
|
||||
obj.selectpicker('val', pk); //Set the new value to be selected
|
||||
obj[0].add(new Option(text, pk, true, true)); // Add new option
|
||||
//obj.selectpicker('val', pk); //Set the new value to be selected
|
||||
obj.selectpicker('refresh');
|
||||
obj.change(); //Trigger the change function manually
|
||||
//console.log(obj);
|
||||
}
|
||||
|
||||
function refreshUpdateHref(obj) {
|
||||
|
||||
@@ -17,14 +17,12 @@ jQuery(document).ready(function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
var easter_egg = new Konami();
|
||||
easter_egg.code = function () {
|
||||
var easter_egg = new Konami(function () {
|
||||
var s = document.createElement('script');
|
||||
s.type = 'text/javascript';
|
||||
document.body.appendChild(s);
|
||||
s.src = '{% static "js/asteroids.min.js"%}';
|
||||
ga('send', 'event', 'easter_egg', 'activated');
|
||||
}
|
||||
s.src = '/static/js/asteroids.min.js';
|
||||
});
|
||||
easter_egg.load();
|
||||
});
|
||||
//CTRL-Enter form submission
|
||||
|
||||
@@ -9,3 +9,4 @@ $theme-colors: (
|
||||
"primary": #3A52A2
|
||||
) !default;
|
||||
$enable-shadows: true;
|
||||
$alert-color-level: 10;
|
||||
|
||||
@@ -77,17 +77,8 @@
|
||||
border-collapse: separate !important;
|
||||
border-spacing: 0;
|
||||
}
|
||||
#event_table tr th {
|
||||
border-right: 0 !important;
|
||||
}
|
||||
#event_table tr td {
|
||||
border-left: 0 !important;
|
||||
}
|
||||
#event_table tr td:not(:last-child) {
|
||||
border-right: 0 !important;
|
||||
}
|
||||
@each $color, $value in $theme-colors {
|
||||
.table-#{$color} {
|
||||
table.table-#{$color} {
|
||||
> td,th {
|
||||
border: 0.3em solid theme-color-level($color, -6) !important;
|
||||
}
|
||||
@@ -96,6 +87,11 @@
|
||||
background-color: #222 !important;
|
||||
}
|
||||
}
|
||||
#event_row.table-#{$color} {
|
||||
border: 0.3em solid theme-color-level($color, -6) !important;
|
||||
background-color: #222 !important;
|
||||
color: white !important;
|
||||
}
|
||||
}
|
||||
del {
|
||||
color: black;
|
||||
@@ -156,4 +152,7 @@
|
||||
.modal {
|
||||
overflow-y: auto !important; //Bootstrap Dark Theme overrides this to none for some insane reason so we need to change it back
|
||||
}
|
||||
.text-muted {
|
||||
color: #c9c9c9 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,3 +281,12 @@ html.embedded {
|
||||
.bootstrap-select, button.btn.dropdown-toggle.bs-placeholder.btn-light {
|
||||
padding-right: 1rem !important;
|
||||
}
|
||||
// New implementation of class dropped in Bootstrap 3
|
||||
.dl-horizontal {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.7rem 0;
|
||||
}
|
||||
.dl-horizontal > dd, .dl-horizontal .markdown > p {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
{% endif %}
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark" role="navigation">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" style="position: absolute; left:0.5em; top: 2px;" href="{% if request.user.is_authenticated %}https://rigs.nottinghamtec.co.uk{%else%}https://nottinghamtec.co.uk{%endif%}">
|
||||
<img src="{% static 'imgs/logo.webp' %}" width="40" height="40" alt="TEC's Logo: Serif 'TEC' vertically next to a blue box with the words 'PA and Lighting', surrounded by graduated rings" id="logo">
|
||||
<a class="navbar-brand" href="{% if request.user.is_authenticated %}https://rigs.nottinghamtec.co.uk{%else%}https://nottinghamtec.co.uk{%endif%}">
|
||||
<img src="{% static 'imgs/logo.webp' %}" class="mr-auto" style="max-height: 40px; position: absolute; left: 0.5em; top: 0;" alt="TEC's Logo: Serif 'TEC' vertically next to a blue box with the words 'PA and Lighting', surrounded by graduated rings" id="logo">
|
||||
</a>
|
||||
{% block titleheader %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{% extends override|default:"base_rigs.html" %}
|
||||
{% load widget_tweaks %}
|
||||
{% load button from filters %}
|
||||
{% load verbose_name from filters %}
|
||||
{% load markdown_tags %}
|
||||
|
||||
{% block content %}
|
||||
@@ -31,11 +30,6 @@
|
||||
<dd>{{ object.three_phase_available|yesno|capfirst }}</dd>
|
||||
{% endif%}
|
||||
|
||||
{% if object.on_campus is not None %}
|
||||
<dt>{{ object|verbose_name:"on_campus" }}</dt>
|
||||
<dd>{{ object.on_campus|yesno|capfirst }}</dd>
|
||||
{% endif%}
|
||||
|
||||
{% if object.union_account is not None %}
|
||||
<dt>Union Account</dt>
|
||||
<dd>{{ object.union_account|yesno|capfirst }}</dd>
|
||||
|
||||
@@ -78,20 +78,6 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if form.on_campus is not None %}
|
||||
<div class="form-group form-row">
|
||||
<div class="col-sm-10 col-sm-offset-2">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{% render_field form.on_campus %} {{ form.on_campus.label }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-danger">
|
||||
<span class="fas fa-exclamation"></span> Selecting this option will add <em>all</em> events at this venue to the calendar viewable by UoN Estates.
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if form.union_account is not None %}
|
||||
<div class="form-group form-row">
|
||||
<div class="col-sm-10 col-sm-offset-2">
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
<h1 class="col-sm-12 pb-3">R<small class="text-muted">ig</small> I<small class="text-muted">nformation</small> G<small class="text-muted">athering</small> S<small class="text-muted">ystem</small></h1>
|
||||
<h2 class="col-sm-12 pb-3">Welcome back {{ user.get_full_name }}, there {%if rig_count == 1 %}is one rig coming up{%else%}are {{ rig_count|apnumber }} rigs coming up.{%endif%}</h2>
|
||||
{% if now %}
|
||||
<div class="col-sm-12 alert alert-primary rounded-0 mx-auto">
|
||||
<div class="col-sm-12">
|
||||
{% for event in now %}
|
||||
Event {{ event }} is happening today! <a href="{% url 'event_checkin' event.pk %}" class="btn btn-success btn-sm modal-href align-baseline {% if request.user.current_event %}disabled{%endif%}"><span class="fas fa-user-clock"></span> <span class="d-none d-sm-inline">Check In</span></a><br/>
|
||||
<div class="alert alert-primary rounded-0">
|
||||
Event <a href="{% url 'event_detail' event.pk %}" class="text-danger">{{ event }}</a> is happening today! <a href="{% url 'event_checkin' event.pk %}" class="btn btn-success btn-sm modal-href align-baseline {% if request.user.current_event %}disabled{%endif%}"><span class="fas fa-user-clock"></span> <span class="d-none d-sm-inline">Check In</span></a><br/>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -78,6 +78,11 @@
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr><th colspan="3" class="text-center">{{object}}</th></tr>
|
||||
<tr>
|
||||
<td><ul class="list-unstyled">{% for req in object.started_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 0 %}</li>{% endfor %}</ul></td>
|
||||
<td><ul class="list-unstyled">{% for req in object.complete_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 1 %}</li>{% endfor %}</ul></td>
|
||||
<td><ul class="list-unstyled">{% for req in object.passed_out_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 2 %}</li>{% endfor %}</ul></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -1,34 +1,33 @@
|
||||
from django.urls import path
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from training.decorators import is_supervisor
|
||||
|
||||
from training import views, models
|
||||
from versioning.views import VersionHistory
|
||||
|
||||
from PyRIGS.decorators import not_estates
|
||||
|
||||
urlpatterns = [
|
||||
path('items/', not_estates()(views.ItemList.as_view()), name='item_list'),
|
||||
path('items/export/', not_estates()(views.ItemListExport.as_view()), name='item_list_export'),
|
||||
path('item/<int:pk>/qualified_users/', not_estates()(views.ItemQualifications.as_view()), name='item_qualification'),
|
||||
path('items/', login_required(views.ItemList.as_view()), name='item_list'),
|
||||
path('items/export/', login_required(views.ItemListExport.as_view()), name='item_list_export'),
|
||||
path('item/<int:pk>/qualified_users/', login_required(views.ItemQualifications.as_view()), name='item_qualification'),
|
||||
|
||||
path('trainee/list/', not_estates()(views.TraineeList.as_view()), name='trainee_list'),
|
||||
path('trainee/<int:pk>/', not_estates()(views.TraineeDetail.as_view()),
|
||||
path('trainee/list/', login_required(views.TraineeList.as_view()), name='trainee_list'),
|
||||
path('trainee/<int:pk>/', login_required(views.TraineeDetail.as_view()),
|
||||
name='trainee_detail'),
|
||||
path('trainee/<int:pk>/history', not_estates()(VersionHistory.as_view()), name='trainee_history', kwargs={'model': models.Trainee, 'app': 'training'}), # Not picked up automatically because proxy model (I think)
|
||||
path('trainee/<int:pk>/history', login_required(VersionHistory.as_view()), name='trainee_history', kwargs={'model': models.Trainee, 'app': 'training'}), # Not picked up automatically because proxy model (I think)
|
||||
path('trainee/<int:pk>/add_qualification/', is_supervisor()(views.AddQualification.as_view()),
|
||||
name='add_qualification'),
|
||||
path('trainee/edit_qualification/<int:pk>/', is_supervisor()(views.EditQualification.as_view()),
|
||||
name='edit_qualification'),
|
||||
|
||||
path('levels/', not_estates()(views.LevelList.as_view()), name='level_list'),
|
||||
path('level/<int:pk>/', not_estates()(views.LevelDetail.as_view()), name='level_detail'),
|
||||
path('level/<int:pk>/user/<int:u>/', not_estates()(views.LevelDetail.as_view()), name='level_detail'),
|
||||
path('levels/', login_required(views.LevelList.as_view()), name='level_list'),
|
||||
path('level/<int:pk>/', login_required(views.LevelDetail.as_view()), name='level_detail'),
|
||||
path('level/<int:pk>/user/<int:u>/', login_required(views.LevelDetail.as_view()), name='level_detail'),
|
||||
path('level/<int:pk>/add_requirement/', is_supervisor()(views.AddLevelRequirement.as_view()), name='add_requirement'),
|
||||
path('level/remove_requirement/<int:pk>/', is_supervisor()(views.RemoveRequirement.as_view()), name='remove_requirement'),
|
||||
|
||||
path('trainee/<int:pk>/level/<int:level_pk>/confirm', is_supervisor()(views.ConfirmLevel.as_view()), name='confirm_level'),
|
||||
path('trainee/<int:pk>/item_record', not_estates()(views.TraineeItemDetail.as_view()), name='trainee_item_detail'),
|
||||
path('trainee/<int:pk>/item_record', login_required(views.TraineeItemDetail.as_view()), name='trainee_item_detail'),
|
||||
|
||||
path('session_log', is_supervisor()(views.SessionLog.as_view()), name='session_log'),
|
||||
]
|
||||
|
||||
@@ -12,8 +12,8 @@ class Command(BaseCommand):
|
||||
|
||||
def handle(self, *args, **options):
|
||||
for person in Profile.objects.all():
|
||||
# Inactivate users that have not logged in for a year (or have never logged in)
|
||||
if person.last_login is None or (timezone.now() - person.last_login).days > 365:
|
||||
# Inactivate users that have not logged in for a year
|
||||
if person.last_login is not None and (timezone.now() - person.last_login).days > 365:
|
||||
person.is_active = False
|
||||
person.is_approved = False
|
||||
person.save()
|
||||
|
||||
@@ -167,9 +167,11 @@
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header">Events</div>
|
||||
<div style="container-type: size; height: 30vh; overflow-y: scroll;">
|
||||
{% with object.latest_events as events %}
|
||||
{% include 'partials/event_table.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.urls import path
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from registration.backends.default.views import RegistrationView
|
||||
|
||||
from PyRIGS.decorators import permission_required_with_403, not_estates
|
||||
from PyRIGS.decorators import permission_required_with_403
|
||||
from users import forms, views
|
||||
|
||||
urlpatterns = [
|
||||
@@ -14,11 +14,11 @@ urlpatterns = [
|
||||
path('user/login/', LoginView.as_view(authentication_form=forms.CheckApprovedForm), name='login'),
|
||||
path('user/login/embed/', xframe_options_exempt(views.LoginEmbed.as_view()), name='login_embed'),
|
||||
# User editing
|
||||
path('user/edit/', not_estates()(views.ProfileUpdateSelf.as_view()),
|
||||
path('user/edit/', login_required(views.ProfileUpdateSelf.as_view()),
|
||||
name='profile_update_self'),
|
||||
path('user/reset_api_key', not_estates()(views.ResetApiKey.as_view(permanent=False)),
|
||||
path('user/reset_api_key', login_required(views.ResetApiKey.as_view(permanent=False)),
|
||||
name='reset_api_key'),
|
||||
path('user/', not_estates()(views.ProfileDetail.as_view()), name='profile_detail'),
|
||||
path('user/', login_required(views.ProfileDetail.as_view()), name='profile_detail'),
|
||||
path('user/<int:pk>/',
|
||||
permission_required_with_403('RIGS.view_profile')(views.ProfileDetail.as_view()),
|
||||
name='profile_detail'),
|
||||
|
||||
Reference in New Issue
Block a user