diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 11:29:30 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 11:29:30 +0100 |
commit | 5351983b5f45505f8bcb5a639c179ec3bb2be689 (patch) | |
tree | c745d963a637a47442b18ca198f0c35318cdd6da | |
parent | a9c4a19b363772dc2ae1465c3c451c9e04cb68d0 (diff) |
moved notes to own table on org detail page
-rw-r--r-- | ctrack/organisations/templates/organisations/organisation_detail.html | 132 | ||||
-rw-r--r-- | ctrack/organisations/views.py | 8 |
2 files changed, 118 insertions, 22 deletions
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 @@ </div> <div class="row" id="top-row"> - <div class="col-md-12 my-2"> <div class="card bg-light"> <div class="card-body"> @@ -81,7 +80,7 @@ </div> </div> -{# TODO - split off the notes#} + {# TODO - split off the notes#} <div class="col-md-12 mb-2"> <div class="row"> @@ -89,7 +88,7 @@ <div class="card bg-light"> <div class="card-body"> <div class="card-title" style="font-size: 1.1rem;"> - Notes & Events + Engagement Events </div> <div class="mb-2"> <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-calendar-month" fill="currentColor" @@ -125,18 +124,7 @@ </svg> <a href="{% url "register:event_create_simple_event_from_org_with_type" object.slug 'EMAIL' %}">New - email</a> | - - <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-journal-text" fill="currentColor" - xmlns="http://www.w3.org/2000/svg"> - <path d="M3 0h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2z"/> - <path d="M1 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1z"/> - <path fill-rule="evenodd" - d="M5 10.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm0-2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0-2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0-2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5z"/> - </svg> - <a href="{% url "register:event_create_note" %}">New - note</a> - <a href="#">[Help]</a> + email</a> </div> <div> @@ -185,6 +173,118 @@ </div> </div> </div> + + <div class="col-md-12 mb-2"> + <div class="row"> + <div class="col-md-12 my-2"> + <div class="card bg-light"> + <div class="card-body"> + <div class="card-title" style="font-size: 1.1rem;"> + Notes + </div> + <div class="mb-2"> + <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-journal-text" + fill="currentColor" + xmlns="http://www.w3.org/2000/svg"> + <path d="M3 0h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2z"/> + <path d="M1 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1z"/> + <path fill-rule="evenodd" + d="M5 10.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm0-2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0-2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0-2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5z"/> + </svg> + <a href="{% url "register:event_create_note" %}">New + note</a> + <a href="#">[Help]</a> + </div> + + <div> + <table class="table table-small table-bordered"> + <thead> + <tr class="d-flex"> + <th scope="col" class="col-3">Created</th> + <th scope="col" class="col-3">Description</th> + <th scope="col" class="col-6">Comments</th> + </tr> + </thead> + <tbody> + {% for event in notes %} + <tr class="d-flex"> + <td class="col-3"> + {{ event.created_date|date:"j M Y" }} + {% if event.private %} + <span class="badge badge-warning float-right">PRIVATE</span> + {% endif %} + </td> + <td class="col-3">{{ event.short_description }}</td> + <td class="col-6">{{ event.comments }}</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> + </div> + </div> + </div> + </div> + + <div class="row pb-2"> + <div class="col-sm"> + <div class="card bg-light"> + <div class="card-body"> + <div class="card-title" style="font-size: 1.1rem;">Essential Services</div> + <table class="table table-bordered"> + {% if applicable_systems|length > 0 %} + {% for es in essential_services %} + <tr> + <td class="w-25" + <a + href="{% url "organisations:essential_service_detail" es.pk %}">{{ es.name }}</a> + </td> + <td>{{ es.description }} + </td> + </tr> + {% endfor %} + {% else %} + <p>button to create new one here</p> + {% endif %} + </table> + </div> + </div> + </div> + </div> + + <div class="row pb-2"> + <div class="col-sm"> + <div class="card bg-light"> + <div class="card-body"> + <div class="card-title" style="font-size: 1.1rem;">NIS Systems <a + href="{% url "caf:as_create_from_org" object.slug %}" + class="btn btn-outline-primary btn-sm float-right">Add + new...</a> + </div> + <div class="table"> + <table class="table table-bordered"> + {% if applicable_systems|length > 0 %} + {% for ass in applicable_systems %} + <tr> + <td class="w-25"><a href="{% url "caf:ass_detail" ass.id %}">{{ ass.name }}</a></td> + <td>{{ ass.function }} + </td> + </tr> + {% endfor %} + {% else %} + <a class="btn btn-primary" href="{% url "caf:as_create_from_org" object.slug %}" + role="button">Add + new...</a> + {% endif %} + </table> + </div> + </div> + </div> + </div> + </div> + </div> + + </div> <div class="row pb-2"> @@ -242,9 +342,7 @@ </div> </div> </div> - </div> - </div> </div> 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 |