<?php $r="../";
require_once($r."inc/funciones.php");
$title = 'Reasignar Domiciliario Pedido';
validNotSession($r);
$spe=$_SESSION['perfil'];
$mysqli = connectDB($r);
roleaccess(1500);
?>

  <?php include $r."inc/head.php"; ?>
<body class="fixed-nav sticky-footer sidenav-toggled bg-dark" id="page-top">
  <?php include $r."inc/nav.php"; ?>
 
  <div class="content-wrapper">
    <div class="container-fluid">
      <h3 class="text-center"> <?= $title; ?></h3>
      <div class="card mb-3">
        <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>Cliente</th>
                  <th>Domiciliario</th>
                  <th>fecha de creacion</th>
                  <th>Fecha de entrega</th>
                  <th>Codigo</th>
                  <th></th>
                </tr>
              </thead>
              <tfoot>
                <tr>
                  <th>Nombre</th>
                  <th>Cliente</th>
                  <th>Domiciliario</th>
                  <th>fecha de creacion</th>
                  <th>Fecha de entrega</th>
                  <th>Codigo</th>
                  <th></th>
                </tr>
              </tfoot>
              <tbody>
                    <?php
                    $sql = $mysqli->query("SELECT * FROM z_pedidos WHERE ruta_estado='pendiente'"); 
                    while($row2 = $sql->fetch_assoc()) {
                    ?>
                      <tr>
                        <td><?php $usuario = suser($row2["iduser"]); echo $usuario['nombre']; ?></td>
                        <td><?php $cliente = sclien($row2["idcliente"]); echo $cliente['nombre'];?></td>
                        <td><?php $rutero = srute($row2["idrutero"]); echo $rutero['nombre'];?></td>
                        <td><?php echo $row2["fecha"]; ?></td>
                        <td><?php echo $row2["fechaentrega"]; ?></td>
                        <td><?php echo $row2["codigopedido"]; ?></td>
                        <td width="20px"><a class="btn_default text-success h5" href="domiciliario_reasignar.php?code=<?php echo $row2["codigopedido"] ?>"><i class="fa fa-refresh"></i></a></td>
                        </tr>
                    <?php
                    }
                    ?>
              <tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php include $r."inc/foot.php"; ?>
  <script>
      $('#dataTable').DataTable( {
        "order": [[2, "asc" ]],
        "stateSave": true,
        "lengthMenu": [[ 50, 100, 500, -1], [ 50, 100, 500, "All"]]
    } );
  </script>
</body>
</html>    
    
 