aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/caf')
-rw-r--r--ctrack/caf/templates/caf/caf_detail.html37
-rw-r--r--ctrack/caf/views.py22
2 files changed, 42 insertions, 17 deletions
diff --git a/ctrack/caf/templates/caf/caf_detail.html b/ctrack/caf/templates/caf/caf_detail.html
index 2e88b15..500ae62 100644
--- a/ctrack/caf/templates/caf/caf_detail.html
+++ b/ctrack/caf/templates/caf/caf_detail.html
@@ -16,25 +16,36 @@
<div class="row">
<div class="col-12">
- <h3>Current status:</h3>
- <div class="row">
- <div class="col-md-12 m-2 p-1">
- {% if not events %}
+ <h3>History:</h3>
+ {% if tde and sde %}
+ <div class="row">
+ <div class="col-md-12">
No events registered for this CAF.
- <span class="float-right"><a href="#" type="button" class="btn btn-outline-primary btn-sm">Register Event</a></span>
- {% endif %}
+ <span class="float-right pb-1"><a href="#" type="button" class="btn btn-outline-primary btn-sm">Register Event</a></span>
+ </div>
</div>
- </div>
+ {% endif %}
<div class="row">
- <div class="col-md-12">
+ <div class="col-md-12 my-1">
<ul class="list-group">
- {% for event in events %}
- {% if not event.ended %}
- <li class="list-group-item list-group-item-{{ event.badge_code }}"><a
- href="#">{{ event.event.type }}</a>
- <span class="float-right">Started: {{ event.event.date|date:"j M Y" }}</span></li>
+ {% for event in twin_date_events %}
+ {% if event.end_date %}
+ <li class="list-group-item list-group-item-success"><a
+ href="#">{{ event.type }}</a>
+ <span class="float-right">Completed: {{ event.end_date|date:"j M Y" }}</span></li>
+ {% else %}
+ <li class="list-group-item list-group-item-warning"><a
+ href="#">{{ event.type }}</a>
+ <span class="float-right">Started: {{ event.date|date:"j M Y" }}</span></li>
{% endif %}
{% endfor %}
+ {% for event in single_date_events %}
+ <li class="list-group-item list-group-item-{{ event.badge_code }}">
+ <a href="#">{{ event.type }}</a>
+ <span class="float-right">Completed: {{ event.date|date:"j M Y" }}</span></li>
+ </li>
+ {% endfor %}
+ </ul>
</div>
</div>
</ul>
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py
index d11fa8c..14a2edb 100644
--- a/ctrack/caf/views.py
+++ b/ctrack/caf/views.py
@@ -32,17 +32,31 @@ def caf_detail_view(request, pk):
lst_scores = [ass, CAFAssessmentOutcomeScore.objects.filter(caf_assessment=ass)]
_scrs.append(lst_scores)
events_related_to_caf = caf.get_events()
- events = []
+ single_date_events = []
+ twin_date_events = []
for event in events_related_to_caf:
- if not event.end_date:
- events.append(dict(event=event, ended=False, badge_code="warning"))
+ if event.type.single_date_type:
+ single_date_events.append(event)
+ else:
+ twin_date_events.append(event)
+ if single_date_events:
+ sde = True
+ else:
+ sde = False
+ if twin_date_events:
+ tde = True
+ else:
+ tde = False
context = {
"object": caf,
"assessments_and_scores": _scrs,
"organisation": caf.organisation,
"systems": caf.systems.all(),
- "events": events
+ "single_date_events": single_date_events,
+ "sde": sde,
+ "tde": tde,
+ "twin_date_events": twin_date_events
}
return render(request, "caf/caf_detail.html", context)