aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-07-21 21:47:09 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-07-21 21:47:09 +0200
commita531c5e12a65ac7c216bb3f91e510c1d31fbb06e (patch)
treec306bfc36f54815759cfe4b15b8f296865e2b70e /client
parentmodify gitignore (diff)
downloadscout-subs-a531c5e12a65ac7c216bb3f91e510c1d31fbb06e.tar.gz
scout-subs-a531c5e12a65ac7c216bb3f91e510c1d31fbb06e.zip
static files, last improvements0.1
Diffstat (limited to 'client')
-rw-r--r--client/templates/client/approve.html2
-rw-r--r--client/templates/client/doc_create.html3
-rw-r--r--client/templates/client/doc_edit.html3
-rw-r--r--client/templates/client/index.html18
-rw-r--r--client/views.py10
5 files changed, 30 insertions, 6 deletions
diff --git a/client/templates/client/approve.html b/client/templates/client/approve.html
index f440fbe..d24df88 100644
--- a/client/templates/client/approve.html
+++ b/client/templates/client/approve.html
@@ -24,7 +24,7 @@
<div class="col l4 offset-l4 m8 offset-m2 s12">
<div class="card">
<div class="card-content">
- <p>Per approvare l'utente inserire prima i propri dati personali cliccando il proprio nome in alto a destra.</p>
+ <p>Per approvare l'utente inserire prima i propri dati personali e medici cliccando il proprio nome in alto a destra.</p>
</div>
</div>
</div>
diff --git a/client/templates/client/doc_create.html b/client/templates/client/doc_create.html
index 710ba29..82d23ff 100644
--- a/client/templates/client/doc_create.html
+++ b/client/templates/client/doc_create.html
@@ -117,7 +117,8 @@ $(document).ready(function(){
{% if error %}
M.toast({html: '{{ error_text}}', classes: 'orange'})
{% endif %}
- });
+});
+
function send(id) {
var form = document.getElementById('form')
var action = document.getElementById('action')
diff --git a/client/templates/client/doc_edit.html b/client/templates/client/doc_edit.html
index 0048fd5..3c97eee 100644
--- a/client/templates/client/doc_edit.html
+++ b/client/templates/client/doc_edit.html
@@ -96,7 +96,8 @@ $(document).ready(function(){
{% if error %}
M.toast({html: '{{ error_text}}', classes: 'orange'})
{% endif %}
- });
+});
+
function send(id) {
var form = document.getElementById('form')
form.submit()
diff --git a/client/templates/client/index.html b/client/templates/client/index.html
index 0eb244e..2ddbfdc 100644
--- a/client/templates/client/index.html
+++ b/client/templates/client/index.html
@@ -44,7 +44,19 @@
<br>
<br>
{% elif doc.0.status == "autosign" %}
- <a class="waves-effect waves-light btn teal" onclick="send('a{{doc.0.id}}')"><i class="material-icons left">check</i>Approva documento</a>
+ <div id="modal{{doc.0.id}}" class="modal">
+ <div class="modal-content">
+ <h4>Attenzione</h4>
+ <p>Una volta approvato il documento non potrà più essere modificato.<br>
+ Sei sicuro di volerlo approvare?
+ </p>
+ </div>
+ <div class="modal-footer">
+ <a style="color:red" href="#!" class="modal-close waves-effect waves-green btn-flat">Annulla</a>
+ <a onclick="send('a{{doc.0.id}}')" class="modal-close waves-effect waves-green btn-flat">Approva</a>
+ </div>
+ </div>
+ <a class="waves-effect waves-light btn teal modal-trigger" href="#modal{{doc.0.id}}"><i class="material-icons left">check</i>Approva documento</a>
<a class="waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i> Elimina documento</a>
<a class="waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i> Modifica documento</a>
<br>
@@ -335,15 +347,19 @@
$(document).ready(function(){
$('.collapsible').collapsible();
$('.tap-target').tapTarget();
+ $('.modal').modal();
+ $('.tooltipped').tooltip();
{% if empty %}
$('.tap-target').tapTarget('open');
{% endif %}
});
+
$('*').click(function(event) {
if (this === event.target) {
$('.tap-target').tapTarget('close');
}
});
+
function send(id) {
var form = document.getElementById('form')
var action = document.getElementById('action')
diff --git a/client/views.py b/client/views.py
index f215e7e..6cc7a15 100644
--- a/client/views.py
+++ b/client/views.py
@@ -36,6 +36,9 @@ def index(request):
if document.user != request.user:
return
+ if document.status == "ok" or document.status == "archive":
+ return
+
if request.POST["action"][0] == 'f':
template = get_template('client/approve_doc_pdf.html')
context = {'doc': document}
@@ -46,8 +49,9 @@ def index(request):
return FileResponse(result, as_attachment=True, filename=document.document_type.name+".pdf")
elif request.POST["action"][0] == 'a':
- document.status = "ok"
- document.save()
+ if document.status == "autosign":
+ document.status = "ok"
+ document.save()
elif request.POST["action"][0] == 'd':
document.delete()
elif request.POST["action"][0] == 'e':
@@ -73,6 +77,8 @@ def index(request):
for i in documents:
personal = None
medical = None
+ vac_file = ""
+ health_file = ""
if i.document_type.personal_data:
personal = i.personal_data
if i.document_type.medical_data: