validation_report.html 5.08 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
<style>
Pierre Dittgen's avatar
Pierre Dittgen committed
6 7 8 9 10 11 12 13 14 15 16 17
  .popover .popover-body h2 {
    font-size: 1.2em;
    font-weight: bold;
  }
  #table-errors td h2 {
    font-size: 1em;
    font-weight: bold;
  }

  @media print {
    .hidden-print {
      display: none;
18
    }
Pierre Dittgen's avatar
Pierre Dittgen committed
19
  }
Pierre Dittgen's avatar
Pierre Dittgen committed
20
</style>
21 22
{% endblock %}
{% block content %}
23
{% if print_mode %}
Pierre Dittgen's avatar
Pierre Dittgen committed
24
<div class="row">
25
    <div class="col-md-5">
Pierre Dittgen's avatar
Pierre Dittgen committed
26
{% endif %}
Christophe Benz's avatar
Christophe Benz committed
27
        <h1 class="my-4">{{ title }}</h1>
Christophe Benz's avatar
Christophe Benz committed
28
        <p>Validation effectuée {{ validation_date }}</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
29
        <p><img src="{{ badge_url }}" alt="{{ badge_msg }}" title="{{ badge_msg }}"/></p>
Pierre Dittgen's avatar
Pierre Dittgen committed
30
{% if print_mode %}
31 32 33 34 35 36 37
    </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
38
<p class="hidden-print">
39
    <a href="{{ pdf_report_url }}&url={{source.name|urlencode}}" target="_blank">
Christophe Benz's avatar
Christophe Benz committed
40 41 42
        Télécharger en PDF
    </a>
</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
43
{% endif %}
44 45 46 47
    {# Schema info #}
    <div class="row">
        <div class="col-md-{% if print_mode %}12{% else %}5{% endif %} my-4">
            <div class="card bg-faded">
Pierre Dittgen's avatar
Pierre Dittgen committed
48 49
                <div class="card-body">  
                    {% include 'schema_info_part.html' %}
50
                    <hr />
Christophe Benz's avatar
Christophe Benz committed
51
                    <div>
Pierre Dittgen's avatar
Pierre Dittgen committed
52 53 54
                        <h5 class="card-title">
                            Fichier traité
                        </h5>
55
                        {% if source_type == 'file' %}
Christophe Benz's avatar
Christophe Benz committed
56
                            {{ source.name }}
57 58
                        {% endif %}
                        {% if source_type == 'url' %}
Christophe Benz's avatar
Christophe Benz committed
59
                            <a href="{{source.name}}" target="_blank">
60
                                {{source.name}}
Christophe Benz's avatar
Christophe Benz committed
61
                            </a>
62 63
                        {% endif %}
                        <br />
Christophe Benz's avatar
Christophe Benz committed
64 65
                        Dimensions : {{ report.table.col_count }} colonnes et {{ report.table.row_count }} lignes
                    </div>
66
                </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
67 68
            </div>
        </div>
69 70
    </div>

Pierre Dittgen's avatar
Pierre Dittgen committed
71
    {% import 'validation_macros.html' as macros %}
Pierre Dittgen's avatar
Pierre Dittgen committed
72

73 74 75
    {% 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
76

Pierre Dittgen's avatar
Pierre Dittgen committed
77
    {{ macros.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
78

79
    {% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
80

81
    <h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
82

Pierre Dittgen's avatar
Pierre Dittgen committed
83 84 85 86 87 88 89 90
    <p>
        {% set error_count = report.table['error-stats']['count'] %}
        {% if error_count == 1 %}
        1 erreur détectée.
        {% else %}
        {{ error_count }} erreurs détectées.
        {% endif %}
    </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
91

Pierre Dittgen's avatar
Pierre Dittgen committed
92
    {{ macros.error_statistics(report) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
93

Pierre Dittgen's avatar
Pierre Dittgen committed
94

Pierre Dittgen's avatar
Pierre Dittgen committed
95
    {% if report.table.errors.structure %}
Pierre Dittgen's avatar
Pierre Dittgen committed
96
        <h3>Erreurs de structure</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
        {# 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
114
        <table class="table table-bordered table-sm table-striped table-hover">
Pierre Dittgen's avatar
Pierre Dittgen committed
115 116 117
            <thead class="thead-light">
                <tr>
                    <th scope="col">Colonnes du fichier</th>
Pierre Dittgen's avatar
Pierre Dittgen committed
118
                    <th scope="col">Colonnes attendues</th>
Pierre Dittgen's avatar
Pierre Dittgen committed
119 120 121
                </tr>
            </thead>
            <tbody>
122
                {% for elt in report.table.column_comparison_info.table %}
Pierre Dittgen's avatar
Pierre Dittgen committed
123
                    <tr{% if elt[2] == 'ko' %} class="table-danger"{% endif %}>
Pierre Dittgen's avatar
Pierre Dittgen committed
124 125
                        <td>{{ elt[0] }}</td>
                        <td>{{ elt[1] }}</td>
Pierre Dittgen's avatar
Pierre Dittgen committed
126 127 128 129
                    </tr>
                {% endfor %}
            </tbody>
        </table>
130
        {% if report.table.column_comparison_info.has_missing %}
Pierre Dittgen's avatar
Pierre Dittgen committed
131
        <p>Attention : toutes les colonnes attendues doivent être présentes dans le fichier à valider.<p>
132 133 134 135
        {% endif %}
        {% if report.table.column_comparison_info.has_case_errors %}
        <p>Attention : la casse (minuscules/majuscules) doit être respectée dans les noms de colonne.<p>
        {% endif %}
Christophe Benz's avatar
Christophe Benz committed
136

137
        {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
138
    {% endif %}
139

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

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

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

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

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

Pierre Dittgen's avatar
Pierre Dittgen committed
158 159
    {# do not display errors #}
    {% else %}
Christophe Benz's avatar
Christophe Benz committed
160
    <p>
Pierre Dittgen's avatar
Pierre Dittgen committed
161
        Veuillez corriger ces erreurs pour visualiser les éventuelles erreurs de contenu.
162 163
    </p>
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
164
    {% endif %}
165 166 167


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

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

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