aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAndrea Lepori <aleporia@gmail.com>2023-07-27 16:16:25 +0200
committerAndrea Lepori <aleporia@gmail.com>2023-07-27 16:16:26 +0200
commit02667f162ecaa344c0fbee54fe0ef11bdee9cb2a (patch)
tree45a52f3928ffa2315dd4f2462df9e3901797300b /client
parentverify attachments upload (diff)
downloadscout-subs-02667f162ecaa344c0fbee54fe0ef11bdee9cb2a.tar.gz
scout-subs-02667f162ecaa344c0fbee54fe0ef11bdee9cb2a.zip
new uc fix document lists
Diffstat (limited to 'client')
-rw-r--r--client/templates/client/index.html6
-rw-r--r--client/views.py3
2 files changed, 7 insertions, 2 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