validation_report.html 5.69 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 24
        <h1>{{ title }}</h1>
        <p class="text">Validation effectuée {{ validation_date }}</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
25
{% if print_mode %}
26 27 28 29 30 31 32 33
    </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' %}
<p class="text hidden-print">Obtenir le rapport au format <a href="{{ url_for('pdf_report', val_code=val_info.code) }}?url={{source.name|urlencode}}">PDF</a>
Pierre Dittgen's avatar
Pierre Dittgen committed
34
{% endif %}
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    {# 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 %}
                    <p class="text">
                        {% 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
54
                    {% endif %}
55
                    <p>
56
                        <a href="{{ val_info.doc_url }}" target="_blank" class="card-link">Documentation</a>
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
                    </p>
                    <hr />
                    <p class="text alert alert-secondary" style="margin-bottom: 0;">
                        Source
                        {% if source_type == 'file' %}
                        (fichier) : <em>{{ source.name }}</em>
                        {% endif %}
                        {% if source_type == 'url' %}
                        (URL) : <em><a href="{{source.name}}" target="_blank" title="{{source.name}}">
                                {% if print_mode %}
                                {{source.name}}
                                {% else %}
                                {{source.name | truncate(60)}}
                                {% endif %}
                            </a></em>
                        {% endif %}
                        <br />
                        Dimensions : <em>{{ report.table.col_count }} colonnes et {{ report.table.row_count }}
                            lignes</em>
                    </p>
                </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
78 79
            </div>
        </div>
80 81
    </div>

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

84 85 86
    {% 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
87

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

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

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

94
    <p class="text">{{ report.table['error-stats']['count'] }} erreur(s) détectée(s).</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
95

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

Pierre Dittgen's avatar
Pierre Dittgen committed
98

Pierre Dittgen's avatar
Pierre Dittgen committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
    <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 %}
        <table class="table table-bordered table-sm table-striped">
            <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>
        
135
        {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
136 137 138 139 140


    {% else %}
        <p class="text">Aucune erreur de structure</p>
    {% endif %}
141

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

    {# No errors - display preview #}
147 148 149 150
    {% if not report.table.errors.body %}
    <p class="text">
        Aucune erreur de contenu
    </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
151
    {{ macros.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
152 153
    
    {% else %}
154

Pierre Dittgen's avatar
Pierre Dittgen committed
155
    {# display errors #}
Pierre Dittgen's avatar
Pierre Dittgen committed
156
    {{ macros.body_errors(report, source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
157
    
158
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
159

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


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

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

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