<?php
include 'header.php';
include 'connect.php';
require_once 'inc/messages.php';
require_once 'inc/usuario.php';

checkLogin('login.php');

$id_usuario = $_SESSION[SESSION_USER_NAME]['id'];
?>


  <div class=block>
    <div class=header>
      <h2>Filtrar Mapa</h2>
    </div>
      <div class="block">
    <div class="content">
      <?php
      displayMessagesAndErrors(true); ?>
    </div>
  </div>
<form id=validate_custom method=POST action="erpc_mapa.php"> 
<input type="hidden" name="tipo" value="canal" />  
<div class="content">

      <!-- Tab panes -->
<div class="tab-content">
  <div role="tabpanel" class="tab-pane fade in active" id="form1" >
  <div class="table-responsive">
  <table class="table table-bordered table-striped table-responsible sortable" >
      <thead>
          <tr>
              <th width=02%><input type="checkbox" class="checkall" /></th>
              <th width=05% >ID</th>
               <th width=50% >Canal</th>
          </tr>
      </thead>
      <tbody>
  <?php

	$consulta_canal = "select erpc_dom_canal_cliente.id
	                    ,erpc_dom_canal_cliente.ds_canal
					from erpc_dom_canal_cliente
					where erpc_dom_canal_cliente.st_ativo=1";
	
	$sql_canal = mysqli_query($conexao, $consulta_canal) or die (mysqli_error($conexao));

                 if(mysqli_num_rows($sql_canal) > 0 ){
                    while ($registro 	= mysqli_fetch_array($sql_canal)){
                        $id  		        = $registro['id'];
                        $ds_canal  			= $registro['ds_canal'];
                    echo "<tr>";
                      echo "<td> <input type='checkbox' value='" . $id . "' name='canal[]' /></td>";
                      echo "<td>" . $id  . "</td>";
                      echo "<td>" . $ds_canal  . "</td>";
                      echo "</tr>";

					  }
                }
    
    ?></tbody>
    </table>
    </div>
  </div>

</div><!-- Tab panes -->
</div><!--content-->

    <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="buscar" name="buscar">Buscar</button>

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



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