validation_report.html 2.64 KB
Newer Older
1
{% extends "base_template.html" %}
2 3 4 5 6 7 8
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>

Pierre Dittgen's avatar
Pierre Dittgen committed
9
{# Schema info #}
Pierre Dittgen's avatar
Pierre Dittgen committed
10
<div class="row">
Christophe Benz's avatar
Christophe Benz committed
11
    <div class="col-md-5 my-4">
Pierre Dittgen's avatar
Pierre Dittgen committed
12 13 14 15 16 17 18 19 20 21
        <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>
                <p class="text">
                    {% if source_type == 'file' %}Fichier{% endif %}
                    {% if source_type == 'url' %}URL{% endif %}
22
                    à valider : {{ source.name }}
Pierre Dittgen's avatar
Pierre Dittgen committed
23 24 25
                </p>
            </div>
        </div>
26 27 28
    </div>
</div>

Pierre Dittgen's avatar
Pierre Dittgen committed
29
{% import 'table_macros.html' as tables %}
Pierre Dittgen's avatar
Pierre Dittgen committed
30

31
{% if report.error_count == 0 %}
32 33
<h2>La table est valide</h2>
<p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
34

Pierre Dittgen's avatar
Pierre Dittgen committed
35
{{ tables.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
36

37
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
38

39
<h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
40

41
{% if source_type == 'url' %}
Christophe Benz's avatar
Christophe Benz committed
42
<button class="btn btn-primary my-2" id="btn-reload">Relancer la validation</button>
43
{% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
44
{# table checks #}
Pierre Dittgen's avatar
Pierre Dittgen committed
45

46
{% if report.table.errors.structure %}
Pierre Dittgen's avatar
Pierre Dittgen committed
47
<div>
48
    <h3>Problèmes de structure</h3>
49 50 51 52 53
    {% for err in report.table.errors.structure %}
    <div class="alert alert-danger">
        {{ err.message | safe}}
    </div>
    {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
54
</div>
55
{% endif %}
56

Pierre Dittgen's avatar
Pierre Dittgen committed
57
<!-- row checks -->
58 59

{% if report.table.errors.body %}
60 61

{% if not report.table.display_body_errors %}
Pierre Dittgen's avatar
Pierre Dittgen committed
62 63 64
<p class="text">
    Veuillez corriger ce(s) erreur(s) pour visualiser les problèmes de contenu.<br />
    <a href="#" id="show_body_errors" title="Attention, en cas de problème sur les colonnes, certains messages d'errur ne seront pas pertinents">Affichez
Pierre Dittgen's avatar
Pierre Dittgen committed
65
        tout de même les problèmes de contenu</a>
Pierre Dittgen's avatar
Pierre Dittgen committed
66 67 68 69
</p>
<div id="body_errors" style="display: none">
    {{ tables.body_errors(report, source_data) }}
</div>
70
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
71
<div>
Pierre Dittgen's avatar
Pierre Dittgen committed
72
    {{ tables.body_errors(report, source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
73
</div>
Pierre Dittgen's avatar
Pierre Dittgen committed
74 75 76
{% endif %}
{% endif %}

77

Pierre Dittgen's avatar
Pierre Dittgen committed
78
{% endif %}
79 80
{% endblock %}
{% block footer %}
81 82
<script>
    $(function () {
83
        // Errors tooltip activate
Pierre Dittgen's avatar
Pierre Dittgen committed
84 85 86
        $('[data-toggle="popover"]').popover({
            html: true,
            placement: 'auto',
87
            trigger: 'hover'
Pierre Dittgen's avatar
Pierre Dittgen committed
88
        });
89

Pierre Dittgen's avatar
Pierre Dittgen committed
90 91 92 93
        // Show body errors
        $('#show_body_errors').on('click', function () {
            $('#body_errors').show();
            $(this).remove();
94
        })
95 96
    })
</script>
97 98 99 100 101 102

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

#}
Pierre Dittgen's avatar
Pierre Dittgen committed
103
{% endblock %}