summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/templates
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_warehouse/templates')
-rw-r--r--archaeological_warehouse/templates/ishtar/sheet_container.html119
-rw-r--r--archaeological_warehouse/templates/ishtar/sheet_warehouse.html34
2 files changed, 130 insertions, 23 deletions
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" %}
</a>
</li>
+ <li class="nav-item">
+ <a class="nav-link" id="{{window_id}}-stats-tab"
+ data-toggle="tab" href="#{{window_id}}-stats" role="tab"
+ aria-controls="{{window_id}}-stats" aria-selected="false">
+ {% trans "Statistics" %}
+ </a>
+ </li>
</ul>
{% endif %}
@@ -69,6 +76,22 @@
</nav>
</dd>
</dl>
+ <dl class="col-6 col-md-3 flex-wrap">
+ <dt>{% trans "Number of containers" %}</dt>
+ <dd>{{item.number_containers}}</dd>
+ </dl>
+ <dl class="col-6 col-md-3 flex-wrap">
+ <dt>{% trans "Number of divisions" %}</dt>
+ <dd>{{item.number_divisions}}</dd>
+ </dl>
+ <dl class="col-6 col-md-3 flex-wrap">
+ <dt>{% trans "Number of finds" %}</dt>
+ <dd>{{item.number_of_finds_hosted}}</dd>
+ </dl>
+ <dl class="col-6 col-md-3 flex-wrap">
+ <dt>{% trans "Number of owned finds" %}</dt>
+ <dd>{{item.number_of_finds}}</dd>
+ </dl>
{% include "ishtar/blocks/sheet_creation_section.html" %}
{% field_flex "Old reference" item.old_reference %}
{% field_flex_full "Comment" item.comment "<pre>" "</pre>" %}
@@ -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' %}
+ <h4>{% trans "Divisions" %}</h4>
+ {% dynamic_table_document '' 'divisions' 'container_tree_child__container_parent__id' item.pk 'TABLE_COLS' output %}
+ <h4>{% trans "Containers" %}</h4>
+ {% 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' %}
+ <h4>{% trans "Finds" %}</h4>
+ {% dynamic_table_document '' 'finds_inside_container' 'container' item.pk 'TABLE_COLS' output 'large' %}
{% endif %}
{% else %}
<div class="alert alert-info">
<i class="fa fa-exclamation-triangle"></i>
- <em>{% trans "Empty" %}</em>
+ &nbsp;<em>{% trans "Empty" %}</em>
+ </div>
+ {% endif %}
+
+ </div>
+
+ <div class="tab-pane fade" id="{{window_id}}-stats"
+ role="tabpanel" aria-labelledby="{{window_id}}-stats-tab">
+ <h3>{% trans "Statistics" %}</h3>
+
+ <small class="centered"><em>{% trans "These numbers are updated hourly" %}</em></small>
+
+ {% if not item.number_containers and not item.number_divisions %}
+ <div class="alert alert-info">
+ <i class="fa fa-exclamation-triangle"></i>
+ &nbsp;<em>{% trans "No container/division inside this container." %}</em>
</div>
+
+ {% else %}
+ <h4>{% trans "Finds" %}</h4>
+
+ <h4>{% trans "Finds by location" %}</h4>
+ {% for items in item.number_of_finds_by_place %}
+ {% if items %}
+ <table class='table table-striped datatables'
+ id="{{window_id}}-find-by-loca-{{forloop.counter}}">
+ <thead>
+ <tr>{% for location_type in item.division_labels %}
+ <th class="text-center">{{location_type|title}}</th>{% endfor %}
+ <th class="text-center">{% trans "Total" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for item in items %}
+ <tr>
+ {% for local in item.0 %}<td>{{local|safe}}</td>{% endfor %}
+ <td class="text-right">{{item.1}}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
{% endif %}
+ {% endfor %}
+
+ <h4>{% trans "Containers" %}</h4>
+ {% if item.number_of_containers_by_place %}
+ <h4>{% trans "Containers by location in the warehouse" %}</h4>
+ {% for items in item.number_of_containers_by_place %}
+ {% if items %}
+ <table class='table table-striped datatables'
+ id="{{window_id}}-container-by-loca-{{forloop.counter}}">
+ <thead>
+ <tr>{% for location_type in item.division_labels %}
+ <th class="text-center">{{location_type|title}}</th>{% endfor %}
+ <th class="text-center">{% trans "Total" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for item in items %}
+ <tr>
+ {% for local in item.0 %}<td>{{local|safe}}</td>{% endfor %}
+ <td class="text-right">{{item.1}}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% endif %}
</div>
</div>
+<script type="text/javascript">
+$(document).ready( function () {
+ datatable_options = {
+ "dom": 'ltip',
+ };
+ $.extend(datatable_options, datatables_static_default);
+ if (datatables_i18n) datatable_options['language'] = datatables_i18n;
+ $('.datatables').each(
+ function(){
+ var dt_id = "#" + $(this).attr('id');
+ if (! $.fn.DataTable.isDataTable(dt_id) ) {
+ $(dt_id).DataTable(datatable_options);
+ }
+ });
+} );
+</script>
+
{% 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 @@
<div class='row'>
<dl class="col-6 col-md-3 flex-wrap">
- <dt>{% trans "Number of container" %}</dt>
+ <dt>{% trans "Number of containers" %}</dt>
<dd>{{item.number_containers}}</dd>
</dl>
<dl class="col-6 col-md-3 flex-wrap">
@@ -70,11 +70,11 @@
</dl>
<dl class="col-6 col-md-3 flex-wrap">
<dt>{% trans "Number of finds" %}</dt>
- <dd>{{item.number_finds}}</dd>
+ <dd>{{item.number_of_finds_hosted}}</dd>
</dl>
<dl class="col-6 col-md-3 flex-wrap">
<dt>{% trans "Number of owned finds" %}</dt>
- <dd>{{item.number_owned_finds}}</dd>
+ <dd>{{item.number_of_finds}}</dd>
</dl>
{% field_flex_detail "Person in charge" item.person_in_charge %}
{% field_flex_detail "Organization" item.organization %}
@@ -138,15 +138,15 @@
<h3>{% trans "Statistics" %}</h3>
<small class="centered"><em>{% trans "These numbers are updated hourly" %}</em></small>
- <h4>{% trans "Finds" %}</h4>
- <div class='row'>
- {% 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 %}
+ <div class="alert alert-info">
+ <i class="fa fa-exclamation-triangle"></i>
+ &nbsp;<em>{% trans "No container/division inside this container" %}</em>
</div>
- {% if item.number_of_finds_by_place %}
+ {% else %}
+
+ <h4>{% trans "Finds" %}</h4>
<h4>{% trans "Finds by location in the warehouse" %}</h4>
{% for items in item.number_of_finds_by_place %}
{% if items %}
@@ -169,15 +169,9 @@
</table>
{% endif %}
{% endfor %}
- {% endif %}
<h4>{% trans "Containers" %}</h4>
- <div class='row'>
- {% trans "Number of containers" as number_of_containers_label %}
- {% field_flex_2 number_of_containers_label item.number_of_containers %}
- </div>
- {% if item.number_of_containers_by_place %}
<h4>{% trans "Containers by location in the warehouse" %}</h4>
{% for items in item.number_of_containers_by_place %}
{% if items %}
@@ -193,13 +187,14 @@
{% for item in items %}
<tr>
{% for local in item.0 %}<td>{{local|safe}}</td>{% endfor %}
- <td class="text-center">{{item.1}}</td>
+ <td class="text-right">{{item.1}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
+
{% endif %}
</div>
</div>
@@ -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);
+ }
});
} );
</script>