From 9d58d07f20a6369f98196aca766ae9224b252da5 Mon Sep 17 00:00:00 2001 From: Jacques Fize <4259846+jacquesfize@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:24:08 +0200 Subject: [PATCH] [IMPORT] update import report (#3223) * feat(import, report): refact of the report design * feat(import, report): change/add condition to display certain element in the import report pdf * fix(import, report) : fix inversion between source and destination field + hide field not mapped --- .../geonature/core/imports/routes/imports.py | 11 +- .../templates/import_template_pdf.html | 370 ++++++++++-------- backend/geonature/core/imports/utils.py | 1 - .../import_report.component.html | 2 +- .../import_report/import_report.component.ts | 14 +- 5 files changed, 221 insertions(+), 177 deletions(-) diff --git a/backend/geonature/core/imports/routes/imports.py b/backend/geonature/core/imports/routes/imports.py index 3fc42e4eba..d2c60dd938 100644 --- a/backend/geonature/core/imports/routes/imports.py +++ b/backend/geonature/core/imports/routes/imports.py @@ -660,15 +660,7 @@ def export_pdf(scope, imprt): """ if not imprt.has_instance_permission(scope): raise Forbidden - ctx = imprt.as_dict( - fields=[ - "errors", - "errors.type", - "errors.entity", - "dataset.dataset_name", - "destination.statistics_labels", - ] - ) + ctx = imprt.as_dict() ctx["map"] = request.form.get("map") if ctx["map"] == "undefined": @@ -685,7 +677,6 @@ def export_pdf(scope, imprt): ctx["url"] = "/".join(url_list) ctx["statistics_formated"] = {} - for label_dict in ctx["destination"]["statistics_labels"]: key = label_dict["value"] if label_dict["key"] in ctx["statistics"]: diff --git a/backend/geonature/core/imports/templates/import_template_pdf.html b/backend/geonature/core/imports/templates/import_template_pdf.html index 989979970c..d883186b23 100644 --- a/backend/geonature/core/imports/templates/import_template_pdf.html +++ b/backend/geonature/core/imports/templates/import_template_pdf.html @@ -1,176 +1,190 @@ - -
+Fiche descriptive
-Identification
-
-
- Auteur :
- {% if data.authors_name: %}
- {{ data.authors_name }}
- {% endif %}
-
- SRID :
- {% if data.srid: %}
- {{ data.srid }}
- {% endif %}
-
- Encodage :
- {% if data.encoding: %}
- {{ data.encoding }}
- {% endif %}
-
- Format :
- {% if data.format_source_file: %}
- {{ data.format_source_file }}
- {% endif %}
-
- Jeux de données :
- {% if data.dataset: %}
- {{ data.dataset.dataset_name }}
- {% endif %}
-
Mots-clés
-- {{ data.keywords }} -
-Zone géographique
- + {% endfor %} + {% if data.dataset: %} +Mots-clés
+{{ data.keywords }}
Statistiques
- -Champs | -Valeur | -
---|
Champs | +Valeur | +
---|---|
{{ key|capitalize }} | {{ value }} | -
Erreurs
- -Type d'erreur | -Champ | -Nombre d'erreur(s) | -Entité | -
---|
Type d'erreur | +Champ | +Nombre d'erreur(s) | +Entité | +
---|---|---|---|
{{ error.type.description }} | -{{ error.column }} | -{{ error.rows | length }} | -{{ error.entity.label if error.entity else "" }} | -
{{ error.type.description }} | +{{ error.column }} | +{{ error.rows | length }} | +{{ error.entity.label if error.entity else "" }} | +