summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/import_table.html
blob: 786df853d36b94a4c8a7149e39e7ae1d74084979 (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
{% load i18n l10n inline_formset %}
{% localize off %}<script type="text/javascript">
var html = $("#message_list").html();
{% if MESSAGES and AJAX %}{% for message, message_type in MESSAGES %}
html += '<div class="alert alert-{{message_type}} alert-dismissible fade show"';
html += '   role="alert">';
html += '     {{message}}';
html += '     <button type="button" class="close" data-dismiss="alert"';
html += '             aria-label="Close">';
html += '         <span aria-hidden="true">&times;</span>';
html += '     </button>';
html += ' </div>';
{% endfor %}{% endif %}
$("#message_list").html(html);

$("#import-list").find('select').prop('disabled', true);
$("#import-list").find('input').prop('disabled', true);

</script>
<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 "File" context "file" %}</th>
            <th>{% trans "Media" %}</th>
            <th>{% trans "Creation" %}</th>
            <th>{% trans "Status" %}</th>
            <th>{% trans "Action" %}</th>
            <th>{% trans "Unmatched items" %}</th>
            <th>{% trans "Error" %}</th>
            <th>{% trans "Control" %}</th>
            <th>{% trans "Match" %}</th>
        </tr>
        {% for import in object_list %}
        <tr{% if import.pk in refreshed_pks %} class='bg-info'{% endif %}>
            <td>
                {{import.name|default:"-"}}
            </td>
            <td>
                {{import.importer_type}} ({% trans import.importer_type.type_label %})
            </td>
            <td>
                {% if import.imported_file %}
                <a href='{{import.imported_file.url}}'>{% trans "Source file" %}</a>
                {% elif import.archive_file %}
                <a href='{{import.archive_file.url}}'>{% trans "Archive" context "name" %}</a>
                {% endif %}
            </td>
            <td>
                {% if import.imported_images %}
                    <a href="{{ import.imported_images.url }}">{% trans "Media file" %}</a>
                {% else %}
                    &ndash;
                {% endif %}
            </td>
            <td>
                {{import.creation_date}} ({{import.user}})
            </td>
            <td>
                {{import.status}}
            </td>
            <td>
                <select class="form-control" name='import-action-{{import.pk}}'>
                    <option value=''>--------</option>
                    {% for action, lbl in import.get_actions %}
                    <option value='{{action}}'>{{lbl}}</option>
                    {% endfor%}
                </select>
            </td>
            <td>
                {% if import.need_matching %}
                <a href='{% url "import_link_unmatched" import.pk %}'>{% trans "Match"%}</a>
                {% endif %}
            </td>
            <td style="white-space: nowrap;">{% if import.error_file %}
                <i class="text-danger fa fa-exclamation-triangle" aria-hidden="true"></i> <a href='{{import.error_file.url}}'>{% trans "File" context "not a directory" %}</a>
                {% endif %}</td>
            <td>{% if import.result_file %}
                <a href='{{import.result_file.url}}'>{% trans "File" context "not a directory" %}</a>
                {% endif %}</td>
            <td>{% if import.match_file %}
                <a href='{{import.match_file.url}}'>{% trans "File" context "not a directory" %}</a>
                {% endif %}</td>
        </tr>
        {% if import.state == 'IP' or import.state == 'PP' and import.current_line %}
        <tr>
            <td colspan="11">
                <div class="progress bg-secondary">
                  <div 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}}%">
                       &nbsp;{{import.current_line}} / {{import.number_of_line}}
                       </div>
                </div>
            </td>
        </tr>
        {% endif %}
        {% endfor %}
    </table>
    {% endif %}
</div>
{% endlocalize %}