Quelques corrections + init du module ClickAndCollect
This commit is contained in:
62
local/modules/ClickAndCollect/ClickAndCollect.php
Normal file
62
local/modules/ClickAndCollect/ClickAndCollect.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect;
|
||||
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use PointRetrait\Model\PdrScheduleQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\OrderPostage;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
class ClickAndCollect extends AbstractDeliveryModule
|
||||
{
|
||||
/** @var string */
|
||||
const DOMAIN_NAME = 'clickandcollect';
|
||||
const MODULE_URL = '/admin/module/ClickAndCollect';
|
||||
|
||||
|
||||
/**
|
||||
* This method is called by the Delivery loop, to check if the current module has to be displayed to the customer.
|
||||
* Override it to implements your delivery rules/
|
||||
*
|
||||
* If you return true, the delivery method will de displayed to the customer
|
||||
* If you return false, the delivery method will not be displayed
|
||||
*
|
||||
* @param Country $country the country to deliver to.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidDelivery(Country $country)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate and return delivery price in the shop's default currency
|
||||
*
|
||||
* @param Country $country the country to deliver to.
|
||||
*
|
||||
* @return OrderPostage|float the delivery price
|
||||
* @throws DeliveryException if the postage price cannot be calculated.
|
||||
*/
|
||||
public function getPostage(Country $country)
|
||||
{
|
||||
if (! $this->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;
|
||||
}
|
||||
|
||||
}
|
||||
32
local/modules/ClickAndCollect/Config/config.xml
Normal file
32
local/modules/ClickAndCollect/Config/config.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<hooks>
|
||||
<!-- Global hook class -->
|
||||
<hook id="cnc.css.hook" class="ClickAndCollect\Hook\CssHook">
|
||||
<tag name="hook.event_listener" event="main.head-css" type="back" method="onAddCss"/>
|
||||
<tag name="hook.event_listener" event="main.stylesheet" type="front" method="onAddCss"/>
|
||||
</hook>
|
||||
|
||||
<hook id="cnc.admin.hook" class="ClickAndCollect\Hook\AdminHook">
|
||||
<tag name="hook.event_listener" event="home.block" type="back" method="displayScheduledWithdrawals" />
|
||||
<tag name="hook.event_listener" event="main.in-top-menu-items" type="back" method="onMainTopMenuTools" />
|
||||
<tag name="hook.event_listener" event="order-edit.bill-delivery-address" type="back" method="displayDeliveryDate" />
|
||||
<argument type="service" id="thelia.securityContext"/>
|
||||
</hook>
|
||||
|
||||
<hook id="cnc.front.hook" class="ClickAndCollect\Hook\FrontHook">
|
||||
<tag name="hook.event_listener" event="order-delivery.extra" type="front" method="onOrderDeliveryExtra" />
|
||||
<tag name="hook.event_listener" event="order-invoice.delivery-address" type="front" method="displayWithdrawalDate" />
|
||||
</hook>
|
||||
|
||||
<hook id="cnc.email.hookmanager" class="ClickAndCollect\Hook\EmailHook">
|
||||
<tag name="hook.event_listener" event="email-html.order-confirmation.delivery-address" type="email" method="displayDeliveryDateWithinEmail" />
|
||||
<tag name="hook.event_listener" event="email-html.order-notification.before-products" type="email" method="displayCompleteInformationWithinEmail" />
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
</config>
|
||||
28
local/modules/ClickAndCollect/Config/module.xml
Normal file
28
local/modules/ClickAndCollect/Config/module.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
|
||||
<fullnamespace>ClickAndCollect\ClickAndCollect</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Click and Collect</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Click and Collect</title>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.0.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Laurent LE CORRE</name>
|
||||
<email>laurent@thecoredev.fr</email>
|
||||
</author>
|
||||
</authors>
|
||||
<type>delivery</type>
|
||||
<thelia>2.3.x</thelia>
|
||||
<stability>beta</stability>
|
||||
<mandatory>0</mandatory>
|
||||
<hidden>0</hidden>
|
||||
</module>
|
||||
39
local/modules/ClickAndCollect/Config/routing.xml
Normal file
39
local/modules/ClickAndCollect/Config/routing.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="cnc.places.list" path="/admin/module/ClickAndCollect" methods="get">
|
||||
<default key="_controller">ClickAndCollect\Controller\backOffice\ListController::viewAction</default>
|
||||
</route>
|
||||
<!-- <route id="cnc.toggle.active" path="/admin/module/ClickAndCollect/toggle-online/{id}" methods="post">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\ListController::toggleActive</default>-->
|
||||
<!-- <requirement key="id">\d+</requirement>-->
|
||||
<!-- </route>-->
|
||||
|
||||
<!-- <route id="cnc.place.create" path="/admin/module/ClickAndCollect" methods="post">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\PlaceController::createPlace</default>-->
|
||||
<!-- </route>-->
|
||||
<!-- <route id="cnc.place.view" path="/admin/module/ClickAndCollect/edit" methods="get">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\PlaceController::viewPlace</default>-->
|
||||
<!-- </route>-->
|
||||
<!-- <route id="cnc.place.edit" path="/admin/module/ClickAndCollect/edit" methods="post">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\PlaceController::editPlace</default>-->
|
||||
<!-- </route>-->
|
||||
|
||||
<!-- <route id="cnc.place.delete" path="/admin/module/ClickAndCollect/delete" methods="post">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\PlaceController::deletePlace</default>-->
|
||||
<!-- </route>-->
|
||||
|
||||
<!-- <route id="cnc.schedule.create" path="admin/module/ClickAndCollect/schedule/create" methods="post">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\ScheduleController::createSchedule</default>-->
|
||||
<!-- </route>-->
|
||||
<!-- <route id="cnc.schedule.update" path="admin/module/ClickAndCollect/schedule/update" methods="post">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\ScheduleController::updateSchedule</default>-->
|
||||
<!-- </route>-->
|
||||
<!-- <route id="cnc.schedule.delete" path="/admin/module/ClickAndCollect/schedule/delete" methods="post">-->
|
||||
<!-- <default key="_controller">ClickAndCollect\Controller\backOffice\ScheduleController::deleteSchedule</default>-->
|
||||
<!-- </route>-->
|
||||
|
||||
</routes>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Controller\backOffice;
|
||||
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
|
||||
/**
|
||||
* Class ListController
|
||||
* @package ClickAndCollect\Controller
|
||||
*/
|
||||
class ListController extends BaseAdminController
|
||||
{
|
||||
public function viewAction($params = [])
|
||||
{
|
||||
return $this->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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Controller\backOffice;
|
||||
|
||||
use PointRetrait\Model\PdrPlaces;
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use PointRetrait\PointRetrait;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Propel;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class PlaceController
|
||||
* @package PointRetrait\Controller
|
||||
*/
|
||||
class PlaceController extends BaseAdminController
|
||||
{
|
||||
|
||||
public function viewPlace()
|
||||
{
|
||||
$selectedPlace = PdrPlacesQuery::create()->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")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Controller\backOffice;
|
||||
|
||||
use LivraisonParSecteurs\LivraisonParSecteurs;
|
||||
use LivraisonParSecteurs\Model\LpsAreaSchedule;
|
||||
use LivraisonParSecteurs\Model\LpsAreaScheduleQuery;
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use PointRetrait\Model\PdrSchedule;
|
||||
use PointRetrait\Model\PdrScheduleQuery;
|
||||
use PointRetrait\PointRetrait;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Propel;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class ScheduleController
|
||||
* @package PointRetrait\Controller
|
||||
*/
|
||||
class ScheduleController extends BaseAdminController
|
||||
{
|
||||
|
||||
/*
|
||||
* Delete a day in a place's withdrawal schedule
|
||||
*/
|
||||
public function deleteSchedule()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
82
local/modules/ClickAndCollect/Hook/AdminHook.php
Normal file
82
local/modules/ClickAndCollect/Hook/AdminHook.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Hook;
|
||||
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
|
||||
/**
|
||||
* Class AdminHook
|
||||
*/
|
||||
class AdminHook extends BaseHook
|
||||
{
|
||||
protected $securityContext;
|
||||
|
||||
public function __construct(SecurityContext $securityContext)
|
||||
{
|
||||
$this->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
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
local/modules/ClickAndCollect/Hook/CssHook.php
Normal file
17
local/modules/ClickAndCollect/Hook/CssHook.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
/**
|
||||
* Class CssHook
|
||||
*/
|
||||
class CssHook extends BaseHook
|
||||
{
|
||||
public function onAddCss(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->addCSS('assets/css/styles.css'));
|
||||
}
|
||||
}
|
||||
82
local/modules/ClickAndCollect/Hook/EmailHook.php
Normal file
82
local/modules/ClickAndCollect/Hook/EmailHook.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Hook;
|
||||
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
|
||||
class EmailHook extends BaseHook
|
||||
{
|
||||
public function displayDeliveryDateWithinEmail(HookRenderEvent $event)
|
||||
{
|
||||
|
||||
$moduleId = $event->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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
56
local/modules/ClickAndCollect/Hook/FrontHook.php
Normal file
56
local/modules/ClickAndCollect/Hook/FrontHook.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Hook;
|
||||
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
|
||||
class FrontHook extends BaseHook
|
||||
{
|
||||
|
||||
public function onOrderDeliveryExtra(HookRenderEvent $event)
|
||||
{
|
||||
$event->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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
4
local/modules/ClickAndCollect/I18n/en_US.php
Normal file
4
local/modules/ClickAndCollect/I18n/en_US.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return array(
|
||||
// 'an english string' => 'The displayed english string',
|
||||
);
|
||||
11
local/modules/ClickAndCollect/I18n/fr_FR.php
Normal file
11
local/modules/ClickAndCollect/I18n/fr_FR.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
return array(
|
||||
'Delay' => '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',
|
||||
'' => '',
|
||||
);
|
||||
55
local/modules/ClickAndCollect/Readme.md
Normal file
55
local/modules/ClickAndCollect/Readme.md
Normal file
@@ -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 ```<thelia_root>/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.
|
||||
12
local/modules/ClickAndCollect/composer.json
Normal file
12
local/modules/ClickAndCollect/composer.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><title>Compass</title><path d='M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z' fill='none' stroke='currentColor' stroke-miterlimit='10' stroke-width='32'/><path d='M350.67 150.93l-117.2 46.88a64 64 0 00-35.66 35.66l-46.88 117.2a8 8 0 0010.4 10.4l117.2-46.88a64 64 0 0035.66-35.66l46.88-117.2a8 8 0 00-10.4-10.4zM256 280a24 24 0 1124-24 24 24 0 01-24 24z'/></svg>
|
||||
|
After Width: | Height: | Size: 468 B |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 117 KiB |
@@ -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"}
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{if $general_error}
|
||||
<div class="alert alert-danger">
|
||||
{$general_error}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed" id="areas-table">
|
||||
<caption class="clearfix">
|
||||
{intl l='My deposit places' d='clickandcollect'}
|
||||
</caption>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Place name" d='clickandcollect'}</th>
|
||||
<th class="col-md-1">{intl l="Active" d='clickandcollect'}</th>
|
||||
<th>{intl l="Address" d='clickandcollect'}</th>
|
||||
<th>{intl l="Opening hours" d='clickandcollect'}</th>
|
||||
<th>{intl l="Additional cost" d='clickandcollect'}</th>
|
||||
<th>{intl l="Minimum amount" d='clickandcollect'}</th>
|
||||
<th class="col-md-1"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<caption class="clearfix">
|
||||
{loop name="auth-create" type="auth" role="ADMIN" resource="admin.pdr.main" access="CREATE" module="ClickAndCollect"}
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-default btn-primary"
|
||||
title="{intl l='Add a new place' d='clickandcollect'}"
|
||||
data-target="#place-create-modal" data-toggle="modal">
|
||||
<i class="glyphicon glyphicon-plus-sign"></i>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
</caption>
|
||||
|
||||
<tbody>
|
||||
{loop name="places" type="pdr_places"}
|
||||
<tr>
|
||||
<td><a href="{url path="/admin/module/ClickAndCollect/edit?place_id=$ID"}">{$TITLE}</a></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small toggle-visible" data-id="{$ID}" data-on="success"
|
||||
data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>"
|
||||
data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="link" {if $ACTIVE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
</td>
|
||||
<td>{$ADDRESS1}<br>{$ZIPCODE} {$CITY}{if $LATITUDE eq '' or $LONGITUDE eq ''}<img src="{image file='assets/img/pin.svg' source='PointRetrait'}" title="Pas de coordonnées pour ce point de retrait" alt="Pas de coordonnées" class="pin-pdr" />{/if}</td>
|
||||
<td>{$DELIVERY_DAYS}{if $DELIVERY_DAYS eq ''}<i>{intl l="There is no schedule for this place" d='clickandcollect'}</i>{/if}</td>
|
||||
<td>{$PRICE} €</td>
|
||||
<td>{$MINIMUM_AMOUNT} €</td>
|
||||
<td class="actions">
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-info btn-responsive" title="{intl l='Edit this place'}" href="{url path="/admin/module/ClickAndCollect/edit?place_id=$ID"}">
|
||||
<i class="glyphicon glyphicon-edit"></i>
|
||||
</a>
|
||||
<a class="btn btn-danger btn-responsive place-delete" title="{intl l='Delete this place'}" data-target="#place-delete" data-toggle="modal" data-id="{$ID}">
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* 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"}
|
||||
<input type="hidden" name="attr-place-id" id="attr-place-id" value="999"/>
|
||||
<input type="hidden" name="success_url" value="{url path='/admin/module/ClickAndCollect'}"/>
|
||||
{/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'}
|
||||
<script src="{$asset_url}"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$('a.place-delete').click(function(ev) {
|
||||
$('#attr-place-id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
$(".toggle-visible").on('switch-change', function (event, data) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "{url path='admin/module/ClickAndCollect/toggle-online/'}" + $(this).data('id')
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/javascripts}
|
||||
{/block}
|
||||
@@ -0,0 +1,8 @@
|
||||
<tr><td> </td></tr>
|
||||
|
||||
<tr style="background-color:#1A712C; color:white">
|
||||
<th>{intl l="Scheduled date" d="pointretrait"}</th>
|
||||
<td>{$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"}</td>
|
||||
</tr>
|
||||
|
||||
<tr><td> </td></tr>
|
||||
@@ -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"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
{form_error form=$form field="title"}{$message}{/form_error}
|
||||
<input type="text" class="form-control" name="{$name}" id="{$label_attr.for}" {if $required}required{/if} />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="price"}
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" {if $required}required{/if} /> €
|
||||
</div>
|
||||
{form_error form=$form field="price"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="minimum_amount"}
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" {if $required}required{/if} /> €
|
||||
</div>
|
||||
{form_error form=$form field="minimum_amount"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="address1"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="100" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="address1"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="address2"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="100" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="address2"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="zipcode"}
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="10" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="zipcode"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="city"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="100" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="city"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="active"}
|
||||
<input type="hidden" id="{$label_attr.for}" name="{$name}" value="1"/>
|
||||
{/form_field}
|
||||
|
||||
{/form}
|
||||
@@ -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"}
|
||||
<div class="form-group hidden">
|
||||
<input type="text" class="form-control" name="{$name}" id="{$label_attr.for}" value="{$place_id}"/>
|
||||
</div>
|
||||
{/form_field}
|
||||
{if {$update|default:false} == true}
|
||||
{form_field form=$form field="place-schedule_id"}
|
||||
<div class="form-group hidden">
|
||||
<input type="text" class="form-control" name="{$name}" id="{$label_attr.for}" value=""/>
|
||||
</div>
|
||||
{/form_field}
|
||||
{/if}
|
||||
|
||||
{form_field form=$form field="day"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
{form_error form=$form field="day"}{$message}{/form_error}
|
||||
|
||||
<select class="form-control" name="{$name}" id="{$label_attr.for}">
|
||||
{if {$update|default:false} == true}
|
||||
<option value="" selected></option>
|
||||
{/if}
|
||||
{foreach $choices as $choice}
|
||||
<option value="{$choice->value}" {if $DAY == $choice->value}selected{/if} >{$choice->label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
|
||||
{if {$update|default:false} == false}
|
||||
<!-- Mode Création d'un nouveau créneau /-->
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{form_field form=$form field="begin_time"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d='pointretrait'}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
{form_error form=$form field="begin_time"}{$message}{/form_error}
|
||||
<div class='input-group time' id="{$label_attr.for}">
|
||||
<input type='text' class="form-control" name="{$name}" value="{$BEGIN|default:"14:00"}"/>
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-time"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field="end_time"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d='pointretrait'}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
{form_error form=$form field="end_time"}{$message}{/form_error}
|
||||
<div class='input-group time' id="{$label_attr.for}">
|
||||
<input type='text' class="form-control" name="{$name}" value="{$END|default:"16:00"}"/>
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-time"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<!-- Mode Modification d'un créneau existant /-->
|
||||
{form_field form=$form field="begin_time"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d='pointretrait'}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
{form_error form=$form field="begin_time"}{$message}{/form_error}
|
||||
<div class='input-group time' id="{$label_attr.for}">
|
||||
<input type='text' class="form-control" name="{$name}" value="{$BEGIN}"/>
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-time"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field="end_time"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d='pointretrait'}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
{form_error form=$form field="end_time"}{$message}{/form_error}
|
||||
<div class='input-group time' id="{$label_attr.for}">
|
||||
<input type='text' class="form-control" name="{$name}" value="{$END}"/>
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-time"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
{/if}
|
||||
|
||||
{/form}
|
||||
@@ -0,0 +1,195 @@
|
||||
{form name='pdr.place.view.main'}
|
||||
<div class="form-container">
|
||||
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
|
||||
{loop name="places" type="pdr_places" id="$place_id"}
|
||||
<form action="{url path='/admin/module/PointRetrait/edit' place_id=$place_id}" method="POST" class="clearfix" {form_enctype form=$form}>
|
||||
{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"}
|
||||
<input type="hidden" name="{$name}" value="{$place_id}"/>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-inline">
|
||||
{form_field form=$form field="title"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d='pointretrait'}
|
||||
</label>
|
||||
<input type="text" id="{$label_attr.for}" class="form-control large" name="{$name}" value="{$TITLE}" {if $required}required{/if} /> 
|
||||
</div>
|
||||
{form_error form=$form field="title"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{form_field form=$form field="active"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
</label>
|
||||
|
||||
<div class="make-switch switch-small toggle-active" data-id="{$ID}" data-on="success"
|
||||
data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>"
|
||||
data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="link" {if $ACTIVE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
<input type="hidden" id="{$label_attr.for}" name="{$name}" value="{$ACTIVE}"/>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{form_field form=$form field="price"}
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="{$PRICE}" {if $required}required{/if} /> €
|
||||
</div>
|
||||
{form_error form=$form field="price"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{form_field form=$form field="minimum_amount"}
|
||||
<div class="form-group form-inline">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="{$MINIMUM_AMOUNT}" {if $required}required{/if} /> €
|
||||
</div>
|
||||
{form_error form=$form field="minimum_amount"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
{form_field form=$form field="address1"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ADDRESS1}" maxlength="100" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="address1"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
{form_field form=$form field="address2"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ADDRESS2}" maxlength="100" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="address2"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
{form_field form=$form field="zipcode"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ZIPCODE}" maxlength="10" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="zipcode"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{form_field form=$form field="city"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$CITY}" maxlength="100" {if $required}required{/if} />
|
||||
</div>
|
||||
</div>
|
||||
{form_error form=$form field="city"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{form_field form=$form field="access_comment"}
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
{intl l=$label d="pointretrait"}
|
||||
{if $required}<span class="required">*</span>{/if}
|
||||
</label>
|
||||
|
||||
<div class="control-input">
|
||||
<textarea id="{$label_attr.for}" name="{$name}" maxlength="400" class="form-control">{if $form_error}{$value}{/if}{$ACCESS_COMMENT}</textarea>
|
||||
</div>
|
||||
<span class="help-block">{intl l="Access comment help" d="pointretrait"}</span>
|
||||
</div>
|
||||
{form_error form=$form field="access_comment"}{$message}{/form_error}
|
||||
{/form_field}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="bouton-geoloc">
|
||||
<img src="{image file='assets/img/compass.svg' source='PointRetrait'}" alt="Geolocate" id="submit-geoloc"/>
|
||||
<span>{intl l="Recenter map" d="pointretrait"}</span>
|
||||
</div>
|
||||
{form_field form=$form field="latitude"}
|
||||
<input type="hidden" value="{$LATITUDE}" id="{$label_attr.for}" name="{$name}">
|
||||
{/form_field}
|
||||
{form_field form=$form field="longitude"}
|
||||
<input type="hidden" value="{$LONGITUDE}" id="{$label_attr.for}" name="{$name}">
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}&callback=initMap&libraries=&v=weekly" async></script>
|
||||
<div id="map" class="locationMap"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/loop}
|
||||
</div>
|
||||
{/form}
|
||||
@@ -0,0 +1,97 @@
|
||||
{form name='pdr.place.view.schedule'}
|
||||
<div class="form-container">
|
||||
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
|
||||
<form action="{url path="/admin/module/PointRetrait/edit?place_id={$place_id}"}" method="POST" class="clearfix" {form_enctype form=$form}>
|
||||
{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"}
|
||||
<input type="hidden" name="{$name}" value="{$place_id}"/>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<table class="table table-striped table-condensed">
|
||||
|
||||
<caption class="clearfix">
|
||||
{loop name="auth-create" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="CREATE" module="ClickAndCollect"}
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-default btn-primary place-schedule-create"
|
||||
title="{intl l='Add a new withdrawal day' d='pointretrait'}"
|
||||
data-target="#place-schedule-create" data-toggle="modal">
|
||||
<i class="glyphicon glyphicon-plus-sign"></i>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
</caption>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Withdrawal day" d="pointretrait"}</th>
|
||||
<th>{intl l="Withdrawal beginning time" d="pointretrait"}</th>
|
||||
<th>{intl l="Withdrawal ending time" d="pointretrait"}</th>
|
||||
<th>{intl l="Actions" d="pointretrait"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="place-schedule-loop" type="pdr_schedule" place_id=$place_id}
|
||||
<tr>
|
||||
<td>{$DAY_LABEL}</td>
|
||||
<td>{format_date date=$BEGIN format="H\hi"}</td>
|
||||
<td>{format_date date=$END format="H\hi"}</td>
|
||||
{* Actions *}
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
{loop name="auth-edit" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="UPDATE" module="ClickAndCollect"}
|
||||
<a class="btn btn-info btn-responsive place-schedule-update-default"
|
||||
title="{intl l='Edit this withdrawal day' d='pointretrait'}"
|
||||
data-target="#place-schedule-update" data-toggle="modal" data-id="{$ID}"
|
||||
data-day="{$DAY}"
|
||||
data-begin="{format_date date=$BEGIN format='H:i'}"
|
||||
data-end="{format_date date=$END format='H:i'}">
|
||||
<i class="glyphicon glyphicon-edit"></i>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop name="auth-delete" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="DELETE" module="ClickAndCollect"}
|
||||
<a class="btn btn-danger btn-responsive place-schedule-delete"
|
||||
title="{intl l='Delete this withdrawal day' d='pointretrait'}"
|
||||
data-target="#place-schedule-delete" data-toggle="modal" data-id="{$ID}">
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
<input type="hidden" name="{$name}" value="{$ID}"/>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{elseloop rel="place-schedule-loop"}
|
||||
<tr>
|
||||
<td colspan="1000">
|
||||
<div class="alert alert-info">
|
||||
{intl l="There is no schedule for this place" d="pointretrait"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{/form}
|
||||
@@ -0,0 +1,75 @@
|
||||
<script>
|
||||
|
||||
let map;
|
||||
let marker;
|
||||
|
||||
|
||||
function initMap() {
|
||||
var opt = {
|
||||
center: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
|
||||
zoom: 15,
|
||||
streetViewControl: true,
|
||||
mapTypeControl: false
|
||||
};
|
||||
|
||||
map = new google.maps.Map(document.getElementById("map"), opt);
|
||||
var markerOpts = {
|
||||
title: $(document.getElementById("title")).val(),
|
||||
position: opt.center,
|
||||
draggable: true,
|
||||
map: map
|
||||
};
|
||||
|
||||
displayPlace();
|
||||
addListener();
|
||||
|
||||
const geocoder = new google.maps.Geocoder();
|
||||
document.getElementById("submit-geoloc").addEventListener("click", () => {
|
||||
geocodeAddress(geocoder, map);
|
||||
});
|
||||
}
|
||||
|
||||
function displayPlace() {
|
||||
marker = new google.maps.Marker({
|
||||
position: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
|
||||
map: map,
|
||||
draggable: true,
|
||||
title: $(document.getElementById("title")).val()
|
||||
});
|
||||
}
|
||||
|
||||
function clearMarkers(map) {
|
||||
marker.setMap(map);
|
||||
marker = "";
|
||||
}
|
||||
|
||||
function geocodeAddress(geocoder, resultsMap) {
|
||||
const address = document.getElementById("address1").value + ', ' + document.getElementById("zipcode").value + ' ' + document.getElementById("city").value;
|
||||
geocoder.geocode({ address: address }, (results, status) => {
|
||||
if (status === "OK") {
|
||||
|
||||
clearMarkers(null);
|
||||
|
||||
resultsMap.setCenter(results[0].geometry.location);
|
||||
marker = new google.maps.Marker({
|
||||
map: resultsMap,
|
||||
position: results[0].geometry.location,
|
||||
draggable: true
|
||||
});
|
||||
$("#latitude").val(results[0].geometry.location.lat);
|
||||
$("#longitude").val(results[0].geometry.location.lng);
|
||||
addListener();
|
||||
} else {
|
||||
alert("Geocode was not successful for the following reason: " + status);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addListener() {
|
||||
google.maps.event.addListener(marker, 'dragend', function(evt) {
|
||||
$("#latitude").val(evt.latLng.lat());
|
||||
$("#longitude").val(evt.latLng.lng());
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
$('a.place-schedule-delete').click(function (ev) {
|
||||
$('#attr-place-schedule-id-delete').val($(this).data('id'));
|
||||
$("#attr-place-schedule-begin input, #attr-place-schedule-end input").prop('required', false);
|
||||
$("#attr-place-schedule-day").prop('required', false);
|
||||
});
|
||||
|
||||
$('a.place-schedule-update-default').click(function (ev) {
|
||||
$("#attr-place-schedule-id-update").val($(this).data('id'));
|
||||
$("#attr-place-schedule-id").val($(this).data('id'));
|
||||
$("#attr-place-schedule-begin input", "#place-schedule-update").val($(this).data('begin'));
|
||||
$("#attr-place-schedule-end input", "#place-schedule-update").val($(this).data('end'));
|
||||
$('#attr-place-schedule-day option[value="' + $(this).data('day') + '"]', '#place-schedule-update').prop('selected', true);
|
||||
$("#attr-place-schedule-day").prop('required', true);
|
||||
});
|
||||
|
||||
$('a.place-schedule-create').click(function (ev) {
|
||||
$('#attr-place-id').val($(this).data('id'));
|
||||
$("#attr-place-schedule-begin input, #attr-place-schedule-end input").prop('required', true);
|
||||
$("#attr-place-schedule-day").prop('required', true);
|
||||
});
|
||||
|
||||
|
||||
{$langcode = {lang attr="code"}|substr:0:2}
|
||||
$(document).ready(function () {
|
||||
$('.input-group.time').datetimepicker({
|
||||
locale: "{$langcode}",
|
||||
format: 'HH:mm',
|
||||
stepping: 15
|
||||
});
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('.input-group.date').datetimepicker({
|
||||
locale: "{$langcode}",
|
||||
format: 'YYYY-MM-DD'
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<li class="{if $admin_current_location == 'clickandcollect'}active{/if}" id="clickandcollect">
|
||||
<a title="{intl l='Module name' d='clickandcollect'}" href="{url path='/admin/module/ClickAndCollect'}" ><span class="glyphicon glyphicon-pushpin"></span> {intl l='Module name' d='clickandcollect'}</a>
|
||||
</li>
|
||||
@@ -0,0 +1,59 @@
|
||||
{* DELETE modal *}
|
||||
{capture "schedule_delete"}
|
||||
{intl l="Do you really want to remove this schedule entry ?" d="pointretrait"}
|
||||
<input type="hidden" name="schedule_id" id="attr-place-schedule-id-delete" value=""/>
|
||||
<input type="hidden" name="place_id" value="{$smarty.get.place_id}"/>
|
||||
<input type="hidden" name="success_url" value="{url path="/admin/module/PointRetrait/edit?area_id={$area_id}#schedule"}"/>
|
||||
{/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"}
|
||||
<input type="hidden" name="schedule_id" id="attr-place-schedule-id-update" value=""/>
|
||||
{/form_field}
|
||||
{form_field form=$form field="place_id"}
|
||||
<input type="hidden" name="place_id" id="place_id" value="{$smarty.get.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}
|
||||
@@ -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"}
|
||||
<link rel="stylesheet"
|
||||
href="{stylesheet file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css'}">
|
||||
{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
{assign "place_id" $smarty.get.place_id}
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="title title-without-tabs">
|
||||
{intl l="Edit a place" d="pointretrait"} : <b>{loop name="places" type="pdr_places" id={$place_id}}{$TITLE}{/loop}</b>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs" id="tabbed-menu">
|
||||
{loop name="auth-general" type="auth" role="ADMIN" resource="admin" access="VIEW" module="ClickAndCollect"}
|
||||
<li class="active"><a href="#main" data-toggle="tab">{intl l="Main" d="pointretrait"}</a></li>
|
||||
{/loop}
|
||||
{loop name="auth-schedule" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="ClickAndCollect"}
|
||||
<li><a href="#schedule" data-toggle="tab">{intl l="Schedule" d="pointretrait"}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
{loop name="auth-general-tab" type="auth" role="ADMIN" resource="admin" access="VIEW" module="ClickAndCollect"}
|
||||
<div class="tab-pane fade in active" id="main">
|
||||
{include file="includes/main.html"}
|
||||
</div>
|
||||
{/loop}
|
||||
{loop name="auth-schedule-tab" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="ClickAndCollect"}
|
||||
<div class="tab-pane fade" id="schedule">
|
||||
{include file="includes/schedule.html"}
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="message-pas-de-coordonnees" value="{intl l='Message no location' d='pointretrait'}" />
|
||||
</div>
|
||||
|
||||
{include file="modal/schedule-modal.html"}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/moment-with-locales.min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$(".toggle-active").on('switch-change', function (event, data) {
|
||||
$("#active").val(data['value'] ? 1 : 0);
|
||||
});
|
||||
|
||||
var hash = location.hash.slice(1);
|
||||
if (!hash) hash = "main";
|
||||
$('#tabbed-menu a[href="#' + hash + '"]').tab('show');
|
||||
|
||||
if ($("#latitude").val() == '')
|
||||
alert ($('#message-pas-de-coordonnees').val());
|
||||
|
||||
});
|
||||
</script>
|
||||
{/javascripts}
|
||||
{include file="js/main-js.html"}
|
||||
{include file="js/schedule-js.html"}
|
||||
{/block}
|
||||
@@ -0,0 +1,49 @@
|
||||
<div class="scheduled-withdrawal-list">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>{intl l="Order number" d="clickandcollect"}</th>
|
||||
<th>{intl l="Scheduled date" d="clickandcollect"}</th>
|
||||
<th>{intl l="Delay" d="clickandcollect"}</th>
|
||||
<th>{intl l="Place name" d="clickandcollect"}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{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"}
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center"><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$CUSTOMER}">{$ORDER_ID}</a></td>
|
||||
<td>
|
||||
{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"}
|
||||
</td>
|
||||
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-right: 10px; width:25px">{$DELTA} jour(s)</td>
|
||||
<td>{$PLACE}</td>
|
||||
</tr>
|
||||
{if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if}
|
||||
|
||||
{/loop}
|
||||
{elseloop rel="deliveries-loop"}
|
||||
<tr>
|
||||
<td colspan="1000">
|
||||
<div class="alert alert-info">
|
||||
{intl l="There is no order to deliver" d="clickandcollect"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
<span class="nb-commandes">Total : <b>{$nbCommandes}</b> commande(s)</span>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<div class="panel panel-default col-md-12">
|
||||
<div class="panel-heading"><strong>{intl l="Scheduled date" d="clickandcollect"}</strong></div>
|
||||
<div class="panel-body">
|
||||
<span>{$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default col-md-12">
|
||||
<div class="panel-heading"><strong>{intl l="Place name" d="clickandcollect"}</strong></div>
|
||||
<div class="panel-body">
|
||||
<span>{format_address organization="{$placeName}"
|
||||
address_line1="{$address1}"
|
||||
postal_code="{$zipcode}"
|
||||
locality="{$city}"
|
||||
locale=$locale}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="panel panel-default col-sm-6">
|
||||
<div class="panel-heading">{intl l="Scheduled date" d="clickandcollect"}</div>
|
||||
<div class="panel-body">
|
||||
<span>{$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@@ -0,0 +1,24 @@
|
||||
{strip}
|
||||
|
||||
<div class="panel panel-default col-sm-6">
|
||||
{loop type="pdr_places" name="place-loop" id={$place_id}}
|
||||
<div class="panel-heading">{intl l="Order to withdraw" d="pointretrait"}</div>
|
||||
<div class="panel-body">
|
||||
<span class="org"><strong>{$TITLE}</strong></span>
|
||||
<address class="adr">
|
||||
<span class="street-address">{$ADDRESS1}</span><br>
|
||||
{if $ADDRESS2 != ""}
|
||||
<span class="street-address">{$ADDRESS2}</span><br>
|
||||
{/if}
|
||||
<span class="locality">{$ZIPCODE} {$CITY}</span>
|
||||
</address>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
<div class="panel-heading">{intl l="Scheduled date" d="clickandcollect"}</div>
|
||||
<div class="panel-body">
|
||||
<span>{$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/strip}
|
||||
@@ -0,0 +1,163 @@
|
||||
<script type="text/html" id="pdr_ui">
|
||||
|
||||
{loop type="pdr_places" name="places-first-loop"}
|
||||
{assign var=module_id value=$MODULE_ID}
|
||||
{/loop}
|
||||
<td colspan="3">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
{form name="thelia.order.delivery"}
|
||||
{form_field field='delivery-module'}
|
||||
<label for="delivery-method_{$module_id}">
|
||||
<input type="radio" delivery-mode="cnc" name="{$name}" id="delivery-method_{$module_id}" value="{$module_id}">
|
||||
<strong>{intl l="Module name - customer" d="clickandcollect"}</strong>
|
||||
<br>
|
||||
</label>
|
||||
{/form_field}
|
||||
{/form}
|
||||
</div>
|
||||
<div class="col-sm-4"> </div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="select-cnc">
|
||||
<div class="col-md-5">
|
||||
{form name="thelia.order.delivery"}
|
||||
<div class="table-responsive" style="border: 0px solid gray">
|
||||
<table class="table table-condensed table-main">
|
||||
{loop type="pdr_places" name="places-loop" active=true click_and_collect=1 order="city"}
|
||||
<tr class="ligne-pdr">
|
||||
<td>
|
||||
<div class="titre-pdr"><img src="{image file='assets/img/pin.png' source='ClickAndCollect'}" class="img-pin"><span class="pin-number">{$ID}</span>{$TITLE}</div>
|
||||
<span class="adresse">{$ADDRESS1}</span><br>
|
||||
<span class="adresse">{$ZIPCODE} {$CITY}</span><br>
|
||||
{if {cart attr='total_taxed_price_without_discount'} < $MINIMUM_AMOUNT}
|
||||
<div class="row">
|
||||
<div class="alert alert-info" style="width:95%; margin:5px">{intl l="Message info minimum de commande" d="clickandcollect" minimum=$MINIMUM_AMOUNT}</div>
|
||||
</div>
|
||||
{else}
|
||||
<table class="table table-schedule">
|
||||
{loop type="pdr_schedule" name="schedule-loop" place_id={$ID}}
|
||||
<tr class="creneau">
|
||||
<td style="padding:10px; text-align: center">{$DAY_LABEL} {$CALCULATED_DAY} {format_date date=$BEGIN format="H\hi"} à {format_date date=$END format="H\hi"}</td>
|
||||
<td style="padding:10px; text-align: center"><input type="radio" name="pdr-choosen-day" value="{$ID}"{if {cart attr='total_taxed_price_without_discount'} < $MINIMUM_AMOUNT} disabled{/if} /></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
<div class="price">
|
||||
{if $PRICE > 0}
|
||||
{format_number number=$PRICE} €
|
||||
{else}
|
||||
{intl l="Free" d="clickandcollect"}
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
</div>
|
||||
{/form}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<input type="hidden" id="map-center-lat" value={{module_config module='PlanificationLivraison' key='map_center_latitude' locale='en_US'}|default:50.75075530537203} />
|
||||
<input type="hidden" id="map-center-lon" value={{module_config module='PlanificationLivraison' key='map_center_longitude' locale='en_US'}|default:2.252608244005041} />
|
||||
|
||||
<table id="coordinates" class="hidden">
|
||||
{loop type="pdr_places" name="places-loop" active=true order="city"}
|
||||
<tr>
|
||||
<td>{$ID}
|
||||
<td>{$LATITUDE}</td>
|
||||
<td>{$LONGITUDE}</td>
|
||||
<td>{$TITLE}</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</table>
|
||||
|
||||
<div id="cnc_map" class="locationMap">
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
// Masquer par défaut les options du mode PDR
|
||||
$(document).ready(function(){
|
||||
$("#delivery-module-{$module_id}").html($('#cnc_ui').html());
|
||||
$('#select-cnc').slideUp('fast');
|
||||
});
|
||||
|
||||
// Gestion du pliage/dépliage du mode PDR
|
||||
$('input[type=radio][delivery-mode]').click(function() {
|
||||
$('div[id^="select"]').not($('#select-' + $(this).attr('delivery-mode'))).slideUp();
|
||||
$('#select-' + $(this).attr('delivery-mode')).slideDown('fast');
|
||||
});
|
||||
|
||||
|
||||
function loadScript() {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = "https://maps.googleapis.com/maps/api/js?callback=initMap" +
|
||||
"&key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}";
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
function initMap() {
|
||||
const LIMITES = {
|
||||
north: 50.85043724044059,
|
||||
east: 2.6869845409159923,
|
||||
south: 50.616717259788544,
|
||||
west: 1.8122213465336767,
|
||||
};
|
||||
|
||||
var opt = {
|
||||
center: new google.maps.LatLng($("#map-center-lat").val(), $("#map-center-lon").val()),
|
||||
zoom: 12,
|
||||
streetViewControl: true,
|
||||
mapTypeControl: true,
|
||||
restriction: {
|
||||
latLngBounds: LIMITES,
|
||||
strictBounds: false,
|
||||
}
|
||||
};
|
||||
|
||||
Data.map = new google.maps.Map(document.getElementById('cnc_map'), opt);
|
||||
|
||||
displayPins();
|
||||
}
|
||||
|
||||
function displayPins() {
|
||||
var arrays = [];
|
||||
$('#coordinates').eq(0).find('tr').each((r,row) => arrays.push($(row).find('td,th').map((c,cell) => $(cell).text()).toArray()))
|
||||
|
||||
arrays.forEach(function(place) {
|
||||
var marker = new google.maps.Marker({
|
||||
title: place[3],
|
||||
label: place[0],
|
||||
position: new google.maps.LatLng(place[1], place[2]),
|
||||
map: Data.map
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
var Data = {
|
||||
markers: [],
|
||||
map: null,
|
||||
geocoder: null,
|
||||
bounds: null
|
||||
};
|
||||
|
||||
if (typeof(google) === 'undefined') {
|
||||
loadScript();
|
||||
} else {
|
||||
initMap();
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -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',
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
<div class="scheduled-deliveries-list">
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped" id="deliveries-table">
|
||||
<thead>
|
||||
<th> </th>
|
||||
<th>{intl l="Order number" d="livraisonparsecteurs"}</th>
|
||||
@@ -27,7 +27,7 @@
|
||||
<th>{intl l="Area" d="livraisonparsecteurs"}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{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}
|
||||
|
||||
<tr>
|
||||
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-left: 30px; width:25px"></td>
|
||||
<td><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$client}">{$ORDER_ID}</a></td>
|
||||
<td><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$CUSTOMER}">{$ORDER_ID}</a></td>
|
||||
<td>
|
||||
{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"}
|
||||
</td>
|
||||
<td>{$DELTA} jour(s)</td>
|
||||
<td>{$commune}</td>
|
||||
<td>{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}
|
||||
</td>
|
||||
<td>{$CITY}</td>
|
||||
<td>{$AREA}</td>
|
||||
</tr>
|
||||
{if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
{form_field field='delivery-module'}
|
||||
<label for="delivery-method_{$module_id}">
|
||||
<input type="radio" delivery-mode="lps" name="{$name}" id="delivery-method_{$module_id}" value="{$module_id}">
|
||||
<strong>{intl l="Module name" d="livraisonparsecteurs"}</strong>
|
||||
<strong>{intl l="Module name - customer" d="livraisonparsecteurs"}</strong>
|
||||
<br>
|
||||
</label>
|
||||
{/form_field}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<column name="zipcode" required="true" size="10" type="VARCHAR" />
|
||||
<column name="city" required="true" size="100" type="VARCHAR" />
|
||||
<column name="access_comment" size="400" type="VARCHAR" />
|
||||
<column name="click_and_collect" required="true" type="TINYINT" defaultValue="0" />
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</caption>
|
||||
|
||||
<tbody>
|
||||
{loop name="places" type="pdr_places"}
|
||||
{loop name="places" type="pdr_places" click_and_collect=0}
|
||||
<tr>
|
||||
<td><a href="{url path="/admin/module/PointRetrait/edit?place_id=$ID"}">{$TITLE}</a></td>
|
||||
<td>
|
||||
|
||||
@@ -19,14 +19,13 @@
|
||||
<div class="scheduled-withdrawal-list">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th> </th>
|
||||
<th>{intl l="Order number" d="pointretrait"}</th>
|
||||
<th>{intl l="Scheduled date" d="pointretrait"}</th>
|
||||
<th>{intl l="Delivery delay" d="pointretrait"}</th>
|
||||
<th>{intl l="Place" d="pointretrait"}</th>
|
||||
<th>{intl l="Place name" d="pointretrait"}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{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}
|
||||
|
||||
<tr>
|
||||
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-left: 30px; width:25px"></td>
|
||||
<td><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$client}">{$ORDER_ID}</a></td>
|
||||
<td style="text-align: center"><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$CUSTOMER}">{$ORDER_ID}</a></td>
|
||||
<td>
|
||||
{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"}
|
||||
</td>
|
||||
<td>{$DELTA} jour(s)</td>
|
||||
<td>Point de retrait</td>
|
||||
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-right: 10px; width:25px">{$DELTA} jour(s)</td>
|
||||
<td>{$PLACE}</td>
|
||||
</tr>
|
||||
{if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
{form_field field='delivery-module'}
|
||||
<label for="delivery-method_{$module_id}">
|
||||
<input type="radio" delivery-mode="pdr" name="{$name}" id="delivery-method_{$module_id}" value="{$module_id}">
|
||||
<strong>{intl l="Module name" d="pointretrait"}</strong>
|
||||
<strong>{intl l="Module name - customer" d="pointretrait"}</strong>
|
||||
<br>
|
||||
</label>
|
||||
{/form_field}
|
||||
@@ -25,7 +25,7 @@
|
||||
{form name="thelia.order.delivery"}
|
||||
<div class="table-responsive" style="border: 0px solid gray">
|
||||
<table class="table table-condensed table-main">
|
||||
{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"}
|
||||
<tr class="ligne-pdr">
|
||||
<td>
|
||||
<div class="titre-pdr"><img src="{image file='assets/img/pin.png' source='PointRetrait'}" class="img-pin"><span class="pin-number">{$ID}</span>{$TITLE}</div>
|
||||
@@ -65,7 +65,7 @@
|
||||
<input type="hidden" id="map-center-lon" value={{module_config module='PlanificationLivraison' key='map_center_longitude' locale='en_US'}|default:2.252608244005041} />
|
||||
|
||||
<table id="coordinates" class="hidden">
|
||||
{loop type="pdr_places" name="places-loop" active=true order="city"}
|
||||
{loop type="pdr_places" name="places-loop" active=true click_and_collect=0 order="city"}
|
||||
<tr>
|
||||
<td>{$ID}
|
||||
<td>{$LATITUDE}</td>
|
||||
@@ -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')) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user