aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2023-07-24 11:56:04 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2023-07-24 11:56:07 +0200
commit9224efb213f92e52557244937b99031dc25f0ce0 (patch)
tree3c52110e0af15435bbe477959a89481eb7804008 /server
parentprototype for doclist table (diff)
parentMerge branch 'master' of ssh://git.thearcway.org:2222/~/r/mafaldo/scout-subs (diff)
downloadscout-subs-9224efb213f92e52557244937b99031dc25f0ce0.tar.gz
scout-subs-9224efb213f92e52557244937b99031dc25f0ce0.zip
Merge branch 'master' into dev
Diffstat (limited to '')
-rw-r--r--server/templates/server/doc_list.html22
-rw-r--r--server/templates/server/doc_list_readonly.html22
-rw-r--r--server/templates/server/user_list.html16
-rw-r--r--server/views.py20
4 files changed, 59 insertions, 21 deletions
diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html
index 06c8893..db1ee4e 100644
--- a/server/templates/server/doc_list.html
+++ b/server/templates/server/doc_list.html
@@ -437,7 +437,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if doc.signed_doc %} <img class="lazyload" data-src="{{ sign_doc_file.0 }}{{ doc.id }}{{ sign_doc_file.1 }}"> {% endif %}
+ {% if doc.signed_doc %}
+ <img class="lazy" data-src="{{ sign_doc_file.0 }}{{ doc.id }}{{ sign_doc_file.1 }}">
+ {% else %}
+ <p>Foto della conferma firmata non caricata</p>
+ {% endif %}
</div>
</div>
</div>
@@ -447,7 +451,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if doc.medical_data.health_care_certificate %}<img class="lazyload" data-src="{{ health_file.0 }}{{ doc.id }}{{ health_file.1}}">{% endif %}
+ {% if doc.medical_data.health_care_certificate %}
+ <img class="lazy" data-src="{{ health_file.0 }}{{ doc.id }}{{ health_file.1}}">
+ {% else %}
+ <p>Foto della tessera della cassa malati non caricata</p>
+ {% endif %}
</div>
</div>
</div>
@@ -456,7 +464,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if doc.medical_data.vac_certificate %}<img class="lazyload" data-src="{{ vac_file.0 }}{{ doc.id }}{{ vac_file.1}}">{% endif %}
+ {% if doc.medical_data.vac_certificate %}
+ <img class="lazy" data-src="{{ vac_file.0 }}{{ doc.id }}{{ vac_file.1}}">
+ {% else %}
+ <p>Foto del certificato di vacinazione non caricato</p>
+ {% endif %}
</div>
</div>
</div>
@@ -487,7 +499,9 @@ $(document).ready(function(){
update();
document.getElementById('progress_bar').className = "determinate";
{% endif %}
- lazyload();
+ var lazyLoadInstance = new LazyLoad({
+ // Your custom settings go here
+ });
});
function resetModal() {
diff --git a/server/templates/server/doc_list_readonly.html b/server/templates/server/doc_list_readonly.html
index c29fb74..ab80242 100644
--- a/server/templates/server/doc_list_readonly.html
+++ b/server/templates/server/doc_list_readonly.html
@@ -417,7 +417,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if doc.signed_doc %} <img class="lazyload" data-src="{{ sign_doc_file.0 }}{{ doc.id }}{{ sign_doc_file.1 }}"> {% endif %}
+ {% if doc.signed_doc %}
+ <img class="lazy" data-src="{{ sign_doc_file.0 }}{{ doc.id }}{{ sign_doc_file.1 }}">
+ {% else %}
+ <p>Foto della conferma firmata non caricata</p>
+ {% endif %}
</div>
</div>
</div>
@@ -427,7 +431,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if doc.medical_data.health_care_certificate %}<img class="lazyload" data-src="{{ health_file.0 }}{{ doc.id }}{{ health_file.1}}">{% endif %}
+ {% if doc.medical_data.health_care_certificate %}
+ <img class="lazy" data-src="{{ health_file.0 }}{{ doc.id }}{{ health_file.1}}">
+ {% else %}
+ <p>Foto della tessera della cassa malati non caricata</p>
+ {% endif %}
</div>
</div>
</div>
@@ -436,7 +444,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if doc.medical_data.vac_certificate %}<img class="lazyload" data-src="{{ vac_file.0 }}{{ doc.id }}{{ vac_file.1}}">{% endif %}
+ {% if doc.medical_data.vac_certificate %}
+ <img class="lazy" data-src="{{ vac_file.0 }}{{ doc.id }}{{ vac_file.1}}">
+ {% else %}
+ <p>Foto del certificato di vacinazione non caricato</p>
+ {% endif %}
</div>
</div>
</div>
@@ -467,7 +479,9 @@ $(document).ready(function(){
update();
document.getElementById('progress_bar').className = "determinate";
{% endif %}
- lazyload();
+ var lazyLoadInstance = new LazyLoad({
+ // Your custom settings go here
+ });
});
function resetModal() {
diff --git a/server/templates/server/user_list.html b/server/templates/server/user_list.html
index 6224df7..dffb8b2 100644
--- a/server/templates/server/user_list.html
+++ b/server/templates/server/user_list.html
@@ -271,7 +271,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if user.medic.health_care_certificate %}<img class="lazyload" data-src="{{ health_file.0 }}{{ user.id }}{{ health_file.1}}">{% endif %}
+ {% if user.medic.health_care_certificate %}
+ <img class="lazy" data-src="{{ health_file.0 }}{{ user.id }}{{ health_file.1}}">
+ {% else %}
+ <p>Foto della tessera della cassa malati non caricata</p>
+ {% endif %}
</div>
</div>
</div>
@@ -280,7 +284,11 @@
<div class="col s12">
<div class="card">
<div class="card-image">
- {% if user.medic.vac_certificate %}<img class="lazyload" data-src="{{ vac_file.0 }}{{ user.id }}{{ vac_file.1 }}">{% endif %}
+ {% if user.medic.vac_certificate %}
+ <img class="lazy" data-src="{{ vac_file.0 }}{{ user.id }}{{ vac_file.1 }}">
+ {% else %}
+ <p>Foto del certificato di vacinazione non caricato</p>
+ {% endif %}
</div>
</div>
</div>
@@ -313,7 +321,9 @@
$(document).ready(function(){
$('.modal').modal();
$('.collapsible').collapsible();
- lazyload();
+ var lazyLoadInstance = new LazyLoad({
+ // Your custom settings go here
+ });
});
function send(id) {
diff --git a/server/views.py b/server/views.py
index dd9bcec..141c9f7 100644
--- a/server/views.py
+++ b/server/views.py
@@ -233,13 +233,13 @@ def docapprove(request):
messages.append(data[i] + " - Formato errato")
elif Document.objects.filter(code=data[i]).count() == 0:
messages.append(data[i] + " - Invalido")
- elif Document.objects.filter(code=data[i])[0].group.name not in groups:
+ elif Document.objects.filter(code=data[i])[0].group not in groups:
# check if user has permission to approve document
messages.append(data[i] + " - Invalido")
else:
document = Document.objects.filter(code=data[i])[0]
- if document.group.name not in groups:
+ if document.group not in groups:
return
if document.status != 'wait' and document.status != 'ok':
@@ -265,14 +265,14 @@ def docapprove(request):
elif Document.objects.filter(code=data).count() == 0:
error_text = "Codice invalido"
error = True
- elif Document.objects.filter(code=data)[0].group.name not in groups:
+ elif Document.objects.filter(code=data)[0].group not in groups:
error_text = "Codice invalido"
error = True
else:
# get document
document = Document.objects.filter(code=data)[0]
- if document.group.name not in groups:
+ if document.group not in groups:
return
if document.status != 'wait' and document.status != 'ok':
@@ -342,7 +342,7 @@ def approve_direct(request):
return
# check if user has permission to approve document
- if document.group.name not in groups:
+ if document.group not in groups:
return
document.status = "ok"
@@ -370,7 +370,7 @@ def approve_direct(request):
return render(request, 'server/approve_doc_direct.html', {"error": "Questo documento non รจ in attesa di approvazione"})
# check if user has permission to approve document
- if document.group.name not in groups:
+ if document.group not in groups:
return render(request, 'server/approve_doc_direct.html', {"error": "Non hai il permesso di approvare questo documento"})
return render(request, 'server/approve_doc_direct.html', {"doc": document})
@@ -1795,7 +1795,7 @@ def docpreview(request):
# get document
document = Document.objects.filter(code=code)[0]
- doc_group = document.group.name
+ doc_group = document.group
parent_group = document.user.groups.values_list('name', flat=True)[0]
# user has not permission to view document
@@ -1847,7 +1847,7 @@ def data_request(request):
context["data"] = data
elif request.POST["request"] == "data_user":
perm = Permission.objects.get(codename="approved")
- users = User.objects.filter(groups__name=parent_group, user_permissions=perm)
+ users = User.objects.filter(groups=parent_group, user_permissions=perm)
# get time for filename
current_time = datetime.strftime(datetime.now(), "%H_%M__%d_%m_%y")
@@ -1895,7 +1895,7 @@ def data_request(request):
elif request.POST["request"] == "data_user_medic":
perm = Permission.objects.get(codename="approved")
- users = User.objects.filter(groups__name=parent_group, user_permissions=perm)
+ users = User.objects.filter(groups=parent_group, user_permissions=perm)
# get time for filename
current_time = datetime.strftime(datetime.now(), "%H_%M__%d_%m_%y")
@@ -1968,7 +1968,7 @@ def media_request(request, id=0, t="", flag=""):
usercode = UserCode.objects.get(id=id)
if request.user.is_staff:
groups = getGroups(request)
- usercode_group = usercode.user.groups[0]
+ usercode_group = list(usercode.user.groups.all())[0]
if usercode_group not in groups:
return
else: