From d903fb1f7417b36306c221526fd2fd987f6718c8 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Thu, 24 Aug 2023 12:53:40 +0200 Subject: format dates in table to be sorted --- server/templates/server/doc_list_table.html | 12 ++++++++---- server/templates/server/user_list_table.html | 8 ++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'server/templates') diff --git a/server/templates/server/doc_list_table.html b/server/templates/server/doc_list_table.html index 6a12378..860ffda 100644 --- a/server/templates/server/doc_list_table.html +++ b/server/templates/server/doc_list_table.html @@ -19,6 +19,10 @@ {% endblock %} +{% block script_import %} + +{% endblock %} + {% block content %} {% load app_filter %}
@@ -136,12 +140,12 @@ {% endif %} type: "{{doc.document_type.name}}", code: {% if doc.status == "ok" or doc.status == "archive" %} "{{doc.code}}" {% else %} "???" {% endif %}, - compilation_date: "{{doc.compilation_date}}", + compilation_date: "{{doc.compilation_date|date:"d/m/Y"}}", capo: {% if "capi" in doc.usercode.user|user_groups %}true{% else %}false{% endif %}, name: "{{doc.usercode.first_name}}", last_name: "{{doc.usercode.last_name}}", email: "{{doc.personal_data.email}}", - birth_date: "{{doc.personal_data.born_date}}", + birth_date: "{{doc.personal_data.born_date|date:"d/m/Y"}}", branca: "{{ doc.usercode.branca }}", parent_name: "{{doc.personal_data.parent_name}}", avs_number: "{{doc.personal_data.avs_number}}", @@ -189,10 +193,10 @@ {title: "Tipo", field: "type"}, {title: "Codice", field: "code"}, {title: "Capo", field: "capo", formatter:"tickCross"}, - {title: "Data compilazione", field: "compilation_date"}, + {title: "Data compilazione", field: "compilation_date", sorter:"date"}, {title: "Branca", field: "branca"}, {title: "Email", field: "email", visible: false}, - {title: "Data di nascita", field: "birth_date", visible: false}, + {title: "Data di nascita", field: "birth_date", visible: false, sorter:"date"}, ] }, {field: "personal", name: "Informazioni personali", cols: diff --git a/server/templates/server/user_list_table.html b/server/templates/server/user_list_table.html index 624fced..98361cc 100644 --- a/server/templates/server/user_list_table.html +++ b/server/templates/server/user_list_table.html @@ -30,6 +30,10 @@
{% endblock %} +{% block script_import %} + +{% endblock %} + {% block script %} $(document).ready(function(){ $('#modal1').modal(); @@ -43,7 +47,7 @@ email: "{{user.user.email}}", name: "{{user.first_name}}", last_name: "{{user.last_name}}", - birth_date: "{{user.born_date}}", + birth_date: "{{user.born_date|date:"d/m/Y"}}", branca: "{{ user.branca }}", parent_name: "{{user.parent_name}}", avs_number: "{{user.avs_number}}", @@ -87,7 +91,7 @@ {title: "Capo", field: "capo", formatter:"tickCross"}, {title: "Email", field: "email"}, {title: "Codice", field: "ucode"}, - {title: "Data di nascita", field: "birth_date"}, + {title: "Data di nascita", field: "birth_date", sorter:"date"}, {title: "Branca", field: "branca"}, ] }, -- cgit v1.2.1