<?

class Atendimento_Form_Tipochamado extends Agro_Form {

	public function init() {
		$Departamento = new Sistema_Model_Departamentos();
		$Funcionarios = new Sistema_Model_Funcionarios();
		$TipoChamados = new Atendimento_Model_TipoChamado();

		$this->addElement('hidden', 'id', array('decorators' => $this->buttonDecorator));

		$this->addElement('text', 'ds_chave', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Chave',
			'required' => true,
			'maxlength' => 50,
			'size' => 30
		));

		$this->addElement('text', 'ds_tipo_chamado', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Nome',
			'required' => true,
			'maxlength' => 50,
			'size' => 30
		));

		$this->addElement('select', 'id_departamento', array(
			'MultiOptions' => $Departamento->getComboChamados('EMPRESA'),
			'decorators' => $this->elementDecorator,
			'label' => 'Departamento',
			'required' => true
		));

		$this->addElement('select', 'id_responsavel', array(
			'MultiOptions' => $Funcionarios->getComboAgroBrasil(),
			'decorators' => $this->elementDecorator,
			'label' => 'Responsável',
			'required' => false
		));

		$this->addElement('select', 'id_tipo_chamado', array(
			'MultiOptions' => $TipoChamados->getCombo(true, 'ds_tipo_chamado'),
			'decorators' => $this->elementDecorator,
			'label' => 'Tipo de Chamado',
			'required' => false
		));

		$this->addElement('checkbox', 'fl_destinatario_corretor', array(
			'decorators' => $this->elementDecorator,
			'class' => 'display: "inline"',
			'label' => 'Corretor'
		));

		$this->addElement('checkbox', 'fl_destinatario_empresa_vistoria', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Empresa Vistoria'
		));

		$this->addElement('checkbox', 'fl_destinatario_seguradora', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Seguradora'
		));

		$this->addElement('checkbox', 'fl_anexar_arquivo_destinatario', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Destinatário'
		));

		$this->addElement('checkbox', 'fl_anexar_arquivo_interno', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Interno'
		));

		$this->addElement('checkbox', 'fl_criar_chamado_destinatario', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Destinatário'
		));

		$this->addElement('text', 'prazo_dias_uteis', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Prazo (dias úteis)',
			'validators' => array(
				array('Digits')
			)
		));

		$this->addElement('textarea', 'ds_identificacao_tipo_chamado', array(
			'decorators' => $this->elementDecorator,
			'label' => 'Identificação do Tipo de Chamado',
			'attribs' => array('rows' => '4')
		));

		$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/tipochamado'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
	}
}