1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-16 19:40:44 +01:00

Fix indirizzo google in modifica sede

This commit is contained in:
Matteo 2022-10-13 15:36:35 +02:00
parent 9e32a0826b
commit 66dfdf2db5

View File

@ -212,7 +212,29 @@ echo '
</form>'; </form>';
echo ' echo '
<script>$(document).ready(init)</script>
<script> <script>
if(window.google){
initGeocomplete();
} else {
$.getScript("//maps.googleapis.com/maps/api/js?libraries=places&key='.$google.'", function() {
initGeocomplete();
});
}
function initGeocomplete() {
$("#form_sedi #geocomplete input").geocomplete({
map: $("#form_sedi #map").length ? "#map" : false,
location: $("#form_sedi #gaddress").val() ? $("#form_sedi #gaddress").val() : [$("#form_sedi #lat_").val(), $("#form_sedi #lng_").val()],
details: ".details",
detailsAttribute: "data-geo"
}).bind("geocode:result", function (event, result) {
$("#form_sedi #lat_").val(result.geometry.location.lat());
$("#form_sedi #lng_").val(result.geometry.location.lng());
});
}
function rimuoviSede(button) { function rimuoviSede(button) {
let hash = window.location.href.split("#")[1]; let hash = window.location.href.split("#")[1];
@ -229,15 +251,4 @@ function rimuoviSede(button) {
}).catch(swal.noop); }).catch(swal.noop);
} }
$(document).ready( function(){
$("#form_sedi #geocomplete input").geocomplete({
map: $("#form_sedi #map").length ? "#form_sedi #map" : false,
location: $("#form_sedi #gaddress").val() ? $("#form_sedi #gaddress").val() : [$("#form_sedi #lat_").val(), $("#form_sedi #lng_").val()],
details: "#form_sedi .details",
detailsAttribute: "data-geo"
}).bind("geocode:result", function (event, result) {
$("#form_sedi #lat_").val(result.geometry.location.lat());
$("#form_sedi #lng_").val(result.geometry.location.lng());
});
});
</script>'; </script>';