aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--accounts/templates/accounts/index.html338
-rw-r--r--accounts/templates/accounts/user_edit.html36
-rw-r--r--accounts/views.py10
-rw-r--r--client/templates/client/index.html1
-rw-r--r--version.txt2
5 files changed, 49 insertions, 338 deletions
diff --git a/accounts/templates/accounts/index.html b/accounts/templates/accounts/index.html
index 4eaa42e..6de7d1c 100644
--- a/accounts/templates/accounts/index.html
+++ b/accounts/templates/accounts/index.html
@@ -9,8 +9,10 @@
{% block toolbar %}
<div class="nav-content {{color}}">
<ul class="tabs tabs-transparent">
+ <!--
<li class="tab"><a class="{{personal_active}}" href="#personal">Info Personali</a></li>
<li class="tab"><a class="{{medic_active}}" href="#medic">Info Mediche</a></li>
+ -->
<li class="tab"><a class="{{settings_active}}" href="#settings">Impostazioni</a></li>
</ul>
</div>
@@ -25,345 +27,9 @@
</div>
<form action="{% url 'personal'%}?saved=true" method="post" id="form1" enctype="multipart/form-data">
-<div id="personal" class="row">
- <div class="col l8 offset-l2 s12">
- <div class="card-panel">
- <div class="row">
- <div class="col 12">
- <input type="hidden" name="action" id="action">
- <input type="hidden" name="delete_vac" id="delete_vac">
- <input type="hidden" name="delete_health" id="delete_health">
- {% csrf_token %}
- <div class="row">
- <div class="input-field col l4 s12">
- <input name="first_name" value="{{first_name}}" id="first_name" type="text" {{validation_dic.first_name|safe}} {{midata_disable}}>
- <label for="first_name">Nome</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input name="last_name" value="{{last_name}}" id="last_name" type="text" {{validation_dic.last_name|safe}} {{midata_disable}}>
- <label for="last_name">Cognome</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input name="birth_date" value="{{birth_date}}" id="birth_date" type="text" {{validation_dic.birth_date|safe}} {{midata_disable}}>
- <label for="birth_date">Data di nascita</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- </div>
- <div class="row">
- <div class="input-field col l4 s12">
- <select name="branca" disabled>
- <option value="" disabled {{branca_default}}>Nessuna</option>
- <option value="diga" {{branca_castorini}}>Castorini</option>
- <option value="muta" {{branca_lupetti}}>Lupetti</option>
- <option value="reparto" {{branca_esploratori}}>Esploratori</option>
- <option value="posto" {{branca_pionieri}}>Pionieri</option>
- <option value="clan" {{branca_rover}}>Rover</option>
- </select>
- <label>Branca (campo non modificabile)</label>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{parent_name}}" name="parent_name" id="parent_name" type="text" {{validation_dic.parent_name|safe}}>
- <label for="parent_name">Nome dei genitori</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{avs_number}}" name="avs_number" id="avs_number" type="text" placeholder="756.1234.5678.90" {{validation_dic.avs_number|safe}}>
- <label for="avs_number" data-error="wrong">Numero AVS</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l12 s12">
- <input value="{{via}}" name="via" id="via" type="text" {{validation_dic.via|safe}} {{midata_disable}}>
- <label for="via">Via e numero</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{cap}}" name="cap" id="cap" type="text" {{validation_dic.cap|safe}} {{midata_disable}}>
- <label for="cap">CAP</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{country}}" name="country" id="country" type="text" {{validation_dic.country|safe}} {{midata_disable}}>
- <label for="country">Comune</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{nationality}}" name="nationality" id="nationality" type="text" {{validation_dic.nationality|safe}}>
- <label for="nationality">Nazionalit&agrave;</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{phone}}" name="phone" id="phone" type="text" {{validation_dic.phone|safe}}>
- <label for="phone">Cellulare</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{home_phone}}" name="home_phone" id="home_phone" type="text" {{validation_dic.home_phone|safe}}>
- <label for="home_phone">Telefono di casa</label>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{email}}" name="email" id="email" type="text" {{validation_dic.email|safe}} {{midata_disable}}>
- <label for="email">Email</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l8 s12">
- <input value="{{school}}" name="school" id="school" type="text" {{validation_dic.school|safe}}>
- <label for="school">Scuola frequentata (o professione)</label>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{year}}" name="year" id="year" type="text" {{validation_dic.year|safe}}>
- <label for="year">Classe scolastica</label>
- </div>
- </div>
- <div class="fixed-action-btn">
- <a class="btn-floating btn-large {{color}}" onclick="send('save')">
- <i class="large material-icons">save</i>
- </a>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-<div id="medic" class="row">
- <div class="col l8 offset-l2 s12">
- <div class="card-panel">
- <div class="row">
- <div class="col s12">
- <h6>Persona di contatto in caso di necessit&agrave;</h6>
- </div>
- </div>
- <div class="row">
- <div class="input-field col l6 s12">
- <input name="emer_name" value="{{emer_name}}" id="emer_name" type="text" {{validation_dic.emer_name|safe}}>
- <label for="emer_name">Nome e cognome</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l3 s12">
- <input name="emer_relative" value="{{emer_relative}}" id="emer_relative" type="text" {{validation_dic.emer_relative|safe}}>
- <label for="emer_releative">Parentela</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l3 s12">
- <input name="cell_phone" value="{{cell_phone}}" id="cellphone" type="text" {{validation_dic.cell_phone|safe}}>
- <label for="cell_phone">Cellulare</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l9 s12">
- <input value="{{address}}" name="address" id="address" type="text" {{validation_dic.address|safe}}>
- <label for="address">Indirizzo completo</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l3 s12">
- <input value="{{emer_phone}}" name="emer_phone" id="emer_phone" type="text" {{validation_dic.emer_phone|safe}}>
- <label for="emer_phone">Telefono di casa</label>
- </div>
- </div>
- <div class="row">
- <div class="col s12">
- <h6>Assicurazione</h6>
- </div>
- </div>
- <div class="row">
- <div class="input-field col l4 s12">
- <input value="{{health_care}}" name="health_care" id="health_care" type="text" {{validation_dic.health_care|safe}}>
- <label for="health_care">Cassa Malati</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{injuries}}" name="injuries" id="injuries" type="text" {{validation_dic.injuries|safe}}>
- <label for="injuries">Infortuni</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l4 s12">
- <input value="{{rc}}" name="rc" id="rc" type="text" {{validation_dic.rc|safe}}>
- <label for="rc">Responsabilit&agrave; civile</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- </div>
- <div class="row">
- <div class="switch col s12">
- &Egrave; sostenitore REGA&nbsp;&nbsp;
- <label>
- No
- <input name="rega" type="checkbox" {{rega_check}}>
- <span class="lever"></span>
- Si
- </label>
- </div>
- </div>
- <div class="row">
- <div class="col s12">
- <h6>Medico di famiglia</h6>
- </div>
- <div class="input-field col l6 s12">
- <input value="{{medic_name}}" name="medic_name" id="medic_name" type="text" {{validation_dic.medic_name|safe}}>
- <label for="medic_name">Nome e cognome</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l6 s12">
- <input value="{{medic_phone}}" name="medic_phone" id="medic_phone" type="text" {{validation_dic.medic_phone|safe}}>
- <label for="medic_phone">Telefono studio</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- <div class="input-field col l12 s12">
- <input value="{{medic_address}}" name="medic_address" id="medic_address" type="text" {{validation_dic.medic_address|safe}}>
- <label for="medic_address">Indirizzo completo</label>
- <span class="helper-text" data-error="Campo richiesto"></span>
- </div>
- </div>
- <div class="row">
- <div class="col s12">
- <h6>Scheda medica personale</h6>
- </div>
- <div class="input-field col s12">
- <input value="{{sickness}}" name="sickness" id="sickness" type="text" data-length="250">
- <label for="sickness">Principali malattie avute</label>
- </div>
- <div class="input-field col l8 s12">
- <input value="{{vaccine}}" name="vaccine" id="vaccine" type="text" data-length="250">
- <label for="vaccine">Vacinazioni fatte</label>
- </div>
- <div class="input-field col l4 s12">
- <label for="tetanus_date">Ultima vacinazione contro il tetano</label>
- <input value="{{tetanus_date}}" name="tetanus_date" id="tetanus_date" type="text" class="datepicker">
- </div>
- <div class="input-field col s12">
- <input value="{{allergy}}" name="allergy" id="allergy" type="text" data-length="250">
- <label for="allergy">Allergie particolari/Intolleraze alimentari</label>
- </div>
- <div class="switch col s12">
- Deve assumere regolarmente medicamenti&nbsp;&nbsp;
- <label>
- No
- <input name="drugs_bool" type="checkbox" {{drugs_check}}>
- <span class="lever"></span>
- Si
- </label>
- </div>
- <div class="col s12">
- <div class="card {{color}}">
- <div class="card-content">
- <p style="color:white"><b>In caso dovesse assumere farmaci, avvisare comunque i capi</b></p>
- </div>
- </div>
- </div>
- <div class="input-field col s12">
- <input value="{{drugs}}" name="drugs" id="drugs" type="text" data-length="250">
- <label for="drugs">Se s&igrave; quali, in che dosi e prescrizioni</label>
- </div>
- <div class="switch col s12">
- Informazioni particolari sullo stato di salute: (postumi di operazioni, incidenti, malattie, disturbi fisici)&nbsp;&nbsp;
- <label>
- No
- <input name="misc_bool" type="checkbox" {{misc_check}}>
- <span class="lever"></span>
- Si
- </label>
- </div>
- <div class="input-field col s12">
- <input value="{{misc}}" name="misc" id="misc" type="text" data-length="250">
- <label for="misc">Se s&igrave; quali</label>
- </div>
- </div>
- <div class="row">
- <div class="col s12">
- <h6>Allegati</h6>
- </div>
- <div class="col s12">
- <div class="card">
- <div class="card-content">
- Certificato di vacinazione
- <div class="file-field input-field">
- <div class="btn {{color}}">
- <span><i class="material-icons left">file_upload</i>File</span>
- <input type="file" name="vac_certificate" id="vac_certificate" multiple>
- </div>
- <div class="file-path-wrapper">
- <input id="vac_file" value="{{vac_certificate}}" class="file-path" type="text" placeholder="Certificato di vacinazione">
- </div>
- </div>
- {% if vac_certificate != ''%}
- <a class="btn {{color}}" onclick="send('download_vac')"><i class="material-icons left">file_download</i>Download</a>
- <a class="btn {{color}}" onclick="delete_vac()"><i class="material-icons left">delete</i><span>Elimina</span></a>
- {% endif %}
- </div>
- </div>
- </div>
- <div class="col s12">
- <div class="card">
- <div class="card-content">
- Tessera cassa malati
- <div class="file-field input-field">
- <div class="btn {{color}}">
- <span><i class="material-icons left">file_upload</i>File</span>
- <input type="file" name="health_care_certificate" id="health_care_certificate" multiple>
- </div>
- <div class="file-path-wrapper">
- <input id="health_care_file" value="{{health_care_certificate}}" class="file-path" type="text" placeholder="Tessera cassa malati">
- </div>
- </div>
- {% if health_care_certificate != ''%}
- <a class="btn {{color}}" onclick="send('download_health')"><i class="material-icons left">file_download</i>Download</a>
- <a class="btn {{color}}" onclick="delete_health()"><i class="material-icons left">delete</i><span>Elimina</span></a>
- {% endif %}
- </div>
- </div>
- </div>
- </div>
- <div class="fixed-action-btn">
- <a class="btn-floating btn-large {{color}}" onclick="send('save')">
- <i class="large material-icons">save</i>
- </a>
- </div>
- </div>
- </div>
-</div>
-</form>
<div id="settings" class="row">
<div class="col l8 offset-l2 s12">
<div class="card-panel">
- {% if midata_enabled %}
- <div class="row">
- <div class="col s12">
- <h5>Collegamento con MiData</h5>
- </div>
- </div>
- {% if midata_user %}
- <div class="row">
- <div class="col s12">
- Il tuo utente è già connesso a MiData
- </div>
- <div class="col m6 s12">
- <a href={% url 'oauth_disconnect' %} style="width: 100%" class="btn waves-effect waves-light {{color}}">
- Scollega da MiData
- </a>
- </div>
- </div>
- {% else %}
- <div class="row">
- <div class="col s12">
- Collega il tuo account con MiData per avere un login unico. Attenzione una volta collegato il
- tuo account i dati presenti su MiData dovranno essere modificati sulla piattaforma stessa.
- </div>
- </div>
- <div class="row">
- <div class="col m6 s12">
- <a href={% url 'oauth_connect' %} style="width: 100%; background-color: #99BF62" class="btn waves-effect waves-light">
- <div class="row">
- <div class="col s2">
- <img style="height: 30px; padding-top: 3px" src="{% static 'pbs_logo.svg' %}" alt="PBS Logo">
- </div>
- <div class="col s10">
- Collega a MiData
- </div>
- </div>
- </a>
- </div>
- </div>
- {% endif %}
- {% endif %}
<div class="row">
<div class="col s12">
<h5>Cambia password</h5>
diff --git a/accounts/templates/accounts/user_edit.html b/accounts/templates/accounts/user_edit.html
index 21e3ed8..bbbbecd 100644
--- a/accounts/templates/accounts/user_edit.html
+++ b/accounts/templates/accounts/user_edit.html
@@ -307,6 +307,41 @@
</div>
</div>
</div>
+
+<div id="modal_del" class="modal">
+ <div class="modal-content">
+ <h4>Sei sicuro di voler eliminare la persona?</h4>
+ <p>Questa azione non è reversibile.</p>
+ <p>Scrivere nome e cognome della persona che si vuole eliminare per confermare</p>
+ <div class="row">
+ <div class="input-field col s6">
+ <input id="del_name" name="del_name" type="text">
+ <label for="del_name">Conferma nome</label>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <a style="color:red" href="#!" class="modal-close waves-effect waves-green btn-flat">Annulla</a>
+ <a href="#!" onclick="send('delete_uc')" class="modal-close waves-effect waves-green btn-flat">Continua</a>
+ </div>
+</div>
+
+<div id="delete" class="row">
+ <div class="col l8 offset-l2 s12">
+ <div class="row">
+ <div class="col s12">
+ <div class="card orange">
+ <div class="card-content">
+ <span class="card-title">Zona di pericolo</span>
+ <p>Attenzione l'eliminazione non è reversibile. Eliminando la persona
+ tutti i documenti collegata ad essa verranno eliminati.</p><br>
+ <a href="#modal_del" class="modal-trigger btn red waves-effect waves-light">Elimina persona</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
</form>
{% endblock %}
@@ -364,6 +399,7 @@ $(document).ready(function() {
$('.datepicker').datepicker(options);
$('select').formSelect();
$('.tap-target').tapTarget();
+ $('.modal').modal();
{% for error in errors %}
M.toast({html: '{{ error }}', classes: 'orange'})
{% endfor %}
diff --git a/accounts/views.py b/accounts/views.py
index 35dca92..145fa9e 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -863,6 +863,16 @@ def edit(request, code):
elif err.code == "password_incorrect":
errors.append("La password attuale è incorretta")
+ elif request.POST['action'] == "delete_uc":
+ confirm_name = request.POST['del_name']
+ correct_name = usercode.first_name + " " + usercode.last_name
+ if (confirm_name == correct_name):
+ usercode.delete()
+ medic.delete()
+ return HttpResponseRedirect("/")
+
+ errors.append("Il nome inserito non corrisponde al nome salvato")
+
else:
# set all attributes
usercode.first_name = request.POST["first_name"]
diff --git a/client/templates/client/index.html b/client/templates/client/index.html
index 0350311..ef9b67d 100644
--- a/client/templates/client/index.html
+++ b/client/templates/client/index.html
@@ -37,7 +37,6 @@
<span class="card-title">
{{data.0.first_name}} {{data.0.last_name}}
<a href="{% url "edit_user" code=data.0.code %}" class="btn-flat"><i class="material-icons">edit</i></a>
- <a href="" class="btn-flat"><i class="material-icons">delete</i></a>
<div style="font-size: 0.5em; line-height: normal;">{{data.0.born_date}}</div>
</span>
<a id="add" class="btn-floating halfway-fab btn-large {{color}}" href="{% url 'create'%}"><i class="material-icons">add</i></a>
diff --git a/version.txt b/version.txt
index b80d385..e9da2e4 100644
--- a/version.txt
+++ b/version.txt
@@ -1,2 +1,2 @@
version=0.6
-rev=28
+rev=29