src/Form/HtExtraItemType.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\HtExtra;
  4. use App\Service\HtService;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  7. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  8. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Form\FormBuilderInterface;
  11. use Symfony\Component\OptionsResolver\OptionsResolver;
  12. class HtExtraItemType extends AbstractType
  13. {
  14.     public function buildForm(FormBuilderInterface $builder, array $options): void
  15.     {
  16.         $builder
  17.             ->add('concept'TextType::class, [
  18.                 'attr' => ['class' => 'form-control'],
  19.                 'required' => false
  20.             ])
  21.             ->add('price'NumberType::class, [
  22.                 'html5' => true,
  23.                 'attr' => ['class' => 'form-control'],
  24.                 'required' => false
  25.             ])
  26.             ->add('vat'NumberType::class, [
  27.                 'html5' => true,
  28.                 'empty_data' => 10,
  29.                 'attr' => ['class' => 'form-control'],
  30.                 'required' => false
  31.             ])
  32.             ->add('appearInvoice'CheckboxType::class, [
  33.                 'attr' => ['class' => 'form-check-input'],
  34.                 'required' => false
  35.             ])
  36.             ->add('overCommission'NumberType::class, [
  37.                 'html5' => true,
  38.                 'empty_data' => 0,
  39.                 'attr' => ['class' => 'form-control'],
  40.                 'required' => false
  41.             ])
  42.             ->add('opOverCommission'ChoiceType::class, [
  43.                 'choices' => HtService::OVER_OR_COMMISSION,
  44.                 'attr' => ['class' => 'form-control']
  45.             ])
  46.         ;
  47.     }
  48.     public function configureOptions(OptionsResolver $resolver): void
  49.     {
  50.         $resolver->setDefaults([
  51.             'data_class' => HtExtra::class,
  52.         ]);
  53.     }
  54. }