<?php
  include VIEWPATH.'includes/new_header.php';
  ?>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  
  <?php
  include VIEWPATH.'includes/new_top_menu.php';
  include VIEWPATH.'includes/new_menu_principal.php';
  ?>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    
    <?php 
    include 'includes/menu_traitement_courier.php';
    ?>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">



          <form id="FormData" action="<?php echo base_url()?>courier/Recherche_Courier/index" method="POST" accept-charset="utf-8" enctype="multipart/form-data">
              
              
                <div class="card-body row">
                  
                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Référence du courier <spam class="text-danger">*</spam></label>
                    <input type="text" id="NUM_COURIER" class="form-control" name="NUM_COURIER" value="">
                  </div>

                  <div class="form-group col-lg-6"><br>
                  <button type="submit" class="btn btn-primary btn-block">Rechercher</button>
                  </div>
                  
                </div>
                
              </form>
            <!-- </div> -->
            
            <!-- /.card -->

            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Liste des couriers enregistr&eacute;</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
                <table id="example1" class="table table-bordered table-striped table-hover">
                  <thead>
                  <tr>
                    <th>Référence</th>
                    <th>Objet</th>
                    <th>Type</th>
                    <th>Nature</th>
                    <th>Destinataire</th>
                    <th>Date</th>
                    <th>Expediteur</th>
                    <th></th>
                  </tr>
                  </thead>
                  <tbody>

                  <?php
                    foreach ($resultat as $key) 
                    {
                       
                      
                    $date_enregistrement = $key['DATE_TIME_ENREGISTREMENT'];
                    $date_formattee = date('h:i d/m/Y', strtotime($date_enregistrement));
                     echo "<tr>
                     <td>".$key['NUM_COURIER']."</td>
                     <td>".$key['OBJET_COURIER']."</td>
                     <td>".$key['TYPE_COURIER']."</td>
                     <td>".$key['NATURE_COURIER']."</td>
                     <td>".$key['DESTINATAIRE_PRINCIPAL']."</td>
                     <td>".$date_formattee."</td>
                     <td>".$key['NOM_CORRESPONDANT']."</td>
                     <td>
                     <a href='".base_url("courier/Recherche_Courier/details/".$key['ID_COURIER'])."' class='btn btn-primary btn-xs'>Details</a>
                     </td>
                   </tr>";
           
                }
                  ?>
                  
                  </tfoot>
                </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <?php
 include VIEWPATH.'includes/new_copy_footer.php';  
  ?>
  

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>

<!-- ./wrapper -->
<?php
  include VIEWPATH.'includes/new_script.php';
  ?>

<!-- Page specific script -->
<script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true, "lengthChange": false, "autoWidth": false,
      "buttons": ["excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example1_wrapper  .col-md-6:eq(0)');
   
  });
</script>
</body>
</html>
