validation_report.html 5.37 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;
    }
10 11 12 13 14
    @media print {
        .hidden-print {
            display: none;
        }
    }
Pierre Dittgen's avatar
Pierre Dittgen committed
15
</style>
16 17
{% endblock %}
{% block content %}
18
{% if print_mode %}
Pierre Dittgen's avatar
Pierre Dittgen committed
19
<div class="row">
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
    <div class="col-md-5">
        {% endif %}
        <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>
        {% if print_mode %}
    </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>
    {% endif %}
    {# 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
56
                    {% endif %}
57
                    <p>
58
                        <a href="{{ val_info.doc_url }}" target="_blank" class="card-link">Documentation</a>
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
                    </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
80 81
            </div>
        </div>
82 83
    </div>

84
    {% import 'table_macros.html' as tables %}
Pierre Dittgen's avatar
Pierre Dittgen committed
85

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

90
    {{ tables.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
91

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

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

96
    {# table checks #}
Pierre Dittgen's avatar
Pierre Dittgen committed
97

98 99 100 101 102 103 104 105
    {% if report.table.errors.structure %}
    <div>
        <h3>Problèmes de structure</h3>
        {% for err in report.table.errors.structure %}
        <div class="alert alert-danger">
            {{ err.message | safe}}
        </div>
        {% endfor %}
106
    </div>
107
    {% endif %}
108

109
    <!-- row checks -->
110

111 112 113 114 115
    {% if not report.table.errors.body %}
    <h3>Problèmes de contenu</h3>
    <p class="text">
        Aucune erreur de contenu
    </p>
116

117
    {{ tables.preview(source_data) }}
118

119
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
120

121
    {% if report.table.errors.body %}
Pierre Dittgen's avatar
Pierre Dittgen committed
122

123 124 125 126
    {% if not report.table.display_body_errors %}
    <p class="text">
        Veuillez corriger ce(s) erreur(s) pour visualiser les problèmes de contenu.
    </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
127

128 129 130 131 132 133 134 135
    <p class="text">
        <a href="#" id="show_body_errors">Affichez
            tout de même les problèmes de contenu</a>
    </p>
    <div class="alert alert-warning">
        Attention, en cas de problèmes de structure signalés ci-dessus, certains messages d'erreurs ne seront pas
        pertinents
    </div>
136

137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
    <div id="body_errors" style="display: none">
        {{ tables.body_errors(report, source_data) }}
    </div>
    {% else %}
    <div>
        {{ tables.body_errors(report, source_data) }}
    </div>
    {% endif %}
    {% endif %}


    {% endif %}
    {% endblock %}
    {% block footer %}
    <script>
        $(function () {
            // Errors tooltip activate
            $('[data-toggle="popover"]').popover({
                html: true,
                placement: 'auto',
                trigger: 'hover'
            });

            // Show body errors
            $('#show_body_errors').on('click', function () {
                $('#body_errors').show();
                $(this).remove();
            })
165
        })
166
    </script>
167 168 169 170 171 172

{#
{{ report.table.errors.structure|length }} erreur(s) détectée(s)
{{ report.table.errors.body|length }} erreur(s) détectée(s)

#}
173
{% endblock %}