src/Form/FacturaFromContratoType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Factura;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  6. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  7. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class FacturaFromContratoType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options)
  13.     {
  14.         $builder
  15.             ->add('fechaLecturaAnterior',null,[
  16.                 'widget' => 'single_text',
  17.                 'attr'=>['disabled'=>true]
  18.             ])
  19.             ->add('lecturaAnteriorP1',null,[
  20.                 'label'=>'Lectura anterior P1',
  21.                 'attr'=>['disabled'=>true]
  22.             ])
  23.             ->add('lecturaAnteriorP2',null,[
  24.                 'label'=>'Lectura anterior P2',
  25.                 'attr'=>['disabled'=>true]
  26.             ])
  27.             ->add('lecturaAnteriorP3',null,[
  28.                 'label'=>'Lectura anterior P3',
  29.                 'attr'=>['disabled'=>true]
  30.             ])
  31.             ->add('lecturaAnteriorP4',null,[
  32.                 'label'=>'Lectura anterior P4',
  33.                 'attr'=>['disabled'=>true]
  34.             ])
  35.             ->add('lecturaAnteriorP5',null,[
  36.                 'attr'=>['disabled'=>true]
  37.             ])
  38.             ->add('lecturaAnteriorP6',null,[
  39.                 'attr'=>['disabled'=>true]
  40.             ])
  41.             ->add('lecturaReactivaAnteriorP1',null,[
  42.                 'attr'=>['disabled'=>true]
  43.             ])
  44.             ->add('lecturaReactivaAnteriorP2',null,[
  45.                 'attr'=>['disabled'=>true]
  46.             ])
  47.             ->add('lecturaReactivaAnteriorP3',null,[
  48.                 'attr'=>['disabled'=>true]
  49.             ])
  50.             ->add('lecturaReactivaAnteriorP4',null,[
  51.                 'attr'=>['disabled'=>true]
  52.             ])
  53.             ->add('lecturaReactivaAnteriorP5',null,[
  54.                 'attr'=>['disabled'=>true]
  55.             ])
  56.             ->add('lecturaReactivaAnteriorP6',null,[
  57.                 'attr'=>['disabled'=>true]
  58.             ])
  59.             ->add('lecturaEnergiaP1')
  60.             ->add('lecturaEnergiaP2')
  61.             ->add('lecturaEnergiaP3')
  62.             ->add('lecturaEnergiaP4')
  63.             ->add('lecturaEnergiaP5')
  64.             ->add('lecturaEnergiaP6')
  65.             ->add('lecturaReactivaP1')
  66.             ->add('lecturaReactivaP2')
  67.             ->add('lecturaReactivaP3')
  68.             ->add('lecturaReactivaP4')
  69.             ->add('lecturaReactivaP5')
  70.             ->add('lecturaReactivaP6')
  71.             ->add('maximetroP1')
  72.             ->add('maximetroP2')
  73.             ->add('maximetroP3')
  74.             ->add('maximetroP4')
  75.             ->add('maximetroP5')
  76.             ->add('maximetroP6')
  77.             ->add('fechaLectura'null,[
  78.                 'widget' => 'single_text',
  79.             ])
  80.             ->add('conceptos',CollectionType::class,[
  81.                 'entry_type'=>ConceptoType::class,
  82.                 'entry_options'=>['label'=>false'attr'=>['class'=>'conceptos-row']],
  83.                 'allow_add'=>true,
  84.                 'allow_delete' => true,
  85.                 'by_reference' => false,
  86.                 'label'=>false
  87.             ])
  88.             ->add('tipoLectura')
  89.             ->add('precioEnergiaP1',null,[
  90.                 'scale'=>6,
  91.                 'label'=>'Precio energía P1'
  92.             ])
  93.             ->add('precioEnergiaP2',null,[
  94.                 'scale'=>6,
  95.                 'label'=>'Precio energía P2'
  96.             ])
  97.             ->add('precioEnergiaP3',null,[
  98.                 'scale'=>6,
  99.                 'label'=>'Precio energía P3'
  100.             ])
  101.             ->add('precioEnergiaP4',null,[
  102.                 'scale'=>6,
  103.                 'label'=>'Precio energía P4'
  104.             ])
  105.             ->add('precioEnergiaP5',null,[
  106.                 'scale'=>6,
  107.                 'label'=>'Precio energía P5'
  108.             ])
  109.             ->add('precioEnergiaP6',null,[
  110.                 'scale'=>6,
  111.                 'label'=>'Precio energía P6'
  112.             ])
  113.             ->add('estadoCompra',null,[
  114.                 'required'=>false
  115.             ])
  116.             ->add('totalCompra',null,[
  117.                 'label'=>'Importe de compra',
  118.                 'required'=>false
  119.             ])
  120.             ->add('fechaEmisionCompra',null,[
  121.                 'widget' => 'single_text',
  122.                 'label'=>'Fecha de emisión',
  123.                 'required'=>false
  124.             ])
  125.             ->add('fechaCobroCompra',null,[
  126.                 'widget' => 'single_text',
  127.                 'label'=>'Fecha de cobro',
  128.                 'required'=>false
  129.             ])
  130.             ->add('bonoSocial',CheckboxType::class,[
  131.                 'data'=>true,
  132.                 'label'=>'Financiación bono social',
  133.                 'mapped'=>false,
  134.                 'required'=>false
  135.             ])
  136.             ->add('topeGas',CheckboxType::class,[
  137.                 'data'=>false,
  138.                 'label'=>'Coste tope del gas',
  139.                 'mapped'=>false,
  140.                 'required'=>false
  141.             ])
  142.             ->add('topeGasValue',NumberType::class,[
  143.                 'label'=>'Importe tope del gas',
  144.                 'mapped'=>false,
  145.                 'required'=>false,
  146.                 'scale'=>10
  147.             ])
  148.             ->add('topeGasAuto',CheckboxType::class,[
  149.                 'label'=>'Importe tope del gas automático',
  150.                 'mapped'=>false,
  151.                 'required'=>false,
  152.                 'attr' => array('checked'   => 'checked'),
  153.             ])
  154.             ->add('topeGasREE',CheckboxType::class,[
  155.                 'data'=>false,
  156.                 'label'=>'Tope del gas REE',
  157.                 'mapped'=>false,
  158.                 'required'=>false
  159.             ])
  160.             ->add('bateriaVirtual',CheckboxType::class,[
  161.                 'data'=>false,
  162.                 'label'=>'Batería virtual',
  163.                 'required'=>false
  164.             ])
  165.             ->add('importeBateriaVirtual',NumberType::class,[
  166.                 'label'=>'Descuento acumulado',
  167.                 'required'=>false,
  168.                 'scale'=>2
  169.             ])
  170.         ;
  171.     }
  172.     public function configureOptions(OptionsResolver $resolver)
  173.     {
  174.         $resolver->setDefaults([
  175.             'data_class' => Factura::class,
  176.         ]);
  177.     }
  178. }