ClickAndCollect : quasiment terminé
This commit is contained in:
99
local/modules/ClickAndCollect/Form/CreatePlaceForm.php
Normal file
99
local/modules/ClickAndCollect/Form/CreatePlaceForm.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Form;
|
||||
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class CreatePlaceForm
|
||||
* @package ClickAndCollect\Form
|
||||
*/
|
||||
class CreatePlaceForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"title",
|
||||
"text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Place name', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'title']
|
||||
])
|
||||
->add(
|
||||
"price",
|
||||
"number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Additional cost', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'price']
|
||||
])
|
||||
->add(
|
||||
"minimum_amount",
|
||||
"number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Minimum amount', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'minimum_amount']
|
||||
])
|
||||
->add(
|
||||
"address1","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Address1', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'address1']
|
||||
])
|
||||
->add(
|
||||
"address2","text",
|
||||
[
|
||||
"required" => false,
|
||||
"label" => $this->translator->trans('Address2', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'address2']
|
||||
])
|
||||
->add(
|
||||
"zipcode","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Zipcode', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'zipcode']
|
||||
])
|
||||
->add(
|
||||
"city","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('City', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'city']
|
||||
])
|
||||
->add(
|
||||
"active",
|
||||
"number",
|
||||
[ "required" => true ]
|
||||
)
|
||||
->add(
|
||||
"click_and_collect",
|
||||
"number",
|
||||
[ "required" => true ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "cnc-place-create";
|
||||
}
|
||||
}
|
||||
62
local/modules/ClickAndCollect/Form/CreateScheduleForm.php
Normal file
62
local/modules/ClickAndCollect/Form/CreateScheduleForm.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Form;
|
||||
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
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" => PlanificationLivraison::getDayLabel(null),
|
||||
"label" => $this->translator->trans("Working day", [], ClickAndCollect::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("Start time", [], ClickAndCollect::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("End time", [], ClickAndCollect::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 "cnc-place-create-schedule";
|
||||
}
|
||||
}
|
||||
69
local/modules/ClickAndCollect/Form/UpdateScheduleForm.php
Normal file
69
local/modules/ClickAndCollect/Form/UpdateScheduleForm.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Form;
|
||||
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class UpdateScheduleForm
|
||||
* @package ClickAndCollect\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" => PlanificationLivraison::getDayLabel(null),
|
||||
"label" => $this->translator->trans("Working day", [], ClickAndCollect::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("Start time", [], ClickAndCollect::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("End time", [], ClickAndCollect::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 "cnc-place-update-schedule";
|
||||
}
|
||||
}
|
||||
127
local/modules/ClickAndCollect/Form/ViewMainForm.php
Normal file
127
local/modules/ClickAndCollect/Form/ViewMainForm.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Form;
|
||||
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
|
||||
/**
|
||||
* Class ViewMainForm
|
||||
* @package ClickAndCollect\Form
|
||||
*/
|
||||
class ViewMainForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"place_id","integer",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add(
|
||||
"title","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
|
||||
"label" => $this->translator->trans('Place name', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'title']
|
||||
])
|
||||
->add(
|
||||
"price","number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Additional cost', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'price']
|
||||
])
|
||||
->add(
|
||||
"minimum_amount","number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Minimum amount', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'minimum_amount']
|
||||
])
|
||||
->add("latitude", "number", [
|
||||
"label" => $this->translator->trans("Latitude", [], ClickAndCollect::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "latitude"],
|
||||
"required" => false
|
||||
])
|
||||
->add("longitude", "number", [
|
||||
"label" => $this->translator->trans("Longitude", [], ClickAndCollect::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "longitude"],
|
||||
"required" => false
|
||||
])
|
||||
->add(
|
||||
"active","number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Active', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'active']
|
||||
])
|
||||
->add(
|
||||
"click_and_collect","number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Click and Collect', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'click_and_collect']
|
||||
])
|
||||
->add(
|
||||
"address1","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Address1', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'address1']
|
||||
])
|
||||
->add(
|
||||
"address2","text",
|
||||
[
|
||||
"required" => false,
|
||||
"label" => $this->translator->trans('Address2', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'address2']
|
||||
])
|
||||
->add(
|
||||
"zipcode","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Zipcode', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'zipcode']
|
||||
])
|
||||
->add(
|
||||
"city","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('City', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'city']
|
||||
])
|
||||
->add(
|
||||
"access_comment","textarea",
|
||||
[
|
||||
"required" => false,
|
||||
"label" => $this->translator->trans('Access comment', [], ClickAndCollect::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'access_comment']
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "cnc-place-view-main";
|
||||
}
|
||||
}
|
||||
62
local/modules/ClickAndCollect/Form/ViewScheduleForm.php
Normal file
62
local/modules/ClickAndCollect/Form/ViewScheduleForm.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Form;
|
||||
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class ViewScheduleForm
|
||||
* @package ClickAndCollect\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" => PlanificationLivraison::getDayLabel(null),
|
||||
"label" => $this->translator->trans("Delivery day", [], ClickAndCollect::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", [], ClickAndCollect::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", [], ClickAndCollect::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 "cnc-place-view-schedule";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user