Start RA list template

This commit is contained in:
2020-05-30 17:19:11 +01:00
parent 6867359146
commit 3768f4a613
8 changed files with 132 additions and 19 deletions

View File

@@ -609,6 +609,11 @@ class RiskAssessment(models.Model):
# Blimey that was a lot of options
# created = models.DateTimeField(auto_now_add=True)
# reviewed_at = models.DateTimeField()
# reviewed_by = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True,
# verbose_name="Reviewer", on_delete=models.CASCADE)
@property
def activity_feed_string(self):
return str(self.event)

View File

@@ -439,3 +439,9 @@ class EventAuthoriseRequestEmailPreview(generic.DetailView):
})
context['to_name'] = self.request.GET.get('to_name', None)
return context
class EventRiskAssessmentList(generic.ListView):
paginate_by = 20
model = models.RiskAssessment
template_name = 'risk_assessment_table.html'

Binary file not shown.

View File

@@ -12,31 +12,31 @@
<div class="card-header">General</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-6">{{ object|help_text:'nonstandard_equipment' }}</dt>
<dd class="col-sm-6">
<dt class="col-10">{{ object|help_text:'nonstandard_equipment' }}</dt>
<dd class="col-2">
{{ object.nonstandard_equipment|yesno|title }}
</dd>
<dt class="col-sm-6">{{ object|help_text:'nonstandard_use'|safe }}</dt>
<dd class="col-sm-6">
<dt class="col-10">{{ object|help_text:'nonstandard_use'|safe }}</dt>
<dd class="col-2">
{{ object.nonstandard_use|yesno|title }}
</dd>
<dt class="col-sm-6">{{ object|help_text:'contractors' }}</dt>
<dd class="col-sm-6">
<dt class="col-10">{{ object|help_text:'contractors' }}</dt>
<dd class="col-2">
{{ object.contractors|yesno|title }}
</dd>
<dt class="col-sm-6">{{ object|help_text:'other_companies' }}</dt>
<dd class="col-sm-6">
<dt class="col-10">{{ object|help_text:'other_companies' }}</dt>
<dd class="col-2">
{{ object.othercompanies|yesno|title }}
</dd>
<dt class="col-sm-6">{{ object|help_text:'crew_fatigue' }}</dt>
<dd class="col-sm-6">
<dt class="col-10">{{ object|help_text:'crew_fatigue' }}</dt>
<dd class="col-2">
{{ object.crewfatigue|yesno|title }}
</dd>
<dt class="col-sm-6">{{ object|help_text:'general_notes' }}</dt>
<dd class="col-sm-6">
<dt class="col-10">{{ object|help_text:'general_notes' }}</dt>
<dd class="col-2">
{{ object.general_notes|default:'N/A'|linebreaks }}
</dd>
</dl>
</dl>
</div>
</div>
<div class="card card-default mb-3">
@@ -72,7 +72,7 @@
{{ object.power_notes|default:'N/A'|linebreaks }}
</dd>
</dl>
</div>
</div>
</div>
<div class="card card-default mb-3">
<div class="card-header">Sound</div>

View File

@@ -0,0 +1,95 @@
{% extends 'base_rigs.html' %}
{% load paginator from filters %}
{% load help_text from filters %}
{% load verbose_name from filters %}
{% block title %}Risk Assessment List{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-12">
<h2>Risk Assessment List</h2>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="table-responsive">
<table class="table mb-0">
<thead class="thead-dark">
<tr>
<th scope="col">Event</th>
<th scope="col" class="text-truncate">{{ object_list.0|verbose_name:'nonstandard_equipment'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'nonstandard_use'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'contractors'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'other_companies'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'crew_fatigue'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'general_notes'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'big_power'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'power_mic'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'generators'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'other_companies_power'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'nonstandard_equipment_power'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'multiple_electrical_environments'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'power_notes'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'noise_monitoring'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'sound_notes'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'known_venue'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'safe_loading'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'safe_storage'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'area_outside_of_control'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'nonstandard_emergency_procedure'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'barrier_required'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'special_structures'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'persons_responsible_structures'|title }}</th>
<th scope="col">{{ object_list.0|verbose_name:'suspended_structures'|title }}</th>
</tr>
</thead>
<tbody>
{% for object in object_list %}
<tr>
<th scope="row">{{ object.event }}</th>
<td class="{% if object.nonstandard_equipment%}bg-danger text-white{%endif%}">{{object.nonstandard_equipment|yesno|title}}</td>
<td class="{% if object.nonstandard_use%}bg-danger text-white{%endif%}">{{object.nonstandard_use|yesno|title}}</td>
<td class="{% if object.contractors%}bg-danger text-white{%endif%}">{{object.contractors|yesno|title}}</td>
<td class="{% if object.other_companies%}bg-danger text-white{%endif%}">{{object.other_companies|yesno|title}}</td>
<td class="{% if object.crew_fatigue%}bg-danger text-white{%endif%}">{{object.crew_fatigue|yesno|title}}</td>
<td>{{ object.general_notes|default:'N/A'|linebreaks }}</td>
<td class="{% if object.big_power%}bg-danger text-white{%endif%}">{{object.big_power|yesno|title}}</td>
<td>{{ object.power_mic.name|default:'N/A' }}</td>
<td class="{% if object.generators%}bg-danger text-white{%endif%}">{{object.generators|yesno|title}}</td>
<td class="{% if object.other_companies_power%}bg-danger text-white{%endif%}">{{object.other_companies_power|yesno|title}}</td>
<td class="{% if object.nonstandard_equipment_power%}bg-danger text-white{%endif%}">{{object.nonstandard_equipment_power|yesno|title}}</td>
<td class="{% if object.multiple_electrical_environments%}bg-danger text-white{%endif%}">{{object.multiple_electrical_environments|yesno|title}}</td>
<td>{{ object.power_notes|default:'N/A'|linebreaks }}</td>
<td class="{% if object.noise_monitoring%}bg-danger text-white{%endif%}">{{object.noise_monitoring|yesno|title}}</td>
<td>{{ object.sound_notes|default:'N/A'|linebreaks }}</td>
<td class="{% if not object.known_venue%}bg-danger text-white{%endif%}">{{object.known_venue|yesno|title}}</td>
<td class="{% if not object.safe_loading%}bg-danger text-white{%endif%}">{{object.safe_loading|yesno|title}}</td>
<td class="{% if object.safe_storage%}bg-danger text-white{%endif%}">{{object.safe_storage|yesno|title}}</td>
<td class="{% if object.area_outside_of_control%}bg-danger text-white{%endif%}">{{object.area_outside_of_control|yesno|title}}</td>
<td class="{% if object.nonstandard_emergency_procedure%}bg-danger text-white{%endif%}">{{object.nonstandard_emergency_procedure|yesno|title}}</td>
<td class="{% if object.barrier_required%}bg-danger text-white{%endif%}">{{object.barrier_required|yesno|title}}</td>
<td class="{% if object.special_structures%}bg-danger text-white{%endif%}">{{object.special_structures|yesno|title}}</td>
<td>{{ object.persons_responsible_structures|default:'N/A'|linebreaks }}</td>
<td class="{% if object.suspended_structures%}bg-danger text-white{%endif%}">{{object.suspended_structures|yesno|title}}</td>
</tr>
{% empty %}
<tr class="bg-warning">
<td colspan="6">Not Found</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% if is_paginated %}
<div class="row justify-content-center">
{% paginator %}
</div>
{% endif %}
{% endblock %}

View File

@@ -62,8 +62,8 @@
<div class="row">
<div class="col-sm-12 text-right">
<div class="btn-group btn-page">
<a href="{% url 'venue_update' object.pk %}" class="btn btn-default"><span
class="fas fa-pencil"></span> Edit</a>
<a href="{% url 'venue_update' object.pk %}" class="btn btn-warning"><span
class="fas fa-edit"></span> Edit</a>
</div>
{% include 'partials/last_edited.html' with target="venue_history" %}
</div>
@@ -78,10 +78,10 @@
<div class="row">
<div class="col-sm-12 text-right">
<div class="btn-group btn-page">
<a href="{% url 'venue_detail' object.pk %}" class="btn btn-default"><span
<a href="{% url 'venue_detail' object.pk %}" class="btn btn-primary"><span
class="fas fa-eye-open"></span> Open Page</a>
<a href="{% url 'venue_update' object.pk %}" class="btn btn-default"><span
class="fas fa-pencil"></span> Edit</a>
<a href="{% url 'venue_update' object.pk %}" class="btn btn-warning"><span
class="fas fa-edit"></span> Edit</a>
</div>
{% include 'partials/last_edited.html' with target="venue_history" %}
</div>

View File

@@ -116,3 +116,8 @@ def orderby(request, field, attr):
@register.filter
def help_text(obj, field):
return obj._meta.get_field(field).help_text
@register.filter
def verbose_name(obj, field):
return obj._meta.get_field(field).verbose_name

View File

@@ -99,6 +99,8 @@ urlpatterns = [
name='event_ra_edit'),
path('event/ra/<int:pk>/history/', permission_required_with_403('RIGS.change_event')(versioning.VersionHistory.as_view()),
name='ra_history', kwargs={'model': models.RiskAssessment}),
path('event/ra/list', permission_required_with_403('RIGS.change_event')(rigboard.EventRiskAssessmentList.as_view()),
name='ra_list'),
# Finance
path('invoice/', permission_required_with_403('RIGS.view_invoice')(finance.InvoiceIndex.as_view()),