<?php

/**
 * BasketOrder form.
 *
 * @package    sf
 * @subpackage form
 * @author     Atma
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class wwwBasketOrderForm extends BaseBasketOrderForm
{
    public function configure()
    {
        $this->useFields(array('username', 'phone', 'email', 'delivery_type', 'delivery_address', 'comment'));

        $this->widgetSchema['username'] = new sfWidgetFormInputText(array(), array("size" => 64, "maxlength" => 255, "required" => true, "placeholder" => "Как к вам обращаться", "class" => "basket_buyer__inp_name validate_it", "size" => 27));
        $this->widgetSchema['phone'] = new sfWidgetFormInputText(array(), array("size" => 24, "maxlength" => 24, "required" => true, "placeholder" => "Номер телефона", "class" => "basket_buyer__inp_name validate_it", "size" => 27));
        $this->widgetSchema['email'] = new sfWidgetFormInputText(array(), array("size" => 24, "maxlength" => 255, "required" => true, "placeholder" => "Email", "class" => "basket_buyer__inp_name validate_it", "size" => 27));
        $this->widgetSchema['delivery_address'] = new sfWidgetFormTextarea(array(), array('cols' => 40, 'rows' => 4, 'placeholder' => 'Адрес доставки'));
        $this->widgetSchema['comment'] = new sfWidgetFormTextarea(array(), array("rows" => 4, 'placeholder' => 'Напишите здесь пожелания к заказу'));

        $this->validatorSchema['delivery_type'] = new sfValidatorChoice(array('choices' => array(0 => 'Самовывоз', 1 => 'Доставка по адресу'), 'required' => true));

        $this->validatorSchema['phone'] = new sfValidatorAnd(array(
            new sfValidatorNumber(array('required' => true)),
            new sfValidatorString(array('max_length' => 24, 'required' => true))
        ));
    }
}
