<?php
$page_title = 'REPORTE';
require_once('../../includes/load.php');
?>
<?php
// Checkin What level user has permission to view this page
page_require_level(1);
//pull out all user form database
$all_users = find_all_user();
?>
<?php include_once('../../layouts/header.php'); ?>
<div class="col-md-12">
<?php echo display_msg($msg); ?>
</div>
  <div class="container">
  <div class="row mb-3">
    <div class="col-12">
      <p class="text-center h2"><b>REPORTE</b></p>
    </div>
  </div>
  <form method="POST" id="form">
    <div class="row mb-3">
      <div class="col-12 col-sm-6 col-md-4">
        <div class="form-group">
          <select class="custom-select-confi" id="selectPlaca" name="selectPlaca">
            <option value="1">Con Placa</option>
            <option value="2">Sin Placa</option>
          </select>
        </div>
      </div>
    </div>
    <div class="row mb-3">
      <div class="col-12 col-sm-6 col-md-4">
        <div class="input-group mb-3">
          <div class="input-group-prepend">
            <span class="input-group-text" for="FechaInicio">Inicio</span>
          </div>
          <input type="date" class="form-control" id="FechaInicio" name="FechaInicio">
        </div>
      </div>
      <div class="col-12 col-sm-6 col-md-4">
        <div class="input-group mb-3">
          <div class="input-group-prepend">
            <span class="input-group-text" for="FechaFin">Fin</span>
          </div>
          <input type="date" class="form-control" id="FechaFin" name="FechaFin">
        </div>
      </div>    

      <div class="col-12 col-lg-4" id="divPlaca" style="display: block;"> 
        <div class="input-group mb-3">
          <div class="input-group-prepend">
            <label class="input-group-text" for="Placa"><i class="fas fa-user-cog"></i></label>
          </div>  
          <select class="custom-select is-valid" id="Placa" name="Placa">
            <option value="0" selected>Seleccione</option>
            <?php   
              $consulta = $db->query("SELECT * FROM vehiculo ORDER BY id DESC");
                while ($row = $db->fetch_assoc($consulta)) {   
                  $Placa = $row['PLACA'];    
                  echo "<option value='$Placa'>$Placa</option>";
                }
            ?>
          </select>
        </div>
      </div>
    </div>
    

    <div class="row pt-4">
      <div class="col-6 col-md-md-2">
        <button class="btn btn-success ml-2" type="button" id="buscar" name="buscar"><i
            class="fas fa-plus-circle"></i> Buscar</button>
      </div>
      <div class="col-6 col-md-5" id="excelDiv" name="excelDiv" style="display: none;">
        <p class="text-end">
          <button class="btn btn-success" type="submit" id="excel" name="excel" value="true"><i class="fas fa-file-excel"> Generar Excel</i></button>
          <button class="btn btn-success" type="submit" id="indicador" name="indicador" value="true"><i class="fas fa-file-excel"> Indicador</i></button></p>
      </div>
  </form>

  </div>
  <div class="row pt-4">
    <div class="col-12">
        <table class="table table-striped"  id="mytable">
            <thead>
                <tr>
                    <th style="text-align: center; padding-right: 10px;">Fecha</th>
                    <th style="text-align: center; padding-right: 20px;">Placa</th>
                    <th style="text-align: center; padding-right: 20px;">Usuario</th>
                    <th style="text-align: center; padding-right: 10px;">Motivo de Traslado</th>
                    <th style="text-align: center; padding-right: 10px;">Área</th>
                    <th style="text-align: center; padding-right: 20px;">D.Carga</th>
                    <th style="text-align: center; padding-right: 10px;">Punto de Partida</th>
                    <th style="text-align: center; padding-right: 10px;">Punto de Llegada</th>
                    <th style="text-align: center; padding-right: 10px;">Kilometraje Inicial</th>
                    <th style="text-align: center; padding-right: 10px;">Kilometraje Final</th>
                    <th style="text-align: center; padding-right: 10px;">Kilometraje Promedio</th>
                    <th style="text-align: center; padding-right: 10px;">Kilometraje Total</th>
                </tr>
            </thead>
            <tbody style="display: none;"></tbody>
        </table>
    </div>
  </div>
</div>
<?php include_once('../../layouts/footer.php'); ?>
<script type="text/javascript" src="js/listado.js"></script>