From 72dc2a4e287fe04e2b62af599b25c91477bfb905 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Fri, 28 Jul 2023 18:03:29 +0200 Subject: new doc list from doc types --- server/templates/server/debug_usercode.html | 2 +- server/templates/server/doc_list.html | 5 +- server/templates/server/doc_list_table.html | 24 ++++-- server/templates/server/doc_type.html | 120 ++++++++++++++++++++++++++-- server/templates/server/index.html | 12 +-- server/urls.py | 4 +- server/views.py | 101 ++++++++++++++++++----- 7 files changed, 222 insertions(+), 46 deletions(-) (limited to 'server') diff --git a/server/templates/server/debug_usercode.html b/server/templates/server/debug_usercode.html index 014d6fd..9549d77 100644 --- a/server/templates/server/debug_usercode.html +++ b/server/templates/server/debug_usercode.html @@ -6,7 +6,7 @@
 {% for user in data %}
-[{{user.0.id}}] {{user.0.username}} {{user.0.first_name}} {{user.0.last_name}}
+[{{user.0.id}}] {{user.0.username}} {{user.0.first_name}} {{user.0.last_name}} ({{user.2}})
 {% for uc in user.1 %}  [{{uc.id}}] {{uc.code}} {{uc.first_name}} {{uc.last_name}} ({{uc.branca}})
 {% endfor %} {% endfor %}
 
diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html index 28511e7..27c209c 100644 --- a/server/templates/server/doc_list.html +++ b/server/templates/server/doc_list.html @@ -4,6 +4,7 @@ {% block breadcrumb %} Admin + Tipi Documenti {% endblock %} {% block toolbar %} @@ -62,7 +63,7 @@ -
+ {% csrf_token %}
-
+
diff --git a/server/templates/server/doc_list_table.html b/server/templates/server/doc_list_table.html index 6b3556b..6a12378 100644 --- a/server/templates/server/doc_list_table.html +++ b/server/templates/server/doc_list_table.html @@ -4,6 +4,7 @@ {% block breadcrumb %} Admin + Tipi Documenti {% endblock %} {% block toolbar %} @@ -20,7 +21,7 @@ {% block content %} {% load app_filter %} - + {% csrf_token %}
-
+
@@ -170,6 +171,9 @@ allergy: "{{doc.medical_data.allergy}}", drugs: "{{doc.medical_data.drugs}}", misc: "{{doc.medical_data.misc}}", + {% for key in doc|doc_key %} + custom_key_{{forloop.counter0}}: "{{key.value}}", + {% endfor %} }, {% endfor %} ]; @@ -179,11 +183,11 @@ var col_categories = [ {field: "base", name: "Informazioni base", cols: [ + {title: "Nome", field: "name", frozen: true}, + {title: "Cognome", field: "last_name", frozen: true}, {title: "Stato", field: "status", formatter: iconFormatter}, {title: "Tipo", field: "type"}, {title: "Codice", field: "code"}, - {title: "Nome", field: "name"}, - {title: "Cognome", field: "last_name"}, {title: "Capo", field: "capo", formatter:"tickCross"}, {title: "Data compilazione", field: "compilation_date"}, {title: "Branca", field: "branca"}, @@ -227,6 +231,15 @@ {title: "Info particolari", field: "misc", visible: false}, ] }, + {% if custom_keys|length > 0 %} + {field: "custom", name: "Parametri personalizzati", cols: + [ + {% for key in custom_keys %} + {title: "{{key.1}}", field: "custom_key_{{key.0}}", visible: true, width: "7%"}, + {% endfor %} + ] + }, + {% endif %} ] var docTypes = {}; @@ -261,8 +274,9 @@ var table = new Tabulator("#example-table", { movableColumns: true, layout:"fitDataFill", - responsiveLayout: "hide", + {% if type_id == 0 %} groupBy: "type", + {% endif %} data:tabledata, columns:columns, groupHeader:function(value, count, data, group){ diff --git a/server/templates/server/doc_type.html b/server/templates/server/doc_type.html index 4f8fe6f..c81bcdb 100644 --- a/server/templates/server/doc_type.html +++ b/server/templates/server/doc_type.html @@ -4,7 +4,7 @@ {% block breadcrumb %} Admin - Tipo Doc + Tipi {% endblock %} {% block toolbar %}