<style>
    .required{
        color: #bf5050;
    }
    
</style>
<?php //var_dump($coster);die(); ?>
        <!-- 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>Adjust Security</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 class="form-horizontal form-label-left" action="<?php echo base_url();?>Salary/getArrearemp" method="post" id="form1">
                      

                       <center><?php echo form_error('grno',"<p style='color:red;font-size:12px;'>");?> </center>
                       <span class="col-lg-12 bg-success text-success" id="success" style="margin-bottom:5px;padding:5px;<?php if($success==true) echo 'display:block;';else echo 'display:none;'; ?>">Arrears successfully applied</span>
                     <?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="name">Type<span class="required">*</span>
                        </label>
                        <div class="col-md-4 col-sm-6 col-xs-6">
                            <select class="form-control" required name="type" id="type">
                              <option value=''>Select Type</option>
                              <option value='teacher'>Teacher</option>
                              <option value='staff'>Staff</option>
                              
                                                </select> 
                           </div>
                      </div>

                      <div class="item form-group">
                        <?php $date = date('Y-m'); ?>
                        <label class="control-label col-md-2 col-sm-2 col-xs-4 col-md-offset-1" for="class"> For Month<span class="required">*</span>
                        </label>
                        <div class="col-md-4 col-sm-2 col-xs-4">
                                     
            <input type="month"  id="for_date" class="form-control" name="for_date" required="true" placeholder="dd-mm-yyyy" value="<?= $date; ?>" >           
                        </div>
                        
                      
                      </div>
                      <table id="datatable2" class="table table-striped table-borderd">
                          <thead>
                                <tr>
                     <td>Sr.#</td>
                      <td>ID</td>
                     <td>Name</td>
                     <td>Enter Security</td>
                     
                     </tr>
                          </thead>
                   
                     <tbody class="center22">
                     
                     
                      
                     
                    
                    
                    </tbody>
                     </table>
                            
                      <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 -->
        <!-- 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>

    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min.js"></script>
    
     <!-- Datatables -->
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/jszip/dist/jszip.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/vfs_fonts.js"></script>
    <script src="<?php echo base_url()?>assets/select/js/select2.min.js"></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: {
                    
            lname: {
                        trigger:'change keyup',
                        validators: {
                             regexp: {
                                 regexp: /^[A-Za-z0-9]+$/i,
                                     message: 'The SID can consist of alphabetical & numeric characters'
                              }
                        }
                    },
                   
                }
            });
    });
    
$("#zzz").click(function(){
   $('.routePermit').bootstrapValidator("resetForm",true);    
});

</script>
<script>

    <?php if($this->user_model->is_super()){ ?>
     $('#branch').select2({
     //selectOnClose: true,
    placeholder: "Select a Branch",
    allowClear:true
    });
    <?php } ?>
    $('#class').select2({
     //selectOnClose: true,
    placeholder: "Select a Class",
    allowClear:true
    });
    $('#section').select2({
     //selectOnClose: true,
    placeholder: "Select a Section",
    allowClear:true
    });
    
    $(document).on("keyup","#sid",function(){
        //alert('Hello');
        $('button[type=submit], input[type=submit]').prop('disabled',false);
      });
    
    $('form').submit(function(){
  	$('button[type=submit], input[type=submit]').prop('disabled',true);
      });
    </script>

  <!-- Datatables -->
    <script>
      $(document).ready(function() {
            $("#datatable-buttons").DataTable({
		
		dom: 'Blftipr',
		    buttons: [
		        'csv',
		        'excel',
		        'pdf',
		        'print'
		    ]
            });
      });
    </script>
    <!-- /Datatables -->
    
    
 <script>

    $('#type').change(function() {


   var c=$(this).val();
   
   if(c=="teacher"){

       $.ajax({
     url: '<?php echo base_url(); ?>Salary/adjust_teacher/',
      success: function (result) {

           $("#datatable2").dataTable().fnDestroy();
           setTimeout(function(){ 
                $("tbody.center22").html(result);
                $('#datatable2').DataTable();
            },500);
           }
      });


   }else{
    $.ajax({
     url: '<?php echo base_url(); ?>Salary/adjust_staff/',
      success: function (result) {
           $("#datatable2").dataTable().fnDestroy();
           setTimeout(function(){ 
                $("tbody.center22").html(result);
                $('#datatable2').DataTable();
            },500);
           }
      });


    }
        

  });
  </script>
    
    <script>
    $(document).on("keypress",".abc", function (event) {

            var englishAlphabetAndWhiteSpace = /[A-Za-z ]/g;


            var key = String.fromCharCode(event.which);


            if (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 37 || event.keyCode == 39 || englishAlphabetAndWhiteSpace.test(key)) {
                return true;
            }
            return false;
        });

         
        $(document).on("keypress",".abc1", function (event) {

            var englishAlphabetAndWhiteSpace = /[A-Za-z0-9|-]/g;


            var key = String.fromCharCode(event.which);


            if (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 32 || event.keyCode == 37 || event.keyCode == 39 || englishAlphabetAndWhiteSpace.test(key)) {
                return true;
            }


            return false;
        });
         //form only numbers
        $(".num").on("keypress", function (e) {
          
            var evt = (e) ? e : window.event;
            var charCode = (evt.keyCode) ? evt.keyCode : evt.which;
            if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }
            return true;
        });
    </script>
  </body>
</html>