<?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_garage.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 garages d&eacute;j&agrave; enregistr&eacute;</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
               



                <table id="example1" class="table table-bordered table-striped" style="width:100%">
        <thead>
            <tr>
                <th>Nom du garage</th>
                <th>Province</th>
                <th>Commune</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
          <?php

          $resultat=$this->Model->getRequete('SELECT voiture_garage.GARAGE_ID, voiture_garage.GARAGE_NOM, syst_provinces.PROVINCE_NAME, syst_communes.COMMUNE_NAME FROM `voiture_garage` JOIN syst_provinces ON syst_provinces.PROVINCE_ID = voiture_garage.PROVINCE_ID JOIN syst_communes ON syst_communes.COMMUNE_ID = voiture_garage.COMMUNE_ID WHERE 1');

          foreach ($resultat as $key) 
         {
          
      
          
          echo "<tr>
                <td>".$key['GARAGE_NOM']."</td>
                <td>".$key['PROVINCE_NAME']."</td>
                <td>".$key['COMMUNE_NAME']."</td>";

                $modadcontent ='<ul class="navbar-nav ml-auto text-center">
      <li class="nav-item dropdown">
        <a class="nav-link" data-toggle="dropdown" href="#">
          <i class="fas fa-cog"></i>
        </a>
        <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
        ';
            $modadcontent.='<div class="dropdown-divider"></div>
          <a href="' . base_url('voiture/Garage/modifier/' .$key['GARAGE_ID']). '" class="dropdown-item">
            <!-- Message Start -->
            <div class="media">
              <div class="media-body">
                <h3 class="dropdown-item-title">
                  Modifier
                </h3>
                <p class="text-sm"> '.$key['GARAGE_NOM'].'</p>
              </div>
            </div>
            <!-- Message End -->
          </a>';          
          
          $modadcontent.='<div class="dropdown-divider"></div>
          
          
        </div>
      </li>
      
    </ul>
  </nav>';
         echo "<td>".$modadcontent."</td></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>
