diff --git a/local/modules/ClickAndCollect/ClickAndCollect.php b/local/modules/ClickAndCollect/ClickAndCollect.php new file mode 100644 index 00000000..eb12e7e0 --- /dev/null +++ b/local/modules/ClickAndCollect/ClickAndCollect.php @@ -0,0 +1,62 @@ +isValidDelivery($country)) { + throw new DeliveryException( + Translator::getInstance()->trans("This module cannot be used on the current cart.") + ); + } + + $price = 0; + if (null !== $chosenPlace = $this->getRequest()->get(('cnc-choosen-place'))) { + $placeId = PdrScheduleQuery::create()->findOneById($chosenPlace)->getIdPlace(); + $price = PdrPlacesQuery::create()->findOneById($placeId)->getPrice(); + } + + return $price; + } + +} diff --git a/local/modules/ClickAndCollect/Config/config.xml b/local/modules/ClickAndCollect/Config/config.xml new file mode 100644 index 00000000..43630ce7 --- /dev/null +++ b/local/modules/ClickAndCollect/Config/config.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/local/modules/ClickAndCollect/Config/module.xml b/local/modules/ClickAndCollect/Config/module.xml new file mode 100644 index 00000000..2713abb8 --- /dev/null +++ b/local/modules/ClickAndCollect/Config/module.xml @@ -0,0 +1,28 @@ + + + ClickAndCollect\ClickAndCollect + + Click and Collect + + + Click and Collect + + + en_US + fr_FR + + 1.0.0 + + + Laurent LE CORRE + laurent@thecoredev.fr + + + delivery + 2.3.x + beta + 0 + 0 + \ No newline at end of file diff --git a/local/modules/ClickAndCollect/Config/routing.xml b/local/modules/ClickAndCollect/Config/routing.xml new file mode 100644 index 00000000..202a56d9 --- /dev/null +++ b/local/modules/ClickAndCollect/Config/routing.xml @@ -0,0 +1,39 @@ + + + + + + ClickAndCollect\Controller\backOffice\ListController::viewAction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/local/modules/ClickAndCollect/Controller/backOffice/ListController.php b/local/modules/ClickAndCollect/Controller/backOffice/ListController.php new file mode 100644 index 00000000..a7c43c5b --- /dev/null +++ b/local/modules/ClickAndCollect/Controller/backOffice/ListController.php @@ -0,0 +1,34 @@ +render("cnc-places-list"); + } + + + public function toggleActive($id) + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, ClickAndCollect::getModuleCode(), AccessManager::UPDATE)) + return $response; + + $place = PdrPlacesQuery::create()->findOneById(($id)); + $place->setActive($place->getActive() ? 0 : 1)->save(); + + return $this->render("places-list"); + } +} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php b/local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php new file mode 100644 index 00000000..73a8c88f --- /dev/null +++ b/local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php @@ -0,0 +1,127 @@ +findOneById($this->getRequest()->query->get("place_id")); + + return $this->render("place-edit", array('module_code' => PointRetrait::getModuleCode(), + 'place_id' => $selectedPlace)); + } + + + public function editPlace() + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::VIEW)) + return $response; + + $con = Propel::getConnection(); + $con->beginTransaction(); + + $error_msg = ""; + $changeForm = $this->createForm("pdr.place.view.main", "form"); + + try { + $form = $this->validateForm($changeForm, "POST"); + + $data = $form->getData(); + $place = PdrPlacesQuery::create()->findOneById($data['place_id']); + if ($place === null) { + $error_msg = "Withdrawal place not found by Id"; + } + else { + $place->fromArray($data, TableMap::TYPE_FIELDNAME); + $place->save(); + $con->commit(); + } + } catch (FormValidationException $ex) { + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + } + + if ($this->getRequest()->get('save_mode') == 'stay') + return $this->render("place-edit"); + + return $this->render("places-list"); + } + + + public function createPlace() + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::VIEW)) + return $response; + + $con = Propel::getConnection(); + $con->beginTransaction(); + + $error_msg = ""; + $createForm = $this->createForm("pdr.place.create", "form"); + + try { + $form = $this->validateForm($createForm, "POST"); + $data = $form->getData(); + + $newPlace = new PdrPlaces(); + $newPlace->fromArray($data, TableMap::TYPE_FIELDNAME); + $newPlace->save(); + $con->commit(); + + } catch (FormValidationException $ex) { + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + } + + if ($this->getRequest()->request->get("success_url") == null) { + return new RedirectResponse(URL::getInstance()->absoluteUrl(PointRetrait::MODULE_URL)); + } else { + return new RedirectResponse(URL::getInstance()->absoluteUrl($this->getRequest()->request->get("success_url"))); + } + } + + + public function deletePlace() + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::VIEW)) + return $response; + + $placeId = $this->getRequest()->get('attr-place-id'); + $query = PdrPlacesQuery::create()->findById($placeId); + if ($query === null) + $error_msg = "Place not found by Id"; + else + { + $con = Propel::getConnection(); + $con->beginTransaction(); + $query->delete($con); + $con->commit(); + } + + if ($this->getRequest()->request->get("success_url") == null) { + return new RedirectResponse(URL::getInstance()->absoluteUrl(PointRetrait::MODULE_URL)); + } else { + return new RedirectResponse(URL::getInstance()->absoluteUrl($this->getRequest()->request->get("success_url"))); + } + } + +} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/Controller/backOffice/ScheduleController.php b/local/modules/ClickAndCollect/Controller/backOffice/ScheduleController.php new file mode 100644 index 00000000..6428031b --- /dev/null +++ b/local/modules/ClickAndCollect/Controller/backOffice/ScheduleController.php @@ -0,0 +1,154 @@ +checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::UPDATE)) + return $response; + + $placeScheduleId = $this->getRequest()->get('schedule_id'); + $query = PdrScheduleQuery::create()->findById($placeScheduleId); + if ($query === null) + $error_msg = "Delivery area schedule not found by Id"; + else + { + $con = Propel::getConnection(); + $con->beginTransaction(); + $query->delete($con); + $con->commit(); + } + + if ($this->getRequest()->request->get("success_url") == null) { + return new RedirectResponse(URL::getInstance()->absoluteUrl(MODULE_URL)); + } else { + return new RedirectResponse(URL::getInstance()->absoluteUrl($this->getRequest()->request->get("success_url"))); + } + } + + + /* + * Update a day in a place's withdrawal schedule + */ + public function updateSchedule() + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::UPDATE)) + return $response; + + $con = Propel::getConnection(); + $con->beginTransaction(); + + $error_msg = ""; + $changeForm = $this->createForm("pdr.place.update.schedule", "form"); + try { + $form = $this->validateForm($changeForm, "POST"); + $data = $form->getData(); + + $placeScheduleId = $this->getRequest()->get('schedule_id'); + $query = PdrScheduleQuery::create()->findOneById($placeScheduleId); + if ($query === null) + $error_msg = "Withdrawal place schedule not found by Id"; + else + { + $query->fromArray($data, TableMap::TYPE_FIELDNAME); + $query->save($con); + $con->commit(); + } + } catch (FormValidationException $ex) { + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + + if (false !== $error_msg) { + $this->setupFormErrorContext( + $this->getTranslator()->trans("Schedule update"), + $error_msg, + $changeForm, + $ex + ); + + return $this->generateErrorRedirect($changeForm); + } + } + + if ($data['success_url'] == null) { + return new RedirectResponse(URL::getInstance()->absoluteUrl(MODULE_URL)); + } else { + return $this->generateSuccessRedirect($changeForm); + } + } + + + /* + * Add a new withdrawal day + */ + public function createSchedule() + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::UPDATE)) + return $response; + + $con = Propel::getConnection(); + $con->beginTransaction(); + + $error_msg = ""; + $changeForm = $this->createForm("pdr.place.create.schedule", "form"); + try { + $form = $this->validateForm($changeForm, "POST"); + $data = $form->getData(); + + $query = new PdrSchedule(); + $query->fromArray($data, TableMap::TYPE_FIELDNAME); + $query->setIdPlace($data['place_id']); + $query->save($con); + $con->commit(); + + } catch (FormValidationException $ex) { + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + + if (false !== $error_msg) { + $this->setupFormErrorContext( + $this->getTranslator()->trans("Schedule update"), + $error_msg, + $changeForm, + $ex + ); + + return $this->generateErrorRedirect($changeForm); + } + } + + if ($data['success_url'] == null) { + return new RedirectResponse(URL::getInstance()->absoluteUrl(MODULE_URL)); + } else { + return $this->generateSuccessRedirect($changeForm); + } + } + +} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/Hook/AdminHook.php b/local/modules/ClickAndCollect/Hook/AdminHook.php new file mode 100644 index 00000000..02b53f28 --- /dev/null +++ b/local/modules/ClickAndCollect/Hook/AdminHook.php @@ -0,0 +1,82 @@ +securityContext = $securityContext; + } + + + public function onMainTopMenuTools(HookRenderEvent $event) + { + $isGranted = $this->securityContext->isGranted( + ["ADMIN"], + [], + [ClickAndCollect::getModuleCode()], + [AccessManager::VIEW] + ); + + if ($isGranted) { + $event->add($this->render("menu-hook.html", $event->getArguments())); + } + } + + + /* Pour afficher la liste des retraits en Click and Collect, dans la page d'accueil backOffice */ + public function displayScheduledWithdrawals(HookRenderBlockEvent $event) + { + $content = trim($this->render("scheduled-clickandcollect.html")); + if (!empty($content)) { + $event->add([ + "id" => "block-scheduled-clickandcollect", + "title" => $this->trans("Scheduled click and collect", [], ClickAndCollect::DOMAIN_NAME), + "content" => $content, + "class" => "col-md-6" + ]); + } + } + + + /* Pour intégrer la date de retrait possible dans différents formulaires (email, backOffice, ...) */ + public function displayDeliveryDate(HookRenderEvent $event) + { + + $moduleId = $event->getArgument('module'); + $orderId = $event->getArgument('order_id'); + + if ((null !== $orderId) && ($moduleId == ClickAndCollect::getModuleId())) + { + $sessionData = $this->getSession()->get('cncData'); + $selectedDay = $sessionData->getDeliveryDate(); + $beginTime = $sessionData->getDeliveryStartTime(); + $endTime = $sessionData->getDeliveryEndTime(); + + if ( (null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime) ) + { + $event->add( + $this->render( + 'delivery-address.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime + ]) + ); + } + } + } +} diff --git a/local/modules/ClickAndCollect/Hook/CssHook.php b/local/modules/ClickAndCollect/Hook/CssHook.php new file mode 100644 index 00000000..e97b8c72 --- /dev/null +++ b/local/modules/ClickAndCollect/Hook/CssHook.php @@ -0,0 +1,17 @@ +add($this->addCSS('assets/css/styles.css')); + } +} diff --git a/local/modules/ClickAndCollect/Hook/EmailHook.php b/local/modules/ClickAndCollect/Hook/EmailHook.php new file mode 100644 index 00000000..7fa1f873 --- /dev/null +++ b/local/modules/ClickAndCollect/Hook/EmailHook.php @@ -0,0 +1,82 @@ +getArgument('module'); + $orderId = $event->getArgument('order'); + + if ((null !== $orderId) && ($moduleId == ClickAndCollect::getModuleId())) + { + $sessionData = $this->getSession()->get('cncData'); + $selectedDay = $sessionData->getDeliveryDate(); + $beginTime = $sessionData->getDeliveryStartTime(); + $endTime = $sessionData->getDeliveryEndTime(); + + if ( (null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime) ) + { + $event->add( + $this->render( + 'delivery-address.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime + ]) + ); + } + else + throw new TheliaProcessException("ClickAndCollect : Impossible de récupérer les données de session SessionData"); + } + } + + + public function displayCompleteInformationWithinEmail(HookRenderEvent $event) + { + + $orderId = $event->getArgument('order'); + $moduleId = OrderQuery::create()->findOneById($orderId)->getDeliveryModuleId(); + + if ((null !== $orderId) && ($moduleId == ClickAndCollect::getModuleId())) + { + $sessionData = $this->getSession()->get('cncData'); + $selectedDay = $sessionData->getDeliveryDate(); + $beginTime = $sessionData->getDeliveryStartTime(); + $endTime = $sessionData->getDeliveryEndTime(); + + if ( (null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime) ) + { + $place = PdrPlacesQuery::create()->findOneById($sessionData->getPlaceId()); + + $event->add( + $this->render( + 'delivery-address-full.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime, + 'placeName' => $place->getTitle(), + 'address1' => $place->getAddress1() . ' ' . $place->getAddress2(), + 'zipcode' => $place->getZipcode(), + 'city' => $place->getCity() + ]) + ); + } + else + throw new TheliaProcessException("ClickAndCollect : Impossible de récupérer les données de session SessionData"); + } + } + +} + + diff --git a/local/modules/ClickAndCollect/Hook/FrontHook.php b/local/modules/ClickAndCollect/Hook/FrontHook.php new file mode 100644 index 00000000..04264d96 --- /dev/null +++ b/local/modules/ClickAndCollect/Hook/FrontHook.php @@ -0,0 +1,56 @@ +add( + $this->render( + 'order-delivery-extra.html', + [ + 'module_id' => ClickAndCollect::getModuleId() + ] + ) + ); + } + + + public function displayWithdrawalDate(HookRenderEvent $event) + { + $order = $this->getSession()->getOrder(); + if ((null !== $order) && $order->getDeliveryModuleId() == PointRetrait::getModuleId()) + { + $sessionData = $this->getSession()->get('cncData'); + $selectedDay = $sessionData->getDeliveryDate(); + $beginTime = $sessionData->getDeliveryStartTime(); + $endTime = $sessionData->getDeliveryEndTime(); + + if ( (null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime) ) + { + $event->add( + $this->render( + 'delivery-address.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime, + 'place_id' => $sessionData->getPlaceId() + ]) + ); + } + else + throw new TheliaProcessException("PointRetrait : Impossible de récupérer les données de session sessionData"); + } + } + +} + + diff --git a/local/modules/ClickAndCollect/I18n/en_US.php b/local/modules/ClickAndCollect/I18n/en_US.php new file mode 100644 index 00000000..0b4fa142 --- /dev/null +++ b/local/modules/ClickAndCollect/I18n/en_US.php @@ -0,0 +1,4 @@ + 'The displayed english string', +); diff --git a/local/modules/ClickAndCollect/I18n/fr_FR.php b/local/modules/ClickAndCollect/I18n/fr_FR.php new file mode 100644 index 00000000..4a961042 --- /dev/null +++ b/local/modules/ClickAndCollect/I18n/fr_FR.php @@ -0,0 +1,11 @@ + 'Délai avant dépôt', + 'Module name' => 'Point Click and Collect', + 'Order number' => 'Commande', + 'Place name' => 'Nom du point de dépôt', + 'Scheduled date' => 'A déposer pour le', + 'Scheduled click and collect' => 'Commandes à déposer en Click & Collect', + 'There is no order to deliver' => 'Aucune commande à déposer', + '' => '', +); diff --git a/local/modules/ClickAndCollect/Readme.md b/local/modules/ClickAndCollect/Readme.md new file mode 100644 index 00000000..50c2d1c0 --- /dev/null +++ b/local/modules/ClickAndCollect/Readme.md @@ -0,0 +1,55 @@ +# Click And Collect + +Add a short description here. You can also add a screenshot if needed. + +## Installation + +### Manually + +* Copy the module into ```/local/modules/``` directory and be sure that the name of the module is ClickAndCollect. +* Activate it in your thelia administration panel + +### Composer + +Add it in your main thelia composer.json file + +``` +composer require your-vendor/click-and-collect-module:~1.0 +``` + +## Usage + +Explain here how to use your module, how to configure it, etc. + +## Hook + +If your module use one or more hook, fill this part. Explain which hooks are used. + + +## Loop + +If your module declare one or more loop, describe them here like this : + +[loop name] + +### Input arguments + +|Argument |Description | +|--- |--- | +|**arg1** | describe arg1 with an exemple. | +|**arg2** | describe arg2 with an exemple. | + +### Output arguments + +|Variable |Description | +|--- |--- | +|$VAR1 | describe $VAR1 variable | +|$VAR2 | describe $VAR2 variable | + +### Exemple + +Add a complete exemple of your loop + +## Other ? + +If you have other think to put, feel free to complete your readme as you want. diff --git a/local/modules/ClickAndCollect/composer.json b/local/modules/ClickAndCollect/composer.json new file mode 100644 index 00000000..43ba57c6 --- /dev/null +++ b/local/modules/ClickAndCollect/composer.json @@ -0,0 +1,12 @@ +{ + "name": "your-vendor/click-and-collect-module", + "description": "ClickAndCollect module for Thelia", + "license": "LGPL-3.0-or-later", + "type": "thelia-module", + "require": { + "thelia/installer": "~1.1" + }, + "extra": { + "installer-name": "ClickAndCollect" + } +} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/assets/css/styles.css b/local/modules/ClickAndCollect/templates/backOffice/default/assets/css/styles.css new file mode 100644 index 00000000..b449eb6c --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/assets/css/styles.css @@ -0,0 +1,86 @@ +.etroit { + width: 80px !important; +} + +.large { + width: 250px !important; +} + +.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:600px; + width:100%; + margin-top: 20px; +} + +.city-remove { + height: 30px !important; +} + +.pin { + height: 25px; + margin-left: 12px; +} + +.legende { + margin-top: 25px; + text-align: center; + font-style: italic; +} + +#submit-geoloc { + width: 50px; + cursor: pointer; +} + +.bouton-geoloc { + display: inline-block; + align-items: center; + margin-top: 25px; +} + +.bouton-geoloc span { + font-size: larger; + font-weight: 600; +} + +.pin-pdr { + height: 25px; + margin-left: 12px; +} + +.titre { + font-weight: 900; + color: red; +} + +#block-scheduled-deliveries > div.scheduled-deliveries-list > table > thead > tr > th, +#block-scheduled-deliveries > div.scheduled-deliveries-list > table > tbody > tr > td { + text-align: center; +} + +.nb-commandes { + font-size: 14px; + margin-left: 30px; +} + +.nb-commandes b { + color: orange; + font-weight: bold; +} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/assets/img/compass.svg b/local/modules/ClickAndCollect/templates/backOffice/default/assets/img/compass.svg new file mode 100644 index 00000000..9bad51ff --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/assets/img/compass.svg @@ -0,0 +1 @@ +Compass \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/assets/img/pin.svg b/local/modules/ClickAndCollect/templates/backOffice/default/assets/img/pin.svg new file mode 100644 index 00000000..35417c6c --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/assets/img/pin.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html b/local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html new file mode 100644 index 00000000..24067cc9 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html @@ -0,0 +1,140 @@ +{extends file="admin-layout.tpl"} + +{block name="no-return-functions"} + {$admin_current_location = 'module'} +{/block} + +{block name="page-title"}{intl l='Title of config view' d='clickandcollect'}{/block} + +{block name="check-resource"}admin.module{/block} +{block name="check-access"}view{/block} +{block name="check-module"}ClickAndCollect{/block} + +{block name="main-content"} +
+ + {if $general_error} +
+ {$general_error} +
+ {/if} + +
+
+ + + + + + + + + + + + + + + + + + + {loop name="places" type="pdr_places"} + + + + + + + + + + {/loop} + + +
+ {intl l='My deposit places' d='clickandcollect'} +
{intl l="Place name" d='clickandcollect'}{intl l="Active" d='clickandcollect'}{intl l="Address" d='clickandcollect'}{intl l="Opening hours" d='clickandcollect'}{intl l="Additional cost" d='clickandcollect'}{intl l="Minimum amount" d='clickandcollect'} 
+ {loop name="auth-create" type="auth" role="ADMIN" resource="admin.pdr.main" access="CREATE" module="ClickAndCollect"} +
+ + + +
+ {/loop} +
{$TITLE} +
+ +
+
{$ADDRESS1}
{$ZIPCODE} {$CITY}{if $LATITUDE eq '' or $LONGITUDE eq ''}Pas de coordonnées{/if}
{$DELIVERY_DAYS}{if $DELIVERY_DAYS eq ''}{intl l="There is no schedule for this place" d='clickandcollect'}{/if}{$PRICE} €{$MINIMUM_AMOUNT} € + +
+
+
+
+ + {* CREATE Modal *} + {form name="pdr.place.create"} + {capture "place_create"} + {include file="form/place-create.html" form_name="pdr.place.create"} + {/capture} + + {include file="includes/generic-create-dialog.html" + dialog_id = "place-create-modal" + dialog_title = {intl l="Create a new place" d="pointretrait"} + dialog_body = {$smarty.capture.place_create nofilter} + dialog_ok_label = {intl l="Create"} + dialog_cancel_label = {intl l="Cancel"} + form_action = {$current_url} + form_enctype = {form_enctype form=$form} + } + {/form} + + {* DELETE modal *} + {capture "place_delete"} + {intl l="Do you really want to remove this place ?" d="pointretrait"} + + + {/capture} + + {include file="includes/generic-confirm-dialog.html" + dialog_id = "place-delete" + dialog_title = {intl l="Delete a place" d="pointretrait"} + dialog_message = {$smarty.capture.place_delete nofilter} + dialog_ok_label = {intl l="Delete"} + dialog_cancel_label = {intl l="Cancel"} + form_action = {token_url path='/admin/module/ClickAndCollect/delete'} + } + +{/block} + +{block name="javascript-initialization"} +{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'} + + +{/javascripts} +{/block} diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/delivery-address.html b/local/modules/ClickAndCollect/templates/backOffice/default/delivery-address.html new file mode 100644 index 00000000..c51430de --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/delivery-address.html @@ -0,0 +1,8 @@ +  + + + {intl l="Scheduled date" d="pointretrait"} + {$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"} + + +  diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/form/place-create.html b/local/modules/ClickAndCollect/templates/backOffice/default/form/place-create.html new file mode 100644 index 00000000..69e6527d --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/form/place-create.html @@ -0,0 +1,102 @@ +{form name=$form_name} + {form_hidden_fields form=$form} + + {render_form_field form=$form field="success_url" value={$success_url|default:{url path='/admin/module/PointRetrait'}}} + + {form_field form=$form field="title"} +
+ + + {form_error form=$form field="title"}{$message}{/form_error} + +
+ {/form_field} + + {form_field form=$form field="price"} +
+ + +  € +
+ {form_error form=$form field="price"}{$message}{/form_error} + {/form_field} + + {form_field form=$form field="minimum_amount"} +
+ + +  € +
+ {form_error form=$form field="minimum_amount"}{$message}{/form_error} + {/form_field} + + {form_field form=$form field="address1"} +
+ + +
+ +
+
+ {form_error form=$form field="address1"}{$message}{/form_error} + {/form_field} + + {form_field form=$form field="address2"} +
+ + +
+ +
+
+ {form_error form=$form field="address2"}{$message}{/form_error} + {/form_field} + + {form_field form=$form field="zipcode"} +
+ + +
+ +
+
+ {form_error form=$form field="zipcode"}{$message}{/form_error} + {/form_field} + + {form_field form=$form field="city"} +
+ + +
+ +
+
+ {form_error form=$form field="city"}{$message}{/form_error} + {/form_field} + + {form_field form=$form field="active"} + + {/form_field} + +{/form} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/form/place-schedule-create.html b/local/modules/ClickAndCollect/templates/backOffice/default/form/place-schedule-create.html new file mode 100644 index 00000000..dba5f757 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/form/place-schedule-create.html @@ -0,0 +1,114 @@ +{form name=$form_name} +{form_hidden_fields form=$form} + +{render_form_field form=$form field="success_url" value={url path="/admin/module/PointRetrait/edit?place_id={$place_id}#schedule"}} +{render_form_field form=$form field="error_url" value={url path="/admin/module/PointRetrait/edit?place_id={$place_id}#schedule"}} + +{form_field form=$form field="place_id"} + +{/form_field} +{if {$update|default:false} == true} + {form_field form=$form field="place-schedule_id"} + + {/form_field} +{/if} + +{form_field form=$form field="day"} +
+ + {form_error form=$form field="day"}{$message}{/form_error} + + +
+{/form_field} + + +{if {$update|default:false} == false} + +
+
+ {form_field form=$form field="begin_time"} +
+ + + {form_error form=$form field="begin_time"}{$message}{/form_error} +
+ + + + +
+
+ {/form_field} + {form_field form=$form field="end_time"} +
+ + + {form_error form=$form field="end_time"}{$message}{/form_error} +
+ + + + +
+
+ {/form_field} +
+
+{else} + + {form_field form=$form field="begin_time"} +
+ + + {form_error form=$form field="begin_time"}{$message}{/form_error} +
+ + + + +
+
+ {/form_field} + {form_field form=$form field="end_time"} +
+ + + {form_error form=$form field="end_time"}{$message}{/form_error} +
+ + + + +
+
+ {/form_field} +{/if} + +{/form} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/includes/main.html b/local/modules/ClickAndCollect/templates/backOffice/default/includes/main.html new file mode 100644 index 00000000..b4407290 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/includes/main.html @@ -0,0 +1,195 @@ +{form name='pdr.place.view.main'} +
+ + {if $form_error} +
{$form_error_message}
+ {/if} + + {loop name="places" type="pdr_places" id="$place_id"} +
+ {form_hidden_fields form=$form} + + {include file = "includes/inner-form-toolbar.html" + hide_flags = true + hide_submit_buttons = false + page_url = "{url path='/admin/module/PointRetrait/edit&place_id=$place_id'}" + close_url = "{url path='/admin/module/PointRetrait'}" + current_tab = "main" + } + + {form_field form=$form field="place_id"} + + {/form_field} + +
+
+ {form_field form=$form field="title"} +
+ +   +
+ {form_error form=$form field="title"}{$message}{/form_error} + {/form_field} +
+ +
+ {form_field form=$form field="active"} +
+ + +
+ +
+ +
+ {/form_field} +
+ +
+ {form_field form=$form field="price"} +
+ + +  € +
+ {form_error form=$form field="price"}{$message}{/form_error} + {/form_field} +
+ +
+ {form_field form=$form field="minimum_amount"} +
+ + +  € +
+ {form_error form=$form field="minimum_amount"}{$message}{/form_error} + {/form_field} +
+ +
+ +
+
+ {form_field form=$form field="address1"} +
+ + +
+ +
+
+ {form_error form=$form field="address1"}{$message}{/form_error} + {/form_field} +
+
+ +
+
+ {form_field form=$form field="address2"} +
+ + +
+ +
+
+ {form_error form=$form field="address2"}{$message}{/form_error} + {/form_field} +
+
+ +
+
+ {form_field form=$form field="zipcode"} +
+ + +
+ +
+
+ {form_error form=$form field="zipcode"}{$message}{/form_error} + {/form_field} +
+
+ {form_field form=$form field="city"} +
+ + +
+ +
+
+ {form_error form=$form field="city"}{$message}{/form_error} + {/form_field} +
+
+ +
+
+ {form_field form=$form field="access_comment"} +
+ + +
+ +
+ {intl l="Access comment help" d="pointretrait"} +
+ {form_error form=$form field="access_comment"}{$message}{/form_error} + {/form_field} +
+
+
+ Geolocate + {intl l="Recenter map" d="pointretrait"} +
+ {form_field form=$form field="latitude"} + + {/form_field} + {form_field form=$form field="longitude"} + + {/form_field} +
+
+ + +
+
+ +
+
+
+ +
+ {/loop} +
+{/form} diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/includes/schedule.html b/local/modules/ClickAndCollect/templates/backOffice/default/includes/schedule.html new file mode 100644 index 00000000..7144d363 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/includes/schedule.html @@ -0,0 +1,97 @@ +{form name='pdr.place.view.schedule'} +
+ + {if $form_error} +
{$form_error_message}
+ {/if} + +
+ {form_hidden_fields form=$form} + + {include + file = "includes/inner-form-toolbar.html" + hide_flags = true + hide_submit_buttons = true + close_url = "{url path='/admin/module/PointRetrait'}" + current_tab = "schedule" + } + + {form_field form=$form field="place_id"} + + {/form_field} + +
+
+ + + + + + + + + + + + + + + + {loop name="place-schedule-loop" type="pdr_schedule" place_id=$place_id} + + + + + {* Actions *} + + + {/loop} + {elseloop rel="place-schedule-loop"} + + + + {/elseloop} + +
+ {loop name="auth-create" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="CREATE" module="ClickAndCollect"} +
+ + + +
+ {/loop} +
{intl l="Withdrawal day" d="pointretrait"}{intl l="Withdrawal beginning time" d="pointretrait"}{intl l="Withdrawal ending time" d="pointretrait"}{intl l="Actions" d="pointretrait"}
{$DAY_LABEL}{format_date date=$BEGIN format="H\hi"}{format_date date=$END format="H\hi"} +
+ {loop name="auth-edit" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="UPDATE" module="ClickAndCollect"} + + + + {/loop} + {loop name="auth-delete" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="DELETE" module="ClickAndCollect"} + + + + {/loop} +
+ +
+
+ {intl l="There is no schedule for this place" d="pointretrait"} +
+
+ +
+
+
+ +
+{/form} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/js/main-js.html b/local/modules/ClickAndCollect/templates/backOffice/default/js/main-js.html new file mode 100644 index 00000000..09dd6e7a --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/js/main-js.html @@ -0,0 +1,75 @@ + \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/js/schedule-js.html b/local/modules/ClickAndCollect/templates/backOffice/default/js/schedule-js.html new file mode 100644 index 00000000..bfdee772 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/js/schedule-js.html @@ -0,0 +1,41 @@ + diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/menu-hook.html b/local/modules/ClickAndCollect/templates/backOffice/default/menu-hook.html new file mode 100644 index 00000000..cbf975e0 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/menu-hook.html @@ -0,0 +1,3 @@ +
  • + {intl l='Module name' d='clickandcollect'} +
  • \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/modal/schedule-modal.html b/local/modules/ClickAndCollect/templates/backOffice/default/modal/schedule-modal.html new file mode 100644 index 00000000..d13c6de1 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/modal/schedule-modal.html @@ -0,0 +1,59 @@ +{* DELETE modal *} +{capture "schedule_delete"} + {intl l="Do you really want to remove this schedule entry ?" d="pointretrait"} + + + +{/capture} + +{include file="includes/generic-confirm-dialog.html" + dialog_id = "place-schedule-delete" + dialog_title = {intl l="Delete an entry of schedule" d="pointretrait"} + dialog_message = {$smarty.capture.schedule_delete nofilter} + dialog_ok_label = {intl l="Delete"} + dialog_cancel_label = {intl l="Cancel"} + form_action = {token_url path='/admin/module/PointRetrait/schedule/delete'} +} + + +{* UPDATE Modal*} +{form name="pdr.place.update.schedule"} + {capture "schedule_update"} + {form_field form=$form field="place-schedule_id"} + + {/form_field} + {form_field form=$form field="place_id"} + + {/form_field} + + {include file="form/place-schedule-create.html" form_name="pdr.place.update.schedule" update=true} + {/capture} + + {include file="includes/generic-create-dialog.html" + dialog_id = "place-schedule-update" + dialog_title = {intl l="Edit this withdrawal day" d="pointretrait"} + dialog_body = {$smarty.capture.schedule_update nofilter} + dialog_ok_label = {intl l="Save"} + dialog_cancel_label = {intl l="Cancel"} + form_action = {url path='admin/module/PointRetrait/schedule/update'} + form_enctype = {form_enctype form=$form} + } +{/form} + + +{* CREATE Modal *} +{form name="pdr.place.create.schedule"} + {capture "schedule_create"} + {include file="form/place-schedule-create.html" form_name="pdr.place.create.schedule" place_id=$smarty.get.place_id} + {/capture} + + {include file="includes/generic-create-dialog.html" + dialog_id = "place-schedule-create" + dialog_title = {intl l="Add a new withdrawal day" d="pointretrait"} + dialog_body = {$smarty.capture.schedule_create nofilter} + dialog_ok_label = {intl l="Create"} + dialog_cancel_label = {intl l="Cancel"} + form_action = {url path="admin/module/PointRetrait/schedule/create"} + form_enctype = {form_enctype form=$form} + } +{/form} \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/place-edit.html b/local/modules/ClickAndCollect/templates/backOffice/default/place-edit.html new file mode 100644 index 00000000..50cddea0 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/place-edit.html @@ -0,0 +1,82 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='My places' d="pointretrait"}{/block} + +{block name="check-access"}update{/block} +{block name="check-module"}PointRetrait{/block} + +{block name="after-bootstrap-css"} + +{/block} + +{block name="main-content"} + + + +
    + {assign "place_id" $smarty.get.place_id} + +
    +
    + {intl l="Edit a place" d="pointretrait"} : {loop name="places" type="pdr_places" id={$place_id}}{$TITLE}{/loop} +
    + + + +
    + {loop name="auth-general-tab" type="auth" role="ADMIN" resource="admin" access="VIEW" module="ClickAndCollect"} +
    + {include file="includes/main.html"} +
    + {/loop} + {loop name="auth-schedule-tab" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="ClickAndCollect"} +
    + {include file="includes/schedule.html"} +
    + {/loop} +
    +
    + + +
    + +{include file="modal/schedule-modal.html"} + +{/block} + +{block name="javascript-initialization"} +{javascripts file='assets/js/moment-with-locales.min.js'} + +{/javascripts} +{javascripts file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js'} + +{/javascripts} +{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'} + + +{/javascripts} +{include file="js/main-js.html"} +{include file="js/schedule-js.html"} +{/block} diff --git a/local/modules/ClickAndCollect/templates/backOffice/default/scheduled-clickandcollect.html b/local/modules/ClickAndCollect/templates/backOffice/default/scheduled-clickandcollect.html new file mode 100644 index 00000000..cec0b90c --- /dev/null +++ b/local/modules/ClickAndCollect/templates/backOffice/default/scheduled-clickandcollect.html @@ -0,0 +1,49 @@ +
    + + + + + + + + + {loop name="deliveries-loop" type="scheduled_deliveries" list_type="clickandcollect" only_future="true" order="date"} + {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"} + + + + + + + + {if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if} + + {/loop} + {elseloop rel="deliveries-loop"} + + + + {/elseloop} + +
    {intl l="Order number" d="clickandcollect"}{intl l="Scheduled date" d="clickandcollect"}{intl l="Delay" d="clickandcollect"}{intl l="Place name" d="clickandcollect"}
    {$ORDER_ID} + {format_date date=$START_DATE format="d/m/Y"} entre {format_date date=$START_DATE format="H\hi"} et {format_date date=$END_DATE format="H\hi"} + {$alt}{$DELTA} jour(s){$PLACE}
    +
    + {intl l="There is no order to deliver" d="clickandcollect"} +
    +
    + Total :  {$nbCommandes}  commande(s) + +
    \ No newline at end of file diff --git a/local/modules/ClickAndCollect/templates/email/default/delivery-address-full.html b/local/modules/ClickAndCollect/templates/email/default/delivery-address-full.html new file mode 100644 index 00000000..548adae5 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/email/default/delivery-address-full.html @@ -0,0 +1,18 @@ +
    +
    {intl l="Scheduled date" d="clickandcollect"}
    +
    + {$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"} +
    +
    + +
    +
    {intl l="Place name" d="clickandcollect"}
    +
    + {format_address organization="{$placeName}" + address_line1="{$address1}" + postal_code="{$zipcode}" + locality="{$city}" + locale=$locale} + +
    +
    diff --git a/local/modules/ClickAndCollect/templates/email/default/delivery-address.html b/local/modules/ClickAndCollect/templates/email/default/delivery-address.html new file mode 100644 index 00000000..7c61becd --- /dev/null +++ b/local/modules/ClickAndCollect/templates/email/default/delivery-address.html @@ -0,0 +1,6 @@ +
    +
    {intl l="Scheduled date" d="clickandcollect"}
    +
    + {$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"} +
    +
    diff --git a/local/modules/ClickAndCollect/templates/frontOffice/default/assets/css/styles.css b/local/modules/ClickAndCollect/templates/frontOffice/default/assets/css/styles.css new file mode 100644 index 00000000..6287eaaa --- /dev/null +++ b/local/modules/ClickAndCollect/templates/frontOffice/default/assets/css/styles.css @@ -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%; +} + + +tr.ligne-pdr > td { + border: 1px solid gray !important; +} +.ligne-pdr > td { + padding: 5px !important; +} +.creneau > td { + text-align: left !important; + font-size: 1.2rem; +} + +div.titre-pdr { + font-size: 1.6rem; + color: #e74c3c; + font-weight: 600; + margin-bottom: 10px; +} +.adresse { + font-size: 1.4rem; +} + +.table-main { + margin-bottom: 0 !important; +} +.table-schedule { + background-color: #f5f5f5 !important; + border-color: white !important; +} + +.img-pin { + width: 30px; +} +span.pin-number { + color: black !important; + position: relative; + left: -19px; + top: -2px; + z-index: 50; +} +.additional-price { + color: #e74c3c; + font-weight: 600; +} diff --git a/local/modules/ClickAndCollect/templates/frontOffice/default/assets/img/pin.png b/local/modules/ClickAndCollect/templates/frontOffice/default/assets/img/pin.png new file mode 100644 index 00000000..75292744 Binary files /dev/null and b/local/modules/ClickAndCollect/templates/frontOffice/default/assets/img/pin.png differ diff --git a/local/modules/ClickAndCollect/templates/frontOffice/default/delivery-address.html b/local/modules/ClickAndCollect/templates/frontOffice/default/delivery-address.html new file mode 100644 index 00000000..b7b7d020 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/frontOffice/default/delivery-address.html @@ -0,0 +1,24 @@ +{strip} + +
    + {loop type="pdr_places" name="place-loop" id={$place_id}} +
    {intl l="Order to withdraw" d="pointretrait"}
    +
    + {$TITLE} +
    + {$ADDRESS1}
    + {if $ADDRESS2 != ""} + {$ADDRESS2}
    + {/if} + {$ZIPCODE} {$CITY} +
    +
    + {/loop} + +
    {intl l="Scheduled date" d="clickandcollect"}
    +
    + {$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"} +
    +
    + +{/strip} diff --git a/local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html b/local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html new file mode 100644 index 00000000..68760680 --- /dev/null +++ b/local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html @@ -0,0 +1,163 @@ + + + + diff --git a/local/modules/LivraisonParSecteurs/I18n/fr_FR.php b/local/modules/LivraisonParSecteurs/I18n/fr_FR.php index cc2472d8..6f7686a4 100644 --- a/local/modules/LivraisonParSecteurs/I18n/fr_FR.php +++ b/local/modules/LivraisonParSecteurs/I18n/fr_FR.php @@ -28,19 +28,20 @@ return array( 'Format to respect' => 'Merci de respecter le format 50.255612 ou -3.121146 (le séparateur est un point et le nombre peut être négatif)', 'General' => 'Général', 'Home delivery cost' => 'Frais de livraison à domicile', - 'Message info minimum de commande' => 'Livraison à domicile possible sur votre secteur : plus que %delta € pour atteindre le minimum de %minimum € et pouvoir en bénéficier.', + 'Message info minimum de commande' => 'Livraison à domicile possible sur votre secteur : plus que %delta € pour atteindre le minimum de %minimum € et pouvoir en bénéficier.', 'Minimum amount' => 'Minimum de commande', 'Modify a delivery day' => 'Modifier un jour de livraison', 'Module name' => 'Livraison à domicile', + 'Module name - customer' => 'Faites-vous livrer à domicile', 'My areas' => 'Mes secteurs de livraison', 'Next delivery day' => 'Prochain jour de livraison', - 'Order number' => 'Commande n°', + 'Order number' => 'Commande', 'Please select a delivery day' => 'Veuillez choisir un jour de livraison', 'Remove this city' => 'Retirer cette commune', 'Save' => 'Sauvegarder', 'Schedule' => 'Horaires de livraison', 'Scheduled date' => 'Livraison prévue le', - 'Scheduled deliveries' => 'Livraisons à domicile planifiées', + 'Scheduled deliveries' => 'Commandes à livrer à domicile', 'There is no city delivered in this area' => 'Aucune commune desservie dans ce secteur', 'There is no order to deliver' => 'Aucune commande à livrer à domicile', 'There is no schedule for this area' => 'Aucune livraison actuellement sur ce secteur', diff --git a/local/modules/LivraisonParSecteurs/templates/backOffice/default/scheduled-deliveries.html b/local/modules/LivraisonParSecteurs/templates/backOffice/default/scheduled-deliveries.html index c8b3141c..ffb897f5 100644 --- a/local/modules/LivraisonParSecteurs/templates/backOffice/default/scheduled-deliveries.html +++ b/local/modules/LivraisonParSecteurs/templates/backOffice/default/scheduled-deliveries.html @@ -17,7 +17,7 @@
    - +
    @@ -27,7 +27,7 @@ - {loop name="deliveries-loop" type="scheduled_deliveries" domicile_ou_retrait="domicile" only_future="true" order="date"} + {loop name="deliveries-loop" type="scheduled_deliveries" list_type="domicile" only_future="true" order='date'} {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'} @@ -42,29 +42,15 @@ {/if} {assign var=title value="{$DELTA} jour(s) de délai"} - {loop name="order-loop" type="order" id={$ORDER_ID} customer="*"} - {loop type="customer" name="customer-loop" current="false" id=$CUSTOMER} - {assign var=client value="$FIRSTNAME $LASTNAME"} - {/loop} - {loop type="order_address" name="address-loop" id=$DELIVERY_ADDRESS} - {assign var=commune value=$CITY} - {/loop} - {/loop} - - + - - + + {if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if} 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 e178c667..7376de76 100644 --- a/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html +++ b/local/modules/LivraisonParSecteurs/templates/frontOffice/default/order-delivery-extra.html @@ -14,7 +14,7 @@ {form_field field='delivery-module'} {/form_field} diff --git a/local/modules/PlanificationLivraison/Loop/ScheduledDeliveriesLoop.php b/local/modules/PlanificationLivraison/Loop/ScheduledDeliveriesLoop.php index 8ebdd61e..2e264dc4 100644 --- a/local/modules/PlanificationLivraison/Loop/ScheduledDeliveriesLoop.php +++ b/local/modules/PlanificationLivraison/Loop/ScheduledDeliveriesLoop.php @@ -3,7 +3,11 @@ namespace PlanificationLivraison\Loop; use DateTime; +use LivraisonParSecteurs\Model\LpsArea; +use LivraisonParSecteurs\Model\LpsAreaCityQuery; +use LivraisonParSecteurs\Model\LpsAreaQuery; use PlanificationLivraison\Model\OrderDeliveryScheduleQuery; +use PointRetrait\Model\PdrPlacesQuery; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; @@ -11,6 +15,11 @@ 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\Base\OrderStatus; +use Thelia\Model\CustomerQuery; +use Thelia\Model\OrderAddressQuery; +use Thelia\Model\OrderQuery; +use Thelia\Model\OrderStatusQuery; /** * Class ScheduledDeliveriesLoop @@ -18,9 +27,9 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection; */ class ScheduledDeliveriesLoop extends BaseLoop implements PropelSearchLoopInterface { - const DOMICILE = "domicile"; - const RETRAIT = "retrait"; - + const DOMICILE = "domicile"; + const RETRAIT = "retrait"; + const CLICK_AND_COLLECT = "clickandcollect"; public $countable = true; @@ -36,6 +45,17 @@ class ScheduledDeliveriesLoop extends BaseLoop implements PropelSearchLoopInterf $loopResultRow = new LoopResultRow($deliveries); $delta = date_diff($deliveries->getDueDeliveryTimeStart(), new DateTime("now")); + $order = OrderQuery::create()->findOneById($deliveries->getOrderId()); + $customer = $order->getCustomer()->getFirstname() . ' ' . $order->getCustomer()->getLastname(); + + if (null != $deliveries->getDeliveryAddressId()) { + $city = OrderAddressQuery::create()->findOneById($order->getDeliveryOrderAddressId())->getCity(); + $area = LpsAreaQuery::create()->findOneById(LpsAreaCityQuery::create()->findOneById($deliveries->getDeliveryAddressId())->getIdArea())->getTitle(); + } + + if (null != $deliveries->getDeliveryPlaceId()) + $place = PdrPlacesQuery::create()->findOneById($deliveries->getDeliveryPlaceId())->getTitle(); + $loopResultRow ->set("ORDER_ID", $deliveries->getOrderId()) @@ -45,6 +65,10 @@ class ScheduledDeliveriesLoop extends BaseLoop implements PropelSearchLoopInterf ->set("START_DATE", $deliveries->getDueDeliveryTimeStart()) ->set("END_DATE", $deliveries->getDueDeliveryTimeEnd()) ->set("DELTA", $delta->days) + ->set("CUSTOMER", $customer) + ->set("AREA", $area) + ->set("CITY", $city) + ->set("PLACE", $place) ; $loopResult->addRow($loopResultRow); } @@ -59,14 +83,15 @@ class ScheduledDeliveriesLoop extends BaseLoop implements PropelSearchLoopInterf { return new ArgumentCollection( Argument::createIntTypeArgument('order_id'), - Argument::createEnumListTypeArgument('domicile_ou_retrait', [ + Argument::createEnumListTypeArgument('list_type', [ self::DOMICILE, - self::RETRAIT + self::RETRAIT, + self::CLICK_AND_COLLECT ], self::DOMICILE), Argument::createBooleanTypeArgument('only_future', true), Argument::createEnumListTypeArgument('order', [ 'date', - 'date-reverse' + 'date-reverse', ], 'date') ); } @@ -78,19 +103,26 @@ class ScheduledDeliveriesLoop extends BaseLoop implements PropelSearchLoopInterf { $deliveries = OrderDeliveryScheduleQuery::create(); - if (null !== $this->getOrderId()) { return $deliveries->filterByOrderId($this->getOrderId()); } + // Déjà, on n'affiche que les commandes non annulées + $deliveries->filterByOrderId(self::onlyNotCanceledOrders()); - foreach ($this->getDomicileOuRetrait() as $parametre) { + $clickAndCollectPlaces = PdrPlacesQuery::create()->filterByClickAndCollect(1)->find()->getData(); + foreach ($this->getListType() as $parametre) { switch ($parametre) { case self::DOMICILE: $deliveries->filterByDeliveryAddressId(null, Criteria::NOT_EQUAL); break; case self::RETRAIT: - $deliveries->filterByDeliveryPlaceId(null, Criteria::NOT_EQUAL); + $deliveries->filterByDeliveryPlaceId(null, Criteria::NOT_EQUAL)->filterByDeliveryPlaceId($clickAndCollectPlaces, Criteria::NOT_IN); + break; + case self::CLICK_AND_COLLECT: + $deliveries->filterByDeliveryPlaceId(null, Criteria::NOT_EQUAL)->filterByDeliveryPlaceId($clickAndCollectPlaces, Criteria::IN); + break; + default: break; } } @@ -108,10 +140,23 @@ class ScheduledDeliveriesLoop extends BaseLoop implements PropelSearchLoopInterf case 'date-reverse': $deliveries->orderByDueDeliveryTimeStart(Criteria::DESC); break; + default: + break; } } return $deliveries; } + + private function onlyNotCanceledOrders() { + $notCanceledOrders = []; + + $notCanceledData = OrderQuery::create()->filterByStatusId(OrderStatusQuery::create()->findOneByCode('canceled')->getId(), Criteria::NOT_EQUAL)->find()->getData(); + foreach ($notCanceledData as $data) { + array_push($notCanceledOrders, $data->getId()); + } + return $notCanceledOrders; + } + } diff --git a/local/modules/PointRetrait/Config/schema.xml b/local/modules/PointRetrait/Config/schema.xml index dcebb1fa..222aeb33 100644 --- a/local/modules/PointRetrait/Config/schema.xml +++ b/local/modules/PointRetrait/Config/schema.xml @@ -16,6 +16,7 @@ +
      {intl l="Order number" d="livraisonparsecteurs"}{intl l="Area" d="livraisonparsecteurs"}
    {$alt}{$ORDER_ID}{$ORDER_ID} {format_date date=$START_DATE format="d/m/Y"} entre {format_date date=$START_DATE format="H\hi"} et {format_date date=$END_DATE format="H\hi"} {$DELTA} jour(s){$commune}{loop name="area-schedule-loop" type="lps_area_schedule" id={$SCHEDULE_ID}} - {loop name="area-loop" type="lps_area" id={$AREA_ID}} - {$TITLE} - {/loop} - {/loop} - {$CITY}{$AREA}
    diff --git a/local/modules/PointRetrait/Config/thelia.sql b/local/modules/PointRetrait/Config/thelia.sql index c7483862..0ba29af6 100644 --- a/local/modules/PointRetrait/Config/thelia.sql +++ b/local/modules/PointRetrait/Config/thelia.sql @@ -23,6 +23,7 @@ CREATE TABLE `pdr_places` `zipcode` VARCHAR(10) NOT NULL, `city` VARCHAR(100) NOT NULL, `access_comment` VARCHAR(400), + `click_and_collect` TINYINT DEFAULT 0 NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; diff --git a/local/modules/PointRetrait/Controller/backOffice/ListController.php b/local/modules/PointRetrait/Controller/backOffice/ListController.php index 1472525f..88d878f7 100644 --- a/local/modules/PointRetrait/Controller/backOffice/ListController.php +++ b/local/modules/PointRetrait/Controller/backOffice/ListController.php @@ -5,6 +5,7 @@ namespace PointRetrait\Controller\backOffice; use LivraisonParSecteurs\LivraisonParSecteurs; use LivraisonParSecteurs\Model\LpsAreaQuery; use PointRetrait\Model\PdrPlacesQuery; +use PointRetrait\PointRetrait; use Thelia\Controller\Admin\BaseAdminController; use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\Resource\AdminResources; @@ -24,7 +25,7 @@ class ListController extends BaseAdminController public function toggleActive($id) { // Check current user authorization - if (null !== $response = $this->checkAuth(AdminResources::MODULE, LivraisonParSecteurs::getModuleCode(), AccessManager::UPDATE)) + if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::UPDATE)) return $response; $place = PdrPlacesQuery::create()->findOneById(($id)); diff --git a/local/modules/PointRetrait/I18n/fr_FR.php b/local/modules/PointRetrait/I18n/fr_FR.php index 8f6387fd..5c035eff 100644 --- a/local/modules/PointRetrait/I18n/fr_FR.php +++ b/local/modules/PointRetrait/I18n/fr_FR.php @@ -23,18 +23,19 @@ return array( 'Message no location' => 'Ce point de retrait ne possède pas de coordonnées GPS : pour vos clients, il est conseillé de géolocaliser l\'adresse.', 'Message info minimum de commande' => 'Vous n\'avez pas atteint le minimum de commande de %minimum € sur ce point de retrait.', 'Minimum amount' => 'Minimum de commande', - 'Module name' => 'Point de Retrait AuxBieauxLegumes', + 'Module name' => 'Point de retrait AuxBieauxLegumes', + 'Module name - customer' => 'Retirez en point retrait AuxBieauxLegumes', 'My places' => 'Point de retrait AuxBieauxLegumes', 'My withdrawal places' => 'Mes points de retrait AuxBieauxLegumes', 'Order to withdraw' => 'Commande à retirer au point retrait suivant', - 'Order number' => 'N° de commande', + 'Order number' => 'Commande', 'Place name' => 'Nom du point de retrait', 'Please select a delivery place' => 'Veuillez sélectionner un point de retrait', 'Recenter map' => 'Géolocaliser l\'adresse', 'Revert origin position' => 'Revenir à la position d\'origine', 'Schedule' => 'Horaires de retrait', 'Scheduled date' => 'Date de retrait prévue', - 'Scheduled withdrawals' => 'Commandes à retirer en Point Retrait', + 'Scheduled withdrawals' => 'Commandes à livrer en Point Retrait', 'Title of config view' => 'Point retrait AuxBieauxLegumes - Configuration', 'There is no order to withdraw' => 'Aucune commande à retirer en Point Retrait', 'There is no schedule for this place' => 'Aucun créneau de retrait sur ce point de retrait', diff --git a/local/modules/PointRetrait/Loop/GeneralLoop.php b/local/modules/PointRetrait/Loop/GeneralLoop.php index 296aa662..ef2a1d20 100644 --- a/local/modules/PointRetrait/Loop/GeneralLoop.php +++ b/local/modules/PointRetrait/Loop/GeneralLoop.php @@ -74,6 +74,7 @@ class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface return new ArgumentCollection( Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('active'), + Argument::createIntListTypeArgument('click_and_collect'), Argument::createEnumListTypeArgument('order', ['city', 'title'], 'title') ); @@ -93,6 +94,9 @@ class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface if (null != $active = $this->getActive()) { $places->filterByActive($active); } + if (null != $clickAndCollect = $this->getClickAndCollect()) { + $places->filterByClickAndCollect($clickAndCollect); + } foreach ($this->getOrder() as $order) { switch ($order) { diff --git a/local/modules/PointRetrait/templates/backOffice/default/places-list.html b/local/modules/PointRetrait/templates/backOffice/default/places-list.html index a4061315..c184c2f2 100644 --- a/local/modules/PointRetrait/templates/backOffice/default/places-list.html +++ b/local/modules/PointRetrait/templates/backOffice/default/places-list.html @@ -51,7 +51,7 @@ - {loop name="places" type="pdr_places"} + {loop name="places" type="pdr_places" click_and_collect=0} {$TITLE} diff --git a/local/modules/PointRetrait/templates/backOffice/default/scheduled-withdrawals.html b/local/modules/PointRetrait/templates/backOffice/default/scheduled-withdrawals.html index 695d32e4..7d4748a3 100644 --- a/local/modules/PointRetrait/templates/backOffice/default/scheduled-withdrawals.html +++ b/local/modules/PointRetrait/templates/backOffice/default/scheduled-withdrawals.html @@ -19,14 +19,13 @@
    - - + - {loop name="deliveries-loop" type="scheduled_deliveries" domicile_ou_retrait="retrait" only_future="true" order="date"} + {loop name="deliveries-loop" type="scheduled_deliveries" list_type="retrait" only_future="true" order="date"} {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'} @@ -41,20 +40,13 @@ {/if} {assign var=title value="{$DELTA} jour(s) de délai"} - {loop name="order-loop" type="order" id={$ORDER_ID} customer="*"} - {loop type="customer" name="customer-loop" current="false" id=$CUSTOMER} - {assign var=client value="$FIRSTNAME $LASTNAME"} - {/loop} - {/loop} - - - + - - + + {if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if} 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 e014f5e1..6d33cd71 100644 --- a/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html +++ b/local/modules/PointRetrait/templates/frontOffice/default/order-delivery-extra.html @@ -11,7 +11,7 @@ {form_field field='delivery-module'} {/form_field} @@ -25,7 +25,7 @@ {form name="thelia.order.delivery"}
      {intl l="Order number" d="pointretrait"} {intl l="Scheduled date" d="pointretrait"} {intl l="Delivery delay" d="pointretrait"}{intl l="Place" d="pointretrait"}{intl l="Place name" d="pointretrait"}
    {$alt}{$ORDER_ID}{$ORDER_ID} {format_date date=$START_DATE format="d/m/Y"} entre {format_date date=$START_DATE format="H\hi"} et {format_date date=$END_DATE format="H\hi"} {$DELTA} jour(s)Point de retrait{$alt}{$DELTA} jour(s){$PLACE}
    - {loop type="pdr_places" name="places-loop" active=true order="city"} + {loop type="pdr_places" name="places-loop" active=true click_and_collect=0 order="city"}
    {$ID}{$TITLE}
    @@ -65,7 +65,7 @@ - {loop type="pdr_places" name="places-loop" active=true order="city"} + {loop type="pdr_places" name="places-loop" active=true click_and_collect=0 order="city"} @@ -94,10 +94,6 @@ $('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')) { - - } });