PointRetrait : OK sur création de créneau et modification
Il reste : - suppression d'un créneau - liste des jours dans places-list.html
This commit is contained in:
@@ -23,8 +23,11 @@
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
<form name="pdr-place-main-update" class="PointRetrait\Form\MainForm"/>
|
||||
<form name="pointretrait.place.create" class="PointRetrait\Form\CreateForm"/>
|
||||
<form name="pdr.place.view.main" class="PointRetrait\Form\ViewMainForm"/>
|
||||
<form name="pdr.place.view.schedule" class="PointRetrait\Form\ViewScheduleForm"/>
|
||||
<form name="pdr.place.create" class="PointRetrait\Form\CreatePlaceForm"/>
|
||||
<form name="pdr.place.create.schedule" class="PointRetrait\Form\CreateScheduleForm"/>
|
||||
<form name="pdr.place.update.schedule" class="PointRetrait\Form\UpdateScheduleForm"/>
|
||||
</forms>
|
||||
|
||||
</config>
|
||||
|
||||
@@ -15,16 +15,24 @@
|
||||
<route id="pointretrait.place.view" path="/admin/module/PointRetrait/edit" methods="get">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::viewPlace</default>
|
||||
</route>
|
||||
<route id="pointretrait.place.edit" path="/admin/module/PointRetrait/edit" methods="post">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::editPlace</default>
|
||||
</route>
|
||||
|
||||
<route id="pointretrait.place.create" path="/admin/module/PointRetrait" methods="post">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::createPlace</default>
|
||||
</route>
|
||||
|
||||
<route id="pointretrait.place.edit" path="/admin/module/PointRetrait/edit" methods="post">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::editPlace</default>
|
||||
</route>
|
||||
<route id="pointretrait.place.delete" path="/admin/module/PointRetrait/delete" methods="post">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::deletePlace</default>
|
||||
</route>
|
||||
|
||||
<route id="pointretrait.schedule.create" path="admin/module/PointRetrait/schedule/create" methods="post">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\ScheduleController::createSchedule</default>
|
||||
</route>
|
||||
<route id="pointretrait.schedule.update" path="admin/module/PointRetrait/schedule/update" methods="post">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\ScheduleController::updateSchedule</default>
|
||||
</route>
|
||||
<route id="pointretrait.schedule.delete" path="/admin/module/PointRetrait/schedule/delete" methods="post">
|
||||
<default key="_controller">PointRetrait\Controller\backOffice\ScheduleController::deleteSchedule</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
|
||||
@@ -41,7 +41,7 @@ class PlaceController extends BaseAdminController
|
||||
$con->beginTransaction();
|
||||
|
||||
$error_msg = "";
|
||||
$changeForm = $this->createForm("pdr-place-main-update", "form");
|
||||
$changeForm = $this->createForm("pointretrait.place.view.main", "form");
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
@@ -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('place-schedule_id');
|
||||
$query = PdrPlacesQuery::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('place-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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,10 +8,10 @@ use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class CreateForm
|
||||
* Class CreatePlaceForm
|
||||
* @package PointRetrait\Form
|
||||
*/
|
||||
class CreateForm extends BaseForm
|
||||
class CreatePlaceForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
@@ -91,6 +91,6 @@ class CreateForm extends BaseForm
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "place_create";
|
||||
return "pdr-place-create";
|
||||
}
|
||||
}
|
||||
61
local/modules/PointRetrait/Form/CreateScheduleForm.php
Normal file
61
local/modules/PointRetrait/Form/CreateScheduleForm.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Form;
|
||||
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class CreateScheduleForm
|
||||
* @package LivraisonParSecteurs\Form
|
||||
*/
|
||||
class CreateScheduleForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"place_id","integer", [
|
||||
"label_attr" => ["for" => "attr-place-id"],
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add("day", "choice", [
|
||||
"choices" => PointRetrait::getDayLabel(null),
|
||||
"label" => $this->translator->trans("Withdrawal day", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-day"],
|
||||
"required" => true,
|
||||
"multiple" => false,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"attr" => array()
|
||||
])
|
||||
->add("begin_time", "time", [
|
||||
"label" => $this->translator->trans("Withdrawal beginning time", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-start"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"attr" => array()
|
||||
])
|
||||
->add("end_time", "time", [
|
||||
"label" => $this->translator->trans("Withdrawal ending time", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-end"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"attr" => array()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "pdr-place-create-schedule";
|
||||
}
|
||||
}
|
||||
68
local/modules/PointRetrait/Form/UpdateScheduleForm.php
Normal file
68
local/modules/PointRetrait/Form/UpdateScheduleForm.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Form;
|
||||
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class UpdateScheduleForm
|
||||
* @package PointRetrait\Form
|
||||
*/
|
||||
class UpdateScheduleForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"place_id","integer", [
|
||||
"label_attr" => ["for" => "attr-place-id"],
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add(
|
||||
"place-schedule_id","integer", [
|
||||
"label_attr" => ["for" => "attr-place-schedule-id"],
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add("day", "choice", [
|
||||
"choices" => PointRetrait::getDayLabel(null),
|
||||
"label" => $this->translator->trans("Withdrawal day", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-day"],
|
||||
"required" => true,
|
||||
"multiple" => false,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"attr" => array()
|
||||
])
|
||||
->add("begin_time", "time", [
|
||||
"label" => $this->translator->trans("Withdrawal beginning time", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-begin"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"attr" => array()
|
||||
])
|
||||
->add("end_time", "time", [
|
||||
"label" => $this->translator->trans("Withdrawal ending time", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-end"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"attr" => array()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "pdr-place-update-schedule";
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@ use Thelia\Form\BaseForm;
|
||||
|
||||
|
||||
/**
|
||||
* Class MainForm
|
||||
* Class ViewMainForm
|
||||
* @package PointRetrait\Form
|
||||
*/
|
||||
class MainForm extends BaseForm
|
||||
class ViewMainForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
@@ -31,7 +31,7 @@ class MainForm extends BaseForm
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"label" => $this->translator->trans('Place', [], PointRetrait::DOMAIN_NAME),
|
||||
"label" => $this->translator->trans('Place name', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'title']
|
||||
])
|
||||
->add(
|
||||
@@ -114,6 +114,6 @@ class MainForm extends BaseForm
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "pdr-place-main-update";
|
||||
return "pdr-place-view-main";
|
||||
}
|
||||
}
|
||||
61
local/modules/PointRetrait/Form/ViewScheduleForm.php
Normal file
61
local/modules/PointRetrait/Form/ViewScheduleForm.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Form;
|
||||
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class ViewScheduleForm
|
||||
* @package PointRetrait\Form
|
||||
*/
|
||||
class ViewScheduleForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"place_id","integer", [
|
||||
"label_attr" => ["for" => "attr-place-id"],
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add("day", "choice", [
|
||||
"choices" => PointRetrait::getDayLabel(null),
|
||||
"label" => $this->translator->trans("Delivery day", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-day"],
|
||||
"required" => true,
|
||||
"multiple" => false,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"attr" => array()
|
||||
])
|
||||
->add("begin_time", "time", [
|
||||
"label" => $this->translator->trans("Delivery beginning time", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-start"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"attr" => array()
|
||||
])
|
||||
->add("end_time", "time", [
|
||||
"label" => $this->translator->trans("Delivery ending time", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-place-schedule-end"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"attr" => array()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "pdr-place-view-schedule";
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
return array(
|
||||
'Access comment' => 'Commentaire d\'accès',
|
||||
'Access comment help' => 'Ce commentaire d\'accès sera visible de vos clients, pour les aider à mieux localiser le point de retrait',
|
||||
'Active' => 'Actif',
|
||||
'Add a new withdrawal day' => 'Ajouter un créneau de retrait',
|
||||
'Address' => 'Adresse',
|
||||
'Address1' => 'Adresse',
|
||||
'Address2' => 'Complément d\'adresse',
|
||||
@@ -9,8 +11,10 @@ return array(
|
||||
'Create a new place' => 'Créer un nouveau point de retrait',
|
||||
'Do you really want to remove this place ?' => 'Voulez-vous réellement supprimer ce point de retrait ?',
|
||||
'Delete a place' => 'Supprimer un point de retrait',
|
||||
'Delete this withdrawal day' => 'Supprimer ce jour de retrait',
|
||||
'Delivery delay' => 'Délai avant retrait',
|
||||
'Edit a place' => 'Modifier un lieu de retrait',
|
||||
'Edit this withdrawal day' => 'Modifier ce jour de retrait',
|
||||
'Location set' => 'Coordonnées GPS présentes ?',
|
||||
'Main' => 'Généralités',
|
||||
'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.',
|
||||
@@ -28,7 +32,10 @@ return array(
|
||||
'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',
|
||||
'Withdrawal beginning time' => 'Début du retrait',
|
||||
'Withdrawal day' => 'Jour de retrait',
|
||||
'Withdrawal days' => 'Jours de retrait',
|
||||
'Withdrawal ending time' => 'Fin du retrait',
|
||||
'Withdrawal price' => 'Coût du retrait',
|
||||
'Zipcode' => 'Code postal',
|
||||
'Monday' => 'Lundi',
|
||||
|
||||
@@ -35,7 +35,7 @@ class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
$loopResultRow = new LoopResultRow($pdr_schedule);
|
||||
$loopResultRow
|
||||
->set("ID", $pdr_schedule->getId())
|
||||
->set("PLACE_ID", $pdr_schedule->getIdArea())
|
||||
->set("PLACE_ID", $pdr_schedule->getIdPlace())
|
||||
->set("DAY", $pdr_schedule->getDay())
|
||||
->set("DAY_LABEL", PointRetrait::getDayLabel($pdr_schedule->getDay()))
|
||||
->set("BEGIN", $pdr_schedule->getBeginTime())
|
||||
|
||||
@@ -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}
|
||||
@@ -1,4 +1,4 @@
|
||||
{form name='pdr-place-main-update'}
|
||||
{form name='pdr.place.view.main'}
|
||||
<div class="form-container">
|
||||
|
||||
{if $form_error}
|
||||
@@ -6,16 +6,15 @@
|
||||
{/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 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"
|
||||
{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"}
|
||||
@@ -163,6 +162,7 @@
|
||||
<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}
|
||||
|
||||
@@ -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="PointRetrait"}
|
||||
<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="PointRetrait"}
|
||||
<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="PointRetrait"}
|
||||
<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,40 @@
|
||||
<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-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,59 @@
|
||||
{* DELETE modal *}
|
||||
{capture "schedule_delete"}
|
||||
{intl l="Do you really want to delete this delivery day ?" d="pointretrait"}
|
||||
<input type="text" name="schedule_id" id="attr-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 = "area-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" id="attr-place-schedule-id-update" name="place-schedule_id" value=""/>
|
||||
{/form_field}
|
||||
{form_field form=$form field="place_id"}
|
||||
<input type="hidden" id="place_id" name="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="Modify a 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}
|
||||
@@ -33,15 +33,13 @@
|
||||
|
||||
<div class="tab-content">
|
||||
{loop name="auth-general-tab" type="auth" role="ADMIN" resource="admin" access="VIEW" module="PointRetrait"}
|
||||
<div class="tab-pane fade in active" id="general">
|
||||
<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="PointRetrait"}
|
||||
<div class="tab-pane fade" id="schedule">
|
||||
{*
|
||||
{include file="includes/schedule.html"}
|
||||
*}
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
@@ -50,9 +48,7 @@
|
||||
<input type="hidden" id="message-pas-de-coordonnees" value="{intl l='Message no location' d='pointretrait'}" />
|
||||
</div>
|
||||
|
||||
{*
|
||||
{include file="modal/schedule-modal.html"}
|
||||
*}
|
||||
|
||||
{/block}
|
||||
|
||||
@@ -82,7 +78,5 @@
|
||||
</script>
|
||||
{/javascripts}
|
||||
{include file="js/main-js.html"}
|
||||
{*
|
||||
{include file="js/schedule-js.html"}
|
||||
*}
|
||||
{/block}
|
||||
|
||||
@@ -85,9 +85,9 @@ mais{extends file="admin-layout.tpl"}
|
||||
</div>
|
||||
|
||||
{* CREATE Modal *}
|
||||
{form name="pointretrait.place.create"}
|
||||
{form name="pdr.place.create"}
|
||||
{capture "place_create"}
|
||||
{include file="form/place-create.html" form_name="pointretrait.place.create"}
|
||||
{include file="form/place-create.html" form_name="pdr.place.create"}
|
||||
{/capture}
|
||||
|
||||
{include file="includes/generic-create-dialog.html"
|
||||
|
||||
Reference in New Issue
Block a user