        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
                <div class="title_left">
                   
                </div>
            </div>
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Add Stock</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">

                    <form class="form-horizontal form-label-left" action="<?php echo base_url() ?>Inventory/save_stock" method="post">
  <p style="color:green;font-weight: bold;padding:10px;text-align: center"><?php echo $this->session->flashdata('msg');?></p>  
        
               <div class="item form-group">
              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Select Categories <span class="required">*</span>
              </label>
              <div class="col-md-6 col-sm-6 col-xs-12">
   <select class="form-control select2_single" name="category_id" id="category_id" required="required">
     <option  value="">Select Categories</option>
            <?php

        

            foreach($cat as $row)
            { ?>
              
              
              <option value="<?php echo $row->id?>"><?php echo $row->category_name?></option>
            <?php 
            
            }
            ?>
            </select>
              </div>
            </div>
               <div class="item form-group">
              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Select Subcategories <span class="required">*</span>
              </label>
              <div class="col-md-6 col-sm-6 col-xs-12">
                
                <select class="form-control select2_single" name="sub_cat_id" id="subcat" required="required">
              <option  value="">Select Subcategories</option>
            </select>
             </div>
            </div>

               <div class="item form-group">
              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Select Brands <span class="required">*</span>
              </label>
              <div class="col-md-6 col-sm-6 col-xs-12">
                
                <select class="form-control select2_single" name="brand_id" id="brand" required="required">
                      <option  value="">Select Brands</option>
                 
            </select>
             </div>
            </div>
              <div class="item form-group">
              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Select Product <span class="required">*</span>
              </label>
              <div class="col-md-6 col-sm-6 col-xs-12">
                
                <select class="form-control select2_single" name="product_id" id="product" required="required">
                      <option  value="">Select Product</option>
                
            </select>
             </div>
            </div>

                <div class="item form-group">
              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Expiry Date <span class="required">*</span>
              </label>
              <div class="col-md-6 col-sm-6 col-xs-12">
                <input id="name" class="form-control col-md-7 col-xs-12"  name="expiry_date" required="required" type="date">
              </div>
            </div>

              <div class="item form-group">
              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Quantity <span class="required">*</span>
              </label>
              <div class="col-md-6 col-sm-6 col-xs-12">
                <input id="name" class="form-control col-md-7 col-xs-12"name="quantity" required="required" type="number">
              </div>
            </div>
          <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <button id="send" type="submit" class="btn btn-success pull-right">Add</button>
                        </div>
                      </div>
          </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->
        <footer>
          <div class="pull-right">
            
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>
    <link href="<?php echo base_url(); ?>assets/vendors/select2/dist/css/select2.min.css" rel="stylesheet">
    <!-- jQuery -->
    <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/select2/dist/js/select2.full.min.js"></script>
    <!-- Datatables -->
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/jszip/dist/jszip.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/vfs_fonts.js"></script>

    <!-- Datatables -->
    
  </body>
</html>

<script>
     $(".select2_single").select2({
            placeholder: "Select Option",
            allowClear: true
         });
</script>

<script>
$(function(){
    $('#category_id').change(function() {
      
   var c=$('#category_id').val();
   console.log(c);
   $.ajax({
          url: "<?php echo base_url();?>Inventory/get_sub_cat/"+c, 
        success: function(result){
          //console.log(result);
          var pre = '<option value="">Select sub category</option>';
              $("#subcat").html(pre+result);
          }});

    })
});

  </script> 


<script>
$(function(){
    $('#subcat').change(function() {
      
   var c=$('#subcat').val();
  console.log(c);
   $.ajax({
          url: "<?php echo base_url();?>Inventory/get_brand/"+c, 
        success: function(result){
          console.log(result);
          var pre = '<option value="">Select brands</option>';
              $("#brand").html(pre+result);
          }});

    })
});

  </script>

  <script>
$(function(){
    $('#brand').change(function() {
      
   
   var c=$('#category_id').val();
    var s=$('#subcat').val();
    var b=$('#brand').val();
  
  console.log(c);
  console.log(s);
  console.log(b);

  $.ajax({
         url: "<?php echo base_url();?>Inventory/get_product/"+c+"/"+s+"/"+b, 
      success: function(result){
          console.log(result);
          var pre = '<option value="">Select product</option>';
              $("#product").html(pre+result);
          }});

    })
});

  </script>