PointRetrait : On avance pas mal sur le frontOffice
This commit is contained in:
@@ -25,7 +25,4 @@
|
||||
<stability>alpha</stability>
|
||||
<mandatory>0</mandatory>
|
||||
<hidden>0</hidden>
|
||||
<required>
|
||||
<module version="~1.0">PlanificationLivraison</module>
|
||||
</required>
|
||||
</module>
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace LivraisonParSecteurs;
|
||||
use DateInterval;
|
||||
use LivraisonParSecteurs\Model\LpsAreaCityQuery;
|
||||
use LivraisonParSecteurs\Model\LpsAreaQuery;
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
@@ -12,6 +13,8 @@ use Thelia\Install\Database;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\ModuleConfigI18nQuery;
|
||||
use Thelia\Model\ModuleConfigQuery;
|
||||
use Thelia\Model\OrderPostage;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
@@ -22,14 +25,12 @@ class LivraisonParSecteurs extends AbstractDeliveryModule
|
||||
/** @var string */
|
||||
const DOMAIN_NAME = 'livraisonparsecteurs';
|
||||
const MESSAGE_DOMAIN = 'livraisonparsecteurs';
|
||||
const VARIABLE_MINIMUM_DELAY = 'minimum_delay_before_order';
|
||||
const LPS_AREA_SCHEDULE_ID = 'lps_area_schedule_id';
|
||||
const LPS_CHOSEN_ADDRESS = 'lps_chosen_delivery_address';
|
||||
const LPS_DELIVERY_DATE = 'lps_delivery_date';
|
||||
const LPS_DELIVERY_BEGIN_TIME = 'lps_begin_time';
|
||||
const LPS_DELIVERY_END_TIME = 'lps_end_time';
|
||||
const FORMAT_DATES = 'd/m/Y';
|
||||
const FORMAT_HEURES = 'H:i';
|
||||
const FORMAT_DATE_COMPLETE = 'Y-m-d H:i:s';
|
||||
const SECTEUR_ACTIF = 1;
|
||||
|
||||
@@ -71,15 +72,7 @@ class LivraisonParSecteurs extends AbstractDeliveryModule
|
||||
|
||||
// Condition 2 : le secteur doit être actif à date.
|
||||
if ($area->getActive() === self::SECTEUR_ACTIF)
|
||||
{
|
||||
// Condition 3 : le panier doit avoir atteint le minimum de commande pour ce secteur.
|
||||
/*
|
||||
$montantPanier = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getTaxedAmount($country);
|
||||
$montantMinimum = $area->getMinimumAmount();
|
||||
if ($montantPanier >= $montantMinimum)
|
||||
*/
|
||||
$isValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $isValid;
|
||||
@@ -136,7 +129,8 @@ class LivraisonParSecteurs extends AbstractDeliveryModule
|
||||
|
||||
static public function calculateRelativeDate($baseDay)
|
||||
{
|
||||
$minimumDelayBeforeOrder = ConfigQuery::read(LivraisonParSecteurs::VARIABLE_MINIMUM_DELAY);
|
||||
$minimumDelayBeforeOrder = PlanificationLivraison::getConfigValue(PlanificationLivraison::CONFIG_PREPARATION_DELAY, 0, "en_US");
|
||||
|
||||
$date = new \DateTime();
|
||||
$date->add(new DateInterval('P'. $minimumDelayBeforeOrder . 'D'));
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace LivraisonParSecteurs\Loop;
|
||||
|
||||
use LivraisonParSecteurs\LivraisonParSecteurs;
|
||||
use LivraisonParSecteurs\Model\LpsAreaSchedule;
|
||||
use LivraisonParSecteurs\Model\LpsAreaScheduleQuery;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
/**
|
||||
* @package LivraisonParSecteurs\Loop
|
||||
*/
|
||||
class SelectedDeliveryDate extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('order_id')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
if (null !== $orderId = $this->getOrderId())
|
||||
{
|
||||
|
||||
if (null !== $order = OrderQuery::create()->findPk($orderId))
|
||||
{
|
||||
return MondialRelayPickupAddressQuery::create()
|
||||
->filterByOrderAddressId($order->getDeliveryOrderAddressId());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
$loopResultRow
|
||||
->set("ID", $relayData['id'])
|
||||
->set("LATITUDE", $relayData['latitude'])
|
||||
->set("LONGITUDE", $relayData['longitude'])
|
||||
->set("ZIPCODE", $relayData['zipcode'])
|
||||
->set("CITY", $relayData['city'])
|
||||
->set("COUNTRY", $relayData['country'])
|
||||
->set("NAME", $relayData['name'])
|
||||
->set("ADDRESS", $relayData['address'])
|
||||
->set("DISTANCE", $relayData['distance'])
|
||||
->set("OPENINGS", $relayData['openings'])
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@
|
||||
<input type="hidden" id="map-center-lat" value="50.749980292425974" />
|
||||
|
||||
<div id="map" class="locationMap"></div>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='planiflivraison_googlemap_api_key' locale='en_US'}&libraries=&v=weekly" async></script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}&libraries=&v=weekly" async></script>
|
||||
|
||||
<caption class="clearfix">
|
||||
<div class="legende">NB : Les communes sans coordonnées GPS n'apparaitront pas sur la carte ci-dessus.</div>
|
||||
|
||||
@@ -28,17 +28,17 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop name="deliveries-loop" type="scheduled_deliveries" domicile_ou_retrait="domicile" only_future="true" order="date"}
|
||||
{if $DELTA <= 7}
|
||||
{assign var=path value="{image file='assets/img/drapeau-vert.png'}"}
|
||||
{assign var=alt value='Drapeau vert'}
|
||||
{/if}
|
||||
{if $DELTA <= 4}
|
||||
{assign var=path value="{image file='assets/img/drapeau-orange.png'}"}
|
||||
{assign var=alt value='Drapeau orange'}
|
||||
{/if}
|
||||
{if $DELTA <= 1}
|
||||
{assign var=path value="{image file='assets/img/drapeau-rouge.png'}"}
|
||||
{if $DELTA <= {module_config module="PlanificationLivraison" key='delay_red_alert' locale="en_US"}}
|
||||
{assign var=path value="{image file='assets/img/drapeau-rouge.png' source='PlanificationLivraison'}"}
|
||||
{assign var=alt value='Drapeau rouge'}
|
||||
{else}
|
||||
{if $DELTA <= {module_config module="PlanificationLivraison" key='delay_orange_alert' locale="en_US"}}
|
||||
{assign var=path value="{image file='assets/img/drapeau-orange.png' source='PlanificationLivraison'}"}
|
||||
{assign var=alt value='Drapeau orange'}
|
||||
{else}
|
||||
{assign var=path value="{image file='assets/img/drapeau-vert.png' source='PlanificationLivraison'}"}
|
||||
{assign var=alt value='Drapeau vert'}
|
||||
{/if}
|
||||
{/if}
|
||||
{assign var=title value="{$DELTA} jour(s) de délai"}
|
||||
|
||||
|
||||
@@ -33,10 +33,12 @@ class Configuration extends BaseAdminController
|
||||
$validateForm = $this->validateForm($form);
|
||||
$data = $validateForm->getData();
|
||||
|
||||
PlanificationLivraison::setConfigValue(
|
||||
PlanificationLivraison::CONFIG_VALUE_NAME,
|
||||
$data["google_api_key"]
|
||||
);
|
||||
PlanificationLivraison::setConfigValue(PlanificationLivraison::CONFIG_API_KEY, $data["google_api_key"]);
|
||||
PlanificationLivraison::setConfigValue(PlanificationLivraison::CONFIG_MAP_CENTER_LAT, $data["map_center_lat"]);
|
||||
PlanificationLivraison::setConfigValue(PlanificationLivraison::CONFIG_MAP_CENTER_LNG, $data["map_center_lng"]);
|
||||
PlanificationLivraison::setConfigValue(PlanificationLivraison::CONFIG_RED_ALERT, $data["delay_red_alert"]);
|
||||
PlanificationLivraison::setConfigValue(PlanificationLivraison::CONFIG_ORANGE_ALERT, $data["delay_orange_alert"]);
|
||||
PlanificationLivraison::setConfigValue(PlanificationLivraison::CONFIG_PREPARATION_DELAY, $data["orders_preparation_delay"]);
|
||||
|
||||
return $this->redirectToConfigurationPage();
|
||||
|
||||
|
||||
@@ -16,12 +16,62 @@ class Configuration extends BaseForm
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"google_api_key",
|
||||
"text",
|
||||
"google_api_key","text",
|
||||
array(
|
||||
"label" => "GoogleMap API key",
|
||||
"label" => $this->translator->trans("GoogleMap API key", [], PlanificationLivraison::DOMAIN_NAME),
|
||||
"label_attr" => [
|
||||
"for" => "google_api_key"
|
||||
"for" => "attr-google-api-key"
|
||||
],
|
||||
"required" => true
|
||||
))
|
||||
->add(
|
||||
"map_center_lat","text",
|
||||
array(
|
||||
"label" => $this->translator->trans("Map Center latitude", [], PlanificationLivraison::DOMAIN_NAME),
|
||||
"label_attr" => [
|
||||
"for" => "attr-map-center-lat",
|
||||
"help" => "Format 99.99999999 ou -99.9999999"
|
||||
],
|
||||
"required" => true
|
||||
))
|
||||
->add(
|
||||
"map_center_lng","text",
|
||||
array(
|
||||
"label" => $this->translator->trans("Map Center longitude", [], PlanificationLivraison::DOMAIN_NAME),
|
||||
"label_attr" => [
|
||||
"for" => "attr-map-center-lng",
|
||||
"help" => "Format 99.99999999 ou -99.9999999"
|
||||
|
||||
],
|
||||
"required" => true
|
||||
))
|
||||
->add(
|
||||
"delay_red_alert","number",
|
||||
array(
|
||||
"label" => $this->translator->trans("Red alert delay", [], PlanificationLivraison::DOMAIN_NAME),
|
||||
"label_attr" => [
|
||||
"for" => "attr-map-center-lat",
|
||||
"help" => $this->translator->trans("Help for red alert", [], PlanificationLivraison::DOMAIN_NAME)
|
||||
],
|
||||
"required" => true
|
||||
))
|
||||
->add(
|
||||
"delay_orange_alert","number",
|
||||
array(
|
||||
"label" => $this->translator->trans("Orange alert delay", [], PlanificationLivraison::DOMAIN_NAME),
|
||||
"label_attr" => [
|
||||
"for" => "attr-delay_orange_alert",
|
||||
"help" => $this->translator->trans("Help for orange alert", [], PlanificationLivraison::DOMAIN_NAME)
|
||||
],
|
||||
"required" => true
|
||||
))
|
||||
->add(
|
||||
"orders_preparation_delay","number",
|
||||
array(
|
||||
"label" => $this->translator->trans("Number of days needed for preparation", [], PlanificationLivraison::DOMAIN_NAME),
|
||||
"label_attr" => [
|
||||
"for" => "attr-orders-preparation-delay",
|
||||
"help" => $this->translator->trans("Help for preparation delay", [], PlanificationLivraison::DOMAIN_NAME)
|
||||
],
|
||||
"required" => true
|
||||
)
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
<?php
|
||||
return array(
|
||||
'GoogleMap API key' => 'Clé API GoogleMap',
|
||||
'Map Center latitude' => 'Latitude du centre de la carte',
|
||||
'Map Center longitude' => 'Longitude du centre de la carte',
|
||||
'Red alert delay' => 'Nombre de jours du seuil CRITIQUE',
|
||||
'Orange alert delay' => 'Nombre de jours du seuil URGENT',
|
||||
'Number of days needed for preparation' => 'Nombre de jours nécessaires pour préparation des commandes',
|
||||
'Help for red alert' => 'Si le délai entre la date du jour et la date de livraison/retrait prévue est inférieur à ce nombre de jours, la commande apparaitra comme CRITIQUE dans votre tableau de bord',
|
||||
'Help for orange alert' => 'Si le délai entre la date du jour et la date de livraison/retrait prévue est inférieur à ce nombre de jours, la commande apparaitra comme URGENTE dans votre tableau de bord',
|
||||
'Help for preparation delay' => 'Délai incompressible entre la commande client et la possibilité de livraison/retrait (achats des produits, préparation, ...)',
|
||||
'Save' => 'Enregistrer',
|
||||
);
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace PlanificationLivraison;
|
||||
|
||||
@@ -19,9 +9,14 @@ use Thelia\Module\BaseModule;
|
||||
class PlanificationLivraison extends BaseModule
|
||||
{
|
||||
/** @var string */
|
||||
const DOMAIN_NAME = 'planiflivraison';
|
||||
const CONFIG_VALUE_NAME = 'planiflivraison_googlemap_api_key';
|
||||
const DOMAIN_NAME = 'planificationlivraison';
|
||||
|
||||
const CONFIG_API_KEY = 'googlemap_api_key';
|
||||
const CONFIG_MAP_CENTER_LAT = 'map_center_latitude';
|
||||
const CONFIG_MAP_CENTER_LNG = 'map_center_longitude';
|
||||
const CONFIG_RED_ALERT = 'delay_red_alert';
|
||||
const CONFIG_ORANGE_ALERT = 'delay_orange_alert';
|
||||
const CONFIG_PREPARATION_DELAY = 'orders_preparation_delay';
|
||||
|
||||
/**
|
||||
* @param ConnectionInterface|null $con
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -13,7 +13,14 @@
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{render_form_field field="google_api_key" value={module_config module="PlanificationLivraison" key='planiflivraison_googlemap_api_key' locale="en_US"}}
|
||||
{render_form_field field="google_api_key" value={module_config module="PlanificationLivraison" key='googlemap_api_key' locale="en_US"}}
|
||||
{render_form_field field="map_center_lat" value={module_config module="PlanificationLivraison" key='map_center_latitude' locale="en_US"}}
|
||||
{render_form_field field="map_center_lng" value={module_config module="PlanificationLivraison" key='map_center_longitude' locale="en_US"}}
|
||||
|
||||
{render_form_field field="orders_preparation_delay" value={module_config module="PlanificationLivraison" key='orders_preparation_delay' locale="en_US"}}
|
||||
|
||||
{render_form_field field="delay_red_alert" value={module_config module="PlanificationLivraison" key='delay_red_alert' locale="en_US"}}
|
||||
{render_form_field field="delay_orange_alert" value={module_config module="PlanificationLivraison" key='delay_orange_alert' locale="en_US"}}
|
||||
|
||||
<button type="submit" name="planiflivraison_save_configuration" value="save" class="form-submit-button btn btn-sm btn-default" title="{intl d='planificationlivraison' l='Save'}">
|
||||
{intl d='planificationlivraison' l='Save'}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<!-- Global hook class -->
|
||||
<hook id="pdr.css.hook" class="PointRetrait\Hook\CssHook">
|
||||
<tag name="hook.event_listener" event="main.head-css" type="back" method="onAddCss"/>
|
||||
<tag name="hook.event_listener" event="main.stylesheet" type="front" method="onAddCss"/>
|
||||
</hook>
|
||||
|
||||
<hook id="pdr.admin.hook" class="PointRetrait\Hook\AdminHook">
|
||||
|
||||
@@ -25,7 +25,4 @@
|
||||
<stability>beta</stability>
|
||||
<mandatory>0</mandatory>
|
||||
<hidden>0</hidden>
|
||||
<required>
|
||||
<module version="~1.0">PlanificationLivraison</module>
|
||||
</required>
|
||||
</module>
|
||||
|
||||
@@ -72,7 +72,9 @@ class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('active')
|
||||
Argument::createIntListTypeArgument('active'),
|
||||
Argument::createEnumListTypeArgument('order',
|
||||
['city', 'title'], 'title')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,7 +93,19 @@ class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
$places->filterByActive($active);
|
||||
}
|
||||
|
||||
return $places->orderByTitle();
|
||||
foreach ($this->getOrder() as $order) {
|
||||
switch ($order) {
|
||||
case 'title':
|
||||
$places->orderByTitle();
|
||||
break;
|
||||
case 'city':
|
||||
$places->orderByZipcode()->orderByCity()->orderByAddress1();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $places;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='planiflivraison_googlemap_api_key' locale='en_US'}&callback=initMap&libraries=&v=weekly" async></script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}&callback=initMap&libraries=&v=weekly" async></script>
|
||||
<div id="map" class="locationMap"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,17 +27,17 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop name="deliveries-loop" type="scheduled_deliveries" domicile_ou_retrait="retrait" only_future="true" order="date"}
|
||||
{if $DELTA <= 7}
|
||||
{assign var=path value="{image file='assets/img/drapeau-vert.png'}"}
|
||||
{assign var=alt value='Drapeau vert'}
|
||||
{/if}
|
||||
{if $DELTA <= 4}
|
||||
{assign var=path value="{image file='assets/img/drapeau-orange.png'}"}
|
||||
{assign var=alt value='Drapeau orange'}
|
||||
{/if}
|
||||
{if $DELTA <= 1}
|
||||
{assign var=path value="{image file='assets/img/drapeau-rouge.png'}"}
|
||||
{if $DELTA <= {module_config module="PlanificationLivraison" key='delay_red_alert' locale="en_US"}}
|
||||
{assign var=path value="{image file='assets/img/drapeau-rouge.png' source='PlanificationLivraison'}"}
|
||||
{assign var=alt value='Drapeau rouge'}
|
||||
{else}
|
||||
{if $DELTA <= {module_config module="PlanificationLivraison" key='delay_orange_alert' locale="en_US"}}
|
||||
{assign var=path value="{image file='assets/img/drapeau-orange.png' source='PlanificationLivraison'}"}
|
||||
{assign var=alt value='Drapeau orange'}
|
||||
{else}
|
||||
{assign var=path value="{image file='assets/img/drapeau-vert.png' source='PlanificationLivraison'}"}
|
||||
{assign var=alt value='Drapeau vert'}
|
||||
{/if}
|
||||
{/if}
|
||||
{assign var=title value="{$DELTA} jour(s) de délai"}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
.custom-map-control-button {
|
||||
appearance: button;
|
||||
background-color: #fff;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3);
|
||||
cursor: pointer;
|
||||
margin: 10px;
|
||||
padding: 0 0.5em;
|
||||
height: 40px;
|
||||
font: 400 18px Roboto, Arial, sans-serif;
|
||||
overflow: hidden;
|
||||
}
|
||||
.custom-map-control-button:hover {
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
.locationMap {
|
||||
height:450px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.legende {
|
||||
margin-top: 25px;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.pin-pdr {
|
||||
height: 25px;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
tr .ligne > td {
|
||||
border: 1px solid gray !important;
|
||||
}
|
||||
|
||||
.ligne > td {
|
||||
padding: 5px !important;
|
||||
}
|
||||
|
||||
.creneau > td {
|
||||
text-align: left !important;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.titre {
|
||||
font-size: 1.6rem;
|
||||
color: red;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.adresse {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.table-main {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.table-schedule {
|
||||
background-color: #aeaeae !important;
|
||||
color: white !important;
|
||||
border-color: #aeaeae !important;
|
||||
}
|
||||
@@ -20,38 +20,49 @@
|
||||
<div class="col-sm-4"> </div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div id="select-pdr">
|
||||
{form name="thelia.order.delivery"}
|
||||
<div class="table-responsive" style="border: 1px solid gray">
|
||||
<table class="table table-striped table-condensed">
|
||||
{loop type="pdr_places" name="places-loop" active=true}
|
||||
<tr>
|
||||
<td>
|
||||
<span class="">{$TITLE}</span><br>
|
||||
<span class="">{$ADDRESS1}</span><br>
|
||||
<span class="">{$ZIPCODE} {$CITY}</span><br>
|
||||
<table class="table">
|
||||
{loop type="pdr_schedule" name="schedule-loop" place_id={$ID}}
|
||||
<tr>
|
||||
<td style="padding:10px; text-align: center">{$DAY_LABEL} {format_date date=$BEGIN format="H\hi"} à {format_date date=$END format="H\hi"}</td>
|
||||
<td style="padding:10px; text-align: center"><input type="radio" name="lps-choosen-day" value="{$ID}"{if {cart attr='total_taxed_price_without_discount'} < $minimum} disabled{/if} /></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
</div>
|
||||
{/form}
|
||||
<div class="row" id="select-pdr">
|
||||
<div class="col-md-4">
|
||||
{form name="thelia.order.delivery"}
|
||||
<div class="table-responsive" style="border: 1px solid gray">
|
||||
<table class="table table-condensed table-main">
|
||||
{loop type="pdr_places" name="places-loop" active=true order="city"}
|
||||
<tr class="ligne">
|
||||
<td>
|
||||
<span class="titre">({$ID}) {$TITLE}</span><br>
|
||||
<span class="adresse">{$ADDRESS1}</span><br>
|
||||
<span class="adresse">{$ZIPCODE} {$CITY}</span><br>
|
||||
<table class="table table-schedule">
|
||||
{loop type="pdr_schedule" name="schedule-loop" place_id={$ID}}
|
||||
<tr class="creneau">
|
||||
<td style="padding:10px; text-align: center">{$DAY_LABEL} {format_date date=$BEGIN format="H\hi"} à {format_date date=$END format="H\hi"}</td>
|
||||
<td style="padding:10px; text-align: center"><input type="radio" name="lps-choosen-day" value="{$ID}"{if {cart attr='total_taxed_price_without_discount'} < $minimum} disabled{/if} /></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
</div>
|
||||
{/form}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div id="mondialrelay_map" style="width: 100%; height: 450px;">
|
||||
<div class="col-md-8">
|
||||
<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} />
|
||||
|
||||
<table id="coordinates" class="hidden">
|
||||
{loop type="pdr_places" name="places-loop" active=true order="city"}
|
||||
<tr>
|
||||
<td>{$ID}
|
||||
<td>{$LATITUDE}</td>
|
||||
<td>{$LONGITUDE}</td>
|
||||
<td>{$TITLE}</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
|
||||
<div id="pdr_map" class="locationMap">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</script>
|
||||
@@ -87,9 +98,52 @@
|
||||
function loadScript() {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = "https://maps.googleapis.com/maps/api/js?callback=mondialRelaySetup&key={config key='planiflivraison_googlemap_api_key'}";
|
||||
script.src = "https://maps.googleapis.com/maps/api/js?callback=initMap" +
|
||||
"&key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}";
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
function initMap() {
|
||||
var opt = {
|
||||
center: new google.maps.LatLng($("#map-center-lat").val(), $("#map-center-lon").val()),
|
||||
zoom: 12,
|
||||
streetViewControl: false,
|
||||
mapTypeControl: false
|
||||
};
|
||||
|
||||
Data.map = new google.maps.Map(document.getElementById('pdr_map'), opt);
|
||||
Data.geocoder = new google.maps.Geocoder();
|
||||
|
||||
displayPins();
|
||||
}
|
||||
|
||||
function displayPins() {
|
||||
var arrays = [];
|
||||
$('#coordinates').eq(0).find('tr').each((r,row) => arrays.push($(row).find('td,th').map((c,cell) => $(cell).text()).toArray()))
|
||||
|
||||
arrays.forEach(function(place) {
|
||||
var marker = new google.maps.Marker({
|
||||
title: place[3],
|
||||
label: place[0],
|
||||
position: new google.maps.LatLng(place[1], place[2]),
|
||||
map: Data.map
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
var Data = {
|
||||
markers: [],
|
||||
map: null,
|
||||
geocoder: null,
|
||||
bounds: null
|
||||
};
|
||||
|
||||
if (typeof(google) === 'undefined') {
|
||||
loadScript();
|
||||
} else {
|
||||
initMap();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user