From 5351983b5f45505f8bcb5a639c179ec3bb2be689 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 23 Oct 2020 11:29:30 +0100 Subject: moved notes to own table on org detail page --- .../organisations/organisation_detail.html | 132 ++++++++++++++++++--- ctrack/organisations/views.py | 8 +- 2 files changed, 118 insertions(+), 22 deletions(-) (limited to 'ctrack/organisations') diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html index 4c09cce..6e2c1c3 100644 --- a/ctrack/organisations/templates/organisations/organisation_detail.html +++ b/ctrack/organisations/templates/organisations/organisation_detail.html @@ -26,7 +26,6 @@
-
@@ -81,7 +80,7 @@
-{# TODO - split off the notes#} + {# TODO - split off the notes#}
@@ -89,7 +88,7 @@
- Notes & Events + Engagement Events
New - email | - - - - - - - New - note -  [Help] + email
@@ -185,6 +173,118 @@
+ +
+
+
+
+
+
+ Notes +
+
+ + + + + + New + note +  [Help] +
+ +
+ + + + + + + + + + {% for event in notes %} + + + + + + {% endfor %} + +
CreatedDescriptionComments
+ {{ event.created_date|date:"j M Y" }} + {% if event.private %} + PRIVATE + {% endif %} + {{ event.short_description }}{{ event.comments }}
+
+
+
+
+
+ +
+
+
+
+
Essential Services
+ + {% if applicable_systems|length > 0 %} + {% for es in essential_services %} + + + + + {% endfor %} + {% else %} +

button to create new one here

+ {% endif %} +
{{ es.name }} + {{ es.description }} +
+
+
+
+
+ +
+
+
+
+
NIS Systems Add + new... +
+
+ + {% if applicable_systems|length > 0 %} + {% for ass in applicable_systems %} + + + + + {% endfor %} + {% else %} + Add + new... + {% endif %} +
{{ ass.name }}{{ ass.function }} +
+
+
+
+
+
+
+ +
@@ -242,9 +342,7 @@
-
- diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py index 1fbefde..76057bb 100644 --- a/ctrack/organisations/views.py +++ b/ctrack/organisations/views.py @@ -115,17 +115,14 @@ class OrganisationDetailView(PermissionRequiredMixin, DetailView): # simple datetime events for org # TODO - a note is not getting registered on org detail page after renamed datetime field so fix! - notes = NoteEvent.objects.filter(user=self.request.user) + notes = NoteEvent.objects.filter(user=self.request.user, organisation=self.object).order_by("-created_date") _sdes = [ filter_private_events( person.get_single_datetime_events(), self.request.user ) for person in peoples ] - _all = list(itertools.chain(list(itertools.chain.from_iterable(_sdes)), notes)) - for x in _all: - if isinstance(x, NoteEvent): - setattr(x, "date", timezone.now()) + _all = list(itertools.chain(list(itertools.chain.from_iterable(_sdes)))) flat_sdes = sorted(_all, key=lambda e: e.date, reverse=True) for x in flat_sdes: if isinstance(x, NoteEvent): @@ -150,6 +147,7 @@ class OrganisationDetailView(PermissionRequiredMixin, DetailView): people = org.person_set.all() context["people"] = people applicable_systems = org.applicable_systems() + context["notes"] = notes context["applicable_systems"] = applicable_systems context["engagement_events"] = engagement_events context["essential_services"] = essential_services -- cgit v1.2.3