aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ctrack/organisations/models.py7
-rw-r--r--ctrack/organisations/templates/organisations/organisation_detail.html12
-rw-r--r--ctrack/organisations/views.py5
3 files changed, 12 insertions, 12 deletions
diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py
index 78e4801..1c914b5 100644
--- a/ctrack/organisations/models.py
+++ b/ctrack/organisations/models.py
@@ -162,6 +162,13 @@ class Organisation(models.Model):
out.extend(list(es.systems.all()))
return out
+ def systems_for_each_essential_service(self):
+ ess = self.essentialservice_set.all()
+ out = []
+ for es in ess:
+ out.extend(es.systems.all())
+ return out
+
class Address(models.Model):
organisation = models.ForeignKey(
diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html
index 8c9ac3b..0e981b9 100644
--- a/ctrack/organisations/templates/organisations/organisation_detail.html
+++ b/ctrack/organisations/templates/organisations/organisation_detail.html
@@ -99,17 +99,7 @@
<div class="col-md-12 my-2">
<div class="card bg-light">
<div class="card-body">
- <div class="card-title">OES Engagements<a href="{% url "register:create" %}" class="btn btn-primary btn-sm float-right">Add
- new...</a></div>
- <div class="table table-responsive">
- <table class="table">
- {% if engagement_events|length > 0 %}
- {% for event in engagement_events %}
- <tr>
- <td><a href="#">{{ event.type}}</a></td>
- <td>{{ event.short_description }}</td>
- </tr>
- {% endfor %}
+ <div class="card-title">OES Engagements<a href="{% url "register:create" %}" class="btn btn-primary btn-sm float-right">Add new...</a></div> <div class="table table-responsive"> <table class="table"> {% if engagement_events|length > 0 %} {% for event in engagement_events %} <tr> <td><a href="#">{{ event.type}}</a></td> <td>{{ event.short_description }}</td> </tr> {% endfor %}
{% else %}
<a class="btn btn-primary" href="{% url "register:create" %}" role="button">Add
new...</a>
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py
index 394966a..3f91e2f 100644
--- a/ctrack/organisations/views.py
+++ b/ctrack/organisations/views.py
@@ -10,6 +10,7 @@ from ctrack.register.models import EngagementEvent
from .forms import AddressInlineFormSet, IncidentReportForm, OrganisationCreateForm
from .models import IncidentReport, Organisation, Person
+from ctrack.caf.models import EssentialService
class PersonListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
@@ -66,6 +67,7 @@ class OrganisationDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detail
org = kwargs["object"]
peoples = org.person_set.all()
engagement_events = EngagementEvent.objects.filter(participants__in=peoples)
+ essential_services = EssentialService.objects.filter(organisation=org)
no_addr = org.addresses.count()
if no_addr > 1:
context["no_addr"] = no_addr
@@ -77,9 +79,10 @@ class OrganisationDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detail
context["addr"] = addr
people = org.person_set.all()
context["people"] = people
- applicable_systems = org.applicablesystem_set.all()
+ applicable_systems = org.systems_for_each_essential_service()
context["applicable_systems"] = applicable_systems
context["engagement_events"] = engagement_events
+ context["essential_services"] = essential_services
return context