mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-04 17:04:53 +02:00
emoji pour le suivi de thème
This commit is contained in:
parent
7166eb646a
commit
ed9e5b6b47
5 changed files with 101 additions and 21 deletions
|
@ -246,9 +246,16 @@ export function setupCitySearch(inputId, suggestionListId, onSelect) {
|
||||||
suggestions.forEach(suggestion => {
|
suggestions.forEach(suggestion => {
|
||||||
const item = document.createElement('div');
|
const item = document.createElement('div');
|
||||||
item.classList.add('suggestion-item');
|
item.classList.add('suggestion-item');
|
||||||
item.textContent = suggestion.display_name;
|
// Nouveau rendu : nom en gras, INSEE et CP en petit/gris
|
||||||
|
item.innerHTML = `
|
||||||
|
<span class="suggestion-name">${suggestion.name}</span>
|
||||||
|
<span class="suggestion-details">
|
||||||
|
<span>INSEE : <b>${suggestion.insee}</b></span>
|
||||||
|
<span style="margin-left:8px;">CP : <b>${Array.isArray(suggestion.postcodes) ? suggestion.postcodes.join(', ') : suggestion.postcode}</b></span>
|
||||||
|
</span>
|
||||||
|
`;
|
||||||
item.addEventListener('click', () => {
|
item.addEventListener('click', () => {
|
||||||
searchInput.value = suggestion.display_name;
|
searchInput.value = suggestion.name;
|
||||||
clearSuggestions();
|
clearSuggestions();
|
||||||
if (onSelect) {
|
if (onSelect) {
|
||||||
onSelect(suggestion);
|
onSelect(suggestion);
|
||||||
|
|
|
@ -1924,18 +1924,48 @@ final class AdminController extends AbstractController
|
||||||
|
|
||||||
public static function getTagEmoji(string $mainTag): string
|
public static function getTagEmoji(string $mainTag): string
|
||||||
{
|
{
|
||||||
|
// Si c'est un tag clé=valeur, on garde le match existant
|
||||||
|
if (str_contains($mainTag, '=')) {
|
||||||
|
return match ($mainTag) {
|
||||||
|
'amenity=restaurant', 'amenity=bar', 'amenity=cafe' => '🍽️',
|
||||||
|
'amenity=townhall', 'amenity=community_centre' => '🏛️',
|
||||||
|
'amenity=bank', 'amenity=atm' => '🏦',
|
||||||
|
'amenity=pharmacy', 'amenity=hospital', 'amenity=clinic' => '🏥',
|
||||||
|
'amenity=school', 'amenity=kindergarten', 'amenity=university' => '🎓',
|
||||||
|
'amenity=library', 'amenity=museum', 'amenity=artwork' => '📚',
|
||||||
|
'shop=car_repair', 'shop=car_parts', 'shop=car_wash' => '🚗',
|
||||||
|
'amenity=post_office' => '📮',
|
||||||
|
'shop=convenience' => '🏪',
|
||||||
|
'shop=supermarket' => '🛒',
|
||||||
|
'shop=clothes' => '👕',
|
||||||
|
default => '🏷️',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Sinon, on regarde si c'est un tag principal simple
|
||||||
return match ($mainTag) {
|
return match ($mainTag) {
|
||||||
'amenity=restaurant', 'amenity=bar', 'amenity=cafe' => '🍽️',
|
'bicycle_parking' => '🚲',
|
||||||
'amenity=townhall', 'amenity=community_centre' => '🏛️',
|
'building' => '🏢',
|
||||||
'amenity=bank', 'amenity=atm' => '🏦',
|
'email' => '📧',
|
||||||
'amenity=pharmacy', 'amenity=hospital', 'amenity=clinic' => '🏥',
|
'fire_hydrant' => '🚒',
|
||||||
'amenity=school', 'amenity=kindergarten', 'amenity=university' => '🎓',
|
'charging_station' => '⚡',
|
||||||
'amenity=library', 'amenity=museum', 'amenity=artwork' => '📚',
|
'toilets' => '🚻',
|
||||||
'shop=car_repair', 'shop=car_parts', 'shop=car_wash' => '🚗',
|
'bus_stop' => '🚌',
|
||||||
'amenity=post_office' => '📮',
|
'defibrillator' => '❤️🩹',
|
||||||
'shop=convenience' => '🏪',
|
'camera' => '📷',
|
||||||
'shop=supermarket' => '🛒',
|
'recycling' => '♻️',
|
||||||
'shop=clothes' => '👕',
|
'substation' => '🏭',
|
||||||
|
'laboratory' => '🧪',
|
||||||
|
'school' => '🏫',
|
||||||
|
'police' => '👮',
|
||||||
|
'healthcare' => '🏥',
|
||||||
|
'advertising_board' => '🪧',
|
||||||
|
'bench' => '🪑',
|
||||||
|
'waste_basket' => '🗑️',
|
||||||
|
'street_lamp' => '💡',
|
||||||
|
'drinking_water' => '🚰',
|
||||||
|
'tree' => '🌳',
|
||||||
|
'places' => '📍',
|
||||||
|
'power_pole' => '⚡',
|
||||||
default => '🏷️',
|
default => '🏷️',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ path('admin_followup_theme_graph', {'insee_code': stats.zone, 'theme': type}) }}" class="fw-bold text-decoration-none">
|
<a href="{{ path('admin_followup_theme_graph', {'insee_code': stats.zone, 'theme': type}) }}" class="fw-bold text-decoration-none">
|
||||||
<i class="bi {{ followup_icons[type]|default('bi-question-circle') }}"></i> {{ diff.label }}
|
{{ tag_emoji(type) }} {{ diff.label }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -655,6 +655,36 @@
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const geojsonData = {{ geojson|raw }};
|
const geojsonData = {{ geojson|raw }};
|
||||||
const map_token = "{{ maptiler_token }}";
|
const map_token = "{{ maptiler_token }}";
|
||||||
|
// Liste des tags attendus pour la complétion des lieux
|
||||||
|
const completionTags = {{ completion_tags['places']|json_encode|raw }};
|
||||||
|
// Calcul de la complétion et des tags manquants pour chaque lieu
|
||||||
|
geojsonData.features.forEach(f => {
|
||||||
|
let filled = 0;
|
||||||
|
let missing = [];
|
||||||
|
if (completionTags && completionTags.length > 0) {
|
||||||
|
completionTags.forEach(tag => {
|
||||||
|
if (f.properties && typeof f.properties[tag] !== 'undefined' && f.properties[tag] !== null && f.properties[tag] !== '') {
|
||||||
|
filled++;
|
||||||
|
} else {
|
||||||
|
missing.push(tag);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
f.properties.completion = completionTags && completionTags.length > 0 ? Math.round(100 * filled / completionTags.length) : null;
|
||||||
|
// Correction : toujours un tableau
|
||||||
|
f.properties.missing_tags = Array.isArray(f.properties.missing_tags) ? f.properties.missing_tags : (f.properties.missing_tags ? [f.properties.missing_tags] : []);
|
||||||
|
});
|
||||||
|
// Fonction de couleur dégradée
|
||||||
|
function lerpColor(a, b, t) {
|
||||||
|
const ah = a.replace('#', '');
|
||||||
|
const bh = b.replace('#', '');
|
||||||
|
const ar = parseInt(ah.substring(0,2), 16), ag = parseInt(ah.substring(2,4), 16), ab = parseInt(ah.substring(4,6), 16);
|
||||||
|
const br = parseInt(bh.substring(0,2), 16), bg = parseInt(bh.substring(2,4), 16), bb = parseInt(bh.substring(4,6), 16);
|
||||||
|
const rr = Math.round(ar + (br-ar)*t);
|
||||||
|
const rg = Math.round(ag + (bg-ag)*t);
|
||||||
|
const rb = Math.round(ab + (bb-ab)*t);
|
||||||
|
return '#' + rr.toString(16).padStart(2,'0') + rg.toString(16).padStart(2,'0') + rb.toString(16).padStart(2,'0');
|
||||||
|
}
|
||||||
let map;
|
let map;
|
||||||
let map_is_loaded = false;
|
let map_is_loaded = false;
|
||||||
let currentMode = 'drop';
|
let currentMode = 'drop';
|
||||||
|
@ -682,10 +712,9 @@
|
||||||
'case',
|
'case',
|
||||||
['has', 'completion'],
|
['has', 'completion'],
|
||||||
[
|
[
|
||||||
'rgb',
|
'interpolate', ['linear'], ['get', 'completion'],
|
||||||
0,
|
0, '#cccccc',
|
||||||
['*', ['get', 'completion'], 2.55],
|
100, '#008000'
|
||||||
0
|
|
||||||
],
|
],
|
||||||
'#cccccc'
|
'#cccccc'
|
||||||
],
|
],
|
||||||
|
@ -701,7 +730,16 @@
|
||||||
source: 'places',
|
source: 'places',
|
||||||
filter: ['!', ['has', 'point_count']],
|
filter: ['!', ['has', 'point_count']],
|
||||||
paint: {
|
paint: {
|
||||||
'circle-color': '#11b4da',
|
'circle-color': [
|
||||||
|
'case',
|
||||||
|
['has', 'completion'],
|
||||||
|
[
|
||||||
|
'interpolate', ['linear'], ['get', 'completion'],
|
||||||
|
0, '#cccccc',
|
||||||
|
100, '#008000'
|
||||||
|
],
|
||||||
|
'#cccccc'
|
||||||
|
],
|
||||||
'circle-radius': 8,
|
'circle-radius': 8,
|
||||||
'circle-stroke-width': 2,
|
'circle-stroke-width': 2,
|
||||||
'circle-stroke-color': '#fff'
|
'circle-stroke-color': '#fff'
|
||||||
|
@ -795,7 +833,12 @@
|
||||||
if (properties.address) popupContent += `${properties.address}<br>`;
|
if (properties.address) popupContent += `${properties.address}<br>`;
|
||||||
if (properties.main_tag) popupContent += `<em>${properties.main_tag}</em><br>`;
|
if (properties.main_tag) popupContent += `<em>${properties.main_tag}</em><br>`;
|
||||||
if (properties.note) popupContent += `<small>Note: ${properties.note}</small><br>`;
|
if (properties.note) popupContent += `<small>Note: ${properties.note}</small><br>`;
|
||||||
popupContent += `<a href="${properties.osm_url}" >Voir sur OSM</a>`;
|
popupContent += `<b>Complétion :</b> ${properties.completion !== null ? properties.completion + '%' : '–'}`;
|
||||||
|
const missingTags = Array.isArray(properties.missing_tags) ? properties.missing_tags : [];
|
||||||
|
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>`;
|
||||||
|
|
||||||
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
|
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
|
||||||
coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
|
coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
title="Voir le graphe détaillé">
|
title="Voir le graphe détaillé">
|
||||||
<i class="bi bi-bar-chart"></i>
|
<i class="bi bi-bar-chart"></i>
|
||||||
</a>
|
</a>
|
||||||
{{ type }}
|
{{ tag_emoji(type) }} {{ type }}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-end">{{ evo.now }}</td>
|
<td class="text-end">{{ evo.now }}</td>
|
||||||
{% for p in periods %}
|
{% for p in periods %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue