Compare commits

..

39 Commits

Author SHA1 Message Date
e32cc30141 Merge branch 'master' into jb3/features/invoice-dashboard 2024-10-27 13:06:27 +00:00
21dea6cc6a Flip 'outstanding' and 'waiting' cards on dashboard to match order in dropdown
Also made them link to their respective lists and fixed low text contrast
2024-10-27 12:37:38 +00:00
075c6f9365 Add payment methods to generated sample data 2024-10-27 12:30:08 +00:00
Joe Banks
e5c7e24941 Link to event details from check-in notice (#595) 2024-10-26 17:54:51 +01:00
Joe Banks
55f45963a0 Update finance URLs to put dashboard at index route 2024-10-24 16:54:18 +01:00
Joe Banks
54e0c9ff9d Add finance dashboard to dropdown 2024-10-24 16:54:18 +01:00
Joe Banks
6bb69ec8a1 Add new view controller for finance dashboard 2024-10-24 16:54:17 +01:00
Joe Banks
c18d7a75b8 Add new invoice dashboard template 2024-10-24 16:54:17 +01:00
Joe Banks
2d83dad44c Enable commas for float thousands separation 2024-10-24 16:54:17 +01:00
be7b595edb Add warning when creating event with access time more than a week before start.
Yes. I know it's a dirty solution. >:D

Closes #593
2024-10-20 19:56:40 +01:00
6d53df0c8b Should fix logo leaking out of navbar 2024-10-20 19:19:57 +01:00
732a6e5c1e Fix contrast and width issues on "now" alert 2024-10-20 19:05:51 +01:00
Joe Banks
c6823bb9ac Colour cancelled invoices red (#599) 2024-10-17 22:10:23 +01:00
Joe Banks
ec000beee8 Update CI build version to 3.10 (#598)
* Update CI build version to 3.10

* Wrap Python version in string to avoid decimalisation

* Update requests for CVE mitigation

* Install cairo
2024-10-17 21:33:46 +01:00
Joe Banks
6c8eb380fd Generate PDFs from Power Test Records (#594)
* Add new block to base_print.xml for additional styles from downstream templates

* Fix page totals on exports by adding <namedString> element

* Add new print template for power test records

* Add a generated name property to power tests to allow for export

* Add new routes for print export for power tests

* Add print button to power test records view page

* Address linting errors
2024-10-15 22:48:47 +01:00
3123d3899c Fix regression in autocompleter - when adding new people/orgs/venues through modal they are not autoselected
Ah the lovely fragile javascript ecosystem, I can't even pin down when or why it broke.
2024-07-21 16:55:14 +01:00
dependabot[bot]
c93c04ec6e Bump urllib3 from 1.26.18 to 1.26.19 (#586)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.18 to 1.26.19.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/1.26.19/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.18...1.26.19)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 13:10:51 +01:00
6bf8d56ce8 Update CI workflow components 2024-07-03 13:10:34 +01:00
8246071b8c Stop gulp corrupting all the font files.
I bloody love the javascript ecosystem, I do. Really.

>.<
2024-07-01 19:29:45 +01:00
06fa1a3b1b Stop asteroids breaking the buildchain.
Game's a bit broken but I've better things to do than fix an easter egg
2024-07-01 19:18:56 +01:00
70abfaf2ae Bulk update JS dependences
May fix #587, either incidentally or properly, the font files presently being served seem to be corrupted in some odd manner.
2024-07-01 18:38:45 +01:00
02a5a94fbb Potential fix for #573
None of the test cases appear to reproduce the issue so live testing it is.
2024-07-01 18:10:41 +01:00
dependabot[bot]
ddce9752c6 Bump braces and gulp (#585)
Bumps [braces](https://github.com/micromatch/braces) to 3.0.3 and updates ancestor dependency [gulp](https://github.com/gulpjs/gulp). These dependencies need to be updated together.


Updates `braces` from 3.0.2 to 3.0.3
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

Updates `gulp` from 4.0.2 to 5.0.0
- [Release notes](https://github.com/gulpjs/gulp/releases)
- [Changelog](https://github.com/gulpjs/gulp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/gulp/compare/v4.0.2...v5.0.0)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
- dependency-name: gulp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-17 12:28:46 +01:00
dependabot[bot]
5a16e06bed --- (#583)
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 16:45:52 +02:00
dependabot[bot]
5160a61a62 Build(deps): Bump gunicorn from 20.0.4 to 22.0.0 (#581)
Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 20.0.4 to 22.0.0.
- [Release notes](https://github.com/benoitc/gunicorn/releases)
- [Commits](https://github.com/benoitc/gunicorn/compare/20.0.4...22.0.0)

---
updated-dependencies:
- dependency-name: gunicorn
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-18 17:41:53 +01:00
dependabot[bot]
607f282ef6 Build(deps): Bump sqlparse from 0.4.4 to 0.5.0 (#580)
Bumps [sqlparse](https://github.com/andialbrecht/sqlparse) from 0.4.4 to 0.5.0.
- [Changelog](https://github.com/andialbrecht/sqlparse/blob/master/CHANGELOG)
- [Commits](https://github.com/andialbrecht/sqlparse/compare/0.4.4...0.5.0)

---
updated-dependencies:
- dependency-name: sqlparse
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-16 17:26:44 +01:00
dependabot[bot]
d71bb81edf Build(deps): Bump idna from 2.10 to 3.7 (#579)
Bumps [idna](https://github.com/kjd/idna) from 2.10 to 3.7.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](https://github.com/kjd/idna/compare/v2.10...v3.7)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 16:27:48 +01:00
dependabot[bot]
f46915233e Build(deps): Bump tar from 6.1.14 to 6.2.1 (#578)
Bumps [tar](https://github.com/isaacs/node-tar) from 6.1.14 to 6.2.1.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v6.1.14...v6.2.1)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 18:32:46 +01:00
Alex Daniel
0c900d2447 Fix typo in PSCC (#577)
Circuit is spelt Circuit, not Sircuit
2024-04-06 19:18:09 +01:00
953b691cc2 Switch magic flexy rigboard layout to use *container* width queries rather than *screen* width queries
This resolves the overflow seen in the profile detail view in the most overkill way possible. Nerf this!
2024-04-06 19:14:23 +01:00
17fa447861 Reimplement .dl-horizontal, dropped in Bootstrap 3 and apparently still used in our templates in some places 2024-04-06 18:13:32 +01:00
bobbinz
409125c8a3 PSSC Values (Three Phase) (#576)
* Update ec_power_info.html

Added three phase column and made tables look the same

* Update ec_power_info.html

Fixed spelling booboo
2024-03-26 19:25:29 +00:00
dependabot[bot]
03d996eb66 Build(deps-dev): Bump follow-redirects from 1.15.4 to 1.15.6 (#574)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 20:19:20 +00:00
dependabot[bot]
1e40916a94 Build(deps): Bump es5-ext from 0.10.62 to 0.10.64 (#572)
Bumps [es5-ext](https://github.com/medikoo/es5-ext) from 0.10.62 to 0.10.64.
- [Release notes](https://github.com/medikoo/es5-ext/releases)
- [Changelog](https://github.com/medikoo/es5-ext/blob/main/CHANGELOG.md)
- [Commits](https://github.com/medikoo/es5-ext/compare/v0.10.62...v0.10.64)

---
updated-dependencies:
- dependency-name: es5-ext
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-03 17:14:37 +00:00
dependabot[bot]
eae3f762b7 Build(deps): Bump ip from 2.0.0 to 2.0.1 (#571)
Bumps [ip](https://github.com/indutny/node-ip) from 2.0.0 to 2.0.1.
- [Commits](https://github.com/indutny/node-ip/compare/v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-03 17:14:29 +00:00
dependabot[bot]
7a387e8724 Build(deps): Bump axios and browser-sync (#570)
Removes [axios](https://github.com/axios/axios). It's no longer used after updating ancestor dependency [browser-sync](https://github.com/BrowserSync/browser-sync). These dependencies need to be updated together.


Removes `axios`

Updates `browser-sync` from 2.29.1 to 3.0.2
- [Release notes](https://github.com/BrowserSync/browser-sync/releases)
- [Changelog](https://github.com/BrowserSync/browser-sync/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BrowserSync/browser-sync/compare/v2.29.1...v3.0.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: indirect
- dependency-name: browser-sync
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-03 17:14:20 +00:00
dependabot[bot]
4f42219821 Build(deps-dev): Bump follow-redirects from 1.15.2 to 1.15.4 (#569)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-21 19:44:08 +00:00
d7d2f93295 Fix typo in non-event display 2024-01-21 19:43:47 +00:00
2a2ce742b0 Reimplement rigboard page in a fully responsive manner (#567)
* Revive this concept for 2023

(cherry picked from commit b3939d8426)

# Conflicts:
#	pipeline/source_assets/scss/dark_screen.scss

* Update app.json

* Updates to all three layouts
2023-12-17 18:01:49 +00:00
31 changed files with 3927 additions and 7299 deletions

View File

@@ -14,11 +14,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYTHONDONTWRITEBYTECODE: 1 PYTHONDONTWRITEBYTECODE: 1
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get install libcairo2-dev
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v5
with: with:
python-version: 3.9 python-version: "3.10"
cache: 'pipenv' cache: 'pipenv'
- name: Install Dependencies - name: Install Dependencies
run: | run: |
@@ -27,7 +30,7 @@ jobs:
# if: steps.pcache.outputs.cache-hit != 'true' # if: steps.pcache.outputs.cache-hit != 'true'
- name: Cache Static Files - name: Cache Static Files
id: static-cache id: static-cache
uses: actions/cache@v3 uses: actions/cache@v4
with: with:
path: 'pipeline/built_assets' path: 'pipeline/built_assets'
key: ${{ hashFiles('package-lock.json') }}-${{ hashFiles('pipeline/source_assets') }} key: ${{ hashFiles('package-lock.json') }}-${{ hashFiles('pipeline/source_assets') }}
@@ -43,7 +46,7 @@ jobs:
pipenv run python3 manage.py collectstatic --noinput pipenv run python3 manage.py collectstatic --noinput
- name: Run Tests - name: Run Tests
run: pipenv run pytest -n auto --cov run: pipenv run pytest -n auto --cov
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
if: failure() if: failure()
with: with:
name: failure-screenshots ${{ matrix.test-group }} name: failure-screenshots ${{ matrix.test-group }}

10
Pipfile
View File

@@ -28,9 +28,9 @@ django-reversion = "~=3.0.9"
django-widget-tweaks = "~=1.4.8" django-widget-tweaks = "~=1.4.8"
django-htmlmin = "~=0.11.0" django-htmlmin = "~=0.11.0"
envparse = "*" envparse = "*"
gunicorn = "~=20.0.4" gunicorn = "~=22.0.0"
icalendar = "~=4.0.7" icalendar = "~=4.0.7"
idna = "~=2.10" idna = "~=3.7"
Markdown = "~=3.3.3" Markdown = "~=3.3.3"
msgpack = "~=1.0.2" msgpack = "~=1.0.2"
pep517 = "~=0.9.1" pep517 = "~=0.9.1"
@@ -47,17 +47,17 @@ python-dateutil = "~=2.8.1"
pytoml = "~=0.1.21" pytoml = "~=0.1.21"
pytz = "~=2020.5" pytz = "~=2020.5"
reportlab = "*" reportlab = "*"
requests = "~=2.31.0" requests = "~=2.32.3"
retrying = "~=1.3.3" retrying = "~=1.3.3"
simplejson = "~=3.17.2" simplejson = "~=3.17.2"
six = "~=1.15.0" six = "~=1.15.0"
soupsieve = "~=2.1" soupsieve = "~=2.1"
sqlparse = "~=0.4.2" sqlparse = "~=0.5.0"
static3 = "~=0.7.0" static3 = "~=0.7.0"
svg2rlg = "~=0.3" svg2rlg = "~=0.3"
tini = "~=3.0.1" tini = "~=3.0.1"
tornado = "~=6.3" tornado = "~=6.3"
urllib3 = "~=1.26.18" urllib3 = "~=1.26.19"
whitenoise = "~=5.2.0" whitenoise = "~=5.2.0"
yolk = "~=0.4.3" yolk = "~=0.4.3"
zipp = "~=3.4.0" zipp = "~=3.4.0"

1470
Pipfile.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -224,6 +224,8 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
USE_THOUSAND_SEPARATOR = True
# Need to allow seconds as datetime-local input type spits out a time that has seconds # 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') DATETIME_INPUT_FORMATS = ('%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S')

View File

@@ -1,10 +1,11 @@
from datetime import datetime from datetime import datetime, timedelta
import simplejson import simplejson
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.core import serializers from django.core import serializers
from django.utils import timezone from django.utils import timezone
from django.utils.html import format_html
from reversion import revisions as reversion from reversion import revisions as reversion
from RIGS import models from RIGS import models
@@ -97,6 +98,9 @@ class EventForm(forms.ModelForm):
raise forms.ValidationError( raise forms.ValidationError(
'You haven\'t provided any client contact details. Please add a person or organisation.', 'You haven\'t provided any client contact details. Please add a person or organisation.',
code='contact') 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() return super().clean()
def save(self, commit=True): def save(self, commit=True):

View File

@@ -254,7 +254,7 @@ class Command(BaseCommand):
new_invoice.void = True new_invoice.void = True
elif random.randint(0, 2) > 1: # 1 in 3 have been paid elif random.randint(0, 2) > 1: # 1 in 3 have been paid
models.Payment.objects.create(invoice=new_invoice, amount=new_invoice.balance, 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 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)), models.RiskAssessment.objects.create(event=new_event, supervisor_consulted=bool(random.getrandbits(1)),
nonstandard_equipment=bool(random.getrandbits(1)), nonstandard_equipment=bool(random.getrandbits(1)),

View File

@@ -943,6 +943,10 @@ class PowerTestRecord(ReviewableModel, RevisionMixin):
def activity_feed_string(self): def activity_feed_string(self):
return str(self.event) return str(self.event)
@property
def name(self):
return f"Power Test Record - {self.event}"
class EventCheckIn(models.Model): class EventCheckIn(models.Model):
event = models.ForeignKey('Event', related_name='crew', on_delete=models.CASCADE) event = models.ForeignKey('Event', related_name='crew', on_delete=models.CASCADE)

View File

@@ -22,6 +22,9 @@
<paraStyle name="center" alignment="center"/> <paraStyle name="center" alignment="center"/>
<paraStyle name="page-head" alignment="center" fontName="OpenSans-Bold" fontSize="16" leading="18" spaceAfter="0"/> <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.event_description" fontName="OpenSans" textColor="DarkGray" />
<paraStyle name="style.item_description" fontName="OpenSans" textColor="DarkGray" leftIndent="10" /> <paraStyle name="style.item_description" fontName="OpenSans" textColor="DarkGray" leftIndent="10" />
<paraStyle name="style.specific_description" fontName="OpenSans" textColor="DarkGray" fontSize="10" /> <paraStyle name="style.specific_description" fontName="OpenSans" textColor="DarkGray" fontSize="10" />
@@ -137,6 +140,7 @@
<nextFrame/> <nextFrame/>
{% block content %} {% block content %}
{% endblock %} {% endblock %}
<namedString id="lastPage"><pageNumber/></namedString>
</story> </story>
</document> </document>

View File

@@ -45,6 +45,7 @@
Invoices <span class="badge {% if todo == 0 %}badge-success{% else %}badge-danger{% endif %} badge-pill">{{ todo }}</span> Invoices <span class="badge {% if todo == 0 %}badge-success{% else %}badge-danger{% endif %} badge-pill">{{ todo }}</span>
</a> </a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownInvoices"> <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 %} {% 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> <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 %} {% endif %}

View File

@@ -46,7 +46,7 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12" style="container-type: inline-size;">
{% with object_list as events %} {% with object_list as events %}
{% include 'partials/event_table.html' %} {% include 'partials/event_table.html' %}
{% endwith %} {% endwith %}

View File

@@ -165,6 +165,7 @@
</div> </div>
</div> </div>
<div class="col-12 text-right"> <div class="col-12 text-right">
{% button 'print' 'pt_print' object.pk %}
{% button 'edit' url='pt_edit' pk=object.pk %} {% button 'edit' url='pt_edit' pk=object.pk %}
{% button 'view' url='event_detail' pk=object.event.pk text="Event" %} {% 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' %} {% include 'partials/review_status.html' with perm=perms.RIGS.review_power review='pt_review' %}

View 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 %}

View 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 %}

View File

@@ -31,7 +31,7 @@
{% for event in object_list %} {% for event in object_list %}
<tr class="{{event.status_color}}"> <tr class="{{event.status_color}}">
<th scope="row"><a href="{% url 'event_detail' event.pk %}">{{ event.display_id }}</a><br> <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.start_date }}</td>
<td> <td>
{{ event.name }} {{ event.name }}

View File

@@ -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> <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="row collapse" id="values">
<div class="table-responsive"> <div class="col-md-6 col-sm-12">
<table class="table table-bordered"> <table class="table table-bordered">
<thead> <thead>
<tr> <tr>
@@ -33,17 +33,20 @@
<thead> <thead>
<tr> <tr>
<th scope="row">Distro</th> <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> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>Intel & Toblerone distros</td> <td>Intel & Toblerone distros</td>
<td>6</td> <td>6</td>
<td>3</td>
</tr> </tr>
<tr> <tr>
<td>All other distros</td> <td>All other distros</td>
<td>10</td> <td>10</td>
<td>5</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -3,7 +3,7 @@
<style> <style>
#event_table { #event_table {
display: grid; display: grid;
grid-template-columns: max-content auto; grid-template-columns: max-content min-content minmax(max-content, 1fr) max-content;
column-gap: 1em; column-gap: 1em;
} }
.eventgrid { .eventgrid {
@@ -11,6 +11,9 @@
grid-column: 1/5; grid-column: 1/5;
grid-template-columns: subgrid; grid-template-columns: subgrid;
padding: 1em; padding: 1em;
dt, dd { display: block; float: left; }
dt { clear: both; }
dd { float: right; }
} }
.grid-header { .grid-header {
border-bottom: 1px solid grey; border-bottom: 1px solid grey;
@@ -23,7 +26,13 @@
grid-row-start: 1; grid-row-start: 1;
grid-column-start: 4; grid-column-start: 4;
} }
@media (max-width: 600px) { .c-none {
display: none;
}
.c-inline {
display: inline;
}
@container (width <= 500px) {
#event_table { #event_table {
grid-template-columns: 1fr !important; grid-template-columns: 1fr !important;
} }
@@ -43,9 +52,9 @@
#event_mic { #event_mic {
grid-row-start: auto; grid-row-start: auto;
grid-column-start: 4; grid-column-start: 4;
}
} }
} @container (width <= 700px) {
@media (max-width: 900px) {
#event_table { #event_table {
grid-template-columns: max-content; grid-template-columns: max-content;
column-gap: 0.5em; column-gap: 0.5em;
@@ -68,17 +77,20 @@
#event_status { #event_status {
grid-column: span 2; grid-column: span 2;
} }
.grid-header { .grid-header, .c-md-none {
display: none; display: none;
} }
} }
dt { @container (width > 700px) {
float: left; .c-lg-block {
clear: left; display: block;
margin-right: 10px; }
} .c-lg-inline {
dd { display: inline;
margin-left: 0px; }
.c-lg-none, .c-md-none {
display: none;
}
} }
</style> </style>
<div id="event_table"> <div id="event_table">
@@ -105,7 +117,7 @@ dd {
table-warning table-warning
{% endif %}" {% if event.cancelled %}style="opacity: 50% !important;"{% endif %} id="event_row"> {% endif %}" {% if event.cancelled %}style="opacity: 50% !important;"{% endif %} id="event_row">
<!---Number--> <!---Number-->
<div class="font-weight-bold d-none d-lg-block" id="event_number">{{ event.display_id }}</div> <div class="font-weight-bold c-none c-lg-block" id="event_number">{{ event.display_id }}</div>
<!--Dates & Times--> <!--Dates & Times-->
<div id="event_dates" style="min-width: 180px;"> <div id="event_dates" style="min-width: 180px;">
<dl> <dl>
@@ -139,12 +151,12 @@ dd {
<div id="event_details" class="w-100"> <div id="event_details" class="w-100">
<h4> <h4>
<a href="{% url 'event_detail' event.pk %}"> <a href="{% url 'event_detail' event.pk %}">
<span class="d-inline d-lg-none">{{ event }}</span><span class="d-none d-lg-inline">{{ event.name }}</span> <span class="c-inline c-lg-none">{{ event }}</span><span class="c-none c-lg-inline">{{ event.name }}</span>
</a> </a>
{% if event.dry_hire %} {% if event.dry_hire %}
<span class="badge badge-secondary">Dry Hire</span> <span class="badge badge-secondary">Dry Hire</span>
{% endif %} {% endif %}
<br class="d-none d-lg-inline"> <br class="c-none c-lg-inline">
{% if event.venue %} {% if event.venue %}
<small>at {{ event.venue|namewithnotes:'venue_detail' }}</small> <small>at {{ event.venue|namewithnotes:'venue_detail' }}</small>
{% endif %} {% endif %}
@@ -164,7 +176,7 @@ dd {
{% include 'partials/event_status.html' %} {% include 'partials/event_status.html' %}
<!---MIC--> <!---MIC-->
<div id="event_mic" class="text-nowrap"> <div id="event_mic" class="text-nowrap">
<span class="d-md-none align-middle">MIC:</span> <span class="c-md-none align-middle">MIC:</span>
{% if event.mic %} {% if event.mic %}
{% if perms.RIGS.view_profile %} {% if perms.RIGS.view_profile %}
<a href="{% url 'profile_detail' event.mic.pk %}" class="modal-href"> <a href="{% url 'profile_detail' event.mic.pk %}" class="modal-href">

View File

@@ -12,7 +12,7 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div style="container-type: inline-size;">
{% include 'partials/event_table.html' %} {% include 'partials/event_table.html' %}
</div>
{% endblock %} {% endblock %}

View File

@@ -127,7 +127,7 @@ class TestEventCreate(BaseRigboardTest):
# Fix it # Fix it
self.page.end_date = datetime.date(2020, 1, 11) 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.dry_hire = True
self.page.status = "Booked" self.page.status = "Booked"
self.page.collected_by = "Fred" self.page.collected_by = "Fred"

View File

@@ -100,6 +100,7 @@ urlpatterns = [
name='pt_edit'), name='pt_edit'),
path('event/power/<int:pk>/review/', permission_required_with_403('RIGS.review_power')(views.MarkReviewed.as_view()), path('event/power/<int:pk>/review/', permission_required_with_403('RIGS.review_power')(views.MarkReviewed.as_view()),
name='pt_review', kwargs={'model': 'PowerTestRecord'}), 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/', login_required(views.EventCheckIn.as_view()), path('event/<int:pk>/checkin/', login_required(views.EventCheckIn.as_view()),
name='event_checkin'), name='event_checkin'),
@@ -114,7 +115,8 @@ urlpatterns = [
path('event/webhook/', views.RecieveForumWebhook.as_view(), name='webhook_recieve'), path('event/webhook/', views.RecieveForumWebhook.as_view(), name='webhook_recieve'),
# Finance # 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'), name='invoice_list'),
path('invoice/archive/', permission_required_with_403('RIGS.view_invoice')(views.InvoiceArchive.as_view()), path('invoice/archive/', permission_required_with_403('RIGS.view_invoice')(views.InvoiceArchive.as_view()),
name='invoice_archive'), name='invoice_archive'),

View File

@@ -5,7 +5,7 @@ import reversion
from django import forms from django import forms
from django.contrib import messages from django.contrib import messages
from django.db import transaction 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 Http404, HttpResponseRedirect
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
@@ -18,8 +18,76 @@ from RIGS import models
forms.DateField.widget = forms.DateInput(attrs={'type': 'date'}) 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 model = models.Invoice
template_name = 'invoice_list.html' template_name = 'invoice_list.html'

View File

@@ -232,6 +232,16 @@ class RAPrint(PrintView):
return context 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): class EventCheckIn(generic.CreateView, ModalURLMixin):
model = models.EventCheckIn model = models.EventCheckIn
template_name = 'hs/eventcheckin_form.html' template_name = 'hs/eventcheckin_form.html'

View File

@@ -16,7 +16,7 @@ const con = require('gulp-concat');
const gulpif = require('gulp-if'); const gulpif = require('gulp-if');
function fonts(done) { 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(gulp.dest('pipeline/built_assets/fonts'))
.pipe(browsersync.stream()); .pipe(browsersync.stream());
} }
@@ -70,14 +70,14 @@ function scripts() {
.pipe(gulpif(function(file) { return interaction.includes(file.relative);}, con('interaction.js'))) .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(gulpif(function(file) { return jpop.includes(file.relative);}, con('jpop.js')))
.pipe(flatten()) .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(gulp.dest(dest))
.pipe(browsersync.stream()); .pipe(browsersync.stream());
} }
function browserSync(done) { function browserSync(done) {
spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'}); spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'});
// TODO Wait for Django server to come up before browsersync, it seems inconsistent
browsersync.init({ browsersync.init({
notify: true, notify: true,
open: false, open: false,

9238
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,6 @@
"cssnano": "^5.0.13", "cssnano": "^5.0.13",
"easymde": "^2.16.1", "easymde": "^2.16.1",
"fullcalendar": "^5.10.1", "fullcalendar": "^5.10.1",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-flatten": "^0.4.0", "gulp-flatten": "^0.4.0",
"gulp-if": "^3.0.0", "gulp-if": "^3.0.0",
@@ -34,7 +33,8 @@
"uglify-js": "^3.14.5" "uglify-js": "^3.14.5"
}, },
"devDependencies": { "devDependencies": {
"browser-sync": "^2.27.11" "browser-sync": "^3.0.2",
"gulp": "^5.0.0"
}, },
"scripts": { "scripts": {
"gulp": "gulp", "gulp": "gulp",

View File

@@ -1,16 +1,11 @@
function changeSelectedValue(obj,pk,text,update_url) { //Pass in JQuery object and new parameters function changeSelectedValue(obj,pk,text,update_url) { //Pass in JQuery object and new parameters
//console.log('Changing selected value'); //console.log('Changing selected value');
obj.find('option').remove(); //Remove all the available options obj.find('option').remove(); //Remove all the available options
obj.append( //Add the new option obj[0].add(new Option(text, pk, true, true)); // Add new option
$("<option></option>") //obj.selectpicker('val', pk); //Set the new value to be selected
.attr("value",pk) obj.selectpicker('refresh');
.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.change(); //Trigger the change function manually obj.change(); //Trigger the change function manually
//console.log(obj);
} }
function refreshUpdateHref(obj) { function refreshUpdateHref(obj) {

View File

@@ -17,14 +17,12 @@ jQuery(document).ready(function () {
}); });
} }
}); });
var easter_egg = new Konami(); var easter_egg = new Konami(function () {
easter_egg.code = function () {
var s = document.createElement('script'); var s = document.createElement('script');
s.type = 'text/javascript'; s.type = 'text/javascript';
document.body.appendChild(s); document.body.appendChild(s);
s.src = '{% static "js/asteroids.min.js"%}'; s.src = '/static/js/asteroids.min.js';
ga('send', 'event', 'easter_egg', 'activated'); });
}
easter_egg.load(); easter_egg.load();
}); });
//CTRL-Enter form submission //CTRL-Enter form submission

View File

@@ -9,3 +9,4 @@ $theme-colors: (
"primary": #3A52A2 "primary": #3A52A2
) !default; ) !default;
$enable-shadows: true; $enable-shadows: true;
$alert-color-level: 10;

View File

@@ -281,3 +281,12 @@ html.embedded {
.bootstrap-select, button.btn.dropdown-toggle.bs-placeholder.btn-light { .bootstrap-select, button.btn.dropdown-toggle.bs-placeholder.btn-light {
padding-right: 1rem !important; 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;
}

View File

@@ -35,8 +35,8 @@
{% endif %} {% endif %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark" role="navigation"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark" role="navigation">
<div class="container"> <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%}"> <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' %}" 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"> <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> </a>
{% block titleheader %} {% block titleheader %}
{% endblock %} {% endblock %}

View File

@@ -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> <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> <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 %} {% if now %}
<div class="col-sm-12 alert alert-primary rounded-0 mx-auto"> <div class="col-sm-12">
{% for event in now %} {% 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 %} {% endfor %}
</div> </div>
{% endif %} {% endif %}

View File

@@ -167,9 +167,11 @@
<div class="col-lg-6"> <div class="col-lg-6">
<div class="card"> <div class="card">
<div class="card-header">Events</div> <div class="card-header">Events</div>
<div style="container-type: size; height: 30vh; overflow-y: scroll;">
{% with object.latest_events as events %} {% with object.latest_events as events %}
{% include 'partials/event_table.html' %} {% include 'partials/event_table.html' %}
{% endwith %} {% endwith %}
</div>
</div> </div>
</div> </div>
</div> </div>