<?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_assurance.php';
    ?>

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

            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Liste des assurances d&eacute;j&agrave; enregistr&eacute;</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
               



                <table id="mytable" class="table table-bordered table-striped" style="width:100%">
        <thead>
            <tr>
                <th>Plaque</th>
                <th>Date debut</th>
                <th>Date Fin</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
          <?php

          $resultat=$this->Model->getRequete('SELECT voiture_assurance.DATE_DEBUT, voiture_assurance.DATE_FIN, voiture_statut.DESCRIPTION AS STATUS, voiture_vehicules.PLAQUE_VEHICULE FROM voiture_assurance JOIN voiture_vehicules ON voiture_vehicules.VEHICULE_ID = voiture_assurance.VEHICULE_ID JOIN voiture_statut ON voiture_statut.ID_STATUS = voiture_assurance.ID_STATUS ');

          foreach ($resultat as $key) 
         {
          $DATE_DEBUT=date_create($key['DATE_DEBUT']);
          $DATE_DEBUT = date_format($DATE_DEBUT,"d/m/Y");
          $DATE_FIN=date_create($key['DATE_FIN']);
          $DATE_FIN = date_format($DATE_FIN,"H:i d/m/Y ");
      
          
          echo "<tr>
                <td>".$key['PLAQUE_VEHICULE']."</td>
                <td>".$key['DATE_DEBUT']."</td>
                <td>".$key['DATE_FIN']."</td>
                <td>".$key['STATUS']."</td>";
         echo "</tr>";
       }
          ?>
            
        </tbody>
        
    </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>

<script type="text/javascript">
  function changelist() {
document.getElementById("myForm").submit();
  }

  $('#reservation').daterangepicker({

        locale: {
        format: 'DD/MM/YYYY'
      }
    })
  $('.select').select2();

</script>
</body>
</html>
