<?
$User = $User = Zend_Auth::getInstance()->getIdentity();

if ($this->form->id_proponente->getValue()):
    $this->form->cpf_cnpj->setAttrib('readonly', true);
endif;

$this->form->fl_programa_abc->setAttrib('checked', '');

if ($this->programa_abc) {
  $this->form->fl_programa_abc->setAttrib('checked', 'checked');
  $this->form->dt_vencimento_programa_abc->setValue($this->dt_vencimento_programa_abc);
}

?>

<script src="/resources/javascript/municipios.js"></script>

<br/>
<form class="formDefault" method="post">
  <div id="tabs">
    <ul>
      <li><a href="#tabs-form">Proponente</a></li>
        <? if (($User->tp_usuario == 'F') && ($User->id_empresa == 20)): ?>
          <li><a href="#tabs-restricao" id='load-restricao'>Moderação de Negócio</a></li>
        <? endif; ?>
    </ul>

    <div class="geral">
      <div id="tabs-form">
          <?= $this->form->id_proponente ?>

          <?= $this->title('Dados do Gerais') ?>
        <div class="padding-10">
          <div class="row">
              <?= $this->form->tp_pessoa ?>
              <?= $this->form->cpf_cnpj ?>
              <?= $this->form->ds_nome_proponente ?>
              <?= $this->form->ds_email_proponente ?>
              <?= $this->form->id_estado_civil ?>
              <?= $this->form->dt_nascimento ?>
          </div>
          <div class="row">
              <?= $this->form->ds_documento_natureza ?>
              <?= $this->form->ds_documento_numero ?>
              <?= $this->form->id_orgao_expedidor ?>
              <?= $this->form->dt_documento_exp ?>
              <?= $this->form->ds_tel_propriedade ?>
              <?= $this->form->ds_tel_residencia ?>
              <?= $this->form->ds_tel_celular ?>
          </div>
          <div class="row">
              <?= $this->form->fl_inadimplente ?>
              <?= $this->form->fl_validacao_receita ?>
              <? $this->form->fl_restricao->setAttrib('disabled', true); ?>
              <?= $this->form->fl_restricao ?>
              <?= $this->form->fl_programa_abc ?>
              <?= $this->form->dt_vencimento_programa_abc ?>
          </div>
        </div>

          <?= $this->title('Dados de Localização'); ?>
        <div class="padding-10">
          <div class="row">
              <?= $this->form->ds_endereco_cep_proponente ?>
            <div class="field"><br/>
              <button type="button" class="buscarCep" name="_proponente">Buscar CEP</button>
            </div>
            <div class="field"><br/>Se você não souber o CEP, <a href="/cep/search/n/_proponente" class="searchCep"
                                                                 id="ds_endereco_cep_proponente"><b>Clique aqui</b></a>
              para buscar.
            </div>
          </div>
          <div class="row">
              <?= $this->form->id_estado_proponente ?>
              <?= $this->form->id_municipio_proponente ?>

              <?= $this->form->ds_nome_estado_proponente ?>
              <?= $this->form->ds_nome_municipio_proponente ?>
          </div>
          <div class="row">
              <?= $this->form->ds_endereco_bairro_proponente ?>
              <?= $this->form->ds_endereco_rua_proponente ?>
          </div>
          <div class="row">
              <?= $this->form->ds_endereco_nro_proponente ?>
              <?= $this->form->ds_endereco_complem_proponente ?>
          </div>
        </div>

        <ul id="buttons" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
          <li>
            <button name="salvar" id="salvar" type="submit">Salvar</button>
          </li>
          <li>
            <button name="cancelar" id="cancelar" type="button" onclick="location.href='/seguro/proponente'">Cancelar
            </button>
          </li>
        </ul>

      </div>

        <? if (($User->tp_usuario == 'F') && ($User->id_empresa == 20)): ?>
          <div id="tabs-restricao">
              <?= $this->title('Dados da proposta com Moderação de Negócio') ?>
            <input type='hidden' id='id_restricao' value=''>
            <div class="padding-10">
              <div class='row'>
                <br/>
                <label class='required'>Problemas</label>
                <table>
                    <? foreach ($this->restricoes as $restricao): ?>
                      <tr>
                        <td>
                          <input type='checkbox' name='id_restricao[]' value='<?= $restricao['id'] ?>'
                                 id='restricao<?= $restricao['id'] ?>' <?= $checked ?> />
                          <input type='hidden' name='ds_nome_restricao' value='<?= $restricao['ds_nome_restricao'] ?>'/>
                        </td>
                        <td>
                          <label for='restricao<?= $restricao['id'] ?>'>
                              <?= $restricao['ds_nome_restricao'] ?>
                          </label>
                        </td>
                      </tr>
                    <? endforeach; ?>
                </table>
              </div>
              <div class='row'>
              <div class="field" id="field-propostas">
                <div style="margin-bottom: 2px;">
                  <label for="id_proposta" style="display:inline-block; height:100%;" class="optional">Proposta</label>
                  <img src="/resources/imagens/mini/add.png" 
                    style="display:inline-block; height:100%; vertical-align:middle; cursor: pointer;"
                    alt="Adicionar Proposta" 
                    id="add-proposta">
                </div>
							  <input type="text" name="id_proposta[]" id="id_proposta_0" size="10" class="integer">

              </div>
              <div class='row'>
                  <?= $this->form->ds_descricao ?>

                  <div class="field">
                    <span 
                      style="display: block; margin-bottom: 10px; background: url(/resources/imagens/bullet.png);
                        background-repeat: no-repeat;padding-left: 12px;font-weight: bold;"
                      >Orientação</span>

                    <input type="radio" id="radio-aceitar-direto" name="id_orientacao_restricao_tecnica" value="<?php echo Seguro_Model_OrientacaoRestricaoTecnica::ACEITAR_DIRETO ?>">
                    <label for="radio-aceitar-direto" style="display: inline-block; margin-bottom: 5px;">Aceitar direto</label><br>
                    
                    <input type="radio" id="radio-negar-direto" name="id_orientacao_restricao_tecnica" value="<?php echo Seguro_Model_OrientacaoRestricaoTecnica::NEGAR_DIRETO ?>">
                    <label for="radio-negar-direto" style="display: inline-block; margin-bottom: 5px;">Negar direto</label><br>
                    
                    <input type="radio" id="radio-analisar-individualmente" name="id_orientacao_restricao_tecnica" value="<?php echo Seguro_Model_OrientacaoRestricaoTecnica::ANALISAR_INDIVIDUALMENTE ?>">
                    <label for="radio-analisar-individualmente" style="display: inline-block; margin-bottom: 5px;">Analisar individualmente</label><br>
                    
                  </div>

              </div>
              <div class='row'>
                  <?= $this->form->id_funcionario_agronomo ?>
                  <?= $this->form->id_funcionario_perito ?>
                  <?= $this->form->id_corretor ?>
              </div>
            </div>
            <ul id="buttons" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
              <li>
                <button name="salvar" id="salvar_restricao" type="button">Salvar</button>
              </li>
              <li>
                <button name="cancelar" id="cancelar" type="button" onclick="location.href='/seguro/proponente'">
                  Cancelar
                </button>
              </li>
            </ul>
            <br/>
              <?= $this->title('Lista de Restrições') ?>
            <div id='list-restricoes'></div>
          </div>
        <? endif; ?>
    </div>
  </div>
</form>