<?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_vehicule.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 voitures d&eacute;j&agrave; enregistr&eacute;</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
                <table id="example1" class="table table-bordered table-striped table-hover">
                  <thead>
                  <tr>
                    <th>Plaque</th>
                    <th>Chassis</th>
                    <th>Marque</th>
                    <th>Usage</th>
                    <th>Options</th>
                  </tr>
                  </thead>
                  <tbody>

                  <?php


                  foreach ($resultat as $key) 
         {
          

      echo '<div class="modal fade" id="modal-delet'.$key['VEHICULE_ID'].'">
        <div class="modal-dialog modal-lg">
          <div class="modal-content">
            <div class="modal-header">
              <h4 class="modal-title">Suppimer ou Annuler de '.$key['VEHICULE_ID'].'</h4>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body">
            Les actions que vous allez faire sont irreversible!
            </div>
            <div class="modal-footer justify-content-between">
              <button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
              <a class="btn btn-warning" href="#">Annuler Enregistrement</a>
            </div>
          </div>
          <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
      </div>';

      
          echo "<tr>
                     <td>".$key['PLAQUE_VEHICULE']."</td>
                     <td>".$key['NUMERO_CHASSIS']."</td>
                     <td>".$key['DESCRIPTION']."</td>
                     <td>".$key['VEHICULE_CATEGORIE_DESCR']."</td>";
          // if($this->mylibrary->get_permission('Vehicule') ==1) {
          $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">
        ';
          // if ($options != 2 and $options != 3 and $options != 4 ) {
            $modadcontent.='<div class="dropdown-divider"></div>
          <a href="' . base_url('voiture/Vehicule/modifier/' .$key['VEHICULE_ID']). '" class="dropdown-item">
            <!-- Message Start -->
            <div class="media">
              <div class="media-body">
                <h3 class="dropdown-item-title">
                  Modifier
                </h3>
                <p class="text-sm">Modification de '.$key['PLAQUE_VEHICULE'].'</p>
              </div>
            </div>
            <!-- Message End -->
          </a>';
          // }
          
          
          $modadcontent.='<div class="dropdown-divider"></div>
          
          
        </div>
      </li>
      
    </ul>
  </nav>';
         // }
 //  else
 //  {
 // $modadcontent='<font style="color:red"><center><i class="fa fa-times-circle"></i></center></font>';  
 //  }
         echo "<td>".$modadcontent."</td>";
         echo"</tr>";

                          
       
     
     }
                //     foreach ($resultat as $key) 
                //     {
                     
                //      if ($key['STATUS'] == 1) {
                //        $stat = 'Actif';
                //        $fx = 'desactiver';
                //        $col = 'btn-danger';
                //        $titr = 'Désactiver';
                //        $stitr = 'voulez-vous désactiver ce service ';
                //        $bigtitr = 'Désactivation de ce service';
                //      }
                //      else{
                //        $stat = 'Innactif';
                //        $fx = 'reactiver';
                //        $col = 'btn-primary';
                //        $titr = 'Réactiver';
                //        $stitr = 'voulez-vous réactiver ce service ';
                //        $bigtitr = 'Réactivation de ce service';
                //      }

                //      echo "<tr>
                //      <td>".$key['DESCRIPTION']."</td>
                //      <td>".$key['SERVICE']."</td>
                //      <td>".$key['DIRECTION']."</td>
                //      <td></td>
                //      <td></td>
                //      <td>".$stat."</td>
                //      <td><div class='modal fade' id='desactcat".$key['ID_SECTION']."' tabindex='-1' role='dialog' aria-labelledby='basicModal' aria-hidden='true'>
                //      <div class='modal-dialog modal-sm'>
                //        <div class='modal-content'>
                //          <div class='modal-header'>
                //            <h4 class='modal-title' id='myModalLabel'>".$bigtitr."</h4>
                //            <button type='button' class='close' data-dismiss='modal' aria-label='Close'>
                //              <span aria-hidden='true'>&times;</span>
                //            </button>
                //          </div>
                //          <div class='modal-body'>
                //            <h6><b>Mr/Mme , </b> ".$stitr." (".$key['DESCRIPTION'].")?</h6>
                //          </div>
                //          <div class='modal-footer'>
                //            <button type='button' class='btn btn-default' data-dismiss='modal'>Annuler</button>
                //            <a href='".base_url("organigramme/Section/".$fx."/".$key['ID_SECTION'])."' class='btn ".$col."'>".$titr."</a>
                //          </div>
                //        </div>
                //      </div>
                //    </div>
                   
                //              <div class='dropdown '>
                //                        <a class='btn btn-primary btn-sm dropdown-toggle' data-toggle='dropdown'>Actions
                //                        <span class='caret'></span></a>
                //                        <ul class='dropdown-menu dropdown-menu-right'>
                                       
                //                        <li><a class='dropdown-item' href='".base_url("organigramme/Section/index_update/".$key['ID_SECTION'])."'> Modifier </a> </li>
                //                        <li><a class='dropdown-item' href='#' data-toggle='modal' data-target='#desactcat".$key['ID_SECTION']."'> ".$titr." </a> </li>
                //                        </ul>
                //                      </div></td>
                //    </tr>";
           
                     
                                     
                //   // $tabledata[]=$chambr;<li><a class='dropdown-item' href='".base_url("organigramme/Service/details/".$key['ID_SERVICE'])."'> Details et Historique </a> </li>
                // }
                  ?>
                  
                  </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>
