From 57e69ddd2fbac3a0293a02b4abbab15e51fc8180 Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Thu, 11 Mar 2021 18:47:03 +0100 Subject: [PATCH] Quelques corrections + init du module ClickAndCollect --- .../ClickAndCollect/ClickAndCollect.php | 62 ++++++ .../modules/ClickAndCollect/Config/config.xml | 32 +++ .../modules/ClickAndCollect/Config/module.xml | 28 +++ .../ClickAndCollect/Config/routing.xml | 39 ++++ .../Controller/backOffice/ListController.php | 34 +++ .../Controller/backOffice/PlaceController.php | 127 ++++++++++++ .../backOffice/ScheduleController.php | 154 ++++++++++++++ .../ClickAndCollect/Hook/AdminHook.php | 82 ++++++++ .../modules/ClickAndCollect/Hook/CssHook.php | 17 ++ .../ClickAndCollect/Hook/EmailHook.php | 82 ++++++++ .../ClickAndCollect/Hook/FrontHook.php | 56 +++++ local/modules/ClickAndCollect/I18n/en_US.php | 4 + local/modules/ClickAndCollect/I18n/fr_FR.php | 11 + local/modules/ClickAndCollect/Readme.md | 55 +++++ local/modules/ClickAndCollect/composer.json | 12 ++ .../backOffice/default/assets/css/styles.css | 86 ++++++++ .../backOffice/default/assets/img/compass.svg | 1 + .../backOffice/default/assets/img/pin.svg | 16 ++ .../backOffice/default/cnc-places-list.html | 140 +++++++++++++ .../backOffice/default/delivery-address.html | 8 + .../backOffice/default/form/place-create.html | 102 +++++++++ .../default/form/place-schedule-create.html | 114 ++++++++++ .../backOffice/default/includes/main.html | 195 ++++++++++++++++++ .../backOffice/default/includes/schedule.html | 97 +++++++++ .../backOffice/default/js/main-js.html | 75 +++++++ .../backOffice/default/js/schedule-js.html | 41 ++++ .../backOffice/default/menu-hook.html | 3 + .../default/modal/schedule-modal.html | 59 ++++++ .../backOffice/default/place-edit.html | 82 ++++++++ .../default/scheduled-clickandcollect.html | 49 +++++ .../email/default/delivery-address-full.html | 18 ++ .../email/default/delivery-address.html | 6 + .../frontOffice/default/assets/css/styles.css | 65 ++++++ .../frontOffice/default/assets/img/pin.png | Bin 0 -> 9358 bytes .../frontOffice/default/delivery-address.html | 24 +++ .../default/order-delivery-extra.html | 163 +++++++++++++++ .../LivraisonParSecteurs/I18n/fr_FR.php | 7 +- .../default/scheduled-deliveries.html | 24 +-- .../default/order-delivery-extra.html | 2 +- .../Loop/ScheduledDeliveriesLoop.php | 63 +++++- local/modules/PointRetrait/Config/schema.xml | 1 + local/modules/PointRetrait/Config/thelia.sql | 1 + .../Controller/backOffice/ListController.php | 3 +- local/modules/PointRetrait/I18n/fr_FR.php | 7 +- .../modules/PointRetrait/Loop/GeneralLoop.php | 4 + .../backOffice/default/places-list.html | 2 +- .../default/scheduled-withdrawals.html | 18 +- .../default/order-delivery-extra.html | 10 +- 48 files changed, 2224 insertions(+), 57 deletions(-) create mode 100644 local/modules/ClickAndCollect/ClickAndCollect.php create mode 100644 local/modules/ClickAndCollect/Config/config.xml create mode 100644 local/modules/ClickAndCollect/Config/module.xml create mode 100644 local/modules/ClickAndCollect/Config/routing.xml create mode 100644 local/modules/ClickAndCollect/Controller/backOffice/ListController.php create mode 100644 local/modules/ClickAndCollect/Controller/backOffice/PlaceController.php create mode 100644 local/modules/ClickAndCollect/Controller/backOffice/ScheduleController.php create mode 100644 local/modules/ClickAndCollect/Hook/AdminHook.php create mode 100644 local/modules/ClickAndCollect/Hook/CssHook.php create mode 100644 local/modules/ClickAndCollect/Hook/EmailHook.php create mode 100644 local/modules/ClickAndCollect/Hook/FrontHook.php create mode 100644 local/modules/ClickAndCollect/I18n/en_US.php create mode 100644 local/modules/ClickAndCollect/I18n/fr_FR.php create mode 100644 local/modules/ClickAndCollect/Readme.md create mode 100644 local/modules/ClickAndCollect/composer.json create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/assets/css/styles.css create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/assets/img/compass.svg create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/assets/img/pin.svg create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/cnc-places-list.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/delivery-address.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/form/place-create.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/form/place-schedule-create.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/includes/main.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/includes/schedule.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/js/main-js.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/js/schedule-js.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/menu-hook.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/modal/schedule-modal.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/place-edit.html create mode 100644 local/modules/ClickAndCollect/templates/backOffice/default/scheduled-clickandcollect.html create mode 100644 local/modules/ClickAndCollect/templates/email/default/delivery-address-full.html create mode 100644 local/modules/ClickAndCollect/templates/email/default/delivery-address.html create mode 100644 local/modules/ClickAndCollect/templates/frontOffice/default/assets/css/styles.css create mode 100644 local/modules/ClickAndCollect/templates/frontOffice/default/assets/img/pin.png create mode 100644 local/modules/ClickAndCollect/templates/frontOffice/default/delivery-address.html create mode 100644 local/modules/ClickAndCollect/templates/frontOffice/default/order-delivery-extra.html 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 0000000000000000000000000000000000000000..752927440fb998b7d26920a4c1703766364a82c7 GIT binary patch literal 9358 zcmeHKcUaR|myU$qn}`S!0YSi!A}vTDNN<7=>7pS8Lkp15L8Pf5pfoAc1Sv|B4k}2~ z0TD!{Nbev`upnJFpfls_e*5jt^X&dN@C1JM-1ofa-1nYyf4SktXSLaw1(*Q<0GqCk zh6(jQYVX5HPyPFl=r#fXus-%hTTo0eULaR@5`pN12T^=n@gTf6kpKXA4-_Rk#x6W& z3*99jw4@mYB{tii_q;tl3q01jS3=;ff`XJ>2tu6lyoXRM|?m;x>gZdmBnj%cX{rkqA3yzHNB zI@{X3VL5aBDbJR>ZGt%rw+u)lUSE28t)LUw?)k>BZ^(1O>G}}^*yeOt(Hb!Gs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*DHNVF&(boB-Wf&_lDlW%}qDzd7{FHgFyhd=c zoqo*D^1dDRJ%Ha;y$~6YxgD^r7zDGSe;&rEzH1Zhc~cd&`N$zoNc)%#4I}oriY6Vt zz4os38ztmfTep!5jqL5`Rs^EJ!^LxBerDQd7^~`060s# zvbxCiJ{MyuIW3Rs=rP&73m;VSqbqx?2sp$h1prx70+Vlo-uzHQ57fpAe>Xt%ZUTVFmh1i$nV#C~JHqTr}@BSB7S@Yjv z)l#xeV-g+I1q@crN^|*tQ28{+;4<<}pc23v*;bbsQTU~6)^euf=6Gb!vBI_@hVRhe zgPnQEr+lO7Dn1?5b2#s}?b_&w4E@(Uo2Dn1QKI*-kLS>T9MHQK+C|l0Q<LI@mQi&bs~l1H*>?fOA-H#8ta@eCbOE}WXEln?TnhdVWsHg@ literal 0 HcmV?d00001 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')) { - - } });