validation_report.html 2.45 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>

<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>

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

{% include 'table_preview.html' %}

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

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

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

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

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

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

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

    {% endif %}

</div>
84 85


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

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