blob: 7c279fe691750ef006e3bbf9cb7465e979334dec (
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
|
{% extends "ishtar/sheet.html" %}
{% load i18n ishtar_helpers window_header window_field window_tables %}
{% block head_title %}<strong>{% trans "Warehouse" %}</strong> - {{item.name}} ({{item.warehouse_type}}){% endblock %}
{% block toolbar %}
{% window_nav item window_id 'show-warehouse' 'warehouse_modify' 'show-historized-warehouse' 'revert-warehouse' 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="row">
<div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12">
<div class="card">
{% include "ishtar/blocks/window_image.html" %}
<div class="card-body">
<div class="card-text">
<p class="window-refs">
<strong>{{ item.name|default:"" }}</strong>
</p>
<p class="window-refs">
{{ item.warehouse_type|default:"" }}
</p>
{% include "ishtar/blocks/sheet_external_id.html" %}
</div>
</div>
</div>
</div>
</div>
<div class='row'>
<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>
{% field_flex_detail "Person in charge" item.person_in_charge %}
{% field_flex_detail "Organization" item.organization %}
{% trans "Default divisions (imports)" as def_div_label %}
{% field_flex def_div_label item.default_location_types|join:", " %}
{% field_flex_full "Comment" item.comment "<pre>" "</pre>" %}
{% include "ishtar/blocks/sheet_creation_section.html" %}
{% include "ishtar/blocks/sheet_json.html" %}
</div>
{% if item.point_2d or item.multi_polygon or item.get_address or item.get_address_complement or item.get_postal_code or item.get_town %}
<h3>{% trans "Localisation"%}</h3>
<div class='row'>
{% with geo_item=item %}
{% if PROFILE.locate_warehouses %}{% include "ishtar/blocks/sheet_simple_map.html"%}{% endif %}
<div class="col-12 col-lg-6 flex-wrap">
{% if PROFILE.locate_warehouses %}{% include "ishtar/blocks/sheet_coordinates.html"%}{% endif %}
{% with full=True %}{% include "ishtar/blocks/sheet_address_section.html" %}{% endwith %}
</div>
{% endwith %}
</div>
{% endif %}
</div>
<div class="tab-pane fade" id="{{window_id}}-content"
role="tabpanel" aria-labelledby="{{window_id}}-content-tab">
{% if item.containers.count %}
<h4>{% trans "Divisions" %}</h4>
{% dynamic_table_document '' 'divisions' 'location_id' item.pk 'TABLE_COLS' output %}
<h4>{% trans "Containers" %}</h4>
{% dynamic_table_document '' 'non-divisions' 'location_id' item.pk 'TABLE_COLS' output %}
{% else %}
<div class="alert alert-info">
<i class="fa fa-exclamation-triangle"></i>
{% trans "No container inside this warehouse" %}
</div>
{% endif %}
{% if item.number_of_finds_hosted %}
<h4>{% trans "Finds (hosted)" %}</h4>
{% dynamic_table_document '' 'finds' 'container__location' item.pk 'TABLE_COLS' output %}
{% else %}
<div class="alert alert-info">
<i class="fa fa-exclamation-triangle"></i>
{% trans "No find inside this warehouse" %}
</div>
{% endif %}
{% if item.number_of_finds %}
<h4>{% trans "Finds (owned)" %}</h4>
{% dynamic_table_document '' 'finds' 'container_ref__location' item.pk 'TABLE_COLS' output %}
{% else %}
<div class="alert alert-info">
<i class="fa fa-exclamation-triangle"></i>
{% trans "No find owned by this warehouse" %}
</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-warehouse' 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 in the warehouse" %}</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>
<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 %}
</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 warehouse" as w_docs %}
{% if permission_view_own_document or permission_view_document %}
{% if item.documents.count %}
{% dynamic_table_document w_docs 'documents' 'warehouses' 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 %}
|