<?php

namespace VGM\WOBundle\Form;

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

class WorkOrderType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('number')
            ->add('equipment')
            ->add('stock_quantity')
            ->add('price')
            ->add('client')
            ->add('delivery_date', null, array(
                    'label' => 'Delivery date',
                    'input'  => 'datetime',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy'))
            ->add('delivery_address')
            ->add('delivery_city')
            ->add('delivery_state')
            ->add('delivery_zipcode')
            /*->add('finished', null, array(
                    'required' => false
                ))*/
            ->add('saletype')
            ->add('worktype');
    }
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'VGM\WOBundle\Entity\WorkOrder',
            'cascade_validation' => true,
        ));
    }

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