<?

class Produto_Form_ValidacoesVariedadeIdade extends Agro_Form {
	public $id;
	public $ds_nome_grupo_variedade;
	public $id_validacao;
	
	public function init() {
		$this->id = $this->createElement('hidden', 'id');
		$this->id->setDecorators($this->buttonDecorator);
		$this->addElement($this->id);
		
		$this->id_validacao = $this->createElement('hidden', 'id_validacao');
		$this->id_validacao->setDecorators($this->buttonDecorator);
		$this->addElement($this->id_validacao);
		
		$Variedades = new Produto_Model_ValidacoesVariedades();
		$this->id_grupo_variedade = $this->createElement('select', 'id_grupo_variedade');
		$this->id_grupo_variedade->setDecorators($this->elementDecorator);
		$this->id_grupo_variedade->addMultiOptions($Variedades->getCombo(true, null, $this->id_validacao_filtro));
		$this->id_grupo_variedade->setRequired(true);
		$this->id_grupo_variedade->setLabel('Grupo de Variedades');
		$this->addElement($this->id_grupo_variedade);
		
		$this->ds_nome_grupo_variedade = $this->createElement('text', 'ds_nome_grupo_variedade');
		$this->ds_nome_grupo_variedade->setDecorators($this->elementDecorator);
		$this->ds_nome_grupo_variedade->setRequired(true);
		$this->ds_nome_grupo_variedade->setAttrib('size', '50');
		$this->ds_nome_grupo_variedade->setAttrib('maxlength', '40');
		$this->ds_nome_grupo_variedade->setLabel('Nome');
		$this->addElement($this->ds_nome_grupo_variedade);		
		
		
  		$this->vl_minimo = $this->createElement('text', 'vl_minimo');
		$this->vl_minimo->setDecorators($this->elementDecorator);
		$this->vl_minimo->setRequired(true);
		$this->vl_minimo->setAttrib('size', '20');
		$this->vl_minimo->setAttrib('class', 'integer');
		$this->vl_minimo->setAttrib('maxlength', '40');
		$this->vl_minimo->setLabel('Valor Mínimo');
		$this->addElement($this->vl_minimo);
		
		$this->vl_maximo = $this->createElement('text', 'vl_maximo');
		$this->vl_maximo->setDecorators($this->elementDecorator);
		$this->vl_maximo->setRequired(true);
		$this->vl_maximo->setAttrib('size', '20');
		$this->vl_maximo->setAttrib('class', 'integer');
		$this->vl_maximo->setAttrib('maxlength', '40');
		$this->vl_maximo->setLabel('Valor Máximo');
		$this->addElement($this->vl_maximo);
  
  		$this->nu_idade = $this->createElement('text', 'nu_idade');
		$this->nu_idade->setDecorators($this->elementDecorator);
		$this->nu_idade->setRequired(true);
		$this->nu_idade->setAttrib('size', '20');
		$this->nu_idade->setAttrib('class', 'integer');
		$this->nu_idade->setAttrib('maxlength', '40');
		$this->nu_idade->setLabel('Idade');
		$this->addElement($this->nu_idade);
		
		$this->save = $this->createElement('button', 'salvar', array('type'=>'submit'));
		$this->save->setDecorators($this->buttonDecorator);
		$this->save->setLabel('Salvar');
		$this->addElement($this->save);
		
		$this->cancel = $this->createElement('button', 'cancelar', array('onclick'=>"location.href='/produto/validacoes'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
	}
}