Compare commits

..

4 Commits

7 changed files with 117 additions and 152 deletions

View 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),
),
]

View File

@@ -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)

View File

@@ -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 #}

View File

@@ -1,84 +1,36 @@
{% load namewithnotes from filters %} {% load namewithnotes from filters %}
<style> <div class="table-responsive">
#event_table { <table class="table mb-0" id="event_table">
display: grid; <thead>
grid-template-columns: 0.5fr 1fr 4fr 1fr; <tr>
column-gap: 1em; <th scope="col">#</th>
} <th scope="col">Dates & Times</th>
.eventgrid { <th scope="col">Event Details</th>
display: inherit; <th scope="col">MIC</th>
grid-column: 1/5; </tr>
grid-template-columns: subgrid; </thead>
padding: 1em; <tbody>
}
.grid-header {
border-bottom: 1px solid grey;
border-top: 1px solid grey;
}
@media (max-width: 600px) {
#event_table {
grid-template-columns: 1fr;
}
.eventgrid {
grid-column: 1/1;
padding: 0.5em;
}
.grid-header {
display: none;
}
#event_dates {
order: 2;
}
}
@media (max-width: 900px) {
#event_table {
grid-template-columns: 0.5fr 1fr;
column-gap: 0.5em;
}
.eventgrid {
grid-column: 1/3;
}
#event_dates {
grid-row: 2;
grid-column: 1;
}
#event_number {
grid-row: 1;
grid-column: 1;
}
#event_mic {
grid-column: 2;
}
}
</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 %} {% for event in events %}
<div class="eventgrid {% if event.cancelled %} <tr class="{% if event.cancelled %}
bg-secondary table-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 %} {% endif %}
@@ -99,9 +51,9 @@
<br><span>Access at: <strong>{{ event.access_at|date:"H:i" }}</strong> {{ event.access_at|date:"(d/m/Y)" }}</span> <br><span>Access at: <strong>{{ event.access_at|date:"H:i" }}</strong> {{ event.access_at|date:"(d/m/Y)" }}</span>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </td>
<!---Details--> <!---Details-->
<div id="event_details" class="w-100"> <td id="event_details" class="w-100">
<h4> <h4>
<a href="{% url 'event_detail' event.pk %}"> <a href="{% url 'event_detail' event.pk %}">
{{ event.name }} {{ event.name }}
@@ -125,10 +77,9 @@
<p>{{ event.description|linebreaksbr }}</p> <p>{{ event.description|linebreaksbr }}</p>
{% endif %} {% endif %}
{% include 'partials/event_status.html' %} {% include 'partials/event_status.html' %}
</div> </td>
<!---MIC--> <!---MIC-->
<div id="event_mic" class="text-nowrap"> <td id="event_mic" class="text-nowrap">
<span class="d-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">
@@ -141,7 +92,13 @@
{% elif event.is_rig %} {% elif event.is_rig %}
<span class="fas fa-exclamation"></span> <span class="fas fa-exclamation"></span>
{% endif %} {% endif %}
</div> </td>
</div> </tr>
{% empty %}
<tr class="bg-warning">
<td colspan="4">No events found</td>
</tr>
{% endfor %} {% endfor %}
</tbody>
</table>
</div> </div>

View File

@@ -3,8 +3,8 @@
{% block content %} {% block content %}
<div class="row align-items-center justify-content-between py-2 align-middle"> <div class="row align-items-center justify-content-between py-2 align-middle">
<div class="col-sm-12 col-md align-middle d-flex flex-wrap"> <div class="col-sm-12 col-md align-middle">
Key: <span class="table-success mr-1 px-2 rounded">Ready</span><span class="table-warning mr-1 px-2 rounded text-nowrap">Action Required</span><span class="table-danger mr-1 px-2 rounded text-nowrap">Needs MIC</span><span class="table-secondary mr-1 px-2 rounded">Cancelled</span><span class="table-info px-2 rounded text-nowrap">Non-Rig</span> Key: <span class="table-success mr-1 px-2 rounded">Ready</span><span class="table-warning mr-1 px-2 rounded">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> </div>
{% if perms.RIGS.add_event %} {% if perms.RIGS.add_event %}
<div class="col text-right"> <div class="col text-right">

View File

@@ -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'

View File

@@ -93,13 +93,6 @@
background-color: #222 !important; background-color: #222 !important;
} }
} }
#event_table {
> .bg-#{$color} {
border: 0.3em solid theme-color-level($color, -6) !important;
background-color: #222 !important;
color: white !important;
}
}
} }
del { del {
color: black; color: black;
@@ -126,7 +119,4 @@
background: #222; background: #222;
color: $gray-100; color: $gray-100;
} }
.text-muted {
color: #c9c9c9 !important;
}
} }