From 3c4eccb13b7b261758fd6ef709d2a06ea0fb47df Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Wed, 13 Sep 2023 12:54:38 +0200 Subject: remove check for approved user --- client/templates/client/index.html | 22 ++++++++++------------ client/views.py | 4 ++++ 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'client') diff --git a/client/templates/client/index.html b/client/templates/client/index.html index 2e714cd..1acdd8c 100644 --- a/client/templates/client/index.html +++ b/client/templates/client/index.html @@ -469,10 +469,9 @@ {% block script %} $(document).ready(function(){ - {% if user.is_staff or perms.client.approved %} $('.collapsible').collapsible(); $('.modal').modal(); - {% if docs|length == 0 and not all_invalid %} + {% if no_docs and not all_invalid %} $('.tap-target').tapTarget(); $('.tap-target').tapTarget('open'); {% endif %} @@ -486,12 +485,11 @@ $(document).ready(function(){ if (docid != undefined) { $('#modal_approve'+docid).modal('open'); } - {% endif %} var lazyLoadInstance = new LazyLoad({ // Your custom settings go here }); }); -{% if user.is_staff or perms.client.approved %} + {% if not all_invalid %} $('*').click(function(event) { if (this === event.target) { @@ -499,12 +497,12 @@ $(document).ready(function(){ } }); {% endif %} - function send(id) { - var form = document.getElementById('form') - var action = document.getElementById('action') - action.setAttribute('value', id); - history.pushState(null, null, '/'); - form.submit() - } -{% endif %} + +function send(id) { + var form = document.getElementById('form') + var action = document.getElementById('action') + action.setAttribute('value', id); + history.pushState(null, null, '/'); + form.submit() +} {% endblock %} diff --git a/client/views.py b/client/views.py index 236ae38..b470f8d 100644 --- a/client/views.py +++ b/client/views.py @@ -93,6 +93,7 @@ def index(request): # divide the docs for each uc all_invalid = True + no_docs = True docs = [] for uc in ucs: documents = Document.objects.filter( @@ -117,14 +118,17 @@ def index(request): 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, uc.branca == None]) + no_docs = no_docs and (len(documents) == 0) # show only docs of the user and non archived vac_file = ["/server/media/", "/vac_certificate/doc"] health_file = ["/server/media/", "/health_care_certificate/doc"] sign_doc_file = ["/server/media/", "/signed_doc/doc"] + print(docs) context = { "docs": docs, + "no_docs": no_docs, "all_invalid": all_invalid, "vac_file": vac_file, "health_file": health_file, -- cgit v1.2.1