Commit e8065e7a authored by Mat's avatar Mat

Déplace 2 formulaires dans un dossier Form/OffreLegumes

parent e4a25baf
......@@ -2,7 +2,7 @@
namespace APIBundle\Form;
use PotageBundle\Form\Offre\OffreLegumesType;
use PotageBundle\Form\OffreLegumes\OffreLegumesType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OffreLegumesAPIType extends OffreLegumesType
......
......@@ -2,7 +2,7 @@
namespace APIBundle\Form;
use PotageBundle\Form\Offre\OffreLegumesInsertType;
use PotageBundle\Form\OffreLegumes\OffreLegumesInsertType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OffreLegumesInsertAPIType extends OffreLegumesInsertType
......
<?php
namespace PotageBundle\Form\Offre;
use PotageBundle\Entity\OffreLegumes;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Vich\UploaderBundle\Form\Type\VichImageType;
class OffreLegumesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('fruit', ChoiceType::class, array(
'label' => "Fruit ou légume ?",
'choices' => array(
'Fruit' => true,
'Légume' => false,
),
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
'autofocus' => true,
),
));
$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',
),
));
$builder->add('revente', CheckboxType::class, array(
'label' => "C'est un produit de revente",
'required' => false,
));
$builder->add('origine', TextType::class, array(
'required' => false,
'label' => "Origine",
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('unite', ChoiceType::class, array(
'label' => "Unité",
'choices' => array(
'le kilo' => 'kg',
'la pièce' => 'pièce',
'la botte' => 'botte',
),
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('quantiteMin', NumberType::class, array(
'label' => "Quantité minimale",
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('quantiteMax', NumberType::class, array(
'label' => "Quantité maximale",
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('quantiteStep', NumberType::class, array(
'label' => "Écart (step)",
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
),
));
$builder->add('prixUnitaire', MoneyType::class, array(
'label' => "Prix unitaire",
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control form-control-sm',
'placeholder' => '€',
),
));
$builder->add('imageFile', VichImageType::class, array(
'label' => "Téléverser une image",
'label_attr' => array('class' => 'col-form-label'),
'attr' => array(
'class' => 'form-control-sm',
),
));
/* TODO les champs en plus
*/
$builder->add('sauver', SubmitType::class, array(
'label' => 'Enregistrer',
'attr' => array('class' => 'btn btn-dark mb-2')
));
}
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('data_class', OffreLegumes::class);
$resolver->setDefault('attr', array(
'class' => 'formulaire formulaire_offre_legumes',
));
}
public function getBlockPrefix()
{
return 'offre_legumes';
}
}
<?php
namespace PotageBundle\Form\Offre;
namespace PotageBundle\Form\OffreLegumes;
use PotageBundle\Entity\Offre;
use PotageBundle\Entity\OffreLegumes;
......
<?php
namespace PotageBundle\Form\OffreLegumes;
use PotageBundle\Entity\OffreLegumes;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OffreLegumesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
/* TODO les champs en plus
*/
$builder->add('sauver', SubmitType::class, array(
'label' => 'Enregistrer',
'attr' => array('class' => 'btn btn-dark mb-2')
));
}
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('data_class', OffreLegumes::class);
$resolver->setDefault('attr', array(
'class' => 'formulaire formulaire_offre_legumes',
));
}
public function getBlockPrefix()
{
return 'offre_legumes';
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment