aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-07-26 21:28:06 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-07-26 21:28:06 +0200
commite1deaaf4a239db742cea2d1e6c4f48a9656d8a0f (patch)
treec3bbe11e47616f702f4c56734430005a5fc04504 /client
parentuse webp to save images (diff)
downloadscout-subs-e1deaaf4a239db742cea2d1e6c4f48a9656d8a0f.tar.gz
scout-subs-e1deaaf4a239db742cea2d1e6c4f48a9656d8a0f.zip
bug fixes and visual improvements
Diffstat (limited to 'client')
-rw-r--r--client/templates/client/index.html34
-rw-r--r--client/views.py15
2 files changed, 41 insertions, 8 deletions
diff --git a/client/templates/client/index.html b/client/templates/client/index.html
index 2ddbfdc..b368630 100644
--- a/client/templates/client/index.html
+++ b/client/templates/client/index.html
@@ -38,9 +38,20 @@
</div>
<div class="collapsible-body"><span>
{% if doc.0.status == "wait" %}
- <a class="waves-effect waves-light btn teal" onclick="send('f{{doc.0.id}}')"><i class="material-icons left">file_download</i> Scarica documento per approvazione</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>
+ <div class="hide-on-med-and-down">
+ <a class="waves-effect waves-light btn teal" onclick="send('f{{doc.0.id}}')"><i class="material-icons left">file_download</i> Scarica documento per approvazione</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>
+ </div>
+ <div class="hide-on-large-only">
+ <a class="s12 waves-effect waves-light btn teal" onclick="send('f{{doc.0.id}}')"><i class="material-icons left">file_download</i> Scarica documento per approvazione</a>
+ <br>
+ <br>
+ <a class="s12 waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i> Elimina documento</a>
+ <br>
+ <br>
+ <a class="s12 waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i> Modifica documento</a>
+ </div>
<br>
<br>
{% elif doc.0.status == "autosign" %}
@@ -56,9 +67,20 @@
<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>
+ <div class="hide-on-med-and-down">
+ <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>
+ </div>
+ <div class="hide-on-large-only">
+ <a class="s12 waves-effect waves-light btn teal modal-trigger" href="#modal{{doc.0.id}}"><i class="material-icons left">check</i>Approva documento</a>
+ <br>
+ <br>
+ <a class="s12 waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i>Elimina documento</a>
+ <br>
+ <br>
+ <a class="s12 waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i>Modifica documento</a>
+ </div>
<br>
<br>
{% endif %}
diff --git a/client/views.py b/client/views.py
index 6cc7a15..c9bb89b 100644
--- a/client/views.py
+++ b/client/views.py
@@ -52,8 +52,10 @@ def index(request):
if document.status == "autosign":
document.status = "ok"
document.save()
+ return HttpResponseRedirect("/")
elif request.POST["action"][0] == 'd':
document.delete()
+ return HttpResponseRedirect("/")
elif request.POST["action"][0] == 'e':
document_type = document.document_type
context = {
@@ -151,13 +153,18 @@ def create(request):
context['custom_message'] = document_type.custom_message
context['custom_message_text'] = document_type.custom_message_text
elif request.POST["action"] == "save":
+ document_type = DocumentType.objects.get(
+ id=request.POST["doctype"])
+
+ current_docs = Document.objects.filter(document_type=document_type)
+ if len(current_docs) > 0:
+ return
+
usercode = UserCode.objects.filter(user=request.user)[0]
code = 0
status = "wait"
personal_data = None
medical_data = None
- document_type = DocumentType.objects.get(
- id=request.POST["doctype"])
if document_type.auto_sign:
status = "autosign"
@@ -202,6 +209,10 @@ def edit_wrapper(request, context):
if request.method == "POST":
if "action" not in request.POST.keys():
document = Document.objects.get(id=request.POST["doc"])
+
+ if document.user != request.user:
+ return
+
usercode = UserCode.objects.filter(user=document.user)[0]
if document.document_type.personal_data: