From 15a57cbb39634b42bec54d9c88d20611e0780b31 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Sat, 6 Aug 2022 21:46:44 +0200 Subject: fix heading prefix and add custom param preview --- server/templates/server/doc_create.html | 7 ++ server/templates/server/doc_creation_preview.html | 121 ++++++++++++++++++++++ server/urls.py | 1 + server/views.py | 25 +++++ 4 files changed, 154 insertions(+) create mode 100644 server/templates/server/doc_creation_preview.html (limited to 'server') diff --git a/server/templates/server/doc_create.html b/server/templates/server/doc_create.html index 43b98e9..908d1eb 100644 --- a/server/templates/server/doc_create.html +++ b/server/templates/server/doc_create.html @@ -149,6 +149,7 @@
+ Visualizza anteprima
@@ -196,4 +197,10 @@ $(document).ready(function(){ {% endif %} $('.modal').modal(); }); + +function preview() { + var param = document.getElementById("param").value; + var param_base64 = btoa(param); + window.open("{%url 'custom_parameters_preview' %}?param=" + param_base64); +} {% endblock %} \ No newline at end of file diff --git a/server/templates/server/doc_creation_preview.html b/server/templates/server/doc_creation_preview.html new file mode 100644 index 0000000..811b9ad --- /dev/null +++ b/server/templates/server/doc_creation_preview.html @@ -0,0 +1,121 @@ +{% extends 'registration/base_client.html' %} + +{% block title %}Preview iscrizione{% endblock %} + +{% block breadcrumb %} + Preview Iscrizione +{% endblock %} + +{% load app_filter %} + +{% block content %} +
+
+
+
+
+ + +
+
+
+
+
+
+

+ Il documento conterrà le informazioni personali, prego verificare che siano corrette e aggiornate +

+
+
+
+
+
+
+
+
+

+ Il documento conterrà le informazioni mediche, prego verificare che siano corrette e aggiornate +

+
+
+
+
+
+
+
+
+

+ Testo personalizzato d'esempio.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed accumsan auctor lobortis. Etiam eu felis ac elit semper vestibulum. Praesent pharetra ex quam. Ut sed magna nec eros viverra blandit nec eget nisl. Cras maximus efficitur urna, eget semper dui commodo a. Fusce eros sem, condimentum eu dignissim eget, pharetra vulputate odio. +

+
+
+
+
+ {% for key in keys %} + {% if key.key_extra|is_heading %} +
+
+
{{key.key_extra|parse_heading}}
+
+
+ {% elif key.key_extra|is_multiple_choice %} +
+
+ {% with arr=key.key_extra|parse_multiple_choice %} + {{arr.0}} + {% for val in arr.1 %} +

+ {% endfor %} + {% endwith %} +
+
+ {% elif key.key_extra|is_checkbox %} + checkbox + {% else %} +
+
+ + +
+
+ {% endif %} + {% endfor %} +
+
+
+
+

+ Attenzione: il documento non sarĂ  valido fino a quando non viene approvato. Selezionare + il documento dalla pagina principale per approvarlo. +

+
+
+
+
+ +
+
+
+{% endblock %} + +{% block script %} +$(document).ready(function(){ + $('select').formSelect(); +}); +{% endblock %} \ No newline at end of file diff --git a/server/urls.py b/server/urls.py index 5ff9eba..42bc0c8 100644 --- a/server/urls.py +++ b/server/urls.py @@ -15,6 +15,7 @@ urlpatterns = [ path('docapprove', views.docapprove, name='docapprove'), path('docupload', views.upload_doc, name='docupload'), path('docpreview', views.docpreview, name='docpreview'), + path('custom_parameters_preview', views.custom_parameters_preview, name='custom_parameters_preview'), path('progress', views.get_progress, name='progress'), path('request', views.data_request, name='request'), path('media///', views.media_request, name='media'), diff --git a/server/views.py b/server/views.py index 7643bee..35fb232 100644 --- a/server/views.py +++ b/server/views.py @@ -610,6 +610,31 @@ def doctype(request): } return render(request, 'server/doc_type.html', context) +@user_passes_test(isStaff) +def custom_parameters_preview(request): + context = {} + if "param" not in request.GET: + return render(request, 'server/doc_creation_preview.html', context) + + params = request.GET["param"] + params = base64.b64decode(params).decode("utf-8") + params = params.splitlines() + keys = [] + for i in range(len(params)): + dic = {} + val = params[i] + if val.startswith("!"): + if len(val) < 3: + val = val + + val = val[3:].split(",")[0] + dic["key"] = val + dic["key_extra"] = params[i] + dic["id"] = i + keys.append(dic) + + context["keys"] = keys + return render(request, 'server/doc_creation_preview.html', context) @user_passes_test(isStaff) def doccreate(request): -- cgit v1.2.1