add josm links, turf circles of completion

This commit is contained in:
Tykayn 2025-06-06 11:50:37 +02:00 committed by tykayn
parent c4cc4a4050
commit 573d4eeb29
8 changed files with 368 additions and 75 deletions

View file

@ -24,7 +24,8 @@
<div class="card shadow-sm">
<div class="card-body">
<h1 class="card-title h2 mb-4">{{ 'display.welcome'|trans }} {{ commerce_overpass.tags_converted.name }}</h1>
<div id="map" style="height: 400px; width: 100%;" class="rounded mb-4"></div>
<div id="map" style="height: 400px; width: 100%;" class="rounded mb-4"></div>
{% include 'public/edit/address.html.twig' %}
{% if commerce_overpass is not empty %}
<form action="{{ path('app_public_submit', {'osm_object_id': commerce_overpass['@attributes'].id, 'version': commerce_overpass['@attributes'].version, 'changesetID': commerce_overpass['@attributes'].changeset }) }}" method="post" class="needs-validation">
@ -39,6 +40,7 @@
</div>
</div>
{% if commerce_overpass.tags_converted.image is defined %}
<div id="images" class="d-none">
@ -56,12 +58,7 @@
{% include 'public/edit/restaurant.html.twig' %}
{% endif %}
{% if hide_filled_inputs and
(commerce_overpass.tags_converted['addr:street']) is defined and commerce_overpass.tags_converted['addr:street'] is empty
and (commerce_overpass.tags_converted['addr:housenumber']) is defined and commerce_overpass.tags_converted['addr:housenumber'] is empty
%}
{% include 'public/edit/address.html.twig' %}
{% endif %}
{% if hide_filled_inputs and (commerce_overpass.tags_converted.opening_hours) is defined and commerce_overpass.tags_converted.opening_hours is empty %}
<span class="deja-rempli d-none">
@ -139,11 +136,19 @@
<strong>{{ 'display.days_ago'|trans({'%days%': date(commerce_overpass['@attributes'].timestamp).diff(date()).days}) }}</strong>
{{ 'display.by'|trans }}
<a href="https://www.openstreetmap.org/user/{{ commerce_overpass['@attributes'].user }}" target="_blank">{{ commerce_overpass['@attributes'].user }}</a>
</div>
</div>
<div class="lien-OpenStreetMap">
<a href="https://www.openstreetmap.org/node/{{ commerce_overpass['@attributes'].id }}" target="_blank" class="btn btn-outline-secondary">
<a href="https://www.openstreetmap.org/{{commerce.osmKind}}/{{ commerce_overpass['@attributes'].id }}" target="_blank" class="btn btn-outline-secondary">
{{ 'display.view_on_osm'|trans }}
</a>
<button onclick="openInJOSM('{{commerce.osmKind}}', '{{ commerce_overpass['@attributes'].id }}')" class="btn btn-outline-secondary ms-2">
<i class="bi bi-pencil"></i> Éditer dans JOSM
</button>
<button onclick="openInPanoramax()" class="btn btn-outline-secondary ms-2">
<i class="bi bi-camera"></i> Voir dans Panoramax
</button>
</div>
<a href="{{ path('app_admin_stats', {'zip_code': zone ?? '-1'}) }}" class="btn btn-outline-secondary">
<i class="bi bi-bar-chart"></i>
@ -176,7 +181,17 @@
{{ parent() }}
<script src={{asset('js/mapbox/mapbox-gl.js')}}></script>
<script>
function openInJOSM(type, id) {
const josmUrl = `http://localhost:8111/load_object?objects=${type}${id}`;
window.open(josmUrl, '_blank');
}
function openInPanoramax() {
const center = map.getCenter();
const zoom = map.getZoom();
const panoramaxUrl = `https://api.panoramax.xyz/?focus=map&map=${zoom}/${center.lat}/${center.lng}`;
window.open(panoramaxUrl, '_blank');
}
{% if commerce is not empty and mapbox_token is not empty and maptiler_token is not empty and commerce_overpass['@attributes'].lon is defined and commerce_overpass['@attributes'].lat is defined %}
mapboxgl.accessToken = '{{ mapbox_token }}';