
<?php
include 'header.php';
include 'erpc_local_estoque_toolbar.php';
include_once 'connect.php';

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

<!-- 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>

<!-- Tab panes -->
<div class="tab-content">
  <div role="tabpanel" class="tab-pane fade in active" id="form1">
  <form id=validate_custom method=POST action="erpc_local_estoque_ws.php">
  <input type="hidden" value="<?php echo $id; ?>" name="id" id="id">

  <div class=block>
    <div class=header>
      <h2>Editar armazem</h2>
      <div class="side pull-right"> <button class="btn btn-default btn-clean" onClick="clear_form('#validate_custom');" type=button>Clear form</button>      </div>
    </div>

    <div class="content controls">
	<?php
		$consulta = "select * from erpc_local_estoque 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_local	= $registro['ds_local'];
      $id_tipo_local = $registro['id_tipo_local'];

			}
		}
	?>
	  <div class=form-row>
        <div class=col-md-3>Descrição da armazem:</div>
        <div class=col-md-6><input type=text name="ds_local" value="<? echo $ds_local?>" class="form-control" class="validate[required]" maxlength=100 /> </div>
    </div>

    <div class="form-row">
      <div class=col-md-3>Tipo de local de estoque</div>
      <div class=col-md-3>
        <select name="id_tipo_local" id="id_tipo_local">
          <option value="1" <?if($id_tipo_local=="1"){echo 'selected';}?>/>Padrão</option>
          <option value="0" <?if($id_tipo_local=="0"){echo 'selected';}?>/>Alternativo</option>
        </select>
      </div>
    </div>
    </div>

     <!-- Itens dos produtos -->
     <? include "erpc_armazens_locais_endereco_add.php" ?>
     
    <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-success" type="submit" value="editar" onClick="$('#validate_custom').validationEngine('hide');" name="editar">EDITAR</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>
</form>

  </div>

</div>

<?php include 'footer.php';?>
