blob: 2a9959ffa8f89553ce7e85541e8ad934c819b5b8 (
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
|
{% load i18n l10n inline_formset %}
{% trans "Source" as source_label %}
{% trans "Media" as media_label %}
{% trans "Result" as result_label %}
{% trans "Error" as error_label %}
{% trans "Match" as match_label %}
{% localize off %}<script type="text/javascript">
$("#import-list").find('select').prop('disabled', true);
$("#import-list").find('input').prop('disabled', true);
var import_table_update_import_ids = new Array();
var import_table_import_state = new Array();
{% for import in object_list %}
{% if import.importer_type.type_label %} {# not group #}
{% if import.state == 'IP' or import.state == 'PP' or import.state == 'IQ' %}
import_table_update_import_ids.push("{{import.import_id}}");{% endif %}
{% else %}{# group #}{% for sub in import.import_list %}
{% if sub.state == 'IP' or sub.state == 'PP' or sub.state == 'IQ' %}
import_table_update_import_ids.push("{{sub.id}}");{% endif %}{% endfor %}
{% endif %}{% endfor %}
var need_refresh = false;
if (import_table_update_import_ids.length) need_refresh = true;
$(document).ready(function(){
setTimeout(function(){$(".alert-info.alert-dismissible").hide("fade");}, 5000);
register_qa();
register_vscroll_icons();
display_horizontal_nav("#import-container");
$(window).on('resize', function() {display_horizontal_nav("#import-container")});
if (need_refresh) setInterval(function(){
import_table_update_import_list(import_table_update_import_ids)
}, 3 * 1000);
});
</script>
<div class="vscroll-arrows">
<button class="btn btn-sm btn-secondary" id="vscroll-left">
<i class="fa fa-arrow-left" aria-hidden="true"></i>
</button>
<button class="btn btn-sm btn-secondary" id="vscroll-right">
<i class="fa fa-arrow-right" aria-hidden="true"></i>
</button>
</div>
<h2>{{page_name}}</h2>
<div class='form' id="import-list">
{% if not object_list %}
<p>{% trans "No pending imports." %}</p>
{% else %}
<table class="table table-striped">
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Action" %}</th>
<th>{% trans "Files" context "file" %}</th>
{% if not ARCHIVE_PAGE %}<th>{% trans "Pré-import form / matching" %}</th>
<th>{% trans "Diagnostic files" %}</th>{% endif %}
</tr>
{% for import in object_list %}
{% with current_import=import %}
<tr id="import-{{import.import_id}}"
class='import-row{% if import.has_error or not import.pre_import_form_is_valid %}-error{% endif %}{% if import.pk in refreshed_pks %} bg-info{% endif %}'>
<td><ul class="simple">
<li>
<a class="display_details" href="#" onclick="load_window('{{ import.get_show_url }}')"><i class="fa fa-info-circle" aria-hidden="true"></i></a>
<strong>{{import.name|default:"-"}}</strong>
</li>
<li><small><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> {{import.creation_date|date:"DATE_FORMAT"}} {{import.creation_date|time:"H:i"}} - {% if import.end_date %}{{import.end_date|date:"DATE_FORMAT"}} {{import.end_date|time:"H:i"}}{% endif %}</small></li>
<li><small><i class="fa fa-fw fa-user" aria-hidden="true"></i> {{import.user}}</small></li>
</ul></td>
<td>
{{import.importer_type}} ({% if import.importer_type.type_label %}{% trans import.importer_type.type_label %}{% else %}{% trans "Group" %}{% endif %})
</td>
<td id="status-{{import.import_id}}">
{{import.status}}
</td>
<td>
{% if import.action_list %}
<select class="form-control"
id='import-action-{{import.import_id}}'
name='import-action-{{import.import_id}}'>
<option value=''>--------</option>
{% for action, lbl in import.action_list %}
<option value='{{action}}'>{{lbl}}</option>
{% endfor%}
</select>
{% else %}
–
{% endif %}
</td>
<td><ul class="simple table-import-files">
{% if import.get_imported_values %}<li class="p-1">
{% with file_label=source_label logo='fa fa-fw fa-file-text-o' file_type='source' file=import.imported_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>
{% if import.get_imported_images %}<li class="p-1">
{% with file_label=media_label logo='fa fa-fw fa-file-image-o' file_type='' file=import.get_imported_images %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}
{% elif import.archive_file %}<li>
<i class="fa fa-fw fa-file-archive-o" aria-hidden="true"></i> <a href='{{import.archive_file.url}}'>{% trans "Archive" context "name" %}</a>
</li>{% endif %}
</ul></td>{% if not ARCHIVE_PAGE %}
<td><ul class="simple table-import-match-files">
{% if import.has_pre_import_form %}<li class="p-1">
<div class="btn-group btn-group-sm" role="group">
<a class="btn btn-secondary" href='{% url "import_pre_import_form" import.pk %}'>
{% if not import.pre_import_form_is_valid %}
<i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
{% else %}
<i class="fa fa-fw fa-check-square-o" aria-hidden="true"></i>
{% endif %}
{% trans "Pre-import values" %}
</a>
</div>
</li>{% endif %}
{% if import.need_matching %}<li class="p-1">
<div class="btn-group btn-group-sm" role="group">
<a class="btn btn-warning" href='{% url "import_link_unmatched" import.pk %}'>
<i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> {% trans "Make match" %}
</a>
</div>
</li>{% endif %}
</ul></td>
<td style="white-space: nowrap;"><ul class="simple table-import-diag">
{% if import.error_file %}<li class="p-1">
{% with file_label=error_label logo='text-danger fa fa-fw fa-exclamation-triangle' file_type='error' file=import.error_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}
{% if import.result_file %}<li class="p-1">
{% with file_label=result_label logo='fa fa-fw fa-th' file_type='result' file=import.result_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}
{% if import.match_file %}<li class="p-1">
{% with file_label=match_label logo='fa fa-fw fa-arrows-h' file_type='match' file=import.match_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}</ul>
</td>{% endif %}
</tr>
{% if import.importer_type.type_label %}
<tr></tr>{# only for even and odd style #}
<tr id="progress-display-{{import.id}}"{% if sub.state != 'IP' and sub.state != 'PP' %} style="display:none"{% endif %}>
<td colspan="11">
<div class="progress bg-secondary">
<div id="progress-{{import.id}}" class="progress-bar progress-bar-striped {% if import.state == 'IP'%}bg-success{% else %}bg-info{% endif %} progress-bar-animated" role="progressbar"
aria-valuenow="{{import.current_line}}" aria-valuemin="0" aria-valuemax="{{import.number_of_line}}" style="width: {{import.progress_percent}}%">
{{import.current_line}} / {{import.number_of_line}}
</div>
</div>
</td>
</tr>
{% endif %}
{% endwith %}
{% if not import.importer_type.type_label and not ARCHIVE_PAGE %} {# group #}
{% for sub in import.import_list %}
{% with current_import=sub %}
<tr id="import-{{sub.import_id}}">
<td></td>
<td>{{sub.importer_type}}</td>
<td id="status-{{sub.import_id}}">{{sub.status}}</td>
<td></td>
<td><ul class="simple table-import-files">
{% if sub.get_imported_values %}<li class="p-1">
{% with file_label=source_label logo='fa fa-fw fa-file-text-o' file_type='source' file=sub.imported_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}
{% if sub.get_imported_images %}<li class="p-1">
{% with file_label=media_label logo='fa fa-fw fa-file-image-o' file_type='' file=sub.get_imported_images %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}
</ul></td>{% if not ARCHIVE_PAGE %}
<td><ul class="simple table-import-match-files">
{% if sub.has_pre_import_form %}<li class="p-1">
<div class="btn-group btn-group-sm" role="group">
<a class="btn btn-secondary" href='{% url "import_pre_import_form" sub.pk %}'>
{% if not sub.pre_import_form_is_valid %}
<i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
{% else %}
<i class="fa fa-fw fa-check-square-o" aria-hidden="true"></i>
{% endif %}
{% trans "Pre-import values" %}
</a>
</div>
</li>{% endif %}
{% if sub.need_matching %}<li class="p-1">
<div class="btn-group btn-group-sm" role="group">
<a class="btn btn-warning" href='{% url "import_link_unmatched" sub.pk %}'>
<i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> {% trans "Make match" %}
</a>
</div>
</li>{% endif %}
</ul></td>
<td style="white-space: nowrap;"><ul class="simple table-import-diag">
{% if sub.error_file %}<li class="p-1">
{% with file_label=error_label logo='text-danger fa fa-fw fa-exclamation-triangle' file_type='error' file=sub.error_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}
{% if sub.result_file %}<li class="p-1">
{% with file_label=result_label logo='fa fa-fw fa-th' file_type='result' file=sub.result_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}
{% if sub.match_file %}<li class="p-1">
{% with file_label=match_label logo='fa fa-fw fa-arrows-h' file_type='match' file=sub.match_file %}
{% include "ishtar/blocks/import_table_buttons_view.html" %}
{% endwith %}
</li>{% endif %}</ul>
</td>
{% endif %}
</tr>
<tr></tr>{# only for even and odd style #}
<tr id="progress-display-{{sub.id}}"{% if sub.state != 'IP' and sub.state != 'PP' %} style="display:none"{% endif %}>
<td colspan="11">
<div class="progress bg-secondary">
<div id="progress-{{sub.id}}" class="progress-bar progress-bar-striped {% if sub.state == 'IP'%}bg-success{% else %}bg-info{% endif %} progress-bar-animated" role="progressbar"
aria-valuenow="{{sub.current_line}}" aria-valuemin="0" aria-valuemax="{{sub.number_of_line}}" style="width: {{sub.progress_percent}}%">
{{sub.current_line}} / {{sub.number_of_line}}
</div>
</div>
</td>
</tr>
{% endwith %}
{% endfor %}
{% endif %}
{% endfor %}
</table>
{% endif %}
</div>
{% endlocalize %}
|