diff options
Diffstat (limited to 'ctrack/caf')
-rw-r--r-- | ctrack/caf/models.py | 4 | ||||
-rw-r--r-- | ctrack/caf/templates/caf/caf_detail.html | 38 |
2 files changed, 41 insertions, 1 deletions
diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py index d5ae98a..5e3e2e2 100644 --- a/ctrack/caf/models.py +++ b/ctrack/caf/models.py @@ -4,6 +4,8 @@ from ctrack.caf.managers import ApplicableSystemManager from ctrack.organisations.models import Organisation, Person from django.urls.base import reverse +from ctrack.register.models import EngagementEvent + class Grading(models.Model): GRADING_TYPE = [ @@ -158,6 +160,8 @@ class CAF(models.Model): def get_assessments(self): return self.cafassessment_set.all() + def get_events(self): + return EngagementEvent.objects.filter(related_caf=self).all().order_by("-date") def __str__(self): # Get the organisation and applicable system diff --git a/ctrack/caf/templates/caf/caf_detail.html b/ctrack/caf/templates/caf/caf_detail.html index c82b241..bfdff0c 100644 --- a/ctrack/caf/templates/caf/caf_detail.html +++ b/ctrack/caf/templates/caf/caf_detail.html @@ -63,7 +63,7 @@ <div class="card bg-light"> <div class="card-body"> <div class="card-title text-muted">NIS Systems <a - href="{% url "caf:as_create_from_caf" object.pk %}" class="btn btn-primary btn-sm float-right">Add + href="{% url "caf:as_create_from_caf" object.pk %}" class="btn btn-outline-primary btn-sm float-right">Add new...</a></div> <div> <table class="table table-responsive"> @@ -90,6 +90,42 @@ </div> <div class="row"> + <div class="col-md-12"> + <div class="card bg-light"> + <div class="card-body"> + <div class="card-title text-muted">CAF History <a href="#" class="btn btn-outline-primary btn-sm float-right">Add new...</a></div> + <div class="table table-responsive"> + <table class="table"> + <thead> + <tr> + <th>Date</th> + <th>Event</th> + <th>Inspector</th> + <th>Comments</th> + </tr> + </thead> + <tbody> + {% for event in object.get_events %} + <tr> + <td>{{ event.date|date:"j F Y"}}</td> + <td>{{ event.type }}</td> + <td>{{ event.user }}</td> + <td>{{ event.comments }}</td> + </tr> + {% endfor %} + + <tr> + + </tr> + </tbody> + </table> + </div> + </div> + </div> + </div> + </div> + + <div class="row"> <div class="col-md-12 my-2"> <div class="card bg-light"> <div class="card-body"> |