aboutsummaryrefslogtreecommitdiffstats
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
parentverify attachments upload (diff)
downloadscout-subs-02667f162ecaa344c0fbee54fe0ef11bdee9cb2a.tar.gz
scout-subs-02667f162ecaa344c0fbee54fe0ef11bdee9cb2a.zip
new uc fix document lists
-rw-r--r--client/templates/client/index.html6
-rw-r--r--client/views.py3
-rw-r--r--server/templates/server/doc_list.html12
-rw-r--r--server/templates/server/doc_list_readonly.html12
-rw-r--r--server/templates/server/doc_list_table.html20
-rw-r--r--server/views.py6
-rw-r--r--version.txt2
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 @@
<ul class="collapsible">
{% for doc in docs %}
<li class="item">
- <input value="{{doc.user|user_primary_group}}" type="hidden">
+ <input value="{{doc.usercode.branca}}" type="hidden">
<div class="collapsible-header">
<label>
<input name={{doc.id}} type="checkbox" class="filled-in allselect"/>
@@ -179,7 +179,7 @@
{{doc.id}}:
{% endif %}
{{doc.document_type.name}}
- <span class="badge" data-badge-caption="">{{doc.user.first_name}} {{doc.user.last_name}}</span>
+ <span class="badge" data-badge-caption="">{{doc.usercode.first_name}} {{doc.usercode.last_name}}</span>
</div>
<div class="collapsible-body"><span>
{% if doc.status == "ok" or doc.status == 'archive' %}
@@ -211,11 +211,11 @@
<div class="collapsible-body"><span>
<div class="row">
<div class="input-field col l4 s12">
- <input disabled value="{{doc.user.first_name}}" id="first_name" type="text" >
+ <input disabled value="{{doc.usercode.first_name}}" id="first_name" type="text" >
<label for="first_name">Nome</label>
</div>
<div class="input-field col l4 s12">
- <input disabled value="{{doc.user.last_name}}" id="last_name" type="text" >
+ <input disabled value="{{doc.usercode.last_name}}" id="last_name" type="text" >
<label for="last_name">Cognome</label>
</div>
<div class="input-field col l4 s12">
@@ -223,7 +223,7 @@
<label for="birth_date">Data di nascita</label>
</div>
<div class="input-field col l4 s12">
- <input disabled value="{{doc.user|user_primary_group}}" id="branca" type="text">
+ <input disabled value="{{doc.usercode.branca}}" id="branca" type="text">
<label for="branca">Branca</label>
</div>
<div class="input-field col l4 s12">
@@ -536,7 +536,7 @@ $('#chips_owner').chips({
autocompleteOptions: {
data: {
{% for user in users %}
- '{{user.user__username}} ({{user.user__first_name}} {{user.user__last_name}})': null,
+ '{{user.usercode__first_name}} {{user.usercode__last_name}}': null,
{% endfor %}
},
limit: Infinity,
diff --git a/server/templates/server/doc_list_readonly.html b/server/templates/server/doc_list_readonly.html
index ab80242..0ae80e2 100644
--- a/server/templates/server/doc_list_readonly.html
+++ b/server/templates/server/doc_list_readonly.html
@@ -136,7 +136,7 @@
<ul class="collapsible">
{% for doc in docs %}
<li class="item">
- <input value="{{doc.user|user_primary_group}}" type="hidden">
+ <input value="{{doc.usercode.branca}}" type="hidden">
<div class="collapsible-header">
<label>
<input name={{doc.id}} type="checkbox" class="filled-in allselect"/>
@@ -159,7 +159,7 @@
{{doc.id}}:
{% endif %}
{{doc.document_type.name}}
- <span class="badge" data-badge-caption="">{{doc.user.first_name}} {{doc.user.last_name}}</span>
+ <span class="badge" data-badge-caption="">{{doc.usercode.first_name}} {{doc.usercode.last_name}}</span>
</div>
<div class="collapsible-body"><span>
{% if doc.status == "ok" or doc.status == 'archive' %}
@@ -191,11 +191,11 @@
<div class="collapsible-body"><span>
<div class="row">
<div class="input-field col l4 s12">
- <input disabled value="{{doc.user.first_name}}" id="first_name" type="text" >
+ <input disabled value="{{doc.usercode.first_name}}" id="first_name" type="text" >
<label for="first_name">Nome</label>
</div>
<div class="input-field col l4 s12">
- <input disabled value="{{doc.user.last_name}}" id="last_name" type="text" >
+ <input disabled value="{{doc.usercode.last_name}}" id="last_name" type="text" >
<label for="last_name">Cognome</label>
</div>
<div class="input-field col l4 s12">
@@ -203,7 +203,7 @@
<label for="birth_date">Data di nascita</label>
</div>
<div class="input-field col l4 s12">
- <input disabled value="{{doc.user|user_primary_group}}" id="branca" type="text">
+ <input disabled value="{{doc.usercode.branca}}" id="branca" type="text">
<label for="branca">Branca</label>
</div>
<div class="input-field col l4 s12">
@@ -516,7 +516,7 @@ $('#chips_owner').chips({
autocompleteOptions: {
data: {
{% for user in users %}
- '{{user.user__username}} ({{user.user__first_name}} {{user.user__last_name}})': null,
+ '{{user.usercode__first_name}} {{user.usercode__last_name}}': null,
{% endfor %}
},
limit: Infinity,
diff --git a/server/templates/server/doc_list_table.html b/server/templates/server/doc_list_table.html
index 0096380..6b3556b 100644
--- a/server/templates/server/doc_list_table.html
+++ b/server/templates/server/doc_list_table.html
@@ -110,16 +110,6 @@
$(document).ready(function(){
$('#modal1').modal();
$('#modal2').modal();
- var elemsMapping = {};
- var rows = table.getRows();
- for (var i = 0; i < rows.length; i++) {
- var cell = rows[i].getCell("username");
- if (cell.getValue() == "col_row") {
- var group = rows[i].getCell("type").getValue();
- elemsMapping[group] = rows[i].getElement();
- }
- }
-
$(".tabulator-col-resize-handle").css("margin-left", "-3px");
});
@@ -146,13 +136,12 @@
type: "{{doc.document_type.name}}",
code: {% if doc.status == "ok" or doc.status == "archive" %} "{{doc.code}}" {% else %} "???" {% endif %},
compilation_date: "{{doc.compilation_date}}",
- capo: {% if "capi" in doc.user|user_groups %}true{% else %}false{% endif %},
- username: "{{doc.user.username}}",
- name: "{{doc.user.first_name}}",
- last_name: "{{doc.user.last_name}}",
+ capo: {% if "capi" in doc.usercode.user|user_groups %}true{% else %}false{% endif %},
+ name: "{{doc.usercode.first_name}}",
+ last_name: "{{doc.usercode.last_name}}",
email: "{{doc.personal_data.email}}",
birth_date: "{{doc.personal_data.born_date}}",
- branca: "{{ doc.user|user_primary_group }}",
+ branca: "{{ doc.usercode.branca }}",
parent_name: "{{doc.personal_data.parent_name}}",
avs_number: "{{doc.personal_data.avs_number}}",
via: "{{doc.personal_data.via}}",
@@ -190,7 +179,6 @@
var col_categories = [
{field: "base", name: "Informazioni base", cols:
[
- {title: "Username", field: "username"},
{title: "Stato", field: "status", formatter: iconFormatter},
{title: "Tipo", field: "type"},
{title: "Codice", field: "code"},
diff --git a/server/views.py b/server/views.py
index edb9d0c..b7a8094 100644
--- a/server/views.py
+++ b/server/views.py
@@ -1182,7 +1182,7 @@ def doclist(request):
# run query
documents = Document.objects.filter(q_obj).select_related("personal_data", "medical_data", "document_type", "user")
- users = documents.values("user__username", "user__first_name", "user__last_name")
+ users = documents.values("usercode__first_name", "usercode__last_name")
vac_file = ["/server/media/", "/vac_certificate/doc"]
health_file = ["/server/media/", "/health_care_certificate/doc"]
@@ -1347,7 +1347,7 @@ def doclist_table(request):
# run query
documents = Document.objects.filter(q_obj).select_related("personal_data", "medical_data", "document_type", "user")
- users = documents.values("user__username", "user__first_name", "user__last_name")
+ users = documents.values("usercode__first_name", "usercode__last_name")
# get types and users for chips autocompletation
if request.user.is_staff:
@@ -1552,7 +1552,7 @@ def doclist_readonly(request):
# run query
documents = Document.objects.filter(q_obj).select_related("personal_data", "medical_data", "document_type", "user")
- users = documents.values("user__username", "user__first_name", "user__last_name")
+ users = documents.values("usercode__first_name", "usercode__last_name")
vac_file = ["/server/media/", "/vac_certificate/doc"]
health_file = ["/server/media/", "/health_care_certificate/doc"]
diff --git a/version.txt b/version.txt
index 4b3a076..fb4e7ab 100644
--- a/version.txt
+++ b/version.txt
@@ -1,2 +1,2 @@
version=0.6
-rev=35
+rev=36