<?php $r="../";
require_once($r."inc/funciones.php");
validNotSession($r);
$mysqli = connectDB($r);
$row1 = $mysqli->query("SELECT * FROM z_zonas");
?>
<!DOCTYPE html>
<html lang="en">
  <?php include $r."inc/head.php"; ?>
<body class="fixed-nav sticky-footer bg-dark" id="page-top">
  <?php include $r."inc/nav.php"; ?>
  
  <div class="content-wrapper">
    <div class="container-fluid">
      <!-- Example DataTables Card-->
      <div class="card mb-3">
        <div class="card-header">
          <i class="fa fa-table"></i> Lista de Clientes</div>
        <div class="card-body">
          <div class="table-responsive">
            <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
              <thead>
                <tr>
                  <th>Nombre</th>
                  <th>Ciudad</th>
                  <th>Asignado a</th>
                <?php if($_SESSION['perfil']>=5){?><th></th><? } ?>
                </tr>
              </thead>
              <tfoot>
                <tr>
                  <th>Nombre</th>
                  <th>Ciudad</th>
                  <th>Asignado a</th>
                <?php if($_SESSION['perfil']>=5){?><th></th><? } ?>
                </tr>
              </tfoot>
              <tbody>
                    <?php
                    while($row2 = $row1->fetch_assoc()) {
                    ?>
                      <tr>
                        <td><?php echo $row2["zona"] ?></td>
                        <td><?php $localidad=sloca($row2["localidad"]); echo $localidad['localidad'] ;?></td>
                        <td><?php $rutero=srute($row2["rutero"]); echo $rutero['nombre']; ?></td>
                <?php if($_SESSION['perfil']>=5){?>
                        <td><a class="btn_default" href="editar.php?id=<?php echo $row2["id"] ?>">Editar</a></td>
                        <? } ?>
                        </tr>
                    <?php
                    }
                    ?>
              <tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php include $r."inc/foot.php"; ?>
</body>
</html>    
    