<?php
require_once 'header.php';
require_once 'erpc_unidades_toolbar.php';

    $id_crip = $_GET['id'];
    $id = (int)base64_decode($id_crip);

    $consulta = "select * from erpc_unidades where id = $id and st_ativo =1";

    $resultado = mysqli_query($conexao, $consulta) or die ($erro = mysqli_error($conexao));
    if (mysqli_num_rows($resultado)>0) {
    while ($registro = mysqli_fetch_assoc($resultado)){

      $ds_razao_social    = $registro['ds_razao_social'];
      $ds_fantasia  = $registro['ds_fantasia'];
      $ds_cnpj      = $registro['ds_cnpj'];
      $ds_ie = $registro['ds_ie'];
      $ds_cnae_fiscal      = $registro['ds_cnae_fiscal'];
      $ds_im = $registro['ds_im'];
      $ds_iest = $registro['ds_iest'];
      $id_regime      = $registro['id_regime'];
      $ds_cep         = $registro['ds_cep'];
      $ds_endereco    = $registro['ds_endereco'];
      $ds_numero        = $registro['ds_numero'];
      $ds_complemento = $registro['ds_complemento'];
      $ds_bairro      = $registro['ds_bairro'];
      $id_municipio   = $registro['id_municipio'];
      $ds_uf    = $registro['ds_uf'];
      $arquivo  = $registro['ds_logo'];
      }
    }
?>

<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
  <li role="presentation" class="active"><a href="#form1" aria-controls="form1" role="tab" data-toggle="tab">Dados Cadastrais</a></li>
  <!--
  <li role="presentation"><a href="#form2" aria-controls="form2" role="tab" data-toggle="tab">Form #2</a></li>
  <li role="presentation"><a href="#form3" aria-controls="form3" role="tab" data-toggle="tab">Form #3</a></li>
  <li role="presentation"><a href="#form4" aria-controls="form4" role="tab" data-toggle="tab">Form #4</a></li>
  -->
</ul>

<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="form1">
<form id=validate_custom method=POST action="erpc_unidades_ws.php">
  <input type=hidden name="id" id="id" value="<? echo $id;?>" class="validate[required] form-control" maxlength="08" size=8/>

  <div class=block>
    <div class=header>
      <h2>Excluir Unidades:</h2>
    </div>

    <div class="content controls">
      <div class="form-row">
        <div class="col-md-2"><label>Razão Social</label></div>
        <div class="col-md-10"><input type=text name="ds_razao_social" id="ds_razao_social" value="<? echo $ds_razao_social;?>" class="validate[required] form-control" maxlength="100"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Nome Fantasia</label></div>
        <div class="col-md-6"><input type=text name="ds_fantasia" id="ds_fantasia" value="<? echo $ds_fantasia;?>"class="validate[required] form-control" maxlength="40"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>CNPJ</label></div>
        <div class="col-md-4"><input name="ds_cnpj" id="ds_cnpj" class="mask_cnpj" value="<? echo $ds_cnpj;?>"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Insc. Estadual</label></div>
        <div class="col-md-3"><input type=number name="ds_ie" id="ds_ie" value="<? echo $ds_ie;?>" /></div>
      </div>

    <div class=footer>
      <div class="side pull-right">
        <div class=btn-group>
            <button class="btn btn-default" type="button" onClick="window.history.go(-1)" value="Voltar">Voltar</button>
            <button class="btn btn-warning" type="submit" value="excluir" name="excluir">Confirma a Exclusão?</button>
        <!--botao antigo
    <button class="btn btn-default" type=button onClick="$('#validate_custom').validationEngine('hide');">Hide prompts</button>            <button class="btn btn-success" type=submit>Submit</button>
    -->
        </div>
      </div>
    </div>


</div>
</div>
</form>
</div>
</div>



    <!-- modal do helper -->
    <div class="row-clear">&nbsp;</div>
    <div class="modal modal-white modal-draggable fade" id="helper-modal-div" tabindex="-1" role="dialog" aria-labelledby="helper-modal-label" aria-hidden="true">
      <div class="modal-dialog modal-lg">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="helper-modal-label">Helper</h4>
          </div>
          <div class="modal-body">
            ...
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal" id="modalCancel">Cancelar</button>
            <button type="button" class="btn btn-primary" data-dismiss="modal" id="modalOk" disabled="disabled">Selecionar</button>
          </div>
        </div>
      </div>
    </div>



<?php include 'footer.php'; ?>
<script type="text/javascript" src="js/acme.js"></script>
