OK pour l'ajout du Home sur le front de PointRetrait

This commit is contained in:
2021-03-20 17:20:14 +01:00
parent 923a7eb466
commit fe76e6b05b
4 changed files with 45 additions and 7 deletions

View File

@@ -70,4 +70,8 @@ span.pin-number {
margin: auto 60px 15px 30px;
text-align: left;
white-space: nowrap;
}
div.Home {
height: 400px;
}

View File

@@ -1,3 +1,5 @@
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<script type="text/html" id="pdr_ui">
{loop type="delivery" name="pdr-delivery-loop" code="pointretrait"}
@@ -64,6 +66,9 @@
<div class="col-md-7">
<input type="hidden" id="map-center-lat" value={{module_config module='PlanificationLivraison' key='map_center_latitude' locale='en_US'}|default:50.75075530537203} />
<input type="hidden" id="map-center-lon" value={{module_config module='PlanificationLivraison' key='map_center_longitude' locale='en_US'}|default:2.252608244005041} />
{loop type="address" name="address-home-loop" id={order attr="delivery_address"}}
<input type="hidden" id="map-home-address" value="{$ADDRESS1}, {$ZIPCODE} {$CITY}">
{/loop}
<table id="coordinates" class="hidden">
{loop type="pdr_places" name="places-loop" active=true click_and_collect=0 order="city"}
@@ -76,8 +81,9 @@
{/loop}
</table>
<div id="pdr_map" class="locationMap">
<div id="pdr_map" class="locationMap"></div>
</div>
</div>
</td>
</script>
@@ -134,6 +140,7 @@
Data.map = new google.maps.Map(document.getElementById('pdr_map'), opt);
displayPinsPdr();
displayHomePdr();
}
function displayPinsPdr() {
@@ -148,7 +155,30 @@
map: Data.map
});
});
}
function displayHomePdr() {
var geocoder = new google.maps.Geocoder();
var adresse = $("#map-home-address").val();
geocoder.geocode({ address: adresse }, (results, status) => {
if (status === "OK") {
var icon = {
url: "http://maps.google.com/mapfiles/kml/shapes/homegardenbusiness.png", // url
scaledSize: new google.maps.Size(30, 30) // scaled size
};
marker = new google.maps.Marker({
map: Data.map,
position: results[0].geometry.location,
title: "Home",
icon : icon
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}