summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/import_step_by_step.html
blob: c827156c58e2ffaa71a96a877cbb68a5d48d247f (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
{% extends "base.html" %}
{% load i18n inline_formset link_to_window %}

{% block content %}
<h2>{% trans "Import step by step" %} &ndash; {{import.name}} &ndash; {% trans "line " %} {{line_number_displayed}}</h2>
{% if errors %}
<div class="alert alert-danger" role="alert">
    <p>{% trans "The following error(s) has been encountered while parsing the source file:" %}</p>
    <ul>{% for error in errors %}
        <li>{{error}}</li>
    {% endfor %}</ul>
</div>

{% if values %}
<table class="table table-striped">
    {% for header, value in values %}
    <tr>
        <th>{{header}}</th>
        <td>{{value}}</td>
    </tr>
    {% endfor %}
</table>
{% endif %}

{% else %}

{% if new_objects %}
<h3>{% trans "Objects to be created" %}</h3>
{% for path, cls, values in new_objects %}
<div class="card">
  <div class="card-body">
    <h5 class="card-title">{{path|safe}} ({{cls.get_verbose_name}})</h5>
  </div>
  <div class="card-body">
    <table class="table table-striped">
        <tr>
            <th>{% trans "Key" %}</th>
            <th>{% trans "Value" %}</th>
        </tr>
        {% for k, value in values.items %}<tr>
            <th>{{k|safe}}</th>
            <td>{{value}}</td>
        </tr>{% endfor %}
    </table>
  </div>
</div>
<hr/>
{% endfor %}
{% endif %}

{% if updated_objects %}
<h3>{% trans "Objects to be updated" %}</h3>
{% for path, obj, values, old_and_updated in updated_objects %}

<div class="card">
    <div class="card-body">
        <h5 class="card-title">{{path}} &ndash; {{obj}} {{obj|link_to_window}} ({{obj.get_verbose_name}})</h5>
    </div>
    <div class="card-body">

        <h5>{% trans "Matching values" %}</h5>
        <table class="table table-striped">
            <tr>
                <th>{% trans "Key" %}</th>
                <th>{% trans "Value" %}</th>
            </tr>
            {% for k, value in values.items %}<tr>
                <th>{{k|safe}}</th>
                <td>{{value}}</td>
            </tr>{% endfor %}
        </table>


        <h5>{% trans "Updated values" %}</h5>
        <table class="table table-striped">
            <tr>
                <th>{% trans "Key" %}</th>
                <th>{% trans "Old value" %}</th>
                <th>{% trans "New value" %}</th>
                <th>{% trans "Changed" %}</th>
            </tr>
            {% for k, value in old_and_updated.items %}<tr>
                <th>{{k|safe}}</th>
                <td>{{value.0|safe}}</td>
                <td>{{value.1|safe}}</td>
                <td class="text-center">{% if value.2%}
                    <i class="fa fa-check-circle-o text-info text-large"
                       aria-hidden="true"></i>{% else %}&ndash;{% endif %}</td>
            </tr>{% endfor %}
        </table>
    </div>
</div>

<hr/>
{% endfor %}

{% endif %}

<h3>{% trans "CSV values" %}</h3>

<div>
    <table class="table table-striped">
        <tr>
            <th>{% trans "Column number" %}</th>
            <th>{% trans "Name" %}</th>
            <th>{% trans "Raw CSV value" %}</th>
            <th>{% trans "Interpreted value" %}</th>
            {% comment %}<th>{% trans "Merged value" %}</th>{% endcomment %}
        </tr>
        {% for idx, name, raw, interpreted in values %}<tr id="col-{{idx}}">
            <td>{{idx}}</td>
            <td>{{name|safe}}</td>
            <td>{{raw}}</td>
            <td>{{interpreted|safe}}</td>
        </tr>{% endfor %}
    </table>

</div>
{% endif %}
{% endblock %}