From 02667f162ecaa344c0fbee54fe0ef11bdee9cb2a Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Thu, 27 Jul 2023 16:16:25 +0200 Subject: new uc fix document lists --- client/templates/client/index.html | 6 ++++-- client/views.py | 3 +++ server/templates/server/doc_list.html | 12 ++++++------ server/templates/server/doc_list_readonly.html | 12 ++++++------ server/templates/server/doc_list_table.html | 20 ++++---------------- server/views.py | 6 +++--- version.txt | 2 +- 7 files changed, 27 insertions(+), 34 deletions(-) diff --git a/client/templates/client/index.html b/client/templates/client/index.html index 8dd3dde..2690703 100644 --- a/client/templates/client/index.html +++ b/client/templates/client/index.html @@ -468,9 +468,9 @@ $(document).ready(function(){ {% if user.is_staff or perms.client.approved %} $('.collapsible').collapsible(); - $('.tap-target').tapTarget(); $('.modal').modal(); - {% if docs|length == 0 %} + {% if docs|length == 0 and not all_invalid %} + $('.tap-target').tapTarget(); $('.tap-target').tapTarget('open'); {% endif %} var params = {}; @@ -489,11 +489,13 @@ $(document).ready(function(){ }); }); {% if user.is_staff or perms.client.approved %} + {% if not all_invalid %} $('*').click(function(event) { if (this === event.target) { $('.tap-target').tapTarget('close'); } }); + {% endif %} function send(id) { var form = document.getElementById('form') var action = document.getElementById('action') diff --git a/client/views.py b/client/views.py index 01cb43e..f3124a8 100644 --- a/client/views.py +++ b/client/views.py @@ -92,6 +92,7 @@ def index(request): return edit_wrapper(request, context) # divide the docs for each uc + all_invalid = True docs = [] for uc in ucs: documents = Document.objects.filter( @@ -114,6 +115,7 @@ def index(request): invalid_flag = ("" in data) or (None in data) or (dt.date(1970, 1, 1) in data) no_attachment_flag = (not uc.medic.vac_certificate) or (not uc.medic.health_care_certificate) invalid_flag = invalid_flag or no_attachment_flag + all_invalid = all_invalid and invalid_flag docs.append([uc, documents, color, invalid_flag, no_attachment_flag]) # show only docs of the user and non archived @@ -123,6 +125,7 @@ def index(request): context = { "docs": docs, + "all_invalid": all_invalid, "vac_file": vac_file, "health_file": health_file, "sign_doc_file": sign_doc_file diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html index db1ee4e..28511e7 100644 --- a/server/templates/server/doc_list.html +++ b/server/templates/server/doc_list.html @@ -156,7 +156,7 @@