<?

class Produto_Form_Cobertura extends Agro_Form {
	public $id;
	public $ds_nome_cobertura;
	public $ds_descricao_cobertura;
	public $id_tipo_liquidacao_cobertura;
	
	public function init() {
		$this->id = $this->createElement('hidden', 'id');
		$this->id->setDecorators($this->buttonDecorator);
		$this->addElement($this->id);
		
		$this->id_legacy = $this->createElement('hidden', 'id_legacy');
		$this->id_legacy->setDecorators($this->buttonDecorator);
		$this->addElement($this->id_legacy);
		
		$this->ds_nome_cobertura = $this->createElement('text', 'ds_nome_cobertura');
		$this->ds_nome_cobertura->setDecorators($this->elementDecorator);
		$this->ds_nome_cobertura->setRequired(true);
		$this->ds_nome_cobertura->setAttrib('size', '50');
		$this->ds_nome_cobertura->setAttrib('maxlength', '50');
		$this->ds_nome_cobertura->setLabel('Nome');
		$this->addElement($this->ds_nome_cobertura);
		
		$this->ds_chave_cobertura = $this->createElement('text', 'ds_chave_cobertura');
		$this->ds_chave_cobertura->setDecorators($this->elementDecorator);
		$this->ds_chave_cobertura->setRequired(true);
		$this->ds_chave_cobertura->setAttrib('size', '50');
		$this->ds_chave_cobertura->setAttrib('maxlength', '50');
		$this->ds_chave_cobertura->setLabel('Chave');
		$this->addElement($this->ds_chave_cobertura);
		
		
		$this->cd_cobertura_seguradora = $this->createElement('text', 'cd_cobertura_seguradora');
		$this->cd_cobertura_seguradora->setDecorators($this->elementDecorator);
		$this->cd_cobertura_seguradora->setRequired(false);
		$this->cd_cobertura_seguradora->setAttrib('size', '15');
		$this->cd_cobertura_seguradora->setAttrib('class', 'integer');
		$this->cd_cobertura_seguradora->setAttrib('maxlength', '11');
		$this->cd_cobertura_seguradora->setLabel('Código Cobertura Seguradora');
		$this->addElement($this->cd_cobertura_seguradora);
		
		
		$this->ds_descricao_cobertura = $this->createElement('textarea', 'ds_descricao_cobertura');
		$this->ds_descricao_cobertura->setDecorators($this->elementDecorator);
		$this->ds_descricao_cobertura->setAttrib('cols','50');
		$this->ds_descricao_cobertura->setAttrib('rows','5');
		$this->ds_descricao_cobertura->setAttrib('maxlength', '200');
		$this->ds_descricao_cobertura->setLabel('Descrição');
		$this->addElement($this->ds_descricao_cobertura);


		
		$modelCoberturas = new Produto_Model_Coberturas();
		$this->id_tipo_liquidacao_cobertura = $this->createElement('select', 'id_tipo_liquidacao_cobertura');
		$this->id_tipo_liquidacao_cobertura->setDecorators($this->elementDecorator);
		$this->id_tipo_liquidacao_cobertura->addMultiOptions($modelCoberturas->getComboTipoLiquidacao());
		$this->id_tipo_liquidacao_cobertura->setRequired(true);
		$this->id_tipo_liquidacao_cobertura->setLabel('Tipo de avaliação/liquidação');
		$this->addElement($this->id_tipo_liquidacao_cobertura);
		
		$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/cobertura'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
	}
}