114 lines
4.8 KiB
HTML
114 lines
4.8 KiB
HTML
{% extends "admin/base_site.html" %}
|
||
{% load i18n %}
|
||
|
||
{% block title %}Importation du GeoPackage RWI – Administration{% endblock %}
|
||
|
||
{% block breadcrumbs %}
|
||
<div class="breadcrumbs">
|
||
<a href="{% url 'admin:index' %}">Accueil</a>
|
||
›
|
||
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_label|capfirst }}</a>
|
||
›
|
||
<a href="{% url 'admin:assets_naturerwiasset_changelist' %}">Ouvrages RWI</a>
|
||
›
|
||
Import RWI
|
||
</div>
|
||
{% endblock %}
|
||
|
||
{% block content %}
|
||
<h1>🔄 Importation du GeoPackage RWI</h1>
|
||
|
||
{% if messages %}
|
||
<ul class="messagelist">
|
||
{% for message in messages %}
|
||
<li class="{{ message.tags }}">{{ message }}</li>
|
||
{% endfor %}
|
||
</ul>
|
||
{% endif %}
|
||
|
||
<div style="display:flex; gap:2rem; flex-wrap:wrap; align-items:flex-start; margin-top:1.5rem;">
|
||
|
||
{# ===== Action form ===== #}
|
||
<div style="flex:0 0 450px; background:#fff; border:1px solid #ddd; border-radius:6px; padding:1.5rem;">
|
||
<h2 style="margin-top:0; font-size:1.1rem;">Lancer l'importation</h2>
|
||
<p style="margin-bottom:1rem; font-size:.9rem; color:#444;">
|
||
Cette action va lire le fichier de base de données GeoPackage <code>inventaire_giep.gpkg</code>,
|
||
calculer les centroïdes en coordonnées standard, et créer ou mettre à jour les ouvrages RWI in-place sans les dupliquer.
|
||
</p>
|
||
<form method="post" enctype="multipart/form-data">
|
||
{% csrf_token %}
|
||
|
||
<div style="margin-bottom:1rem;">
|
||
<label for="gpkg_file" style="display:block; font-weight:bold; margin-bottom:.4rem;">
|
||
Fichier GeoPackage (.gpkg) <span style="color:red">*</span>
|
||
</label>
|
||
<input type="file" name="gpkg_file" id="gpkg_file" accept=".gpkg"
|
||
required
|
||
style="width:100%; padding:.4rem 0;">
|
||
</div>
|
||
|
||
<fieldset style="border:1px solid #e0e0e0; border-radius:4px; padding:.8rem 1rem; margin-bottom:1rem;">
|
||
<legend style="font-weight:bold; padding:0 .4rem;">Option</legend>
|
||
|
||
<label style="display:flex; align-items:center; gap:.5rem; cursor:pointer;">
|
||
<input type="checkbox" name="dry_run" value="1">
|
||
<span>
|
||
<strong>Dry-run</strong>
|
||
<small style="color:#555; display:block;">Simule l'importation sans modifier la base de données</small>
|
||
</span>
|
||
</label>
|
||
</fieldset>
|
||
|
||
<div style="display:flex; gap:.75rem; flex-wrap:wrap;">
|
||
<button type="submit"
|
||
style="background:#417690; color:#fff; border:none; border-radius:4px;
|
||
padding:.55rem 1.2rem; font-size:.95rem; cursor:pointer; font-weight:bold;">
|
||
▶ Lancer l'importation RWI
|
||
</button>
|
||
<a href="{% url 'admin:assets_naturerwiasset_changelist' %}"
|
||
style="background:#f0f0f0; color:#333; border:1px solid #ccc; border-radius:4px;
|
||
padding:.5rem 1.1rem; font-size:.95rem; text-decoration:none; display:inline-block;">
|
||
Annuler
|
||
</a>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
{# ===== Information ===== #}
|
||
<div style="flex:1; min-width:280px; background:#f8f8f8; border:1px solid #e0e0e0;
|
||
border-radius:6px; padding:1.2rem 1.5rem; font-size:.88rem; line-height:1.5;">
|
||
<h3 style="margin-top:0; font-size:1rem;">Détails de l'opération</h3>
|
||
<ul style="padding-left:1.2rem; margin:.4rem 0;">
|
||
<li><strong>Fichier source :</strong> <code>external_files/giep/inventaire_giep.gpkg</code></li>
|
||
<li><strong>Reprojection :</strong> Conversion automatique Lambert 72 ➡️ Lambert 2008 (standard du projet).</li>
|
||
<li><strong>Centroïdes :</strong> Extraction automatique des coordonnées WGS84 pour la carte.</li>
|
||
<li><strong>Traductions :</strong> Mapping automatique français/néerlandais pour les ouvrages.</li>
|
||
<li><strong>Z-Dimension :</strong> Normalisation automatique des géométries 3D en 2D.</li>
|
||
</ul>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
{% if import_error %}
|
||
<div style="margin-top:1.5rem; background:#fff0f0; border:1px solid #f5c6cb;
|
||
border-radius:6px; padding:1rem 1.2rem; color:#721c24;">
|
||
<strong>Erreur :</strong> {{ import_error }}
|
||
</div>
|
||
{% endif %}
|
||
|
||
{% if output_lines %}
|
||
<div style="margin-top:1.5rem;">
|
||
<h2 style="font-size:1.05rem; margin-bottom:.5rem;">
|
||
Journal d'importation
|
||
{% if dry_run %}<span style="color:#856404; font-size:.85rem;">(dry-run – aucune donnée enregistrée)</span>{% endif %}
|
||
</h2>
|
||
<div style="background:#1a1a2e; color:#e0e0e0; font-family:monospace; font-size:.82rem;
|
||
border-radius:6px; padding:1rem 1.2rem; max-height:500px; overflow-y:auto;
|
||
white-space:pre-wrap; line-height:1.5;">{% for line in output_lines %}{% autoescape on %}{{ line }}{% endautoescape %}
|
||
{% endfor %}</div>
|
||
</div>
|
||
{% endif %}
|
||
|
||
{% endblock %}
|
||
|
||
{% block sidebar %}{% endblock %}
|