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

@@ -54,8 +54,8 @@ class LivraisonParSecteurs extends AbstractDeliveryModule
$zipcode = AddressQuery::create()->filterById($currentAddressId)->findOne($con)->getZipcode();
// Condition 1 : le client doit être situé dans un secteur couvert par la livraison à domicile.
if (null !== $areaId = LpsAreaCityQuery::create()->filterByZipcode($zipcode)->findOne($con)->getIdArea())
{
if (null !== $areaFromZipcode = LpsAreaCityQuery::create()->filterByZipcode($zipcode)->findOne($con)) {
$areaId = $areaFromZipcode->getIdArea();
$area = LpsAreaQuery::create()->findOneById($areaId);
// Condition 2 : le secteur doit être actif à date.

View File

@@ -14,13 +14,12 @@ h4 > b {
}
.lancer-impression {
font-size: 16px;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
font-weight: 600;
margin: 0 0 0 20px !important;
cursor: pointer;
background-color: red;
padding: 5px;
background-color: #ea5a0b;
padding: 5px 10px 5px 10px;
color: white;
}
.lancer-impression::before {
@@ -33,3 +32,8 @@ h4 > b {
-moz-osx-font-smoothing: grayscale;
padding-right: 8px;
}
.btn-info {
background-color: #95c11e;
border-color: #95c11e;
}

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);
}
});
}