diff options
-rw-r--r-- | engagements/models.py | 8 | ||||
-rw-r--r-- | engagements/templates/engagements/engagement_detail.html | 42 |
2 files changed, 38 insertions, 12 deletions
diff --git a/engagements/models.py b/engagements/models.py index 45d8e69..24acabd 100644 --- a/engagements/models.py +++ b/engagements/models.py @@ -1,3 +1,5 @@ +from itertools import chain + from django.conf import settings from django.db import models from django.db.models import Q @@ -158,7 +160,11 @@ class Engagement(Common): } def get_officers(self): - return [" ".join([x.first_name, x.last_name]) for x in self.officers.all()] + officers_from_effort = list(chain.from_iterable([x.officers.all() for x in self.effort.all()])) + return [o.fullname() for o in set(officers_from_effort + list(self.officers.all()))] + return "toss" + + # return [" ".join([x.first_name, x.last_name]) for x in self.officers.all()] def total_planning_effort(self): p_effort = self.engagementeffort_set.all().filter(is_planned=True) diff --git a/engagements/templates/engagements/engagement_detail.html b/engagements/templates/engagements/engagement_detail.html index 51b0e11..f98191e 100644 --- a/engagements/templates/engagements/engagement_detail.html +++ b/engagements/templates/engagements/engagement_detail.html @@ -102,26 +102,46 @@ </div> <!-- Subject of Activity --> - <div class="flex items-center space-x-2"> - - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" - stroke-width="1.5" stroke="currentColor" class="size-6 mr-2"> - <path stroke-linecap="round" stroke-linejoin="round" - d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75"/> - </svg> - - <span class="text-black">{{ engagement.dscs|join:", " }}</span> + <! TODO - fix this grid -> + <div class="grid grid-cols-2 gap-2"> + + <div> + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" + stroke-width="1.5" stroke="currentColor" width="24" height="24"> + <path stroke-linecap="round" stroke-linejoin="round" + d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75"/> + </svg> + </div> + + <div> + {% if not engagement.dscs %} + <p> + No DSCs. Add Regulation effort. + </p> + {% else %} + <span class="text-black">{{ engagement.dscs|join:", " }}</span> + {% endif %} + </div> </div> <!-- Inspectors --> - <div class="flex items-center space-x-2"> + <div class="grid grid-cols-2 gap-2"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6 mr-2"> <path stroke-linecap="round" stroke-linejoin="round" d="M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"/> </svg> - <span class="text-black">{{ engagement.get_officers|join:", " }}</span> + <div> + {% if effort %} + <span class="text-black">{{ engagement.get_officers|join:", " }}</span> + {% else %} + <p> + No Inspectors. Add effort. + </p> + {% endif %} + </div> + </div> <div> |