aboutsummaryrefslogtreecommitdiffstats
path: root/server/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 /server/templates
parentDocument support (diff)
downloadscout-subs-ccc5d1f1b2cb4b5e2a95b97bbd1a5760ce585f08.tar.gz
scout-subs-ccc5d1f1b2cb4b5e2a95b97bbd1a5760ce585f08.zip
Document custom field
Diffstat (limited to '')
-rw-r--r--server/templates/server/approve_doc.html43
-rw-r--r--server/templates/server/approve_user.html51
-rw-r--r--server/templates/server/doc_edit.html19
-rw-r--r--server/templates/server/doc_list.html65
-rw-r--r--server/templates/server/doc_type.html52
-rw-r--r--server/templates/server/index.html2
6 files changed, 184 insertions, 48 deletions
diff --git a/server/templates/server/approve_doc.html b/server/templates/server/approve_doc.html
new file mode 100644
index 0000000..82ecf2a
--- /dev/null
+++ b/server/templates/server/approve_doc.html
@@ -0,0 +1,43 @@
+{% extends 'registration/base.html' %}
+
+{% block title %}Admin - Approva Utente{% endblock %}
+
+{% block nav %}
+ <a style="margin-left: 10px;" href="{% url 'index' %}" class="breadcrumb">Home</a>
+ <a href="{% url 'server'%}" class="breadcrumb hide-on-med-and-down">Admin</a>
+ <a href="{% url 'docapprove'%}" class="breadcrumb hide-on-med-and-down">Approva Documento</a>
+{% endblock %}
+
+{% block content %}
+
+{% if not empty %}
+ <div class="row">
+ <div class="col l4 offset-l4 m8 offset-m2 s12">
+ <div class="card">
+ <ul class="collection">
+ {% for i in messages %}
+ <li class="collection-item">{{ i }}</li>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
+ </div>
+{% endif %}
+
+<div class="row">
+ <div class="col l4 offset-l4 m8 offset-m2 s12">
+ <div class="card">
+ <form id="form" action="{% url 'docapprove'%}" method="post">
+ {% csrf_token %}
+ <div class="card-content">
+ <p>Inserire un codice per riga</p>
+ <textarea name="codes" class="materialize-textarea"></textarea>
+ </div>
+ <div class="card-action">
+ <a href="#" onclick="document.getElementById('form').submit()">Invia</a>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+{% endblock %} \ No newline at end of file
diff --git a/server/templates/server/approve_user.html b/server/templates/server/approve_user.html
index 126c0b9..9d4b36c 100644
--- a/server/templates/server/approve_user.html
+++ b/server/templates/server/approve_user.html
@@ -3,24 +3,41 @@
{% block title %}Admin - Approva Utente{% endblock %}
{% block nav %}
- <a style="margin-left: 10px;" href="{% url 'index' %}" class="breadcrumb">Home</a>
- <a href="{% url 'server'%}" class="breadcrumb hide-on-med-and-down">Admin</a>
- <a href="#!" class="breadcrumb hide-on-med-and-down">Approva Utente</a>
+ <a style="margin-left: 10px;" href="{% url 'index' %}" class="breadcrumb">Home</a>
+ <a href="{% url 'server'%}" class="breadcrumb hide-on-med-and-down">Admin</a>
+ <a href="{% url 'uapprove'%}" class="breadcrumb hide-on-med-and-down">Approva Utente</a>
{% endblock %}
{% block content %}
-<p>Inserire un codice per riga</p>
-<ul class="collection">
-{% for i in messages %}
- <li class="collection-item">{{ i }}</li>
-{% endfor %}
-</ul>
-<form action="{% url 'uapprove'%}" method="post">
- {% csrf_token %}
- <textarea name="codes" class="materialize-textarea"></textarea>
- <br><br>
- <button type="submit" class="btn waves-effect waves-light">Invia
- <i class="material-icons right">send</i>
- </button>
-</form>
+
+{% if not empty %}
+ <div class="row">
+ <div class="col l4 offset-l4 m8 offset-m2 s12">
+ <div class="card">
+ <ul class="collection">
+ {% for i in messages %}
+ <li class="collection-item">{{ i }}</li>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
+ </div>
+{% endif %}
+
+<div class="row">
+ <div class="col l4 offset-l4 m8 offset-m2 s12">
+ <div class="card">
+ <form id="form" action="{% url 'uapprove'%}" method="post">
+ {% csrf_token %}
+ <div class="card-content">
+ <p>Inserire un codice per riga</p>
+ <textarea name="codes" class="materialize-textarea"></textarea>
+ </div>
+ <div class="card-action">
+ <a href="#" onclick="document.getElementById('form').submit()">Invia</a>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
{% endblock %} \ No newline at end of file
diff --git a/server/templates/server/doc_edit.html b/server/templates/server/doc_edit.html
index cca0607..8b01c35 100644
--- a/server/templates/server/doc_edit.html
+++ b/server/templates/server/doc_edit.html
@@ -41,31 +41,44 @@
</div>
</div>
<div class="row">
- <div class="input-field col s3">
+ <div class="input-field col s2">
<label>
<input name="personal_data" type="checkbox" class="filled-in" {{personal_check}}/>
<span>Dati personali</span>
</label>
</div>
- <div class="input-field col s3">
+ <div class="input-field col s2">
<label>
<input name="medical_data" type="checkbox" class="filled-in" {{medical_check}} />
<span>Dati medici</span>
</label>
</div>
- <div class="input-field col s3">
+ <div class="input-field col s4">
<label>
<input name="custom_data" type="checkbox" class="filled-in" {{custom_check}}/>
<span>Parametri personalizzati</span>
</label>
</div>
+ <div class="input-field col s4">
+ <label>
+ <input name="custom_message" type="checkbox" class="filled-in" {{custom_message_check}}/>
+ <span>Messaggio personalizzato</span>
+ </label>
+ </div>
</div>
+ <br>
<div class="row">
<div class="input-field col s12">
<textarea name="custom" id="textarea" class="materialize-textarea"></textarea>
<label for="textarea">Lista parametri personalizzati, uno per riga</label>
</div>
</div>
+ <div class="row">
+ <div class="input-field col s12">
+ <textarea name="custom_message_text" id="textarea" class="materialize-textarea"></textarea>
+ <label for="textarea">Messaggio personalizzato</label>
+ </div>
+ </div>
<div class="fixed-action-btn">
<a class="btn-floating btn-large red lighten-1" onclick="document.getElementById('form').submit()">
<i class="large material-icons">save</i>
diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html
index cf98010..c5978b1 100644
--- a/server/templates/server/doc_list.html
+++ b/server/templates/server/doc_list.html
@@ -7,10 +7,12 @@
<div class="nav-wrapper red lighten-1">
<a style="margin-left: 10px;" href="{% url 'index' %}" class="breadcrumb">Home</a>
<a href="{% url 'server'%}" class="breadcrumb hide-on-med-and-down">Admin</a>
- <a href="{% url 'doctype' %}" class="breadcrumb hide-on-med-and-down">Documenti</a>
+ <a href="{% url 'doclist' %}" class="breadcrumb hide-on-med-and-down">Documenti</a>
<ul class="right">
{% if user.is_staff %}
- <li><a onclick="document.getElementById('selection').submit()">Elimina selezionati</a></li>
+ <li><a onclick="send('archive')">Archivia selezionati</a></li>
+ <li><a onclick="send('approve')">Approva selezionati</a></li>
+ <li><a onclick="send('delete')">Elimina selezionati</a></li>
<li><a href="{% url 'server' %}">Pannello Admin</a></li>
{% endif %}
{% if user.is_authenticated %}
@@ -30,41 +32,70 @@
{% endblock %}
{% block content %}
-<form id="selection" action="{% url 'doctype' %}" method="post">
+<form id="selection" action="{% url 'doclist' %}" method="post">
{% csrf_token %}
+<input type="hidden" name="action" id="action">
<ul class="collapsible">
{% for doc in docs %}
<li>
<div class="collapsible-header">
<label>
- <input name={{doc.id}} type="checkbox" class="filled-in"/>
+ <input name={{doc.0.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>
+ {% elif doc.0.status == "archive" %}
+ <i class="material-icons">archive</i>
{% endif %}
- {{doc.document_type.name}}
+ {{doc.0.document_type.name}}
+ <span class="badge" data-badge-caption="">{{doc.0.user.username}}</span></div>
</div>
<div class="collapsible-body"><span>
- {% for key in keys %}
- {{key}}<br>
- {% endfor %}
+ {{doc.0.code}} <br>
+ {{doc.0.compilation_date}}<br>
+ {% 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_message %}
+ <i class="material-icons">message</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>
-<div class="fixed-action-btn">
- <a class="btn-floating btn-large red lightend-1" href="{% url 'docedit'%}">
- <i class="large material-icons">add</i>
- </a>
-</div>
{% endblock %}
{%block script%}
$(document).ready(function(){
$('.collapsible').collapsible();
});
+function send(id) {
+ var form = document.getElementById('selection')
+ var action = document.getElementById('action')
+ action.setAttribute('value', id);
+ form.submit()
+}
{% endblock %} \ No newline at end of file
diff --git a/server/templates/server/doc_type.html b/server/templates/server/doc_type.html
index 75bb79a..fecfc9d 100644
--- a/server/templates/server/doc_type.html
+++ b/server/templates/server/doc_type.html
@@ -10,7 +10,8 @@
<a href="{% url 'doctype' %}" class="breadcrumb hide-on-med-and-down">Tipo Doc</a>
<ul class="right">
{% if user.is_staff %}
- <li><a onclick="document.getElementById('selection').submit()">Elimina selezionati</a></li>
+ <li><a onclick="send('hide')">Nascondi/mostra selezionati</a></li>
+ <li><a onclick="send('delete')">Elimina selezionati</a></li>
<li><a href="{% url 'server' %}">Pannello Admin</a></li>
{% endif %}
{% if user.is_authenticated %}
@@ -32,32 +33,56 @@
{% block content %}
<form id="selection" action="{% url 'doctype' %}" method="post">
{% csrf_token %}
+<input type="hidden" name="action" id="action">
<ul class="collapsible">
{% for doctype in docs %}
<li>
<div class="collapsible-header">
<label>
- <input name={{doctype.id}} type="checkbox" class="filled-in"/>
+ <input name={{doctype.0.id}} type="checkbox" class="filled-in"/>
<span></span>
</label>
- {% if doctype.enabled %}
- <i class="material-icons">visibility_on</i>
- {% else %}
+ {% if not doctype.0.enabled %}
<i class="material-icons">visibility_off</i>
{% endif %}
- {{doctype.name}}
+ {% if not doctype.0.group_private %}
+ <i class="material-icons">public</i>
+ {% endif %}
+ {{doctype.0.name}}
+ <span class="new badge red lighten-1" data-badge-caption="">{{doctype.2}}</span></div>
</div>
<div class="collapsible-body"><span>
- {% for key in keys %}
- {{key}}<br>
- {% endfor %}
+ {% if doctype.0.personal_data %}
+ <i class="material-icons">person</i>
+ {% endif %}
+ {% if doctype.0.medical_data %}
+ <i class="material-icons">healing</i>
+ {% endif %}
+ {% if doctype.0.custom_data %}
+ <i class="material-icons">add_circle_outline</i>
+ {% endif %}
+ {% if doctype.0.custom_message %}
+ <i class="material-icons">message</i>
+ {% endif %}
+ {% if doctype.0.custom_data %}
+ <br>
+ <ul class="collection">
+ {% for key in doctype.1 %}
+ <li class="collection-item">{{key.key}}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% if doctype.0.custom_message %}
+ <br>
+ {{doctype.0.custom_message_text}}
+ {% endif %}
</span></div>
</li>
{% endfor %}
</ul>
</form>
<div class="fixed-action-btn">
- <a class="btn-floating btn-large red lightend-1" href="{% url 'docedit'%}">
+ <a class="btn-floating btn-large red lighten-1" href="{% url 'docedit'%}">
<i class="large material-icons">add</i>
</a>
</div>
@@ -67,4 +92,11 @@
$(document).ready(function(){
$('.collapsible').collapsible();
});
+
+function send(id) {
+ var form = document.getElementById('selection')
+ var action = document.getElementById('action')
+ action.setAttribute('value', id);
+ form.submit()
+}
{% endblock %} \ No newline at end of file
diff --git a/server/templates/server/index.html b/server/templates/server/index.html
index 4095d4a..d88454f 100644
--- a/server/templates/server/index.html
+++ b/server/templates/server/index.html
@@ -46,7 +46,7 @@
<div class="card-action">
<a href="{% url 'doctype' %}">Lista tipo doc</a>
<a href="{% url 'doclist' %}">Lista documenti</a>
- <a href="{% url 'uapprove' %}">Approva documento</a>
+ <a href="{% url 'docapprove' %}">Approva documento</a>
</div>
</div>
</div>