aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client/templates/client/index.html27
-rw-r--r--client/views.py15
2 files changed, 39 insertions, 3 deletions
diff --git a/client/templates/client/index.html b/client/templates/client/index.html
index ff12e74..0eb244e 100644
--- a/client/templates/client/index.html
+++ b/client/templates/client/index.html
@@ -266,6 +266,33 @@
</span></div>
</li>
{% endif %}
+ {% if doc.0.document_type.medical_data %}
+ <li>
+ <div class="collapsible-header">
+ <i class="material-icons">attach_file</i>Allegati
+ </div>
+ <div class="collapsible-body"><span>
+ <div class="row">
+ <div class="col s12">
+ <div class="card">
+ <div class="card-image">
+ <img src="data:;base64,{{ doc.5 }}">
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col s12">
+ <div class="card">
+ <div class="card-image">
+ <img src="data:;base64,{{ doc.6 }}">
+ </div>
+ </div>
+ </div>
+ </div>
+ </span></div>
+ </li>
+ {% endif %}
</ul>
</span></div>
</li>
diff --git a/client/views.py b/client/views.py
index 76672cd..f215e7e 100644
--- a/client/views.py
+++ b/client/views.py
@@ -10,6 +10,7 @@ from django.shortcuts import render
from django.template.loader import get_template
from io import BytesIO
import pdfkit
+import base64
# Create your views here.
@@ -77,9 +78,17 @@ def index(request):
if i.document_type.medical_data:
medical = i.medical_data
+ if medical.vac_certificate.name:
+ with open(medical.vac_certificate.name, 'rb') as image_file:
+ vac_file = base64.b64encode(image_file.read()).decode()
+
+ if medical.health_care_certificate.name:
+ with open(medical.health_care_certificate.name, 'rb') as image_file:
+ health_file = base64.b64encode(image_file.read()).decode()
+
doc_group = i.user.groups.values_list('name', flat=True)[0]
- out.append([i, KeyVal.objects.filter(container=i), personal, medical, doc_group])
+ out.append([i, KeyVal.objects.filter(container=i), personal, medical, doc_group, vac_file, health_file])
context = {
"docs": out,
"empty": len(out) == 0,
@@ -155,7 +164,7 @@ def create(request):
if document_type.medical_data:
medic = usercode.medic
- medical_data = MedicalData(emer_name=medic.emer_name, emer_relative=medic.emer_relative, cell_phone=medic.cell_phone, address=medic.address, emer_phone=medic.emer_phone, health_care=medic.health_care, injuries=medic.injuries, rc=medic.rc, rega=medic.rega, medic_name=medic.medic_name, medic_phone=medic.medic_phone, medic_address=medic.medic_address, sickness=medic.sickness, vaccine=medic.vaccine, tetanus_date=medic.tetanus_date, allergy=medic.allergy, drugs_bool=medic.drugs_bool, drugs=medic.drugs, misc_bool=medic.misc_bool, misc=medic.misc)
+ medical_data = MedicalData(vac_certificate=medic.vac_certificate, health_care_certificate=medic.health_care_certificate, emer_name=medic.emer_name, emer_relative=medic.emer_relative, cell_phone=medic.cell_phone, address=medic.address, emer_phone=medic.emer_phone, health_care=medic.health_care, injuries=medic.injuries, rc=medic.rc, rega=medic.rega, medic_name=medic.medic_name, medic_phone=medic.medic_phone, medic_address=medic.medic_address, sickness=medic.sickness, vaccine=medic.vaccine, tetanus_date=medic.tetanus_date, allergy=medic.allergy, drugs_bool=medic.drugs_bool, drugs=medic.drugs, misc_bool=medic.misc_bool, misc=medic.misc)
medical_data.save()
while (True):
@@ -200,7 +209,7 @@ def edit_wrapper(request, context):
if document.document_type.medical_data:
medic = usercode.medic
- medical_data = MedicalData(emer_name=medic.emer_name, emer_relative=medic.emer_relative, cell_phone=medic.cell_phone, address=medic.address, emer_phone=medic.emer_phone, health_care=medic.health_care, injuries=medic.injuries, rc=medic.rc, rega=medic.rega, medic_name=medic.medic_name, medic_phone=medic.medic_phone, medic_address=medic.medic_address, sickness=medic.sickness, vaccine=medic.vaccine, tetanus_date=medic.tetanus_date, allergy=medic.allergy, drugs_bool=medic.drugs_bool, drugs=medic.drugs, misc_bool=medic.misc_bool, misc=medic.misc)
+ medical_data = MedicalData(vac_certificate=medic.vac_certificate, health_care_certificate=medic.health_care_certificate, emer_name=medic.emer_name, emer_relative=medic.emer_relative, cell_phone=medic.cell_phone, address=medic.address, emer_phone=medic.emer_phone, health_care=medic.health_care, injuries=medic.injuries, rc=medic.rc, rega=medic.rega, medic_name=medic.medic_name, medic_phone=medic.medic_phone, medic_address=medic.medic_address, sickness=medic.sickness, vaccine=medic.vaccine, tetanus_date=medic.tetanus_date, allergy=medic.allergy, drugs_bool=medic.drugs_bool, drugs=medic.drugs, misc_bool=medic.misc_bool, misc=medic.misc)
medical_data.save()
old_data = document.medical_data
document.medical_data = medical_data