up table ville infos tags

This commit is contained in:
Tykayn 2025-11-25 21:39:10 +01:00 committed by tykayn
parent f7e9576c41
commit 6560b20f16
3 changed files with 142 additions and 21 deletions

View file

@ -129,6 +129,39 @@
.table-theme th {
background: #f8f9fa;
}
/* En-têtes de tableau fixes */
#table_container {
position: relative;
max-height: 70vh;
overflow-y: auto;
overflow-x: auto;
}
#stats-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
}
#stats-table thead {
position: sticky;
top: 0;
z-index: 10;
background: #fff;
}
#stats-table thead th {
background: #f8f9fa;
border-bottom: 2px solid #dee2e6;
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
padding: 0.75rem;
font-weight: 600;
}
#stats-table tbody td {
border-top: 1px solid #dee2e6;
}
</style>
{% endblock %}
@ -919,20 +952,65 @@
const coordinates = e.features[0].geometry.coordinates.slice();
const properties = e.features[0].properties;
let missing_tags = [];
let missing_tags_info = [];
const tags_for_completion = ['name', 'wheelchair', 'siret', 'opening_hours'];
tags_for_completion.forEach(function (tag) {
if (!properties[tag]) {
missing_tags.push(tag);
// Vérifier les tags manquants avec leurs descriptions
const tags_info = {
'name': {tag: 'name', desc: 'Nom du commerce'},
'opening_hours': {tag: 'opening_hours', desc: 'Horaires d\'ouverture'},
'wheelchair': {tag: 'wheelchair', desc: 'Accessibilité PMR'},
'ref:FR:SIRET': {tag: 'ref:FR:SIRET', desc: 'SIRET'},
'contact:street': {tag: 'contact:street', desc: 'Rue (ou addr:street)'},
'contact:housenumber': {tag: 'contact:housenumber', desc: 'Numéro (ou addr:housenumber)'},
'website': {tag: 'website', desc: 'Site web (ou contact:website, url, contact:url)'},
'contact:phone': {tag: 'contact:phone', desc: 'Téléphone (ou phone)'}
};
// Vérifier le nom
if (!properties['name']) {
missing_tags.push('name');
missing_tags_info.push(tags_info['name']);
}
// Vérifier l'adresse
const hasStreet = properties['contact:street'] || properties['addr:street'];
const hasHousenumber = properties['contact:housenumber'] || properties['addr:housenumber'];
if (!hasStreet || !hasHousenumber) {
if (!hasStreet) {
missing_tags.push('contact:street');
missing_tags_info.push(tags_info['contact:street']);
}
})
if (!hasHousenumber) {
missing_tags.push('contact:housenumber');
missing_tags_info.push(tags_info['contact:housenumber']);
}
}
if (!properties['phone'] && properties['contact:phone']) {
missing_tags.push('contact:phone');
// Vérifier les horaires
if (!properties['opening_hours']) {
missing_tags.push('opening_hours');
missing_tags_info.push(tags_info['opening_hours']);
}
if (!properties['website'] && properties['contact:website']) {
missing_tags.push('contact:website');
// Vérifier le site web
const hasWebsite = properties['website'] || properties['contact:website'] || properties['url'] || properties['contact:url'];
if (!hasWebsite) {
missing_tags.push('website');
missing_tags_info.push(tags_info['website']);
}
// Vérifier l'accessibilité
if (!properties['wheelchair']) {
missing_tags.push('wheelchair');
missing_tags_info.push(tags_info['wheelchair']);
}
// Vérifier le SIRET
if (!properties['ref:FR:SIRET'] && !properties['siret']) {
missing_tags.push('ref:FR:SIRET');
missing_tags_info.push(tags_info['ref:FR:SIRET']);
}
properties.missing_tags = missing_tags;
let popupContent = `<strong>${properties.name || 'Sans nom'}</strong><br>`;
@ -940,11 +1018,16 @@
if (properties.main_tag) popupContent += `<em>${properties.main_tag}</em><br>`;
if (properties.note) popupContent += `<small>Note: ${properties.note}</small><br>`;
popupContent += `<b>Complétion :</b> ${properties.completion !== null ? properties.completion + '%' : ''}`;
const missingTags = Array.isArray(properties.missing_tags) ? properties.missing_tags : [];
console.log('e.features[0]', e.features[0], missingTags, 'tags', properties)
// if (missingTags.length > 0) {
// popupContent += `<div style='color:#b30000;font-size:0.95em;margin-top:4px;'><b>Manque :</b> ${missingTags.map(t => `<code>${t}</code>`).join(', ')}</div>`;
// }
// Afficher les tags manquants avec leurs descriptions
if (missing_tags_info.length > 0) {
popupContent += `<div style='color:#b30000;font-size:0.9em;margin-top:8px;padding:8px;background:#ffe6e6;border-radius:4px;'><b>Informations manquantes :</b><ul style='margin:4px 0 0 0;padding-left:20px;'>`;
missing_tags_info.forEach(function(info) {
popupContent += `<li>${info.desc} : <code>${info.tag}</code></li>`;
});
popupContent += `</ul></div>`;
}
popupContent += `<br><a href="${properties.osm_url}" >Voir sur OSM</a>`;
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
@ -1293,6 +1376,12 @@
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
// Initialiser les popovers Bootstrap pour les icônes d'informations manquantes
const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl);
});
const ctcCompletionSeries = {{ ctc_completion_series|json_encode|raw }};
console.log('ctcCompletionSeries', ctcCompletionSeries)

View file

@ -35,22 +35,38 @@
{# <h6>Infos manquantes :</h6> #}
<ul class='list-unstyled list-inline mb-0'>
{% if not commerce.name %}
<span title="Nom du commerce">
<span data-bs-toggle="popover"
data-bs-trigger="hover"
data-bs-html="true"
data-bs-content="Nom du commerce manquant.<br>Tag OSM attendu : <code>name</code>"
data-bs-placement="top">
<i class='bi bi-person-badge text-danger'></i>
</span>
{% endif %}
{% if not commerce.hasAddress() %}
<span title="Adresse complète">
<span data-bs-toggle="popover"
data-bs-trigger="hover"
data-bs-html="true"
data-bs-content="Adresse complète manquante.<br>Tags OSM attendus : <code>contact:street</code> (ou <code>addr:street</code>) et <code>contact:housenumber</code> (ou <code>addr:housenumber</code>)"
data-bs-placement="top">
<i class='bi bi-geo-alt text-danger'></i>
</li>
</span>
{% endif %}
{% if not commerce.hasOpeningHours() %}
<span title="Horaires d'ouverture">
<span data-bs-toggle="popover"
data-bs-trigger="hover"
data-bs-html="true"
data-bs-content="Horaires d'ouverture manquants.<br>Tag OSM attendu : <code>opening_hours</code>"
data-bs-placement="top">
<i class='bi bi-clock text-danger'></i>
</span>
{% endif %}
{% if not commerce.hasWebsite() %}
<span title="Site web">
<span data-bs-toggle="popover"
data-bs-trigger="hover"
data-bs-html="true"
data-bs-content="Site web manquant.<br>Tags OSM attendus : <code>website</code>, <code>contact:website</code>, <code>url</code> ou <code>contact:url</code>"
data-bs-placement="top">
<i class='bi bi-globe text-danger'></i>
</span>
{% endif %}
@ -60,12 +76,20 @@
</li>
{% endif %} #}
{% if not commerce.hasWheelchair() %}
<span title="Accessibilité PMR">
<span data-bs-toggle="popover"
data-bs-trigger="hover"
data-bs-html="true"
data-bs-content="Accessibilité PMR manquante.<br>Tag OSM attendu : <code>wheelchair</code>"
data-bs-placement="top">
<i class='bi bi-universal-access text-danger'></i>
</span>
{% endif %}
{% if not commerce.siret %}
<span title="SIRET">
<span data-bs-toggle="popover"
data-bs-trigger="hover"
data-bs-html="true"
data-bs-content="SIRET manquant.<br>Tag OSM attendu : <code>ref:FR:SIRET</code>"
data-bs-placement="top">
<i class='bi bi-book text-danger'></i>
</span>
{% endif %}