Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
9d0bdd61
Commit
9d0bdd61
authored
Jun 16, 2018
by
Mat
Browse files
FormType pour Groupe et Depot
parent
af915e72
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/PotageBundle/Form/Depot/DepotType.php
View file @
9d0bdd61
...
...
@@ -3,8 +3,13 @@
namespace
PotageBundle\Form\Depot
;
use
PotageBundle\Entity\Depot
;
use
PotageBundle\Entity\Groupe
;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\SubmitType
;
use
Symfony\Component\Form\AbstractType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\Extension\Core\Type\TimeType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\OptionsResolver\OptionsResolver
;
...
...
@@ -13,8 +18,55 @@ class DepotType extends AbstractType
{
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
{
/*
$builder->add('groupe', EntityType::class, array(
'class' => Groupe::class,
'choice_label' => 'getNom',
'placeholder' => 'Associer le point de dépôt à un groupe',
'label' => 'Groupe',
'attr' => array('class' => 'form-control form-control-sm'),
));
*/
$builder
->
add
(
'localisation'
,
TextType
::
class
,
array
(
'label'
=>
"Localisation"
,
'label_attr'
=>
array
(
'class'
=>
'col-form-label'
),
'attr'
=>
array
(
'class'
=>
'form-control form-control-sm'
,
),
));
$builder
->
add
(
'responsable'
,
TextType
::
class
,
array
(
'label'
=>
"Propriétaire ou personne responsable"
,
'label_attr'
=>
array
(
'class'
=>
'col-form-label'
),
'attr'
=>
array
(
'class'
=>
'form-control form-control-sm'
,
),
));
$builder
->
add
(
'jourPanier'
,
ChoiceType
::
class
,
array
(
'label'
=>
"Jour de livraison"
,
'choices'
=>
array
(
'lundi'
=>
'1'
,
'mardi'
=>
'2'
,
'mercredi'
=>
'3'
,
'jeudi'
=>
'4'
,
'vendredi'
=>
'5'
,
'samedi'
=>
'6'
,
'dimanche'
=>
'0'
,
),
'label_attr'
=>
array
(
'class'
=>
'col-form-label'
),
'attr'
=>
array
(
'class'
=>
'form-control form-control-sm'
,
),
));
$builder
->
add
(
'heurePanier'
,
TimeType
::
class
,
array
(
'label'
=>
"Heure de livraison"
,
'widget'
=>
'single_text'
,
//'data' => new \DateTime('now'),
'label_attr'
=>
array
(
'class'
=>
'col-form-label'
),
'attr'
=>
array
(
'class'
=>
'form-control form-control-sm'
,
),
));
/* TODO les champs en plus
*/
...
...
src/PotageBundle/Form/Groupe/GroupeType.php
View file @
9d0bdd61
...
...
@@ -2,9 +2,14 @@
namespace
PotageBundle\Form\Groupe
;
use
PotageBundle\Entity\Depot
;
use
PotageBundle\Entity\Groupe
;
use
PotageBundle\Entity\Lettre
;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
Symfony\Component\Form\Extension\Core\Type\SubmitType
;
use
Symfony\Component\Form\AbstractType
;
use
Symfony\Component\Form\Extension\Core\Type\TextareaType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\OptionsResolver\OptionsResolver
;
...
...
@@ -13,8 +18,29 @@ class GroupeType extends AbstractType
{
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
{
$builder
->
add
(
'depot'
,
EntityType
::
class
,
array
(
'class'
=>
Depot
::
class
,
'choice_label'
=>
'getNom'
,
'placeholder'
=>
'Associer le groupe à un point de dépôt'
,
'label'
=>
'Point de dépôt'
,
'attr'
=>
array
(
'class'
=>
'form-control form-control-sm'
),
));
$builder
->
add
(
'nom'
,
TextType
::
class
,
array
(
'label'
=>
"Nom"
,
'label_attr'
=>
array
(
'class'
=>
'col-form-label'
),
'attr'
=>
array
(
'class'
=>
'form-control form-control-sm'
,
),
));
$builder
->
add
(
'description'
,
TextareaType
::
class
,
array
(
'label'
=>
"Description"
,
'label_attr'
=>
array
(
'class'
=>
'col-form-label'
),
'attr'
=>
array
(
'class'
=>
'form-control form-control-sm'
,
),
));
/* TODO les champs en plus
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment