src/Form/AlertaType.php line 17
- <?php
- namespace App\Form;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\OptionsResolver\OptionsResolver;
- use Symfony\Component\Validator\Constraints\NotBlank;
- use Symfony\Component\Validator\Constraints\NotNull;
- use Symfony\Component\Validator\Constraints\Email;
- use App\Entity\Alerta;
- use Symfony\Component\Form\Extension\Core\Type\DateType;
- use Symfony\Component\Form\Extension\Core\Type\TextType;
- use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
- use Symfony\Component\Form\Extension\Core\Type\NumberType;
- class AlertaType extends AbstractType
- {
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder
- ->add('fechaInicio', DateType::class, array(
- 'html5' => true,
- 'attr' =>[
- 'class' => 'datepicker fechas1'
- ],
- 'label' => false,
- 'required' => true,
- 'widget' => 'single_text',
- 'constraints' => array(new NotBlank()),
- )
- )
- ->add('fechaFin', DateType::class, array(
- 'html5' => true,
- 'attr' =>[
- 'class' => 'datepicker fechas1'
- ],
- 'label' => false,
- 'data' => null,
- 'required' => false,
- 'widget' => 'single_text',
- )
- )
- ->add('divisa', null, array(
- 'attr' =>[
- 'class' => 'hidden'
- ],
- // 'property' => 'nombre',
- 'label' => false,
- 'required' => true,
- 'constraints' => array(
- new NotBlank(),
- ),
- )
- )
- ->add('oficina', null, array(
- 'attr' =>[
- 'class' => 'hidden'
- ],
- 'label' => false,
- 'required' => true,
- 'constraints' => array(
- new NotBlank(),
- ),
- )
- )
- ->add('precioMinimo', NumberType::class, array(
- 'label' => false,
- 'required' => false
- ))
- ->add('frecuencia', ChoiceType::class, array(
- 'attr' =>[
- ],
- 'choices' => array_flip([
- 1 => $options['settings']->getValue('currency.alert.daily'),
- 7 => $options['settings']->getValue('currency.alert.weekly'),
- 30 => $options['settings']->getValue('currency.alert.monthly'),
- ]),
- 'data' => 1,
- 'expanded' => true,
- 'multiple' => false,
- 'required' => true,
- 'constraints' => array(
- new NotBlank(),
- ),
- )
- )
- ->add('tipo', ChoiceType::class, [
- 'attr' =>[
- 'class' => 'hidden'
- ],
- 'label' => false,
- 'choices' => [
- 'Venta' => 1,
- 'Compra' => 0,
- ],
- 'data' => 1,
- 'expanded' => true,
- 'multiple' => false,
- 'required' => true,
- ]);
- ;
- }
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver
- ->setRequired( array('settings') )
- ;
- }
- public function getName()
- {
- return 'dinamic_alerta';
- }
- }