<script src="<?php echo base_url();?>assets/choosen.js"></script>
<link rel="stylesheet" href="<?php echo base_url();?>assets/style.css">
  
 <?php echo form_open(base_url(''),array('class'=>"form-horizontal add_fg_stock", 'id'=>"add_fg_stock")); ?>
                                    
                <?php if($this->session->flashdata('fg_stock_success')){ ?>
        <div class="alert alert-success solid" style='text-align:center;'><?php echo $this->session->flashdata('fg_stock_success'); ?></div>
    <?php } ?> 

     <div id='fg_stock_success' class='alert alert-success solid' style='display:none;'></div>   
<div class="row">
        
               
                <input type="hidden" name="created" id="created" value="<?php echo date('Y-m-d H:i:s'); ?>" class="form-control required">
         

        
        <input type="hidden" value="<?php echo date('Y-m-d'); ?>" name="insert_date" id="insert_date" class="form-control required">


          <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>">

          			 <div class="col-lg-4 col-md-6 col-sm-12">
                       <div class="form-group">
                            <label class="form-label">Machine:</label>
                             <select class="form-control machine"name="machine" required="required" id="machine">
                                <option>Select Option</option>
                                <?php  if(!empty($get_machine_data)){ 

                                   ?>

                                    <?php foreach($get_machine_data as $get_machine){ 
                                        $check_type = machine_type_ibm($get_machine['machine']);
                                            if($check_type == 3){
                                        ?>
                                    <option value="<?php echo $get_machine['machine']; ?>"><?php echo machine_name($get_machine['machine']); ?></option>

                                <?php } } }?>
                                
                            </select>
                         </div>
                        </div>

                        

                     <div class="col-lg-4 col-md-6 col-sm-12">
                       <div class="form-group">
                        <label class="form-label">Item:</label>
                       <input type="text" id="product_name" name="product_name" readonly="readonly"  placeholder="Product Name" required="required"  class="form-control product_name">
                     </div>
                    </div>

                    <div class="col-lg-4 col-md-6 col-sm-12">
                       <div class="form-group">
                        <label class="form-label">Job #:</label>
                       <input type="text" id="job" readonly="readonly" name="job" placeholder="JOB NO" required="required"  class="form-control job">
                     </div>
                    </div>

        		 <div class="col-lg-2 col-md-6 col-sm-12" id="range1_max_div" style="display:none;">
                            <div class="form-group">
                                <label class="form-label badge badge-warning">Rang1 Max:</label>
                            <input type="text" id="range1_max" name="range1_max" readonly="readonly"  class="form-control">
                            </div>
                            </div>

                            <div class="col-lg-2 col-md-6 col-sm-12" id="range1_min_div" style="display:none;">
                            <div class="form-group">
                                <label class="form-label badge badge-warning">Range1 Min:</label>
                            <input type="text" id="range1_min" name="range1_min" readonly="readonly"  class="form-control">
                            </div>
                            </div>

                            <div class="col-lg-2 col-md-6 col-sm-12" id="range2_max_div" style="display:none;">
                            <div class="form-group">
                                <label class="form-label badge badge-warning">Range2 Max:</label>
                            <input type="text" id="range2_max" name="range2_max" readonly="readonly"  class="form-control">
                            </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range2_min_div" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range2 Min:</label>
                           <input type="text" id="range2_min" name="range2_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range3" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range3 Max:</label>
                           <input type="text" id="range3_max" name="range3_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range4" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range3 Min:</label>
                           <input type="text" id="range3_min" name="range3_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range5" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range4 Max:</label>
                           <input type="text" id="range4_max" name="range4_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range6" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range4 Min:</label>
                           <input type="text" id="range4_min" name="range4_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range7" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range5 Max:</label>
                           <input type="text" id="range5_max" name="range5_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range8" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range5 Min:</label>
                           <input type="text" id="range5_min" name="range5_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range9" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Injection Pressure Max:</label>
                           <input type="text" id="inj_pressure_max" name="inj_pressure_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range10" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Injection Pressure Min:</label>
                           <input type="text" id="inj_pressure_min" name="inj_pressure_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range11" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Injection Speed Max:</label>
                           <input type="text" id="inj_speed_max" name="inj_speed_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range12" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Injection Speed Min:</label>
                           <input type="text" id="inj_speed_min" name="inj_speed_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range13" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">DOZ Pressure Max:</label>
                           <input type="text" id="doz_pressure_max" name="doz_pressure_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range14" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">DOZ Pressure Min:</label>
                           <input type="text" id="doz_pressure_min" name="doz_pressure_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range15" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Doz Speed Max:</label>
                           <input type="text" id="doz_speed_max" name="doz_speed_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range16" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Doz Speed Min:</label>
                           <input type="text" id="doz_speed_min" name="doz_speed_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>
                        <div class="col-lg-2 col-md-6 col-sm-12" id="range17" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Air Blast Time Max:</label>
                           <input type="text" id="blast_time_max" name="blast_time_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>
                        <div class="col-lg-2 col-md-6 col-sm-12" id="range18" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Air Blast Time Min:</label>
                           <input type="text" id="blast_time_min" name="blast_time_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>
                        <div class="col-lg-2 col-md-6 col-sm-12" id="range19" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Expect Max:</label>
                           <input type="text" id="expect_max" name="expect_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>
                        <div class="col-lg-2 col-md-6 col-sm-12" id="range20" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Expect Min:</label>
                           <input type="text" id="expect_min" name="expect_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range21" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">M-O-T Range Max:</label>
                           <input type="text" id="m_o_t_max" name="m_o_t_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range22" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">M-O-T Range Min:</label>
                           <input type="text" id="m_o_t_min" name="m_o_t_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                       

                        <hr/>
                            <div class="col-lg-12 col-md-6 col-sm-12">
                         <h3> A<hr/></h3>
                     </div>


                      <div class="col-lg-2 col-md-6 col-sm-12">

                        <div class="form-group">
                            <label class="form-label">Range 1</label>
                             <input type="text" id="rang_1" name="rang_1" placeholder="Range 1" required="required"  class="form-control heater1">
                        </div>
                    </div>
                   <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 2</label>
                             <input type="text" id="rang_2" name="rang_2" placeholder="Range 2" required="required"  class="form-control heater2">
                        </div>
                    </div>


                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 3</label>
                             <input type="text" id="rang_3" name="rang_3" placeholder="Range 3" required="required"  class="form-control rang_3">
                        </div>
                    </div>



                     <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 4</label>
                             <input type="text" id="rang_4" name="rang_4" placeholder="Range 4" required="required"  class="form-control rang_4">
                        </div>
                    </div>

                          
                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 5</label>
                             <input type="text" id="rang_5" name="rang_5" placeholder="Range 5" required="required"  class="form-control rang_5">
                        </div>
                    </div>


                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Injection Pressure</label>
                             <input type="text" id="inject_pressure" name="inject_pressure" placeholder="inject pressure" required="required"  class="form-control rang_5">
                        </div>
                    </div>


                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Injection Speed </label>
                             <input type="text" id="inject_speed" name="inject_speed" placeholder="inject Speed" required="required"  class="form-control rang_5">
                        </div>
                    </div>



                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">DOZ Pressure </label>
                             <input type="text" id="doz_pressure" name="doz_pressure" placeholder="DOZ Pressure" required="required"  class="form-control rang_5">
                        </div>
                    </div>



                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Doz Speed</label>
                             <input type="text" id="doz_speed" name="doz_speed" placeholder="DOZ Speed" required="required"  class="form-control rang_5">
                        </div>
                    </div>

                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Air Blast Time </label>
                             <input type="text" id="air_blast" name="air_blast" placeholder="AIR BLAST" required="required"  class="form-control rang_5">
                        </div>
                    </div>

                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Expect</label>
                             <input type="text" id="expect" name="expect" placeholder="EXPECT" required="required"  class="form-control rang_5">
                        </div>
                    </div>


                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">M.T.O</label>
                             <input type="text" id="m_t_o" name="m_t_o" placeholder="M.T.O" required="required"  class="form-control rang_5">
                        </div>
                    </div>



                        <div class="col-lg-2 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Die Condition</label>
                                    <select class="form-control" required="required" name="die_condition" id="die_condition">
                                     <option>Select Option</option>
                                     <option value="Good">Good</option>
                                     <option value="Bad">Bad</option>
                                        
                            </select>
                         </div>
                        </div>

                      <div class="col-lg-2 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Pressure Quality</label>
                                    <select class="form-control" required="required" name="pieces_quality" id="pieces_quality">
                                     <option>Select Option</option>
                                     <option value="sp">S-P</option>
                                     <option value="wp">W-P</option>
                                     <option value="ok">OK-PCS</option>
                                        
                            </select>
                         </div>
                        </div>



                      <div class="col-lg-2 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Mould Cooling</label>
                                    <select class="form-control" required="required" name="mould_cooling" id="mould_cooling">
                                     <option>Select Option</option>
                                     <option value="hot">HOT</option>
                                     <option value="normal">Normal</option>
                                     <option value="cold">Cold</option>
                                        
                            </select>
                         </div>
                        </div>


                       

                    <div class="col-lg-2 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Shift</label>
                                    <select class="form-control" required="required" name="shift" id="shift">
                                     <option>Select Option</option>
                                     <option value="day">Day</option>
                                     <option value="night">Night</option>
                                        
                            </select>
                         </div>
                        </div>



                    <div class="col-lg-2 col-md-6 col-sm-12">
                            <div class="form-group">
                            <label class="form-label">Remarks</label>
                            <select class="form-control" required="required" name="remarks" id="remarks">
                                
                                     <option>Select Option</option>
                                     <option value="Machine issue">Machine Issue</option>
                                     <option value="Die problem">Die Problem</option>
                                      <option value="Ok Pcs">Ok Pcs</option> 
                            </select> 
                             </div>
                         </div>

                  

                 </div>

                  <?php form_close();?>
               <button type="submit" id="dis_submit" class="btn btn-primary">Save <i class="icon-arrow-right14 position-right"></i></button>
                <div class="col-12">
					<div class="card">
						    <div class="card-body">
                                <button type="button" class="btn btn-rounded btn-success" onclick="btnExport_monthly();"><span class="btn-icon-left text-success"><i class="fa fa-download color-success"></i>
                                    </span>Download</button>
                               <br/><br/><br/>
                                <div class="table-responsive">

                                    <table  id="example" class="table table-striped table-bordered" style="font-size:10px;">
                                        <thead>
                                            <tr>
                                                
                                                <th>Machine</th>
                                                <th>Item</th>
                                                <th>Job#</th>
                                                <th>Date</th>
                                                <th>Die</th>
                                                <th>Range 1 Max</th>
                                                <th>Range 1 Min</th>
                                                <th>Range 2 Max</th>
                                                <th>Range 2 Min</th>
                                                <th>Range 3 Max</th>
                                                <th>Range 3 Min</th>
                                                <th>Range 4 Max</th>
                                                <th>Range 4 Min</th>
                                                <th>Range 5 Max</th>
                                                <th>Range 5 Min</th>
                                            
                                                <th>Shift</th>
                                                <th>Remarks</th>
                                                <th>Date/Time</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                          
                                        </tbody>
                                        <tbody>
                                        <?php
                                        if(!empty($get_supervisor_data)){
                                         foreach($get_supervisor_data as $get_supervisor_datas){ ?>
                                        
                                      <tr>
                                        <td><strong><?php 
                                        //$machine =  machine_from_production($get_supervisor_datas['machine']); 
                                        echo machine_name($get_supervisor_datas['machine']);

                                    ?></strong></td>
                                        <td><strong><?php echo $get_supervisor_datas['product_name']; ?></strong></td>      
                                        <td><?php echo $get_supervisor_datas['job']; ?></td>
                                        <td><?php echo $get_supervisor_datas['insert_date']; ?></td>
                                        <td><?php echo $get_supervisor_datas['die_condition']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range1_max']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range1_min']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range2_max']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range2_min']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range3_max']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range3_min']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range4_max']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range4_min']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range5_max']; ?></td>
                                        <td><?php echo $get_supervisor_datas['range5_min']; ?></td>
                                        
                                      
                                        <td><?php echo $get_supervisor_datas['shift']; ?></td>
                                        <td><?php echo $get_supervisor_datas['remarks']; ?></td>
                                        <td><?php echo $get_supervisor_datas['created']; ?></td>
                                        
                                        <td><a href="#" class="btn btn-sm btn-primary"><i class="la la-pencil"></i></a></td>
                                      </tr>
                                      <?php } } ?>
                                        </tbody>
                                    </table>
                                </div>
                                
                            </div>
                            </div>
                            </div>



      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <style>
        .redborder{
            border:1px solid red;
        }
        </style>

        <SCRIPT language=Javascript>
       <!--
       function isNumberKey(evt)
       {
          var charCode = (evt.which) ? evt.which : evt.keyCode;
          if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
             return false;

          return true;
       }
       //-->
    </SCRIPT>


    <script type='text/javascript'>


          $(".machine").chosen();


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

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

                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Order_qc/get_item_production_supervisor_1'); ?>',
                            data:{machine:machine},
                            dataType:'json',
                            success:function(data){
                            
                                    $('#product_name').val(data.product_name);
                                    $('#job').val(data.job);
                                    /*$('#total_qty').val(data.total_qty);*/
                                      
                                  
                            },
                            error:function(data){console.log(data.responseText);}
                        });

    });


        
    var add_fg_stocks = $('#add_fg_stock');   
    
    add_fg_stocks.on('submit',function(e){
  //$("#dis_submit").attr('disabled', true);
        e.preventDefault();
        
        var add_fg = add_fg_stocks.serialize();
         
     
          if (confirm('Are you sure you want to Add.?')) {
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Order_qc/add_supervisor1'); ?>',
                data:add_fg,
                dataType:'json',
                success:function(data){
                
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#fg_stock_success').show().html('Added Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Order_qc/qc_production_on_machine/'); ?>"} , 2000);
                    }else{
                        console.log('third'+data);          
                    }
                },
                error:function(data){console.log(data.responseText);}
            });
        }
        
    });

    $("#machine").change(function() {
       var machine =  this.value;
        //alert(id);
        $('#range1_max_div').show();
        $('#range1_min_div').show();
        $('#range2_max_div').show();
        $('#range2_min_div').show();
        $('#range3').show();
        $('#range4').show();
        $('#range5').show();
        $('#range6').show();
        $('#range7').show();
        $('#range8').show();
        $('#range9').show();
        $('#range10').show();
        $('#range11').show();
        $('#range12').show();
        $('#range13').show();
        $('#range14').show();
        $('#range15').show();
        $('#range16').show();
        $('#range17').show();
        $('#range18').show();
        $('#range19').show();
        $('#range20').show();
        $('#range21').show();
        $('#range22').show();

        $.ajax({
            type:'POST',
            url:'<?php echo base_url('Order_qc/get_item_production1'); ?>',
            data:{machine:machine},
            dataType:'json',
            success:function(data){

                    $('#product_name').val(data.product_name);
                    $('#job').val(data.job);


                        $('#range1_max').val(data.range1_max);
                        $('#range1_min').val(data.range1_min);
                        $('#range2_max').val(data.range2_max);
                        $('#range2_min').val(data.range2_min);
                        $('#range3_max').val(data.range3_max);
                        $('#range3_min').val(data.range3_min);
                        $('#range4_max').val(data.range4_max);
                        $('#range4_min').val(data.range4_min);
                        $('#range5_max').val(data.range5_max);
                        $('#range5_min').val(data.range5_min);

                        $('#inj_pressure_max').val(data.inj_pressure_max);
                        $('#inj_pressure_min').val(data.inj_pressure_min);
                        $('#inj_speed_max').val(data.inj_speed_max);
                        $('#inj_speed_min').val(data.inj_speed_min);
                        $('#doz_pressure_max').val(data.doz_pressure_max);
                        $('#doz_pressure_min').val(data.doz_pressure_min);
                        $('#doz_speed_max').val(data.doz_speed_max);
                        $('#doz_speed_min').val(data.doz_speed_min);
                        $('#blast_time_max').val(data.blast_time_max);
                        $('#blast_time_min').val(data.blast_time_min);
                        $('#expect_max').val(data.expect_max);
                        $('#expect_min').val(data.expect_min);
                        $('#m_o_t_max').val(data.m_o_t_max);
                        $('#m_o_t_min').val(data.m_o_t_min);
                       
                    /*$('#total_qty').val(data.total_qty);*/
                      
                  
            },
            error:function(data){console.log(data.responseText);}
        });

});



$("#rang_1").keyup(function(){
     var range1_max  = parseInt($('#range1_max').val());
     var range1_min  = parseInt($('#range1_min').val());
       var rang_1 = parseInt($('#rang_1').val());
      if(range1_max >= rang_1 && rang_1 >= range1_min){
        $('#rang_1').css('border-color', 'green'); 
      }else{
        $('#rang_1').css('border-color ', 'red'); 
      }
      
    });


    $("#rang_2").keyup(function(){
     var range2_max  = parseInt($('#range2_max').val());
     var range2_min  = parseInt($('#range2_min').val());
       var rang_2 = parseInt($('#rang_2').val());
      if(range2_max >= rang_2 && rang_2 >= range2_min){
        $('#rang_2').css('border-color', 'green'); 
      }else{
        $('#rang_2').css('border-color', 'red'); 
      }
      
    });


    $("#rang_3").keyup(function(){
     var range3_max  = parseInt($('#range3_max').val());
     var range3_min  = parseInt($('#range3_min').val());
       var rang_3 = parseInt($('#rang_3').val());
      if(range3_max >= rang_3 && rang_3 >= range3_min){
        $('#rang_3').css('border-color', 'green'); 
      }else{
        $('#rang_3').css('border-color', 'red'); 
      }
      
    });


    $("#rang_4").keyup(function(){
     var range4_max  = parseInt($('#range4_max').val());
     var range4_min  = parseInt($('#range4_min').val());
       var rang_4 = parseInt($('#rang_4').val());
      if(range4_max >= rang_4 && rang_4 >= range4_min){
        $('#rang_4').css('border-color', 'green'); 
      }else{
        $('#rang_4').css('border-color', 'red'); 
      }
      
    });

    $("#rang_5").keyup(function(){
     var range5_max  = parseInt($('#range5_max').val());
     var range5_min  = parseInt($('#range5_min').val());
       var rang_5 = parseInt($('#rang_5').val());
      if(range5_max >= rang_5 && rang_5 >= range5_min){
        $('#rang_5').css('border-color', 'green'); 
      }else{
        $('#rang_5').css('border-color', 'red'); 
      }
      
    });


    $("#inject_pressure").keyup(function(){
     var inj_pressure_max  = parseInt($('#inj_pressure_max').val());
     var inj_pressure_min  = parseInt($('#inj_pressure_min').val());
       var inject_pressure = parseInt($('#inject_pressure').val());
      if(inj_pressure_max >= inject_pressure && inject_pressure >= inj_pressure_min){
        $('#inject_pressure').css('border-color', 'green'); 
      }else{
        $('#inject_pressure').css('border-color', 'red'); 
      }
      
    });


    $("#inject_speed").keyup(function(){
     var inj_speed_max  = parseInt($('#inj_speed_max').val());
     var inj_speed_min  = parseInt($('#inj_speed_min').val());
       var inject_speed = parseInt($('#inject_speed').val());
      if(inj_speed_max >= inject_speed && inject_speed >= inj_speed_min){
        $('#inject_speed').css('border-color', 'green'); 
      }else{
        $('#inject_speed').css('border-color', 'red'); 
      }
      
    });


    $("#doz_pressure").keyup(function(){
     var doz_pressure_max  = parseInt($('#doz_pressure_max').val());
     var doz_pressure_min  = parseInt($('#doz_pressure_min').val());
       var doz_pressure = parseInt($('#doz_pressure').val());
      if(doz_pressure_max >= doz_pressure && doz_pressure >= doz_pressure_min){
        $('#doz_pressure').css('border-color', 'green'); 
      }else{
        $('#doz_pressure').css('border-color', 'red'); 
      }
      
    });


    $("#doz_speed").keyup(function(){
     var doz_speed_max  = parseInt($('#doz_speed_max').val());
     var doz_speed_min  = parseInt($('#doz_speed_min').val());
       var doz_speed = parseInt($('#doz_speed').val());
      if(doz_speed_max >= doz_speed && doz_speed >= doz_speed_min){
        $('#doz_speed').css('border-color', 'green'); 
      }else{
        $('#doz_speed').css('border-color', 'red'); 
      }
      
    });


    $("#air_blast").keyup(function(){
     var blast_time_max  = parseInt($('#blast_time_max').val());
     var blast_time_min  = parseInt($('#blast_time_min').val());
       var air_blast = parseInt($('#air_blast').val());
      if(blast_time_max >= air_blast && air_blast >= blast_time_min){
        $('#air_blast').css('border-color', 'green'); 
      }else{
        $('#air_blast').css('border-color', 'red'); 
      }
      
    });


    $("#expect").keyup(function(){
     var expect_max  = parseInt($('#expect_max').val());
     var expect_min  = parseInt($('#expect_min').val());
       var expect = parseInt($('#expect').val());
      if(expect_max >= expect && expect >= expect_min){
        $('#expect').css('border-color', 'green'); 
      }else{
        $('#expect').css('border-color', 'red'); 
      }
      
    });


    $("#m_t_o").keyup(function(){
     var m_o_t_max  = parseInt($('#m_o_t_max').val());
     var m_o_t_min  = parseInt($('#m_o_t_min').val());
       var m_t_o = parseInt($('#m_t_o').val());
      if(m_o_t_max >= m_t_o && m_t_o >= m_o_t_min){
        $('#m_t_o').css('border-color', 'green'); 
      }else{
        $('#m_t_o').css('border-color', 'red'); 
      }
      
    });


  </script>