mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-04-12 05:01:46 +00:00
Compare commits
6 Commits
f775cee7dd
...
optimisati
| Author | SHA1 | Date | |
|---|---|---|---|
|
d6c789d90a
|
|||
|
4fe7b874a4
|
|||
|
ac0425740e
|
|||
|
5382d8ae00
|
|||
|
08a55644c5
|
|||
|
b3939d8426
|
18
RIGS/migrations/0042_auto_20210302_1121.py
Normal file
18
RIGS/migrations/0042_auto_20210302_1121.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.1.7 on 2021-03-02 11:21
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('RIGS', '0041_auto_20210208_1603'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='phone',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=13),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -21,7 +21,7 @@ from reversion.models import Version
|
|||||||
|
|
||||||
class Profile(AbstractUser):
|
class Profile(AbstractUser):
|
||||||
initials = models.CharField(max_length=5, unique=True, null=True, blank=False)
|
initials = models.CharField(max_length=5, unique=True, null=True, blank=False)
|
||||||
phone = models.CharField(max_length=13, null=True, default='')
|
phone = models.CharField(max_length=13, blank=True, default='')
|
||||||
api_key = models.CharField(max_length=40, blank=True, editable=False, default='')
|
api_key = models.CharField(max_length=40, blank=True, editable=False, default='')
|
||||||
is_approved = models.BooleanField(default=False)
|
is_approved = models.BooleanField(default=False)
|
||||||
# Currently only populated by the admin approval email. TODO: Populate it each time we send any email, might need that...
|
# Currently only populated by the admin approval email. TODO: Populate it each time we send any email, might need that...
|
||||||
@@ -707,7 +707,7 @@ class RiskAssessment(models.Model, RevisionMixin):
|
|||||||
]
|
]
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def fields(self):
|
def fieldz(self):
|
||||||
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -792,16 +792,16 @@ class EventChecklist(models.Model, RevisionMixin):
|
|||||||
|
|
||||||
inverted_fields = []
|
inverted_fields = []
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def fields(self):
|
|
||||||
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['event']
|
ordering = ['event']
|
||||||
permissions = [
|
permissions = [
|
||||||
('review_eventchecklist', 'Can review Event Checklists')
|
('review_eventchecklist', 'Can review Event Checklists')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def fieldz(self):
|
||||||
|
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def activity_feed_string(self):
|
def activity_feed_string(self):
|
||||||
return str(self.event)
|
return str(self.event)
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<blockTable style="signatureTable" colWidths="50,120,60,120,35,110">
|
|
||||||
<tr>
|
|
||||||
<td>Signature</td>
|
|
||||||
<td></td>
|
|
||||||
<td>Print Name</td>
|
|
||||||
<td></td>
|
|
||||||
<td>Date</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<th scope="col">Event</th>
|
<th scope="col">Event</th>
|
||||||
{# mmm hax #}
|
{# mmm hax #}
|
||||||
{% if object_list.0 != None %}
|
{% if object_list.0 != None %}
|
||||||
{% for field in object_list.0.fields %}
|
{% for field in object_list.0.fieldz %}
|
||||||
<th scope="col">{{ object_list.0|verbose_name:field|title }}</th>
|
<th scope="col">{{ object_list.0|verbose_name:field|title }}</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<tr class="{% if object.reviewed_by %}table-success{%endif%}">
|
<tr class="{% if object.reviewed_by %}table-success{%endif%}">
|
||||||
{# General #}
|
{# General #}
|
||||||
<th scope="row"><a href="{% url 'event_detail' object.event.pk %}">{{ object.event }}</a></th>
|
<th scope="row"><a href="{% url 'event_detail' object.event.pk %}">{{ object.event }}</a></th>
|
||||||
{% for field in object_list.0.fields %}
|
{% for field in object_list.0.fieldz %}
|
||||||
<td>{{ object|get_field:field }}</td>
|
<td>{{ object|get_field:field }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{# Buttons #}
|
{# Buttons #}
|
||||||
|
|||||||
@@ -1,113 +1,104 @@
|
|||||||
{% load namewithnotes from filters %}
|
{% load namewithnotes from filters %}
|
||||||
<style>
|
<div class="table-responsive">
|
||||||
.eventgrid {
|
<table class="table mb-0" id="event_table">
|
||||||
display: grid;
|
<thead>
|
||||||
grid-template-columns: 0.5fr 2fr 4fr 1fr;
|
<tr>
|
||||||
border: solid 3px black;
|
<th scope="col">#</th>
|
||||||
padding: 1em;
|
<th scope="col">Dates & Times</th>
|
||||||
}
|
<th scope="col">Event Details</th>
|
||||||
@media (max-width: 600px) {
|
<th scope="col">MIC</th>
|
||||||
.eventgrid {
|
</tr>
|
||||||
grid-template-columns: 1fr;
|
</thead>
|
||||||
}
|
<tbody>
|
||||||
.grid-header {
|
{% for event in events %}
|
||||||
display: none;
|
<tr class="{% if event.cancelled %}
|
||||||
}
|
table-secondary
|
||||||
#event_dates {
|
|
||||||
order: 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div id="event_table">
|
|
||||||
<div class="eventgrid grid-header font-weight-bold">
|
|
||||||
<div>#</div>
|
|
||||||
<div>Dates & Times</div>
|
|
||||||
<div>Event Details</div>
|
|
||||||
<div>MIC</div>
|
|
||||||
</div>
|
|
||||||
{% for event in events %}
|
|
||||||
<div class="eventgrid {% if event.cancelled %}
|
|
||||||
bg-secondary
|
|
||||||
{% elif not event.is_rig %}
|
{% elif not event.is_rig %}
|
||||||
bg-info
|
table-info
|
||||||
{% elif not event.mic %}
|
{% elif not event.mic %}
|
||||||
bg-danger
|
table-danger
|
||||||
{% elif event.confirmed and event.authorised %}
|
{% elif event.confirmed and event.authorised %}
|
||||||
{% if event.dry_hire or event.riskassessment %}
|
{% if event.dry_hire or event.riskassessment %}
|
||||||
bg-success
|
table-success
|
||||||
{% else %}
|
{% else %}
|
||||||
bg-warning
|
table-warning
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
bg-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-sm-block" id="event_number">{{ event.display_id }}</div>
|
<th scope="row" id="event_number">{{ event.display_id }}</th>
|
||||||
<!--Dates & Times-->
|
<!--Dates & Times-->
|
||||||
<div id="event_dates">
|
<td id="event_dates">
|
||||||
<span class="text-nowrap attribute">Start: <strong>{{ event.start_date|date:"D d/m/Y" }}</strong>
|
<span class="text-nowrap">Start: <strong>{{ event.start_date|date:"D d/m/Y" }}</strong>
|
||||||
{% if event.has_start_time %}
|
{% if event.has_start_time %}
|
||||||
{{ event.start_time|date:"H:i" }}
|
{{ event.start_time|date:"H:i" }}
|
||||||
{% endif %}
|
|
||||||
</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" }}</strong>{% endif %}
|
|
||||||
{% if event.has_end_time %}
|
|
||||||
{{ event.end_time|date:"H:i" }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% if event.end_date %}
|
||||||
{% if not event.cancelled %}
|
<br>
|
||||||
{% if event.meet_at %}
|
<span class="text-nowrap">End: {% if event.end_date != event.start_date %}<strong>{{ event.end_date|date:"D d/m/Y" }}</strong>{% endif %}
|
||||||
<br><span>Crew meet: <strong>{{ event.meet_at|date:"H:i" }}</strong> {{ event.meet_at|date:"(d/m/Y)" }}</span>
|
{% if event.has_end_time %}
|
||||||
{% endif %}
|
{{ event.end_time|date:"H:i" }}
|
||||||
{% if event.access_at %}
|
|
||||||
<br><span>Access at: <strong>{{ event.access_at|date:"H:i" }}</strong> {{ event.access_at|date:"(d/m/Y)" }}</span>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<!---Details-->
|
|
||||||
<div 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>
|
|
||||||
{{ event.person.name }}
|
|
||||||
{% if event.organisation %}
|
|
||||||
for {{ event.organisation.name }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h5>
|
</span>
|
||||||
{% endif %}
|
|
||||||
{% if not event.cancelled and event.description %}
|
|
||||||
<p>{{ event.description|linebreaksbr }}</p>
|
|
||||||
{% endif %}
|
|
||||||
{% include 'partials/event_status.html' %}
|
|
||||||
</div>
|
|
||||||
<!---MIC-->
|
|
||||||
<div 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 %}
|
{% endif %}
|
||||||
<img src="{{ event.mic.profile_picture }}" class="event-mic-photo"/>
|
{% if not event.cancelled %}
|
||||||
{{ event.mic }}
|
{% if event.meet_at %}
|
||||||
{% if perms.RIGS.view_profile %}
|
<br><span>Crew meet: <strong>{{ event.meet_at|date:"H:i" }}</strong> {{ event.meet_at|date:"(d/m/Y)" }}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if event.access_at %}
|
||||||
|
<br><span>Access at: <strong>{{ event.access_at|date:"H:i" }}</strong> {{ event.access_at|date:"(d/m/Y)" }}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<!---Details-->
|
||||||
|
<td id="event_details" class="w-100">
|
||||||
|
<h4>
|
||||||
|
<a href="{% url 'event_detail' event.pk %}">
|
||||||
|
{{ event.name }}
|
||||||
</a>
|
</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>
|
||||||
|
{{ event.person.name }}
|
||||||
|
{% if event.organisation %}
|
||||||
|
for {{ event.organisation.name }}
|
||||||
|
{% endif %}
|
||||||
|
</h5>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif event.is_rig %}
|
{% if not event.cancelled and event.description %}
|
||||||
<span class="fas fa-exclamation"></span>
|
<p>{{ event.description|linebreaksbr }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
{% include 'partials/event_status.html' %}
|
||||||
</div>
|
</td>
|
||||||
{% endfor %}
|
<!---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-exclamation"></span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr class="bg-warning">
|
||||||
|
<td colspan="4">No events found</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ 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
|
// TODO Wait for Django server to come up before browsersync, it seems inconsistent
|
||||||
browsersync.init({
|
browsersync.init({
|
||||||
notify: true,
|
notify: false,
|
||||||
open: false,
|
open: false,
|
||||||
port: 8001,
|
port: 8001,
|
||||||
proxy: 'localhost:8000'
|
proxy: 'localhost:8000'
|
||||||
|
|||||||
Reference in New Issue
Block a user