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

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            
            <!-- /.card -->
            <?php 
             if(!empty($this->session->flashdata('message')))
               echo $this->session->flashdata('message');
            ?>
            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Entree stock</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
               



                <table id="example1" class="table table-bordered table-striped" style="width:100%">
        <thead>
            <tr>
                <th>Date entree</th>
                <th>Intitule</th>
                <th>Quantite</th>
                <th>Prix d'achat</th>
                <th>Date enregistrement</th>
            </tr>
        </thead>
        <tbody>
          <?php

          $resultat=$this->Model->getRequete('SELECT `ID_CONSOMMABLE`, `DATE_ENTREE_STOCK`,type_consommables.DESCRIPTION_CONSO , `QUANTITE`, `PRIX_ACHAT`, `DATE_INSERTION` FROM `consommable` LEFT JOIN type_consommables ON type_consommables.ID_TYPE_CONSOMMABLES=consommable.INTITULE WHERE 1 ');

          foreach ($resultat as $key) 
         {
           
          echo "<tr>
                <td>".$key['DATE_ENTREE_STOCK']."</td>
                <td>".$key['DESCRIPTION_CONSO']."</td>
                <td>".$key['QUANTITE']."</td>
                 <td>".$key['PRIX_ACHAT']."</td>
                <td>".$key['DATE_INSERTION']."</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('donnee/Consommables/index_update/' .$key['ID_CONSOMMABLE']). '" class="dropdown-item">
            <!-- Message Start -->
            <div class="media">
              <div class="media-body">
                <h3 class="dropdown-item-title">
                  Modifier
                </h3>
                <p class="text-sm"> #'.$key['ID_CONSOMMABLE'].'</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>
