<?php
include 'header.php';
include 'erpc_armazens_locais_toolbar.php';
// require_once 'inc/armazens_locais.php';
require_once 'inc/local_estoque.php';
require_once 'inc/usuario.php';

checkLogin('login.php');


$local_estoque = local_estoque_create();

if(isset($_GET['id'])){
  $id_crip = $_GET['id'];
  $id = base64_decode($id_crip);

  $local_estoque = local_estoque_getById($id);
}

?>
<form method="post" action="erpc_armazens_locais_ws.php" id=validate_custom>
  <input type="hidden" value="<?php echo $id; ?>" name="id" id="id">
  <div class="block">
    <div class="header">
      <h2>Armazéns (Locais de Estoque)</h2>
    </div>
    <div class="block">
      <div class="content">
        <?php
        displayMessagesAndErrors(true);
        ?>
      </div>
    </div>
  </div>
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#form4" aria-controls="form4" role="tab" data-toggle="tab">Dados</a></li>
  </ul>

<!-- Tab panes -->
<div class="tab-content">

  <div role="tabpanel" class="tab-pane fade in active" id="form4">
    <? include "erpc_armazens_locais_dados_add.php" ?>
  </div> <!-- tab-pane -->

</div> <!-- 1o tab-content -->

    <!-- Itens dos produtos -->
    <? include "erpc_armazens_locais_endereco_add.php" ?>


  <div class="block">
    <div class="content controls">
      <div class="form-row">
        <div class="col-md-12 text-right">
        <?if(!isset($_GET['id'])){?>
          <button type="submit" name="btn-add" id="btn-add" class="btn btn-primary btn-cleanx" onClick="$('#validate_custom').validationEngine('hide');" >Adicionar</button>
        <?}else{ ?>
          <button type="submit" name="btn-edit" id="btn-edit" class="btn btn-primary btn-cleanx" onClick="$('#validate_custom').validationEngine('hide');" >Salvar</button>
        <?}?>
          <button type="button" name="btn-voltar" id="btn-voltar" class="btn btn-default btn-cleanx">Voltar</button>
        </div>
      </div>
    </div>
  </div>
</form>

<?php include 'inc/helper_modal_div.php'; ?>
<?php include 'footer.php'; ?>
<script type='text/javascript' src='js\armazens_locais.js' ></script>
<style>
  .input-group {
    min-width:130px;// if you want width please write here //
    text-align:left;
  }
</style>
