<script src="<?php echo base_url();?>assets/choosen.js"></script>
<link rel="stylesheet" href="<?php echo base_url();?>assets/style.css">


        <label class="form-label">Products:</label>
                      <select class="form-control production_id" name="production_id" required id="production_id">
                        <option>Select Option</option>
                      <?php foreach ($get_so_production_products as $get_so_production_product) { ?>
                     
                       <option value="<?php echo $get_so_production_product['production_id']; ?>">
                          <?php echo $get_so_production_product['product_name']; ?></option>
                              
                     <?php } ?> </select>



                        <script src="<?php echo base_url();?>assets/js/jjquery.min.js"></script>


                     <script type="text/javascript">
                        
                        

                    
                          $("#production_id").change(function() {

                
    
                                    var production_id =  this.value;
                                         
                                    $.ajax({
                                                type:'POST',
                                                url:'<?php echo base_url('Stock/get_so_production_production_id'); ?>',
                                                data:{production_id:production_id},
                                                dataType:'json',
                                                success:function(data){
                                                
                                                       
                                               $('.materials').show().html(data.html);


                                                       
                                                },
                                                error:function(data){console.log(data.responseText);}
                                            });

                        });



                           $("#production_id").change(function() {

    
                                    var production_id =  this.value;
                                  

                                    $.ajax({
                                                type:'POST',
                                                url:'<?php echo base_url('Stock/get_material_code_production'); ?>',
                                                data:{production_id:production_id},
                                                dataType:'json',
                                                success:function(data){
                                                
                                                        $('#code').val(data.codes);
                                                        $('#type').val(data.type);
                                                        $('#total_qty').val(data.total_qty);
                                                      //  $('#wast_stock').val(data.wast_stock);
                                                        
                                                },
                                                error:function(data){console.log(data.responseText);}
                                            });

                        });



          $("#production_id").change(function() {

                var production_id =  this.value;
                //alert(id);

                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Stock/get_machine_code_production'); ?>',
                            data:{production_id:production_id},
                            dataType:'json',
                            success:function(data){
                            
                                   
                                    $('#weight_wast').val(data.total_qty);
                                    $('#wlot').val(data.wast_lot);
                            },
                            error:function(data){console.log(data.responseText);}
                        });

    });

                     </script>