aboutsummaryrefslogtreecommitdiffstats
path: root/client/templates
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-06-20 15:55:28 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-06-20 15:55:28 +0200
commitccc5d1f1b2cb4b5e2a95b97bbd1a5760ce585f08 (patch)
tree6912e8d96bce8bdf7782c7877a7a0928560c7a1a /client/templates
parentDocument support (diff)
downloadscout-subs-ccc5d1f1b2cb4b5e2a95b97bbd1a5760ce585f08.tar.gz
scout-subs-ccc5d1f1b2cb4b5e2a95b97bbd1a5760ce585f08.zip
Document custom field
Diffstat (limited to 'client/templates')
-rw-r--r--client/templates/client/doc_create.html95
-rw-r--r--client/templates/client/index.html55
2 files changed, 120 insertions, 30 deletions
diff --git a/client/templates/client/doc_create.html b/client/templates/client/doc_create.html
index a52518f..550eb54 100644
--- a/client/templates/client/doc_create.html
+++ b/client/templates/client/doc_create.html
@@ -4,7 +4,7 @@
{% block nav %}
<a style="margin-left: 10px;" href="{% url 'index' %}" class="breadcrumb">Home</a>
- <a href="#!" class="breadcrumb hide-on-med-and-down">Crea Doc</a>
+ <a href="#!" class="breadcrumb hide-on-med-and-down">Crea Documento</a>
{% endblock %}
{% block content %}
@@ -14,20 +14,78 @@
<div class="row">
<form id="form" action="{% url 'create'%}" method="post" class="col s12">
{% csrf_token %}
- <div class="row">
- <div class="input-field col s12">
- <select name="doctype">
- <option value="" disabled selected>Scegli</option>
- {% for doctype in docs%}
- <option value="{{doctype.id}}">{{doctype.name}}</option>
- {% endfor %}
- </select>
- <label>Documento</label>
+ <input type="hidden" name="action" id="action">
+ {% if not next %}
+ <div class="row">
+ <div class="input-field col s12">
+ <select name="doctype">
+ <option value="" disabled selected>Scegli</option>
+ {% for doctype in docs%}
+ <option value="{{doctype.id}}">{{doctype.name}}</option>
+ {% endfor %}
+ </select>
+ <label>Documento</label>
+ </div>
</div>
- </div>
- <button class="btn waves-effect waves-light" type="submit" name="action">Invia
- <i class="material-icons right">send</i>
- </button>
+ <a class="btn waves-effect waves-light" onclick="window.history.back();" >
+ <i class="material-icons left">navigate_before</i>Indietro
+ </a>
+ <a class="btn waves-effect waves-light" onclick="send('details')" >Avanti
+ <i class="material-icons right">navigate_next</i>
+ </a>
+ {% else %}
+ <input type="hidden" name="doctype" value="{{doctype.id}}">
+ <div class="row">
+ <div class="input-field col s12">
+ <select>
+ <option disabled selected>{{doctype.name}}</option>
+ </select>
+ <label>Documento</label>
+ </div>
+ </div>
+ {% if personal_data %}
+ <div class="row">
+ <div class="col s12">
+ <a style="pointer-events: none; cursor: default;" class="btn red lighten-1"> Il documento conterr&aacute le informazioni personali, prego verificare che siano corrette e aggiornate</a>
+ </div>
+ </div>
+ {% endif %}
+ {% if medical_data %}
+ <div class="row">
+ <div class="col s12">
+ <a style="pointer-events: none; cursor: default;" class="btn red lighten-1"> Il documento conterr&aacute le informazioni mediche, prego verificare che siano corrette e aggiornate</a>
+ </div>
+ </div>
+ {% endif %}
+ {% if custom_message %}
+ <div class="row">
+ <div class="col s12">
+ <a style="pointer-events: none; cursor: default;" class="btn red lighten-1">{{custom_message_text}}</a>
+ </div>
+ </div>
+ {% endif %}
+ {% if custom_data %}
+ {% for key in keys %}
+ <div class="row">
+ <div class="input-field col s12">
+ <input value="{{key.1}}" name="{{key.0.id}}" id="{{key.0.id}}" type="text" class="validate">
+ <label for="{{key.0.id}}">{{key.0.key}}</label>
+ </div>
+ </div>
+ {% endfor %}
+ {% endif %}
+ <div class="row">
+ <div class="col s12">
+ <br>
+ <a class="btn waves-effect waves-light" onclick="window.history.back();" >
+ <i class="material-icons left">navigate_before</i>Indietro
+ </a>
+ <a class="btn waves-effect waves-light" onclick="send('save')" >Crea
+ <i class="material-icons right">create</i>
+ </a>
+ </div>
+ </div>
+ {% endif %}
</form>
</div>
</div>
@@ -38,5 +96,14 @@
{% block script %}
$(document).ready(function(){
$('select').formSelect();
+ {% if error %}
+ M.toast({html: '{{ error_text}}', classes: 'orange'})
+ {% endif %}
});
+function send(id) {
+ var form = document.getElementById('form')
+ var action = document.getElementById('action')
+ action.setAttribute('value', id);
+ form.submit()
+}
{% endblock %} \ No newline at end of file
diff --git a/client/templates/client/index.html b/client/templates/client/index.html
index 2b19f30..96179b2 100644
--- a/client/templates/client/index.html
+++ b/client/templates/client/index.html
@@ -15,34 +15,56 @@
</div>
{% if user.is_authenticated %}
{% if user.is_staff or perms.client.approved %}
- <form id="selection" action="{% url 'doctype' %}" method="post">
- {% csrf_token %}
+ {% if not empty %}
<ul class="collapsible">
{% for doc in docs %}
<li>
<div class="collapsible-header">
- <label>
- <input name={{doc.id}} type="checkbox" class="filled-in"/>
- <span></span>
- </label>
- {% if doc.enabled %}
- <i class="material-icons">visibility_on</i>
- {% else %}
- <i class="material-icons">visibility_off</i>
+ {% if doc.0.status == "wait" %}
+ <i class="material-icons">timelapse</i>
+ {% elif doc.0.status == "ok" %}
+ <i class="material-icons">check</i>
{% endif %}
- {{doc.document_type.name}}
+ {{doc.0.document_type.name}}
+ <span class="badge" data-badge-caption="">{{doc.0.compilation_date}}</span></div>
</div>
<div class="collapsible-body"><span>
- {% for key in keys %}
- {{key}}<br>
- {% endfor %}
+ {% if doc.0.status == "wait" %}
+ <a class="waves-effect waves-light btn red lighten-1" href="{%url 'server'%}"><i class="material-icons left">file_download</i> Scarica documento per approvazione</a>
+ <a class="waves-effect waves-light btn red lighten-1" href="{%url 'server'%}"><i class="material-icons left">delete</i> Elimina documento</a>
+ <a class="waves-effect waves-light btn red lighten-1" href="{%url 'server'%}"><i class="material-icons left">edit</i> Modifica documento</a>
+ <br>
+ <br>
+ {% endif %}
+ {% if doc.0.document_type.personal_data %}
+ <i class="material-icons">person</i>
+ {% endif %}
+ {% if doc.0.document_type.medical_data %}
+ <i class="material-icons">healing</i>
+ {% endif %}
+ {% if doc.0.document_type.custom_data %}
+ <i class="material-icons">add_circle_outline</i>
+ {% endif %}
+ {% if doc.0.document_type.custom_data %}
+ <br>
+ <table class="striped">
+ <tbody>
+ {% for key in doc.1 %}
+ <tr>
+ <td>{{key.key}}</td>
+ <td>{{key.value}}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endif %}
</span></div>
</li>
{% endfor %}
</ul>
- </form>
+ {% endif %}
<div class="fixed-action-btn">
- <a id="add" class="btn-floating btn-large red lightend-1" href="{% url 'create'%}">
+ <a id="add" class="btn-floating btn-large red lighten-1" href="{% url 'create'%}">
<i class="large material-icons">add</i>
</a>
</div>
@@ -75,6 +97,7 @@
{% block script %}
$(document).ready(function(){
+ $('.collapsible').collapsible();
$('.tap-target').tapTarget();
{% if empty %}
$('.tap-target').tapTarget('open');