blob: 98b640936cc724872ab0da20b3f2da2403605cf5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
{% extends "ishtar/sheet.html" %}
{% load i18n ishtar_helpers window_header window_field window_tables link_to_window %}
{% block head_title %}<strong>{% trans "Container" %}</strong> -
{{ item.reference|default:"" }} ({{ item.container_type|default:"" }}) - {{item.location}}
{% endblock %}
{% block toolbar %}
{% window_nav item window_id 'show-container' 'container_modify' '' '' previous next 1 %}
{% endblock %}
{% block content %}
{% with can_view_documents=permission_view_own_document|or_:permission_view_document %}
{% with has_documents=item.documents.count %}
{% with display_documents=can_view_documents|and_:has_documents %}
{% if output != "ODT" and output != "PDF"%}
<ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="{{window_id}}-general-tab"
data-toggle="tab" href="#{{window_id}}-general" role="tab"
aria-controls="{{window_id}}-general" aria-selected="true">
{% trans "General" %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" id="{{window_id}}-content-tab"
data-toggle="tab" href="#{{window_id}}-content" role="tab"
aria-controls="{{window_id}}-content" aria-selected="true">
{% 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>
{% if display_documents %}
<li class="nav-item">
<a class="nav-link" id="{{window_id}}-documents-tab"
data-toggle="tab" href="#{{window_id}}-documents" role="tab"
aria-controls="{{window_id}}-documents" aria-selected="false">
{% trans "Documents" %}
</a>
</li>
{% endif %}
</ul>
{% endif %}
<div class="tab-content" id="{{window_id}}-tab-content">
<div class="tab-pane fade show active" id="{{window_id}}-general"
role="tabpanel" aria-labelledby="{{window_id}}-general-tab">
<div class="clearfix">
{% if item.main_image %}
<div class="card float-left col-12 col-md-4">
{% include "ishtar/blocks/window_image.html" %}
</div>
{% endif %}
{% if item.main_image %}
<div class="float-left col-12 col-md-6 col-lg-8 text-center">{# </div>> #}
{% else %}
<div class="float-left col-6 col-md-3 text-center">
{% endif %}
{% if item.complete_identifier %}<p class="window-refs"
title="{% trans 'Complete identifier' %}">
<strong>{{ item.complete_identifier }}</strong></p>{% endif %}
<p class="window-refs">{{ item.container_type|default:"" }} {{ item.reference|default:"" }}</p>
{% include "ishtar/blocks/sheet_external_id.html" %}
</div>
{% if item.main_image %}
<div class="row float-left col-12 col-md-6 col-lg-8 text-center">{# </div>> #}
{% else %}
<div class="float-left row col-6 col-md-8">
{% endif %}
<dl class="col-12 flex-wrap">
<dt>{% trans "Location" %}</dt>
<dd>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
{% for loca in item.get_localisations %}
<li class="breadcrumb-item">
{{loca.short_label}} {{loca|simple_link_to_window}}
</li>
{% endfor %}
</ol>
</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>
{% if item.responsibility != item.location %}
{% field_flex_detail "Responsibility" item.responsibility %}
{% endif %}
{% include "ishtar/blocks/sheet_creation_section.html" %}
{% field_flex "Old reference" item.old_reference %}
{% field_flex_full "Comment" item.comment "<pre>" "</pre>" %}
{% include "ishtar/blocks/sheet_json.html" %}
</div>
</div>
{% with item.container_type as container_type %}
{% if container_type.length or container_type.width or container_type.height or container_type.volume or container_type.reference %}
<h4>{% trans "Container type" %}</h4>
<div class='row'>
{% field_flex "Type" container_type.label %}
{% field_flex "Length (mm)" container_type.length %}
{% field_flex "Width (mm)" container_type.width %}
{% field_flex "Height (mm)" container_type.height %}
{% field_flex "Volume (l)" container_type.volume %}
{% field_flex "Reference" container_type.reference %}
</div>
{% endif %}
{% endwith %}
{% if PROFILE.locate_warehouses %}
{% if item.point_2d or item.multi_polygon %}
<h3>{% trans "Localisation"%}</h3>
<div class='row'>
{% with geo_item=item %}
{% include "ishtar/blocks/sheet_simple_map.html" %}
<div class="col-12 col-lg-6 flex-wrap">
{% include "ishtar/blocks/sheet_coordinates.html" %}
</div>
{% endwith %}
</div>
{% endif %}
{% endif %}
</div>
<div class="tab-pane fade" id="{{window_id}}-content"
role="tabpanel" aria-labelledby="{{window_id}}-content-tab">
{% if item.container_content.count or item.children.count or item.contained_documents.count %}
{% if item.children.count %}
<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 %}
<h4>{% trans "Finds" %}</h4>
{% dynamic_table_document '' 'finds_inside_container' 'container' item.pk 'TABLE_COLS' output 'large' %}
{% endif %}
{% if item.contained_documents.count %}
{% trans "Documents" as document_lbl %}
{% dynamic_table_document document_lbl 'documents' 'container_id' item.pk 'TABLE_COLS' output 'large' %}
{% endif %}
{% else %}
<div class="alert alert-info">
<i class="fa fa-exclamation-triangle"></i>
<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>
<div class="row mt-2 mb-2">
<div class="col">
<div class="btn-group btn-group-sm" role="group"
aria-label="{% trans 'Export' %}">
<a class="btn btn-success"
onclick="long_wait();return true;"
href="{% url 'generate-stats-container' item.pk %}">
{% trans "Regenerate statistics" %}
</a>
</div>
{% with item.last_stats_update as last_stats_update%}
{% if last_stats_update %}<small class="ml-2">
<em>{% trans "Last update:" %} {{last_stats_update}}</em>
</small>{% endif %}{% endwith %}
</div>
</div>
{% if not item.number_containers and not item.number_divisions %}
<div class="alert alert-info">
<i class="fa fa-exclamation-triangle"></i>
<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 %}
{% if item.number_of_containers_by_place %}
<h4>{% trans "Containers by location" %}</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>
{% if display_documents %}
<div class="tab-pane fade" id="{{window_id}}-documents"
role="tabpanel" aria-labelledby="{{window_id}}-documents-tab">
{% trans "Document for this container" as ct_docs %}
{% if permission_view_own_document or permission_view_document %}
{% if item.documents.count %}
{% dynamic_table_document ct_docs 'documents' 'containers' item.pk '' output %}
{% endif %}
{% endif %}
</div>
{% endif %}
</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>
{% endwith %} {% endwith %} {% endwith %}
{% endblock %}
|