Geolocalize the current user position
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0beb0cd95f
commit
51986d5bac
@ -1,4 +1,29 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.foundDate) }}
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3 d-flex justify-content-center align-items-center">
|
||||
<button class="btn btn-secondary" id="geolocalize">{{ 'geolocation'|trans }}</button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{{ form_row(form.latitude) }}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{{ form_row(form.longitude) }}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{{ form_row(form.altitude) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('save'|trans) }}</button>
|
||||
<button class="btn btn-primary">{{ button_label|default('save'|trans) }}</button>
|
||||
<script>
|
||||
document.querySelector('#geolocalize').addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
navigator.geolocation.getCurrentPosition(function ({ coords }) {
|
||||
document.querySelector('#post_latitude').value = coords.latitude;
|
||||
document.querySelector('#post_longitude').value = coords.longitude;
|
||||
document.querySelector('#post_altitude').value = coords.altitude;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{{ form_end(form) }}
|
||||
|
Loading…
Reference in new issue