Premiers écrans sur module PointRetrait
This commit is contained in:
86
local/modules/PointRetrait/Form/MainForm.php
Normal file
86
local/modules/PointRetrait/Form/MainForm.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Form;
|
||||
|
||||
use PointRetrait\PointRetrait;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
|
||||
/**
|
||||
* Class MainForm
|
||||
* @package PointRetrait\Form
|
||||
*/
|
||||
class MainForm 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', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'title']
|
||||
])
|
||||
->add(
|
||||
"price",
|
||||
"number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Withdrawal price', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'price']
|
||||
])
|
||||
->add(
|
||||
"minimum_amount",
|
||||
"number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Minimum amount', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'minimum_amount']
|
||||
])
|
||||
->add("latitude", "number", [
|
||||
"label" => $this->translator->trans("Latitude", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "latitude"],
|
||||
"required" => false
|
||||
])
|
||||
->add("longitude", "number", [
|
||||
"label" => $this->translator->trans("Longitude", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
"label_attr" => ["for" => "longitude"],
|
||||
"required" => false
|
||||
])
|
||||
->add(
|
||||
"active",
|
||||
"number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Active', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'active']
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "pdr-place-main-update";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user