mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-04 17:04:53 +02:00
add logs to main city page
This commit is contained in:
parent
060b23f87e
commit
5deda4a01d
2 changed files with 79 additions and 64 deletions
|
@ -200,17 +200,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% if theme == 'bicycle_parking' %}
|
|
||||||
{% include 'admin/_followup_bicycle_parking_extra.html.twig' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if theme == 'camera' %}
|
|
||||||
{% include 'admin/_followup_cameras_extra.html.twig' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if josm_url %}
|
{% if josm_url %}
|
||||||
<a href="{{ josm_url }}" class="btn btn-outline-dark btn-josm" target="_blank">
|
<a href="{{ josm_url }}" class="btn btn-outline-dark btn-josm" target="_blank">
|
||||||
<i class="bi bi-box-arrow-up-right"></i> Ouvrir tous les objets dans JOSM
|
<i class="bi bi-box-arrow-up-right"></i> Ouvrir tous les objets dans JOSM
|
||||||
|
@ -226,8 +215,15 @@
|
||||||
<i class="bi bi-geo"></i> Overpass Turbo
|
<i class="bi bi-geo"></i> Overpass Turbo
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="themeMap"></div>
|
<div id="themeMap"></div>
|
||||||
|
{% if theme == 'bicycle_parking' %}
|
||||||
|
{% include 'admin/_followup_bicycle_parking_extra.html.twig' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if theme == 'camera' %}
|
||||||
|
{% include 'admin/_followup_cameras_extra.html.twig' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div class="stats-grid">
|
<div class="stats-grid">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
|
@ -543,27 +539,27 @@
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: measureData
|
body: measureData
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
console.log('Count measurement saved:', result);
|
console.log('Count measurement saved:', result);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
// Add the new measurement to the chart data
|
// Add the new measurement to the chart data
|
||||||
const newMeasurement = {
|
const newMeasurement = {
|
||||||
date: result.follow_up.date,
|
date: result.follow_up.date,
|
||||||
value: result.follow_up.measure
|
value: result.follow_up.measure
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add to the global countData array
|
// Add to the global countData array
|
||||||
if (Array.isArray(window.countData)) {
|
if (Array.isArray(window.countData)) {
|
||||||
window.countData.push(newMeasurement);
|
window.countData.push(newMeasurement);
|
||||||
// Update the chart
|
// Update the chart
|
||||||
updateChart();
|
updateChart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
.catch(error => {
|
||||||
.catch(error => {
|
console.error('Error saving count measurement:', error);
|
||||||
console.error('Error saving count measurement:', error);
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Send completion measurement
|
// Send completion measurement
|
||||||
if (average_completion) {
|
if (average_completion) {
|
||||||
|
@ -576,27 +572,27 @@
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: completionData
|
body: completionData
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
console.log('Completion measurement saved:', result);
|
console.log('Completion measurement saved:', result);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
// Add the new measurement to the chart data
|
// Add the new measurement to the chart data
|
||||||
const newMeasurement = {
|
const newMeasurement = {
|
||||||
date: result.follow_up.date,
|
date: result.follow_up.date,
|
||||||
value: result.follow_up.measure
|
value: result.follow_up.measure
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add to the global completionData array
|
// Add to the global completionData array
|
||||||
if (Array.isArray(window.completionData)) {
|
if (Array.isArray(window.completionData)) {
|
||||||
window.completionData.push(newMeasurement);
|
window.completionData.push(newMeasurement);
|
||||||
// Update the chart
|
// Update the chart
|
||||||
updateChart();
|
updateChart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
.catch(error => {
|
||||||
.catch(error => {
|
console.error('Error saving completion measurement:', error);
|
||||||
console.error('Error saving completion measurement:', error);
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
const tbody = document.querySelector('#tags-stats-table tbody');
|
const tbody = document.querySelector('#tags-stats-table tbody');
|
||||||
if (Object.keys(tagCounts).length === 0) {
|
if (Object.keys(tagCounts).length === 0) {
|
||||||
|
|
|
@ -806,6 +806,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map_token && geojsonData && geojsonData.features.length > 0) {
|
if (map_token && geojsonData && geojsonData.features.length > 0) {
|
||||||
|
console.log('geojsonData.features', geojsonData.features)
|
||||||
|
|
||||||
map = new maplibregl.Map({
|
map = new maplibregl.Map({
|
||||||
container: 'map',
|
container: 'map',
|
||||||
style: `https://api.maptiler.com/maps/streets/style.json?key=${map_token}`,
|
style: `https://api.maptiler.com/maps/streets/style.json?key=${map_token}`,
|
||||||
|
@ -885,6 +887,22 @@
|
||||||
map.on('click', 'unclustered-point', function (e) {
|
map.on('click', 'unclustered-point', function (e) {
|
||||||
const coordinates = e.features[0].geometry.coordinates.slice();
|
const coordinates = e.features[0].geometry.coordinates.slice();
|
||||||
const properties = e.features[0].properties;
|
const properties = e.features[0].properties;
|
||||||
|
let missing_tags = [];
|
||||||
|
|
||||||
|
const tags_for_completion = ['name', 'wheelchair', 'siret', 'opening_hours'];
|
||||||
|
tags_for_completion.forEach(function (tag) {
|
||||||
|
if (!properties[tag]) {
|
||||||
|
missing_tags.push(tag);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!properties['phone'] && properties['contact:phone']) {
|
||||||
|
missing_tags.push('contact:phone');
|
||||||
|
}
|
||||||
|
if (!properties['website'] && properties['contact:website']) {
|
||||||
|
missing_tags.push('contact:website');
|
||||||
|
}
|
||||||
|
properties.missing_tags = missing_tags;
|
||||||
|
|
||||||
let popupContent = `<strong>${properties.name || 'Sans nom'}</strong><br>`;
|
let popupContent = `<strong>${properties.name || 'Sans nom'}</strong><br>`;
|
||||||
if (properties.address) popupContent += `${properties.address}<br>`;
|
if (properties.address) popupContent += `${properties.address}<br>`;
|
||||||
|
@ -892,9 +910,10 @@
|
||||||
if (properties.note) popupContent += `<small>Note: ${properties.note}</small><br>`;
|
if (properties.note) popupContent += `<small>Note: ${properties.note}</small><br>`;
|
||||||
popupContent += `<b>Complétion :</b> ${properties.completion !== null ? properties.completion + '%' : '–'}`;
|
popupContent += `<b>Complétion :</b> ${properties.completion !== null ? properties.completion + '%' : '–'}`;
|
||||||
const missingTags = Array.isArray(properties.missing_tags) ? properties.missing_tags : [];
|
const missingTags = Array.isArray(properties.missing_tags) ? properties.missing_tags : [];
|
||||||
if (missingTags.length > 0) {
|
console.log('e.features[0]', e.features[0], missingTags, 'tags', properties)
|
||||||
popupContent += `<div style='color:#b30000;font-size:0.95em;margin-top:4px;'><b>Manque :</b> ${missingTags.map(t => `<code>${t}</code>`).join(', ')}</div>`;
|
// 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>`;
|
||||||
|
// }
|
||||||
popupContent += `<br><a href="${properties.osm_url}" >Voir sur OSM</a>`;
|
popupContent += `<br><a href="${properties.osm_url}" >Voir sur OSM</a>`;
|
||||||
|
|
||||||
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
|
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue