<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\PercentType;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
/**
* BubbleType
*/
class BubbleEditType extends AbstractType
{
/**
* buildForm
*
* @param mixed $builder
* @param mixed $options
* @return void
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
-> add('bubble_name', TextType::class, [
'attr' => [
'class' => 'form-control',
'readonly' => true,
],
'label' => 'Nom de la bulle'
])
->add('b_address', TextType::class, [
'attr' => [
'class' => 'form-control',
'readonly' => true,
],
])
->add('b_postal_code', TextType::class, [
'attr' => [
'class' => 'form-control',
'readonly' => true,
],
])
->add('b_city_name', TextType::class, [
'attr' => [
'class' => 'form-control',
'readonly' => true,
],
])
->add('b_country', CountryType::class, [
'attr' => [
'class' => 'form-control',
'readonly' => true,
'disabled' => true,
],
'data' => 'FR' // Set default country to France
])
->add('is_qc_updatable', ChoiceType::class, [
'choices' => [
'Non modifiable' => false,
'Modifiable' => true
],
'attr' => [
'class' => 'form-control',
'readonly' => true,
'disabled' => true,
],
'placeholder' => 'Choisir le mode du contrôle qualité',
])
->add('stripe_customer_id', TextType::class, [
'required' => false,
'attr' => [
'maxlength' => 30
],
])
->add('stripe_pay_method_id', TextType::class, [
'required' => false,
'attr' => [
'maxlength' => 30
],
])
->add('number_credit', NumberType::class, [
'required' => false,
'constraints' => [
new GreaterThanOrEqual(['value' => 0.1]),
new Assert\Type(
'float',
''
),
]
])
->add('credit_value', MoneyType::class, [
'required' => false,
'constraints' => [
new GreaterThanOrEqual(['value' => 0.01]),
new Assert\Type(
'float',
''
),
],
'attr' => ['class' => 'input-money']
])
// ->add('ad_valorem', NumberType::class, [
// 'required' => false,
// 'constraints' => [
// new GreaterThanOrEqual(['value' => 0]),
// new Assert\Type(
// 'float',
// ''
// ),
// ],
// 'attr' => [
// 'class' => 'input-advalorem'
// ]
// ])
;
}
/**
* configureOptions
*
* @param mixed $resolver
* @return void
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'attr' => [
'novalidate' => 'novalidate',
]
]);
}
}