<?php
namespace App\Form;
use App\Entity\HtExtra;
use App\Service\HtService;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class HtExtraItemType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('concept', TextType::class, [
'attr' => ['class' => 'form-control'],
'required' => false
])
->add('price', NumberType::class, [
'html5' => true,
'attr' => ['class' => 'form-control'],
'required' => false
])
->add('vat', NumberType::class, [
'html5' => true,
'empty_data' => 10,
'attr' => ['class' => 'form-control'],
'required' => false
])
->add('appearInvoice', CheckboxType::class, [
'attr' => ['class' => 'form-check-input'],
'required' => false
])
->add('overCommission', NumberType::class, [
'html5' => true,
'empty_data' => 0,
'attr' => ['class' => 'form-control'],
'required' => false
])
->add('opOverCommission', ChoiceType::class, [
'choices' => HtService::OVER_OR_COMMISSION,
'attr' => ['class' => 'form-control']
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => HtExtra::class,
]);
}
}