summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/blocks/view_import_csv.html
blob: ff49dd13db7568dec2fe21f7eef9befc3311d0e5 (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
{% load i18n l10n %}

<div class="modal-dialog full modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <h2>{{ title }} |
                <i class="{{icon}}" aria-hidden="true"></i>
                {{target}}
            </h2>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
        {% if has_line_errors %}
        <div class="text-center pt-2">
            <button type="button" class="btn btn-success" id="check-all-ignored"><i class="fa fa-check-square" aria-hidden="true"></i> &nbsp;{% trans "check all" %}</button>
            <button type="button" class="btn btn-success"  id="uncheck-all-ignored"><i class="fa fa-square-o" aria-hidden="true"></i> &nbsp;{% trans "uncheck all" %}</button>
        </div>
        {% endif %}
        <div class="table-scroll">
           <table class="table table-striped table-bordered" data-import="{{import_id}}">
              <thead>
              <tr>
                  <th>&nbsp;</th>
                  {% if has_line_errors %}<th>{% trans "Ignore" %}</th>{% endif %}
                  {% for head in header %}<th>{{head}}</th>{% endfor %}
              </tr>
              </thead>
              <tbody>
              {% for line in content %}
              <tr{% if has_line_errors and line.0.1 %} class="import-line-ignored"{% endif%}>
                  <td>{{ forloop.counter }}</td>
                  {% for cell in line %}<td>
                      {% if has_line_errors and not forloop.counter0 %}<input class="check-ignored {% if not cell.1 %}not-{% endif %}ignored" value="{{cell.0|unlocalize}}"{% if cell.1%} checked="checked"{% endif %} type="checkbox" />{% else %}{{cell}}{% endif %}
                  </td>{% endfor %}
              </tr>{% endfor %}
              </tbody>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript">{% localize off %}
$(".check-ignored").click(function(e){
    import_csv_check_ignored(e.target);
    $(this).removeClass('ignored').removeClass('not-ignored');
    if (this.checked){
        $(this).addClass("ignored");
    } else {
        $(this).addClass("not-ignored");
    }
});

$("#check-all-ignored").click(function() {
    if (confirm("{% trans 'Are you sure to check all the errors?' %}")){
        $(".check-ignored.not-ignored").click();
    }
});

$("#uncheck-all-ignored").click(function() {
    if (confirm("{% trans 'Are you sure to uncheck all the errors?' %}")){
        $(".check-ignored.ignored").click();
    }
});
{% endlocalize %}</script>