On avance sur LivraisonParSecteurs
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace LivraisonParSecteurs\Form;
|
||||
|
||||
use LivraisonParSecteurs\LivraisonParSecteurs;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class ScheduleCreateForm
|
||||
* @package LivraisonParSecteurs\Form
|
||||
*/
|
||||
class ScheduleCreateForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"area_id",
|
||||
"integer",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add(
|
||||
"area-schedule_id",
|
||||
"integer",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add("day", "choice", [
|
||||
"choices" => $this->getDay(),
|
||||
"label" => $this->translator->trans("Day", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-area-schedule-day"],
|
||||
"required" => false,
|
||||
"multiple" => true,
|
||||
"attr" => array()
|
||||
])
|
||||
->add("begin", "time", [
|
||||
"label" => $this->translator->trans("Begin", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-area-schedule-begin"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => false,
|
||||
"attr" => array()
|
||||
])
|
||||
->add("end", "time", [
|
||||
"label" => $this->translator->trans("End", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-area-schedule-end"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => false,
|
||||
"attr" => array()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "lps-area-schedule-create";
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace LivraisonParSecteurs\Form;
|
||||
|
||||
use LivraisonParSecteurs\LivraisonParSecteurs;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class ScheduleForm
|
||||
* @package LivraisonParSecteurs\Form
|
||||
*/
|
||||
class ScheduleForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'price',
|
||||
'number',
|
||||
[
|
||||
'constraints' => [new Constraints\NotBlank()],
|
||||
'required' => true,
|
||||
'label' => $this->translator->trans('Delivery price', [], LivraisonParSecteurs::DOMAIN_NAME),
|
||||
'label_attr' => ['for' => 'price'],
|
||||
'attr' => array()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "lps-area-schedule.update";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace LivraisonParSecteurs\Form;
|
||||
|
||||
use LivraisonParSecteurs\LivraisonParSecteurs;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class ScheduleUpdateForm
|
||||
* @package LivraisonParSecteurs\Form
|
||||
*/
|
||||
class ScheduleUpdateForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"area_id",
|
||||
"integer",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add(
|
||||
"area-schedule_id",
|
||||
"integer",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()]
|
||||
])
|
||||
->add("day", "choice", [
|
||||
"choices" => LivraisonParSecteurs::getDayLabel(null),
|
||||
"label" => $this->translator->trans("Delivery day", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-area-schedule-day"],
|
||||
"required" => true,
|
||||
"multiple" => false,
|
||||
"attr" => array()
|
||||
])
|
||||
->add("begin", "time", [
|
||||
"label" => $this->translator->trans("Delivery beginning time", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-area-schedule-begin"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,
|
||||
"attr" => array()
|
||||
])
|
||||
->add("end", "time", [
|
||||
"label" => $this->translator->trans("Delivery ending time", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "attr-area-schedule-end"],
|
||||
"input" => "string",
|
||||
"widget" => "single_text",
|
||||
"required" => true,
|
||||
"attr" => array()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "lps-area-schedule-update";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user