<!-- page content -->
<style>
    #button_hide{
        display:none;
    }
</style>
        <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>Edit Datesheet</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 action="<?php echo base_url(); ?>Exam/edit_datesheet" class="form-horizontal form-bordered" method="post">
                      <input type="hidden" name="id" value="<?php echo $data['datesheet_id']; ?>">
                      <?php if($this->user_model->is_super()){ ?>
                     <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Branch <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="branch" class="form-control col-md-7 col-xs-12" name="branch" required="required">
                                <option value=''>Select Branch</option>
                          <?php
                          
                                foreach ($branch as $value) {
                          ?>
                                <option value="<?php echo $value['id']; ?>" <?php if($value['id'] == $data['bid'] ){?>selected <?php } ?> ><?php echo $value['name']?></option>
    
                          <?php } ?>
                              </select>
                            </div>
                      </div>
                      <?php  }else{$branch=$this->user_model->getbranch();?>
                          <input id="branch" name="branch" type="hidden" value="<?= $branch ?>">
                      <?php  } ?>

                                             <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Select Class</label>
                        <div class="col-md-6">
                                            <select disabled name="class" id="class" class="form-control" required>
                                                <option value="">Select class</option>
                                                    <?php foreach($class as $value) { 
                                                      if($value['class_id']==$data['class_id'])
                                                        $a = "selected";
                                                      else
                                                        $a = "";
                                                    ?>
                                                <option value="<?php echo $value['class_id']; ?>" <?php echo $a; ?>><?php echo $value['class_name']; ?></option>
                                                    <?php } ?>
                                            </select>
                                <span id="class_loader"></span> 
                                
                        </div>
                      </div> 

               <!-- <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Section</label>
                        <div class="col-md-6">
                                            <select name="section" id="section" class="form-control" required>
                <option value="">Select Section</option>
                                                    <?php foreach($section as $value) { 
                                                      if($value['section_id']==$data['section_id'])
                                                        $a = "selected";
                                                      else
                                                        $a = "";
                                                    ?>
                                                        <option value="<?php echo $value['section_id']; ?>" <?php echo $a; ?>><?php echo $value['section_name']; ?></option>
                                                    <?php } ?>
              </select>
              <span id="section_loader"></span> 
                                
                        </div>
                      </div> -->
                                            

                                            <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Subject</label>
                        <div class="col-md-6">
                                            <select name="subject" id="subject" class="form-control" required>

                <option value="">Select subject</option>
                                                    <?php foreach($subject as $value) { 
                                                      if($value['id']==$data['subject_id'])
                                                        $a = "selected";
                                                      else
                                                        $a = "";
                                                    ?>
                                                        <option value="<?php echo $value['id']; ?>" <?php echo $a; ?>><?php echo $value['name']; ?></option>
                                                    <?php } ?>
              </select>
                                
                        </div>
                      </div>
                                            
                        
                        <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Exam Type</label>
                        <div class="col-md-6">
                                            <select disabled name="exam" id="exam" class="form-control" required>
                                            <!--<option value="">Select Exam Type </option>
                                                                        <?php foreach($exam as $value) { 
                                                                          if($value['id']==$data['exam_id'])
                                                                            $a = "selected";
                                                                          else
                                                                            $a = "";
                                                                          
                                                                          ?>
                                                        <option value="<?php echo $value['id']; ?>" <?php echo $a; ?>><?php echo $value['name']; ?></option>
                                                    <?php } ?>-->
                                              
                                            </select>
                                
                        </div>
                      </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Exam Date</label>
                        <div class="col-md-6">
                                                <input type="date" name="date" class="form-control" required="" value="<?php echo $data['date_exam']; ?>">
                                
                        </div>
                    </div>
                   <!-- <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Exam Day</label>
                        <div class="col-md-6">
                                                <input type="text" name="day" class="form-control" required="" value="<?php echo $data['day_exam']; ?>">
                                
                        </div>
                    </div>-->

                    <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Time Start</label>
                        <div class="col-md-6">
                                               
                                 <!--<input id='timepicker' class="form-control" type='text'  name="time_start" class="form-control" required="" value="<?php echo $data['start_time']; ?>" >-->
                                 <input id="timepicker" type="text" name="time_start" value="<?php echo $data['start_time']; ?>" title="timepicker" class="form-control " style="width: 100%;" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label" for="inputSuccess">Time End</label>
                        <div class="col-md-6">
                                               
                                <!--<input id='timepicker1' class="form-control" type='text'  name="time_end" class="form-control" required="" value="<?php echo $data['end_time']; ?>"> -->
                                <input id="timepicker1" type="text" name="time_end" value="<?php echo $data['end_time']; ?>" title="timepicker" class="form-control" style="width: 100%;" />
                        </div>
                    </div>

                       
                        <div class="row">
                            <button class="btn btn-success col-lg-offset-8" id="button_hide" type="submit" name="submit">Update</button>
                        </div>  
                    
                                            
                      </form>
                      </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

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

    <!-- jQuery -->
    <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></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/js/kendo.all.min.js"></script>
     <script>
                $(document).ready(function () {
                   $("#button_hide").show();
                    //$("input[type='submit']").prop('disabled', 'false');
                    // create TimePicker from input HTML element
                    $("#timepicker").kendoTimePicker({
                        dateInput: true
                    });
                });
            </script>
                 <script>
                $(document).ready(function () {
                    // create TimePicker from input HTML element
                    $("#timepicker1").kendoTimePicker({
                        dateInput: true
                    });
                });
            </script>
    
     <script src="<?php echo base_url()?>assets/select/js/select2.min.js"></script>
   <script>
 
     /*$('#class').select2({
     //selectOnClose: true,
    placeholder: "Select a Class",
    allowClear:true
    });*/
    </script>
    <script>
 
     $('#subject').select2({
     //selectOnClose: true,
    placeholder: "Select a Subject",
    allowClear:true
    });
    </script>
     <script>
 
     $('#exam').select2({
     //selectOnClose: true,
    placeholder: "Select a Exam",
    allowClear:true
    });
    </script>


    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min.js"></script>
    
    <script>
        $(document).ready(function(){
                var value = $('#branch').val();
               $.get("<?php echo base_url(); ?>Load/exam/"+value,{},function(data){
                    var pre = "<option value=''>Select Exam</option>";
                    $("#exam").html(pre+data);
                    $("#exam").val(<?php echo $data['exam_id']; ?>);
                  });
            
        });
    </script>

    <script>
      $(function(){
        $(document).on("change","#branch",function(){
          var val = $(this).val();
          $.get("<?php echo base_url(); ?>Load/classs/role/"+val,{},function(data){
            var pre = "<option value=''>Select Class</option>";
            $("#class").html(pre+data);
          });
          $.get("<?php echo base_url(); ?>Load/exam/"+val,{},function(data){
                    var pre = "<option value=''>Select Exam</option>";
                    $("#exam").html(pre+data);
                    $("#exam").val(<?php echo $data['exam_id']; ?>);
                  });
        });
      });
    </script>
    
<script>
      $(function(){
        $(document).on("change","#class",function(){
          var val = $(this).val();
          $.get("<?php echo base_url(); ?>Load/subject_class/"+val,{},function(data){
            var pre = "<option value=''>Select subject</option>";
            $("#subject").html(pre+data);
          });
        });
      });
</script>

  </body>
</html>