validation_report.html 5.29 KB
Newer Older
1
{% extends "base_template.html" %}
2
3
4
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
Pierre Dittgen's avatar
Pierre Dittgen committed
5
6
7
8
9
<style>
    .popover .popover-body h2 {
        font-size: 1.2em;
        font-weight: bold;
    }
Pierre Dittgen's avatar
Pierre Dittgen committed
10

11
12
13
14
15
    @media print {
        .hidden-print {
            display: none;
        }
    }
Pierre Dittgen's avatar
Pierre Dittgen committed
16
</style>
17
18
{% endblock %}
{% block content %}
19
{% if print_mode %}
Pierre Dittgen's avatar
Pierre Dittgen committed
20
<div class="row">
21
    <div class="col-md-5">
Pierre Dittgen's avatar
Pierre Dittgen committed
22
{% endif %}
23
        <h1>{{ title }}</h1>
Christophe Benz's avatar
Christophe Benz committed
24
        <p>Validation effectuée {{ validation_date }}</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
25
{% if print_mode %}
26
27
28
29
30
31
32
    </div>
    <div class="col-md-7">
        <img src="{{ url_for('static', filename='img/logo-horizontal.png') }}" height="80" alt="Validata" />
    </div>
</div>
{% endif %}
{% if source.type == 'url' %}
Christophe Benz's avatar
Christophe Benz committed
33
34
35
36
37
<p class="hidden-print">
    <a href="{{ url_for('pdf_report', val_code=val_info.code) }}?url={{source.name|urlencode}}">
        Télécharger en PDF
    </a>
</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
38
{% endif %}
39
40
41
42
43
44
45
46
47
48
49
    {# Schema info #}
    <div class="row">
        <div class="col-md-{% if print_mode %}12{% else %}5{% endif %} my-4">
            <div class="card bg-faded">
                <div class="card-body">
                    <h5 class="card-title">
                        Schéma {{ val_info.code }}
                        <span class="badge badge-primary">{{ val_info.version }}</span>
                    </h5>
                    <h6 class="card-subtitle mb-2 text-muted">{{ val_info.description }}</h6>
                    {% if val_info.author or val_info.contributor %}
Christophe Benz's avatar
Christophe Benz committed
50
                    <p>
51
52
53
54
55
56
57
                        {% if val_info.author %}
                        Auteur : {{ val_info.author }}
                        {% endif %}
                        {% if val_info.contributor %}
                        <br />Contributeur(s) : {{ val_info.contributor }}
                        {% endif %}
                    </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
58
                    {% endif %}
59
                    <p>
60
                        <a href="{{ val_info.doc_url }}" target="_blank" class="card-link">Documentation</a>
61
62
                    </p>
                    <hr />
Christophe Benz's avatar
Christophe Benz committed
63
64
                    <div>
                        Fichier traité :
65
                        {% if source_type == 'file' %}
Christophe Benz's avatar
Christophe Benz committed
66
                            {{ source.name }}
67
68
                        {% endif %}
                        {% if source_type == 'url' %}
Christophe Benz's avatar
Christophe Benz committed
69
                            <a href="{{source.name}}" target="_blank">
70
                                {{source.name}}
Christophe Benz's avatar
Christophe Benz committed
71
                            </a>
72
73
                        {% endif %}
                        <br />
Christophe Benz's avatar
Christophe Benz committed
74
75
                        Dimensions : {{ report.table.col_count }} colonnes et {{ report.table.row_count }} lignes
                    </div>
76
                </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
77
78
            </div>
        </div>
79
80
    </div>

Pierre Dittgen's avatar
Pierre Dittgen committed
81
    {% import 'validation_macros.html' as macros %}
Pierre Dittgen's avatar
Pierre Dittgen committed
82

83
84
85
    {% if report.error_count == 0 %}
    <h2>La table est valide</h2>
    <p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
86

Pierre Dittgen's avatar
Pierre Dittgen committed
87
    {{ macros.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
88

89
    {% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
90

91
    <h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
92

Christophe Benz's avatar
Christophe Benz committed
93
    <p>{{ report.table['error-stats']['count'] }} erreur(s) détectée(s).</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
94

Pierre Dittgen's avatar
Pierre Dittgen committed
95
    {{ macros.error_statistics(report) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
96

Pierre Dittgen's avatar
Pierre Dittgen committed
97

Pierre Dittgen's avatar
Pierre Dittgen committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
    <h3>Problèmes de structure</h3>
    {% if report.table.errors.structure %}
        {# Non-column errors #}
        {% for err in report.table.errors.structure %}
            {% if not err.in_column_comp %}
                {{ err.content | safe }}
            {% endif %}
        {% endfor %}

        {# Column errors #}
        {% for err in report.table.errors.structure %}
            {% if err.in_column_comp %}
                {{ err.content | safe }}
            {% endif %}
        {% endfor %}


        {# Afficher un tableau de comparaison des colonnes #}
        {% if report.table.column_comparison_needed %}
Christophe Benz's avatar
Christophe Benz committed
117
        <table class="table table-bordered table-sm table-striped table-hover">
Pierre Dittgen's avatar
Pierre Dittgen committed
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
            <thead class="thead-light">
                <tr>
                    <th scope="col">Colonnes du fichier</th>
                    <th scope="col">Champs du schéma</th>
                </tr>
            </thead>
            <tbody>
                {% for elt in report.table.column_comparison_info %}
                    <tr{% if elt[2] == 'ko' %} class="table-danger"{% endif %}>
                        <td>{{ elt[0]}}</td>
                        <td>{{ elt[1]}}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
Christophe Benz's avatar
Christophe Benz committed
133

134
        {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
135
136
137


    {% else %}
Christophe Benz's avatar
Christophe Benz committed
138
        <p>Aucune erreur de structure</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
139
    {% endif %}
140

Pierre Dittgen's avatar
Pierre Dittgen committed
141
142
    {# We do display body errors! #}
    {% if report.table.do_display_body_errors %}
Pierre Dittgen's avatar
Pierre Dittgen committed
143
    <h3>Problèmes de contenu</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
144
145

    {# No errors - display preview #}
146
    {% if not report.table.errors.body %}
Christophe Benz's avatar
Christophe Benz committed
147
    <p>
148
149
        Aucune erreur de contenu
    </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
150
    {{ macros.preview(source_data) }}
Christophe Benz's avatar
Christophe Benz committed
151

Pierre Dittgen's avatar
Pierre Dittgen committed
152
    {% else %}
153

Pierre Dittgen's avatar
Pierre Dittgen committed
154
    {# display errors #}
Pierre Dittgen's avatar
Pierre Dittgen committed
155
    {{ macros.body_errors(report, source_data) }}
Christophe Benz's avatar
Christophe Benz committed
156

157
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
158

Pierre Dittgen's avatar
Pierre Dittgen committed
159
160
    {# do not display errors #}
    {% else %}
Christophe Benz's avatar
Christophe Benz committed
161
    <p>
Pierre Dittgen's avatar
Pierre Dittgen committed
162
        Veuillez corriger ce(s) erreur(s) pour visualiser les éventuels problèmes de contenu.
163
164
    </p>
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
165
    {% endif %}
166
167
168


    {% endblock %}
Pierre Dittgen's avatar
Pierre Dittgen committed
169

170
171
172
173
174
175
176
177
178
    {% block footer %}
    <script>
        $(function () {
            // Errors tooltip activate
            $('[data-toggle="popover"]').popover({
                html: true,
                placement: 'auto',
                trigger: 'hover'
            });
179
        })
180
    </script>
181

Pierre Dittgen's avatar
Pierre Dittgen committed
182
    {% endblock %}