Commit 8dd04ff4 authored by Pierre Dittgen's avatar Pierre Dittgen

Better PDF report

parent 88a48e53
......@@ -71,7 +71,7 @@
<script src="{{url_for('static', filename='js/popper.min.js')}}"></script>
<script src="{{url_for('static', filename='js/bootstrap.min.js')}}"></script>
{% block footer %}{% endblock %}
<footer class="footer">
<footer class="footer hidden-print">
<div>
Le service de validation du <a href="https://www.validata.fr/">projet Validata</a>
est mis à disposition par
......@@ -107,4 +107,4 @@
</body>
</html>
</html>
\ No newline at end of file
......@@ -24,7 +24,50 @@
</div>
{% endmacro %}
{% macro body_errors(report, source_data) %}
{% macro body_errors(report, source_data, print_mode) %}
{% if print_mode %}
{{ body_errors_pdf(report, source_data) }}
{% else %}
{{ body_errors_screen(report, source_data) }}
{% endif %}
{% endmacro %}
{% macro body_errors_pdf(report, source_data) %}
<table id="table-errors" class="table table-striped table-bordered table-sm">
<thead class="thead-light">
<th>Ligne</th>
<th>Colonne</th>
<th>Valeur</th>
<th>Erreur</th>
</thead>
<tbody>
{% for row in report.table.errors.body_by_rows %}
{% if 'row' in row.errors %}
<tr>
<td>{{ row.row_id }}</td>
<td colspan="3">{{ row.errors.row.title }}</td>
</tr>
{% else %}
{% for d in source_data.data_rows[row.row_id - 2] %}
{% if loop.index in row.errors %}
<tr>
<td>{{ row.row_id }}</td>
<td>{{ source_data.header[loop.index - 1] }}</td>
<td>{{ d }}</td>
<td>
<h5>{{row.errors[loop.index].title}}</h5>
{{ row.errors[loop.index].content | safe }}
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endmacro %}
{% macro body_errors_screen(report, source_data) %}
<div class="table-responsive-sm">
<table class="table-sm table-bordered table-striped table-hover">
<thead class="thead-light">
......@@ -109,4 +152,4 @@ au total
{% endif %}
{% endif %}
{% endmacro %}
\ No newline at end of file
{% endmacro %}
......@@ -7,6 +7,10 @@
font-size: 1.2em;
font-weight: bold;
}
#table-errors td h2 {
font-size: 1em;
font-weight: bold;
}
@media print {
.hidden-print {
......@@ -161,7 +165,7 @@
{% else %}
{# display errors #}
{{ macros.body_errors(report, source_data) }}
{{ macros.body_errors(report, source_data, print_mode) }}
{% endif %}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment