validation_report.html 4.86 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 25 26 27
        <h1>{{ title }}</h1>
        <p class="text">Validation effectuée {{ validation_date }}</p>
        <p class="text alert alert-info hidden-print">
            Pour relancer la validation, <a href="#" onclick="location.reload();">rechargez</a> la page.
        </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
28
{% if print_mode %}
29 30 31 32 33 34 35 36
    </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
37
{% endif %}
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    {# 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
57
                    {% endif %}
58
                    <p>
59
                        <a href="{{ val_info.doc_url }}" target="_blank" class="card-link">Documentation</a>
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
                    </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
81 82
            </div>
        </div>
83 84
    </div>

Pierre Dittgen's avatar
Pierre Dittgen committed
85
    {% import 'validation_macros.html' as macros %}
Pierre Dittgen's avatar
Pierre Dittgen committed
86

87 88 89
    {% 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
90

Pierre Dittgen's avatar
Pierre Dittgen committed
91
    {{ macros.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
92

93
    {% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
94

95
    <h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
96

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

Pierre Dittgen's avatar
Pierre Dittgen committed
99
    {{ macros.error_statistics(report) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
100

Pierre Dittgen's avatar
Pierre Dittgen committed
101

102 103
    {% if report.table.errors.structure %}
    <div>
Pierre Dittgen's avatar
Pierre Dittgen committed
104
        <h3>Problèmes de structure</h3>
105 106 107 108 109
        {% for err in report.table.errors.structure %}
        <div class="alert alert-danger">
            {{ err.message | safe}}
        </div>
        {% endfor %}
110
    </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
111 112
    {% else %}
    <p class="text">Aucune erreur de structure</p>
113
    {% endif %}
114

Pierre Dittgen's avatar
Pierre Dittgen committed
115 116
    {# We do display body errors! #}
    {% if report.table.do_display_body_errors %}
Pierre Dittgen's avatar
Pierre Dittgen committed
117
    <h3>Problèmes de contenu</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
118 119

    {# No errors - display preview #}
120 121 122 123
    {% if not report.table.errors.body %}
    <p class="text">
        Aucune erreur de contenu
    </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
124
    {{ macros.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
125 126
    
    {% else %}
127

Pierre Dittgen's avatar
Pierre Dittgen committed
128
    {# display errors #}
Pierre Dittgen's avatar
Pierre Dittgen committed
129
    {{ macros.body_errors(report, source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
130
    
131
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
132

Pierre Dittgen's avatar
Pierre Dittgen committed
133 134
    {# do not display errors #}
    {% else %}
135
    <p class="text">
Pierre Dittgen's avatar
Pierre Dittgen committed
136
        Veuillez corriger ce(s) erreur(s) pour visualiser les éventuels problèmes de contenu.
137 138
    </p>
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
139
    {% endif %}
140 141 142


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

144 145 146 147 148 149 150 151 152
    {% block footer %}
    <script>
        $(function () {
            // Errors tooltip activate
            $('[data-toggle="popover"]').popover({
                html: true,
                placement: 'auto',
                trigger: 'hover'
            });
153
        })
154
    </script>
155

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