                        <!-- 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>Enter Marks</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">
                    <?php 
                        if(@$student_marks[0]['total_marks']!=0)
                            $action = $base_url."senior_exam/update_marks"; 
                        else 
                            $action = $base_url."senior_exam/enter";
                    ?>
                    <form id="theform" class="form-horizontal form-label-left" action="<?php echo $action;?>" method="post">
                      <input type="hidden" name="class" value="<?php echo $class; ?>">
                      <input type="hidden" name="section" value="<?php echo $section; ?>">
                      <input type="hidden" name="subject" value="<?php echo $subject; ?>">
                      <input type="hidden" name="exam" id="exam" value="<?php echo $exam; ?>">
                      <input type="hidden" name="sub_typeid" id="sub_typeid" value="<?php echo $subexam_id; ?>">
                      <input type="hidden" name="session" value="<?php echo $session; ?>">
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="date">Exam Date<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <?php if(@$student_marks[0]['total_marks']!=0){ ?>
                            <input id="date" type="date" class="form-control col-md-7 col-xs-12" name="date" required="required" value="<?php echo $student_marks[0]['paper_date']; ?>">
                            <?php }else{ ?>
                            <input id="date" type="text" class="form-control col-md-7 col-xs-12 datepicker" name="date" Placeholder="DD/MM/YYYY" required="required">
                            <?php } ?>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="total_marks">Total Marks<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <?php if(@$student_marks[0]['total_marks']!=0){ ?>
                            <input id="total_marks"  type="number" class="form-control col-md-7 col-xs-12" name="total_marks" required="required" min="0"  value="<?php echo $student_marks[0]['total_marks']; ?>">
                            <?php }else{ ?>
                            <input id="total_marks"  type="number" class="form-control col-md-7 col-xs-12" name="total_marks" required="required" min="0">
                            <?php } ?>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="passing_marks">Passing Marks<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <?php if(@$student_marks[0]['total_marks']!=0){ ?>
                            <input id="passing_marks" type="number"  class="form-control col-md-7 col-xs-12 get_marks" name="passing_marks" required="required" min="0" value="<?php echo $student_marks[0]['passing_marks']; ?>">
                            <?php }else{ ?>
                            <input id="passing_marks" type="number"  class="form-control col-md-7 col-xs-12 get_marks" name="passing_marks" required="required" min="0">
                            <?php } ?>
                        </div>
                      </div>
                      
                      
                      
                      
                      
                      <div class="ln_solid"></div>
                      <table class="table table-stripped dt-responsive">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>S.Id</th>
                                <th>Roll No</th>
                                <th>Student Name</th>
                                <th>Obtained Marks</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                    function getStudentMarks($id,$data){
                                        foreach($data as $k=>$v)
                                        {
                                            if($v['pid']==$id)
                                            {  
                                                return [$v['id'],$v['obtained_marks']];
                                            }
                                        } 
                                    } 
                                     //var_dump($student);die;
                            $i=1; foreach($student as $key=>$value){ ?>
                            <tr>
                                <td><?php echo $i++; ?></td>
                                <td><?php echo $value['sid']; ?></td>
                                <td><?php echo $value['roll_no'];
        //                          $fetch_std_id=$this->db->select('id')
        //                                     ->from('student')
        //                                     ->where('sid',$value['sid'])
        //                                     ->where('branch',$b_id)
        //                                     ->get()->row()->id;
        //                         $mystudent['mydata']=$fetch_std_id;
        //                   if($class_order<=5)
        //                  {
        //                      $fetch_table=$this->db->where('student_id',$mystudent['mydata'])
        //                                              ->where('is_delete',0)
        //                                              ->order_by('id','desc')
        //                                              ->get('seating_plan')->result();
        //                       if(!empty($fetch_table))
        //                       {

        //                          $fetch_seat_no=$this->db->select('seat_no')
        //                                     ->from('seating_plan')
        //                                     ->where('is_delete',0)
        //                                     ->where('student_id',$mystudent['mydata'])
        //                                     ->order_by('id','desc')
        //                                     ->get()->row()->seat_no; 
        //                                     echo $fetch_seat_no;
        //                       }else{
        //                           echo " ";
        //                       }
        //                  }else{
        //                          $examss = $this->db->select('exam.*')
							 //  		                ->join("exam_type","exam_type.id = exam.etype_id")
								//                      ->where('exam_type.branch_id',$b_id)->where('exam.is_delete',0)->where('exam.id',$exam) 
        //                                              ->get('exam')->row()->id;
							 //  					//var_dump($classs);die;
							   					
								//  $fetch_tables=$this->db->where('student_id',$mystudent['mydata'])
								//                       ->where('exam',$exam)
								//                      ->where('class_id',$class)
								//                      ->where('is_delete',0) 
								//                      ->order_by('id','desc')
        //                                              ->get('seating_plans')->result();
        //                         if(!empty($fetch_tables))
								// 	{
											
								// 		  $fetch_seat_no=$this->db->select('seat_no')
								// 						->from('seating_plans')
								// 						->where('student_id',$mystudent['mydata'])
								// 						->where('class_id',$class)->where('is_delete',0)
								// 						->where('exam',$exam)
								// 						->order_by('id','desc')
								// 						->get()->row()->seat_no; 
								// 	      $blockname=$this->db->select('block.name')
        //                                                 ->from('seating_plans')
        //                                                 ->join('block', 'block.id = seating_plans.block')
        //                                                 ->where('student_id',$mystudent['mydata'])
        //                                                 ->where('class_id',$class)->where('seating_plans.is_delete',0)
        //                                                 ->where('exam',$exam)
        //                                                 ->order_by('seating_plans.id','desc')
        //                                                 ->get()->row()->name;             
								// 						echo $fetch_seat_no.' ('.$blockname.')';
								//  }else{
								//      echo "";
								//  }                    
        //                  }
                                ?></td>
                                <td><?php echo $value['student_name']; ?></td>
                                <td>
                                    <?php 
                                    $val = getStudentMarks($value['id'],$student_marks);
                                   // var_dump($val);
                                   // die();
                                    ?>
                                    <input type="number" step="0.01" class="form-control col-md-7 col-xs-12 get_marks" name="obtained_marks[<?php echo $value['id']; ?>]"   min="0" value="<?php echo @$val[1]; ?>">
                                    <input type="hidden" class="form-control col-md-7 col-xs-12" name="action[<?php echo $value['id']; ?>]" required="required" min="0" value="<?php echo @$val[0]; ?>">
                                </td>
                            </tr>
                            <?php } ?>
                        </tbody>
                      </table>
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-9 col-md-offset-3">
                          <button id="send" type="submit" class="btn btn-success pull-right">Enter</button>
                        </div>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
          </div>
        </div>
         </div>

        <!-- /page content -->
        <!-- footer content -->
        <footer>
          <div class="pull-right">
            Prudmac
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
     

    <!-- jQuery -->
    <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>
<script type="text/javascript">

  $(function(){
      $('#theform').submit(function(e){
        $("#send", this).val("Please Wait...").attr('disabled', 'disabled');
        return true;
      });
});

</script>
<script>
//  $("#send").prop('disabled',true); 

    // 	$('form input').change(function() {
    
    // var value = $(this).val();
    //     if(value.length >0){
    //       $("#send").prop('disabled',false);
    //         }
    // });
</script>
<script>
    /*	$(document).ready(function(){
    $("#send").prop('disabled',false);
    $('form').submit(function() {
  $("#send").prop('disabled',true);
});
    });*/
</script>

    <!-- Custom JS -->
    <script src="<?php echo base_url(); ?>assets/js/main.js"></script>
    <!-- Bootstrap -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo base_url(); ?>assets/vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="<?php echo base_url(); ?>assets/vendors/nprogress/nprogress.js"></script>
    <!-- Chart.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/Chart.js/dist/Chart.min.js"></script>
    <!-- gauge.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/gauge.js/dist/gauge.min.js"></script>
    <!-- bootstrap-progressbar -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
    <!-- iCheck -->
    <script src="<?php echo base_url(); ?>assets/vendors/iCheck/icheck.min.js"></script>
    <!-- Skycons -->
    <script src="<?php echo base_url(); ?>assets/vendors/skycons/skycons.js"></script>
    <!-- Flot -->
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.pie.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.time.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.stack.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.resize.js"></script>
    <!-- Flot plugins -->
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.orderBars.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/date.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.spline.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/curvedLines.js"></script>
    <!-- jVectorMap -->
    <script src="<?php echo base_url(); ?>assets/js/maps/jquery-jvectormap-2.0.3.min.js"></script>
    <!-- bootstrap-daterangepicker -->
    <script src="<?php echo base_url(); ?>assets/js/moment/moment.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/datepicker/daterangepicker.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datepicker/jquery-ui.min.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min.js"></script>
    
      <script  src="<?php echo base_url(); ?>assets/js/notify.js"></script>

 <script>

$(function(){
    var count=0;
    var pwd1=$('#total_marks').val();
  
    $(".get_marks").each(function(){
        //alert($(this).val())
        var pwd2=$(this).val();
        if(parseInt(pwd1) < parseInt(pwd2))
        {
            count=1;
            
            
        }
    });
    if(count==0){
            $('#send').attr('disabled',false);
            
    }else{
       
        $('#send').attr('disabled',true);      
    }
    
});

$(document).on("keyup",".get_marks",function(){
        var count=0;    
     var pwd1=$('#total_marks').val();
  
        
    $(".get_marks").each(function(){
        //alert($(this).val())
        var pwd2=$(this).val();
        //alert(pwd1)
        if(parseInt(pwd1) < parseInt(pwd2))
        {
            count=1;
              $.notify(" Marks Can't be greater than Total Marks ", "danger");
        }
        //alert(count);
    });
    if(count==0){
            $('#send').attr('disabled',false);
    }else{
        $('#send').attr('disabled',true);      
    }
  
});



</script>


   
<script>
$(document).ready(function(){
             $('.DMY').daterangepicker({
      	format: 'DD-MM-YYYY',
        singleDatePicker: true,
        showDropdowns: true
    	});
        // $("#myModal").modal({
            // backdrop: 'static',
            // keyboard: false
    // });
        });
    // Select your input element.
var number = document.getElementById('number');


// Listen for input event on numInput.
number.onkeydown = function(e) {
    if(!((e.keyCode > 95 && e.keyCode < 106)
      || (e.keyCode > 47 && e.keyCode < 58) 
      || e.keyCode == 8)) {
        return false;
    }
}
</script>
<script>
    // Select your input element.
var number = document.getElementById('total_marks');

// Listen for input event on numInput.
number.onkeydown = function(e) {
    if(!((e.keyCode > 95 && e.keyCode < 106)
      || (e.keyCode > 47 && e.keyCode < 58) 
      || e.keyCode == 8)) {
        return false;
    }
}
</script>
<script>
    // Select your input element.

var number = document.getElementById('passing_marks');

// Listen for input event on numInput.
number.onkeydown = function(e) {
    if(!((e.keyCode > 95 && e.keyCode < 106)
      || (e.keyCode > 47 && e.keyCode < 58) 
      || e.keyCode == 8)) {
        return false;
    }
}
</script>

<script>
  $( function() {
    $( ".datepicker" ).datepicker({ dateFormat: 'd-m-yy' }).val();
  } );
  </script>

  </body>
</html>