diff --git a/local/modules/LivraisonParSecteurs/Config/module.xml b/local/modules/LivraisonParSecteurs/Config/module.xml index 5978655d..25207301 100644 --- a/local/modules/LivraisonParSecteurs/Config/module.xml +++ b/local/modules/LivraisonParSecteurs/Config/module.xml @@ -25,4 +25,7 @@ alpha 0 0 + + PlanificationLivraison + diff --git a/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html b/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html index 0174acb6..17e320cb 100644 --- a/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html +++ b/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html @@ -132,7 +132,7 @@
- +
NB : Les communes sans coordonnées GPS n'apparaitront pas sur la carte ci-dessus.
diff --git a/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html b/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html index 972d2064..458b3349 100644 --- a/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html +++ b/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html @@ -31,7 +31,7 @@ {if {cart attr='total_taxed_price_without_discount'} < $minimum}
-
{intl l="Message info minimum de commande" d="livraisonparsecteurs" minimum=$minimum delta=$minimum-{cart attr='total_taxed_price_without_discount'}}
+
{intl l="Message info minimum de commande" d="livraisonparsecteurs" minimum=$minimum delta=$minimum-{cart attr='total_taxed_price_without_discount'}}
{/if} diff --git a/local/modules/PlanificationLivraison/Config/config.xml b/local/modules/PlanificationLivraison/Config/config.xml index 719dca70..fa3d23a9 100644 --- a/local/modules/PlanificationLivraison/Config/config.xml +++ b/local/modules/PlanificationLivraison/Config/config.xml @@ -11,8 +11,19 @@ + +
+ + + + + + + + + diff --git a/local/modules/PlanificationLivraison/Config/routing.xml b/local/modules/PlanificationLivraison/Config/routing.xml new file mode 100644 index 00000000..9ddee681 --- /dev/null +++ b/local/modules/PlanificationLivraison/Config/routing.xml @@ -0,0 +1,10 @@ + + + + + PlanificationLivraison\Controller\Configuration::editConfig + + + diff --git a/local/modules/PlanificationLivraison/Controller/Configuration.php b/local/modules/PlanificationLivraison/Controller/Configuration.php new file mode 100755 index 00000000..16544fb1 --- /dev/null +++ b/local/modules/PlanificationLivraison/Controller/Configuration.php @@ -0,0 +1,66 @@ +checkAuth( + AdminResources::MODULE, + [PlanificationLivraison::DOMAIN_NAME], + AccessManager::UPDATE + )) { + return $response; + } + + $form = $this->createForm('planiflivraison.configuration'); + $error_message = null; + + try { + $validateForm = $this->validateForm($form); + $data = $validateForm->getData(); + + PlanificationLivraison::setConfigValue( + PlanificationLivraison::CONFIG_VALUE_NAME, + $data["google_api_key"] + ); + + return $this->redirectToConfigurationPage(); + + } catch (FormValidationException $e) { + $error_message = $this->createStandardFormValidationErrorMessage($e); + } + + if (null !== $error_message) { + $this->setupFormErrorContext( + 'configuration', + $error_message, + $form + ); + $response = $this->render("module-configure", ['module_code' => 'PlanificationLivraison']); + } + return $response; + } + + /** + * Redirect to the configuration page + */ + protected function redirectToConfigurationPage() + { + return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/PlanificationLivraison')); + } + +} diff --git a/local/modules/PlanificationLivraison/Form/Configuration.php b/local/modules/PlanificationLivraison/Form/Configuration.php new file mode 100644 index 00000000..f10ebb22 --- /dev/null +++ b/local/modules/PlanificationLivraison/Form/Configuration.php @@ -0,0 +1,38 @@ +formBuilder + ->add( + "google_api_key", + "text", + array( + "label" => "GoogleMap API key", + "label_attr" => [ + "for" => "google_api_key" + ], + "required" => true + ) + ); + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return "planiflivraison_configuration"; + } +} diff --git a/local/modules/PlanificationLivraison/Hook/HookManager.php b/local/modules/PlanificationLivraison/Hook/HookManager.php new file mode 100644 index 00000000..18c88064 --- /dev/null +++ b/local/modules/PlanificationLivraison/Hook/HookManager.php @@ -0,0 +1,20 @@ +getModuleId(); + + $event->add($this->render("module_configuration.html", ['module_id' => $module_id])); + } +} diff --git a/local/modules/PlanificationLivraison/I18n/fr_FR.php b/local/modules/PlanificationLivraison/I18n/fr_FR.php index 37086245..b6adb853 100644 --- a/local/modules/PlanificationLivraison/I18n/fr_FR.php +++ b/local/modules/PlanificationLivraison/I18n/fr_FR.php @@ -1,4 +1,5 @@ 'La traduction française de la chaine', + 'GoogleMap API key' => 'Clé API GoogleMap', + 'Save' => 'Enregistrer', ); diff --git a/local/modules/PlanificationLivraison/PlanificationLivraison.php b/local/modules/PlanificationLivraison/PlanificationLivraison.php index a7b881f4..e4e4fb7c 100644 --- a/local/modules/PlanificationLivraison/PlanificationLivraison.php +++ b/local/modules/PlanificationLivraison/PlanificationLivraison.php @@ -20,6 +20,7 @@ class PlanificationLivraison extends BaseModule { /** @var string */ const DOMAIN_NAME = 'planiflivraison'; + const CONFIG_VALUE_NAME = 'planiflivraison_googlemap_api_key'; /** diff --git a/local/modules/PlanificationLivraison/templates/backOffice/default/module_configuration.html b/local/modules/PlanificationLivraison/templates/backOffice/default/module_configuration.html new file mode 100755 index 00000000..b751f3b4 --- /dev/null +++ b/local/modules/PlanificationLivraison/templates/backOffice/default/module_configuration.html @@ -0,0 +1,25 @@ +{if isset($smarty.get.errmes) && !empty($smarty.get.errmes)} +
+ {$smarty.get.errmes} +
+{/if} + +
+
+
+ {form name="planiflivraison.configuration"} + + {form_hidden_fields form=$form} + + {if $form_error}
{$form_error_message}
{/if} + + {render_form_field field="google_api_key" value={module_config module="PlanificationLivraison" key='planiflivraison_googlemap_api_key' locale="en_US"}} + + + + {/form} +
+
+
diff --git a/local/modules/PointRetrait/Config/module.xml b/local/modules/PointRetrait/Config/module.xml index b5018a01..33c75b16 100644 --- a/local/modules/PointRetrait/Config/module.xml +++ b/local/modules/PointRetrait/Config/module.xml @@ -25,4 +25,7 @@ beta 0 0 + + PlanificationLivraison + diff --git a/local/modules/PointRetrait/templates/backOffice/default/includes/main.html b/local/modules/PointRetrait/templates/backOffice/default/includes/main.html index 76690e24..0c47dba8 100644 --- a/local/modules/PointRetrait/templates/backOffice/default/includes/main.html +++ b/local/modules/PointRetrait/templates/backOffice/default/includes/main.html @@ -184,7 +184,7 @@
- +
diff --git a/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html b/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html index 79271394..6779a5c1 100644 --- a/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html +++ b/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html @@ -20,12 +20,6 @@
 
- {if {cart attr='total_taxed_price_without_discount'} < $minimum} - - - - {/if} -
@@ -75,6 +69,10 @@ $('input[type=radio][delivery-mode]').click(function() { $('div[id^="select"]').not($('#select-' + $(this).attr('delivery-mode'))).slideUp(); $('#select-' + $(this).attr('delivery-mode')).slideDown('fast'); + + if ($('[delivery-mode=pdr]').is(':checked')) { + + } }); $("#form-cart-delivery").off('submit').submit(function(ev) { @@ -86,4 +84,12 @@ } }); + 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'}"; + document.body.appendChild(script); + } + +