<?php
include 'header.php';
include 'erpc_dom_canal_cliente_toolbar.php';
include 'connect.php';

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

?>

<!-- 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_dom_canal_cliente_ws.php" enctype="multipart/form-data">
  <div class=block>
    <div class=header>
      <h2>Editar Canal</h2>
    </div>
  
    <div class="content controls">
	<?php
		$consulta = "select * from erpc_dom_canal_cliente where id = '$id'";

		$resultado = mysqli_query($conexao, $consulta) or die ($erro = mysqli_error($conexao));
		if (mysqli_num_rows($resultado)>0) {
		while ($registro = mysqli_fetch_assoc($resultado)){
      
		    $ds_canal	= $registro['ds_canal'];
            $ds_path_marker	= $registro['ds_path_marker'];
           // $st_ativo	= $registro['st_ativo'];
           
            //echo $ds_path_marker;
			}
		}

	?>
  <input type="hidden" name="id" value="<?php echo $id; ?>" />
  	  <div class=form-row>
          <div class=col-md-3>Canal:</div>
          <div class=col-md-6><input type=text name="ds_canal" class="form-control" value="<?php echo $ds_canal; ?>" maxlength=50 class="validate[required]"/> </div>
        </div>
        
        <div class=form-row>
          <div class=col-md-3>Ícone:</div>
          <div class=col-md-6>
          <input name="ds_icone" id="ds_icone" type="file" accept="image/*" />

          </div>
        </div>
<?php 
    if($ds_path_marker != null && $ds_path_marker != " "){    
?>
        <div class=form-row>
          <div class=col-md-3>Ícone Atual:</div>
          <div class=col-md-6>
          <img src="mapas/<?php echo $ds_path_marker; ?>" width="50" >
          </div>
        </div>
<?php 
    }
?>
        
    </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-success" type="submit" value="editar" onClick="$('#validate_custom').validationEngine('hide');" name="editar">EDITAR</button>

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

  </div>

</div>

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