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

9
<!-- Schema info -->
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<div class="card bg-faded" style="width: 30rem;">
    <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 %}
            à valider : {{ source }}
        </p>
    </div>
</div>

25
{% if report.error_count == 0 %}
26 27
<h2>La table est valide</h2>
<p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
28 29 30

{% include 'table_preview.html' %}

31
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
32

33
<h2>La table est invalide</h2>
34
<p>{{ report.error_count }} erreur(s) détectée(s)</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
35

Pierre Dittgen's avatar
Pierre Dittgen committed
36 37
<!-- table checks -->

38
{% if report.table.errors.structure %}
Pierre Dittgen's avatar
Pierre Dittgen committed
39
<div>
40
    <h3>Problèmes de structure</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
41
    <ul>
42
        {% for err in report.table.errors.structure %}
43
        <li>[{{ err.code }}] {{ err.message }}</li>
Pierre Dittgen's avatar
Pierre Dittgen committed
44 45 46
        {% endfor %}
    </ul>
</div>
47
{% endif %}
48

Pierre Dittgen's avatar
Pierre Dittgen committed
49
<!-- row checks -->
50 51

{% if report.table.errors.body %}
Pierre Dittgen's avatar
Pierre Dittgen committed
52
<div>
53
    <h3>Erreurs de valeurs</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
54

Pierre Dittgen's avatar
Pierre Dittgen committed
55
    <div class="table-responsive-sm">
Pierre Dittgen's avatar
Pierre Dittgen committed
56 57
        <table class="table-sm table-bordered">
            <thead class="thead-light">
58 59
                <th scope="col">Ligne</th>
                {% for h in report['table']['headers'] %}
Pierre Dittgen's avatar
Pierre Dittgen committed
60
                <th scope="col">{{ h }}</th>
61
                {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
62 63
            </thead>
            <tbody>
64
                {% for row in report.table.errors.by_rows %}
Pierre Dittgen's avatar
Pierre Dittgen committed
65
                <tr>
66 67 68
                    <th>{{ row.row_id }}</th>
                    {% for d in source_data.data_rows[row.row_id - 2] %}
                    {% if loop.index in row.errors %}
69
                    <td class="table-danger" data-toggle="tooltip" title="[{{row.errors[loop.index].code}}] {{ row.errors[loop.index].message }}">
70 71 72 73 74
                        {% else %}
                    <td>
                        {% endif %}
                        {{ d | truncate(30) }}
                    </td>
Pierre Dittgen's avatar
Pierre Dittgen committed
75 76
                    {% endfor %}
                </tr>
77
                {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
78 79 80
            </tbody>
        </table>
    </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
81 82 83 84

    {% endif %}

</div>
85 86


87
<!--
88
<pre>
89
    {{ report_str }}
90
</pre>
91
-->
92

Pierre Dittgen's avatar
Pierre Dittgen committed
93
{% endif %}
94 95
{% endblock %}
{% block footer %}
96 97 98 99 100
<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip()
    })
</script>
101
{% endblock %}