<style>
    .required{
        color: #bf5050;
    }
    
</style>

        <!-- 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>Section Wise Report Card</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 ($this->session->flashdata('msg' )): ?>
                            <div class="alert alert-danger">
                            <?php echo $this->session->flashdata('msg'); ?>  
                            </div>
                             <?php endif; ?>
                    <form class="form-horizontal form-label-left" id="routePermit" action="<?php echo $base_url;?>exam/get_section_reportcart" method="post">
                     <?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 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="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="class">Class<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="class" class="form-control col-md-7 col-xs-12 class" name="class" required="required">
                            <option value=''>Select Class</option>
                          </select>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="section">Section<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="section" class="form-control col-md-7 col-xs-12 section" name="section" required="required">
                            <option value=''>Select Section</option>
                          </select>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Session">Session<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="session" class="form-control col-md-7 col-xs-12 session" name="session" required="required">
                            <option value=''>Select Session</option>
                            <?php foreach($session as $k=>$v){ ?>
                            <option value='<?php echo $v['id']; ?>'><?php echo $v['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="section">Exam<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="exam" class="form-control col-md-7 col-xs-12 exam" name="exam" required="required">
                            <option value=''>Select Exam</option>
                          </select>
                        </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">Submit</button>
                        </div>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
        
      </div>
    </div>
    
  
    

    <!-- jQuery -->
    <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>
    <script>
        $(document).ready(function(){
            
                var value = $('#branch').val();
                $.get("<?php echo base_url(); ?>load/classs/role/"+value,{},function(d){
                    var pre = '<option value="">Select Class</opiton>';
                    $("#class").html(pre+d);
                });
                $.get("<?php echo base_url(); ?>load/exam/"+value,{},function(d){
                    var pre = '<option value="">Select Exam</opiton>';
                    $(".exam").html(pre+d);
                });
            
        });
    </script>
    
<script>
        $(document).ready(function(){
            $(document).on("change","#branch",function(){
                var value = $(this).val();
                $.get("<?php echo base_url(); ?>load/classs/role/"+value,{},function(d){
                    var pre = '<option value="">Select Class</opiton>';
                    $(".class").html(pre+d);
                });
            });
            
        });
          $(document).ready(function(){
            $(document).on("change",".class",function(){
                var value = $(this).val();
                $.get("<?php echo base_url(); ?>load/section/role/"+value,{},function(d){
                    var pre = '<option value="">Select Section</opiton>';
                    $(".section").html(pre+d);
                });
            });
            
        });
          $(document).ready(function(){
            $(document).on("change",".branch",function(){
                var value = $(this).val();
                $.get("<?php echo base_url(); ?>load/exam/"+value,{},function(d){
                    var pre = '<option value="">Select Exam</opiton>';
                    $(".exam").html(pre+d);
                });
            });
            
        });
    </script>
    
      <script src="<?php echo base_url()?>assets/select/js/select2.min.js"></script>
   <script>
 
      <?php if($this->user_model->is_super()){ ?>
      $('#branch').select2({
     //selectOnClose: true,
    allowClear:true
    });
     <?php }?>
    </script>
   <script>
 
     $('#class').select2({
     //selectOnClose: true,
    allowClear:true
    });
    </script>
    <script>
 
     $('#section').select2({
     //selectOnClose: true,
    allowClear:true
    });
    </script>
    <script>
 
     $('#session').select2({
     //selectOnClose: true,
    allowClear:true
    });
    </script>
     <script>
 
     $('#session').select2({
     //selectOnClose: true,
    allowClear:true
    });
    </script>
     <script>
 
     $('#exam').select2({
     //selectOnClose: true,
    allowClear:true
    });
    </script>
     <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/bootstrapValidator.js"></script>
<!-- Form Validator-->
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrapValidator.css"/>
  
  <script type="text/javascript">
    $(document).ready(function() {
        $('#routePermit')
            .on('init.form.bv', function(e, data) {
                //console.log(data);
            })
            .bootstrapValidator({
                message: 'This value is not valid',
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {
                    password: {
                validators: {
                    identical: {
                        field: 'confirmPassword',
                        message: 'The password and its confirm are not the same'
                    }
                }
            },
            confirmPassword: {
                validators: {
                    identical: {
                        field: 'password',
                        message: 'The password and its confirm are not the same'
                    }
                }
            },
            name: {
                        trigger:'change keyup',
                        validators: {
                             regexp: {
                                 regexp: /^[a-z\s]+$/i,
                                     message: 'The last name can consist of alphabetical characters and spaces only'
                              }
                        }
                    },
            username: {
                        trigger:'change keyup',
                        validators: {
                             regexp: {
                                 regexp: /^[a-z\s]+$/i,
                                     message: 'The full name can consist of alphabetical characters and spaces only'
                              }
                        }
                    },        
            fname: {
                        trigger:'change keyup',
                        validators: {
                            regexp: {
                                 regexp: /^[a-z\s]+$/i,
                                     message: 'The full name can consist of alphabetical characters and spaces only'
                              }
                        }
                    },
                    
            contact: {
                        validators: {
                            notEmpty: {
                                        message: 'The contact is required and cannot be empty'
                                },
                                        
                                    }
                                },

                    'phone[]': {
                      
                    trigger:'blur',
                validators: {
                    
                         stringLength: {
                            min: 13,
                            max: 13,
                            message: 'The phone numbe   r must be mobile number'
                        }
                }
            },
                
                   
                }
            });
    });
    
$("#zzz").click(function(){
   $('#routePermit').bootstrapValidator("resetForm",true);    
});

</script>

<script>
window.setTimeout(function() {
  $(".alert").fadeTo(500, 0).slideUp(500, function(){
      $(this).remove(); 
  });
  }, 2000);
</script>