<?php
  include VIEWPATH.'includes/new_header.php';
  ?>
  
<body class="hold-transition sidebar-mini">
<!-- Site wrapper -->
<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_perte_stock.php';
    ?>

    <!-- Main content -->
    <section class="content">

      <!-- Default box -->
      <div class="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">Enregistrement d'un perte</h3>
              </div>
              <!-- /.card-header -->
              <!-- form start -->
                <form role="form" action="<?=base_url('stock/Perte_Stock/add')?>" enctype="multipart/form-data" method="POST">
                <div class="card-body row">

                

                <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Date Perte stock<spam class="text-danger">*</spam></label>
                    <input type="date" class="form-control" id="DATE_RETOUR_STOCK" name="DATE_RETOUR_STOCK" placeholder="Date entree stock" value="<?=set_value('DATE_RETOUR_STOCK')?>">
                    <?php echo form_error('DATE_RETOUR_STOCK', '<div class="text-danger">', '</div>'); ?>
                  </div> 
                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Quantite <spam class="text-danger">*</spam></label>
                    <input type="text" class="form-control" id="QUANTITE" name="QUANTITE" placeholder="Quantite" value="<?=set_value('QUANTITE')?>">
                    <input type="hidden" class="form-control" id="PERTE_RETOUR" name="PERTE_RETOUR" value="2">
                    
                    <?php echo form_error('QUANTITE', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-4">
                    <label for="exampleInputEmail1">Type de Bouteille <spam class="text-danger">*</spam> </label>
                    <select  onchange="get_commune(this.value)" class="custom-select" name="ID_TYPE_BOUTEILLE" id="ID_TYPE_BOUTEILLE">
                          <option value="">-- Select --</option>
                          <?php
                          foreach ($typebout as $typebous) {
                           echo"<option value='".$typebous['ID_TYPE_BOUTEILLE']."'>".$typebous['DESCRIPTION']."</option>";
                          }
                          ?>
                        </select>
                    
                    <?php echo form_error('ID_TYPE_BOUTEILLE', '<div class="text-danger">', '</div>'); ?>
                  </div>


                  <div class="form-group col-lg-4">
                    <label for="exampleInputEmail1">Taille <spam class="text-danger">*</spam> </label>
                    <select class="custom-select" name="ID_TAILLE_BOUTEILLE" id="ID_TAILLE_BOUTEILLE">
                          <option value="">-- Select --</option>
                          
                          <?php
                          foreach ($tailbout as $typebous) {
                           echo"<option value='".$typebous['ID_TAILLE_BOUTEILLE']."'>".$typebous['DESCRIPTION']."</option>";
                          }
                          ?>
                        </select>
                    
                    <?php echo form_error('ID_TAILLE_BOUTEILLE', '<div class="text-danger">', '</div>'); ?>
                  </div>

                  <div class="form-group col-lg-4">
                    <label for="exampleInputEmail1">Motif <spam class="text-danger">*</spam> </label>
                    <select class="custom-select" name="ID_MOTIF_RETOUR" id="ID_MOTIF_RETOUR">
                          <option value="">-- Select --</option>
                          
                          <?php
                          foreach ($retourst as $retourmotif) {
                           echo"<option value='".$retourmotif['ID_MOTIF_RETOUR']."'>".$retourmotif['DESCRIPTION']."</option>";
                          }
                          ?>
                        </select>
                    
                    <?php echo form_error('ID_MOTIF_RETOUR', '<div class="text-danger">', '</div>'); ?>
                  </div>

                  <div class="form-group col-lg-12">
                    <label for="exampleInputEmail1">Commentaire <spam class="text-danger">*</spam> </label>
                    <textarea class="form-control"  name="COMMENTAIRE" id="COMMENTAIRE" rows="3"></textarea>

                    
                    
                    <?php echo form_error('COMMENTAIRE', '<div class="text-danger">', '</div>'); ?>
                  </div>

                  

                    

                    
                  
                </div>
                <!-- /.card-body -->

                <div class="card-footer">
                  <button type="submit" class="btn btn-primary btn-block">Enregistrer</button>
                </div>
              </form>
            </div>
        
        
        <!-- /.card-body -->
        <!-- <div class="card-footer">
          Footer
        </div> -->
        <!-- /.card-footer-->
      </div>
      <!-- /.card -->

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <?php
 include VIEWPATH.'includes/new_copy_footer.php';  
  ?>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<?php
  include VIEWPATH.'includes/new_script.php';
  ?>

<script>
  $(document).ready(function(){ 
    $('#message').delay(5000).hide('slow');
    });



    function get_commune(prov){
    var form= new FormData();
    form.append("prov",prov);
    $.ajax({
            url: "<?php echo base_url('voiture/Garage/get_commune/');?>"+prov,
            type: "POST",
            data: form,
            processData: false,  
            contentType: false,
            success: function(data){
            $('#COMMUNE_ID').html(data);
           
          }
    }); 

  }

  $('#sandbox-container input').datepicker({
});
</script>


  


</body>
</html>
