From cf38e81844d6828825c0cf5810cc9186b58174f9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Sep 2020 17:56:39 +0200 Subject: Sheet container: show statistics --- .../templates/ishtar/sheet_container.html | 119 ++++++++++++++++++++- .../templates/ishtar/sheet_warehouse.html | 34 +++--- 2 files changed, 130 insertions(+), 23 deletions(-) (limited to 'archaeological_warehouse/templates') diff --git a/archaeological_warehouse/templates/ishtar/sheet_container.html b/archaeological_warehouse/templates/ishtar/sheet_container.html index 5116820f0..336684bc8 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_container.html +++ b/archaeological_warehouse/templates/ishtar/sheet_container.html @@ -27,6 +27,13 @@ {% trans "Content" %} + {% endif %} @@ -69,6 +76,22 @@ +
+
{% trans "Number of containers" %}
+
{{item.number_containers}}
+
+
+
{% trans "Number of divisions" %}
+
{{item.number_divisions}}
+
+
+
{% trans "Number of finds" %}
+
{{item.number_of_finds_hosted}}
+
+
+
{% trans "Number of owned finds" %}
+
{{item.number_of_finds}}
+
{% include "ishtar/blocks/sheet_creation_section.html" %} {% field_flex "Old reference" item.old_reference %} {% field_flex_full "Comment" item.comment "
" "
" %} @@ -107,24 +130,110 @@ {% if item.container_content.count or item.children.count %} {% if item.children.count %} - {% trans "Containers" as container_lbl %} - {% dynamic_table_document container_lbl 'containers' 'parent' item.pk 'TABLE_COLS' output 'large' %} +

{% trans "Divisions" %}

+ {% dynamic_table_document '' 'divisions' 'container_tree_child__container_parent__id' item.pk 'TABLE_COLS' output %} +

{% trans "Containers" %}

+ {% dynamic_table_document '' 'non-divisions' 'container_tree_child__container_parent__id' item.pk 'TABLE_COLS' output %} {% endif %} {% if item.container_content.count %} - {% trans "Finds" as finds_lbl %} - {% dynamic_table_document finds_lbl 'finds_inside_container' 'container' item.pk 'TABLE_COLS' output 'large' %} +

{% trans "Finds" %}

+ {% dynamic_table_document '' 'finds_inside_container' 'container' item.pk 'TABLE_COLS' output 'large' %} {% endif %} {% else %}
- {% trans "Empty" %} +  {% trans "Empty" %} +
+ {% endif %} + + + +
+

{% trans "Statistics" %}

+ + {% trans "These numbers are updated hourly" %} + + {% if not item.number_containers and not item.number_divisions %} +
+ +  {% trans "No container/division inside this container." %}
+ + {% else %} +

{% trans "Finds" %}

+ +

{% trans "Finds by location" %}

+ {% for items in item.number_of_finds_by_place %} + {% if items %} + + + {% for location_type in item.division_labels %} + {% endfor %} + + + + + {% for item in items %} + + {% for local in item.0 %}{% endfor %} + + + {% endfor %} + +
{{location_type|title}}{% trans "Total" %}
{{local|safe}}{{item.1}}
{% endif %} + {% endfor %} + +

{% trans "Containers" %}

+ {% if item.number_of_containers_by_place %} +

{% trans "Containers by location in the warehouse" %}

+ {% for items in item.number_of_containers_by_place %} + {% if items %} + + + {% for location_type in item.division_labels %} + {% endfor %} + + + + + {% for item in items %} + + {% for local in item.0 %}{% endfor %} + + + {% endfor %} + +
{{location_type|title}}{% trans "Total" %}
{{local|safe}}{{item.1}}
+ {% endif %} + {% endfor %} + {% endif %} + {% endif %}
+ + {% endblock %} diff --git a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html index 8e143aae9..e6717f230 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html +++ b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html @@ -61,7 +61,7 @@
-
{% trans "Number of container" %}
+
{% trans "Number of containers" %}
{{item.number_containers}}
@@ -70,11 +70,11 @@
{% trans "Number of finds" %}
-
{{item.number_finds}}
+
{{item.number_of_finds_hosted}}
{% trans "Number of owned finds" %}
-
{{item.number_owned_finds}}
+
{{item.number_of_finds}}
{% field_flex_detail "Person in charge" item.person_in_charge %} {% field_flex_detail "Organization" item.organization %} @@ -138,15 +138,15 @@

{% trans "Statistics" %}

{% trans "These numbers are updated hourly" %} -

{% trans "Finds" %}

-
- {% trans "Number of attached finds" as number_of_attached_finds_label %} - {% field_flex_2 number_of_attached_finds_label item.number_of_finds %} - {% trans "Number of hosted finds" as number_of_hosted_finds_label %} - {% field_flex_2 number_of_hosted_finds_label item.number_of_finds_hosted %} + {% if not item.number_containers and not item.number_divisions %} +
+ +  {% trans "No container/division inside this container" %}
- {% if item.number_of_finds_by_place %} + {% else %} + +

{% trans "Finds" %}

{% trans "Finds by location in the warehouse" %}

{% for items in item.number_of_finds_by_place %} {% if items %} @@ -169,15 +169,9 @@ {% endif %} {% endfor %} - {% endif %}

{% trans "Containers" %}

-
- {% trans "Number of containers" as number_of_containers_label %} - {% field_flex_2 number_of_containers_label item.number_of_containers %} -
- {% if item.number_of_containers_by_place %}

{% trans "Containers by location in the warehouse" %}

{% for items in item.number_of_containers_by_place %} {% if items %} @@ -193,13 +187,14 @@ {% for item in items %} {% for local in item.0 %}{{local|safe}}{% endfor %} - {{item.1}} + {{item.1}} {% endfor %} {% endif %} {% endfor %} + {% endif %}
@@ -213,7 +208,10 @@ $(document).ready( function () { if (datatables_i18n) datatable_options['language'] = datatables_i18n; $('.datatables').each( function(){ - $("#" + $(this).attr('id')).DataTable(datatable_options); + var dt_id = "#" + $(this).attr('id'); + if (! $.fn.DataTable.isDataTable(dt_id) ) { + $(dt_id).DataTable(datatable_options); + } }); } ); -- cgit v1.2.3