<?

class Atendimento_Form_Pendencia extends Agro_Form {
	
	public function init() {
		$this->id = $this->createElement('hidden', 'id');
		$this->id->setDecorators($this->buttonDecorator);
		$this->addElement($this->id);
		
		$this->ds_nome_pendencia = $this->createElement('text', 'ds_nome_pendencia');
		$this->ds_nome_pendencia->setDecorators($this->elementDecorator);
		$this->ds_nome_pendencia->setRequired(true);
		$this->ds_nome_pendencia->setAttrib('size', '50');
		$this->ds_nome_pendencia->setAttrib('maxlength', '100');
		$this->ds_nome_pendencia->setLabel('Nome pendência');
		$this->addElement($this->ds_nome_pendencia);

		$TipoPendencia = new Atendimento_Model_TipoPendencia();
		$this->id_tipo_pendencia = $this->createElement('select', 'id_tipo_pendencia');
		$this->id_tipo_pendencia->setDecorators($this->elementDecorator);
		$this->id_tipo_pendencia->addMultiOptions($TipoPendencia->getCombo());
		$this->id_tipo_pendencia->setRequired(true);
		$this->id_tipo_pendencia->setLabel('Tipo de Pendência');
		$this->addElement($this->id_tipo_pendencia);
		
		
		$this->ds_chave = $this->createElement('text', 'ds_chave');
		$this->ds_chave->setDecorators($this->elementDecorator);
		$this->ds_chave->setRequired(true);
		$this->ds_chave->setAttrib('size', '50');
		$this->ds_chave->setAttrib('maxlength', '100');
		$this->ds_chave->setLabel('Chave');
		$this->addElement($this->ds_chave);
		
		$this->addElement('textarea', 'ds_descricao_pendencia', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Descrição pendência',
			'required' => true,
			'maxlength' => 500,
			'rows' => 7,
			'cols' => 80
		));
		
		$this->save = $this->createElement('button', 'salvar', array('type'=>'submit'));
		$this->save->setDecorators($this->buttonDecorator);
		$this->save->setDecorators($this->buttonDecorator);
		$this->save->setLabel('Salvar');
		$this->addElement($this->save);
		
		$this->cancel = $this->createElement('button', 'cancelar', array('onclick'=>"location.href='/atendimento/pendencia'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
		
	}
}