<?php

namespace VGM\WOBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\Constraints\Image;

class WorkerType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('worker_code',null, array(
                    'label' => 'Worker code',
                    'required' => true))
            ->add('name', null, array(
                    'label' => 'Name',
                    'required' => true))
            ->add('lastname', null, array(
                    'label' => 'Last Name',
                    'required' => true))
            ->add('address', null, array(
                    'label' => 'Street',
                    'required' => false))
            ->add('city', null, array(
                    'label' => 'City',
                    'required' => false))
            ->add('state', null, array(
                    'label' => 'State',
                    'required' => false))
            ->add('zip_code', null, array(
                    'label' => 'Zip code',
                    'required' => false))
            ->add('phone1', null, array(
                    'label' => 'Personal phone number',
                    'required' => false))
            ->add('phone2', null, array(
                    'label' => 'Work phone number',
                    'required' => false))
            ->add('pemail', null, array(
                    'label' => 'Personal e-mail',
                    'required' => false))
            ->add('wemail', null, array(
                    'label' => 'Work e-mail',
                    'required' => false))
            ->add('birth_date', null, array(
                    'label' => 'Birth date',
                    'required' => false,
                    'input'  => 'datetime',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy'))
            ->add('hire_date', null, array(
                    'label' => 'Hire date',
                    'required' => false,
                    'input'  => 'datetime',
                    'widget'=> 'single_text',
                    'format' => 'MM/dd/yyyy'))
            ->add('department', null, array(
                    'label' => 'Department',
                    'required' => true))
            ->add('termination_date', null, array(
                    'label' => 'Termination date',
                    'required' => false,
                    'input'  => 'datetime',
                    'widget'=> 'single_text',
                    'format' => 'MM/dd/yyyy'))
            ->add('pay_by_hour', null, array(
                    'label' => 'Pay by hour',
                    'required' => false))
            ->add('standart_pay', null, array(
                    'label' => 'Standart payment',
                    'required' => false))
            ->add('pay_rate', null, array(
                    'label' => 'Payment rate',
                    'required' => false))
            ->add('npayschedule', null, array(
                    'label' => 'Payment schedule',
                    'required' => false))
            ->add('full_time', null, array(
                    'label' => 'Full time',
                    'required' => false))
            ->add('supervisor', null, array(
                    'label' => 'Supervisor',
                    'required' => false))
            ->add('status_active', null, array(
                    'label' => 'Active',
                    'required' => false))
            ->add('picture','image',array(
                    'required' => false))
        ;
    }
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'VGM\WOBundle\Entity\Worker',
            'cascade_validation' => true,
        ));
    }

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