<?php

namespace VGM\WOBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class LaborLoopType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('date', null, array(
                    'label_attr' => array('hidden' => ''),
                    'attr' => array('class' => 'form-control datepicker',
                        'data-date' => '',
                        'data-date-format' => 'mm/dd/yyyy',
                        'data-link-field' => 'birth_date_picker',
                        'data-link-format' => 'mm/dd/yyyy'),
                    'required' => true,
                    'input'  => 'datetime',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy'
                ))
            ->add('started_at', null, array(
                    'label_attr' => array('hidden' => ''),
                    'attr' => array('class' => 'form-control form_time',
                        'data-date' => '',
                        'data-date-format' => 'hh:ii',
                        'data-link-field' => 'form_time',
                        'data-link-format' => 'hh:ii'),
                    'widget' => 'single_text',
                ))
            ->add('finished_at', null, array(
                    'label_attr' => array('hidden' => ''),
                    'attr' => array('class' => 'form-control form_time',
                        'data-date' => '',
                        'data-date-format' => 'hh:ii',
                        'data-link-format' => 'hh:ii'),
                    'widget' => 'single_text',
                ))
            ->add('total_time', null, array(
                    'label_attr' => array('hidden' => ''),
                    'attr' => array('class' => 'form-control',
                        'disabled' => '')
                ))
        ;
    }
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'VGM\WOBundle\Entity\LaborLoop'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'laborloop';
    }
}
