
<style>
    .required{
        color: #bf5050;
    }
    #def{
        display:none;
    }
    </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>Teacher Attendance</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; ?>Teacherattendancecr/save" method="post">
                          <!--branch check-->
                      <?php if(!$this->user_model->is_super()){ 
                                   $branch=$this->user_model->getbranch(); ?>
	                            <input type="hidden" class="form-control" name="branch" id="branch" value="<?= $branch ?>">
                                <?php } ?>
               
                <!--branch-->
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Date <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-3 col-sm-3 col-xs-6">
<input type="text" class="form-control date datepicker" id="date" name="date" onchange="myFunction()"
pattern="([0-9]{2}|[0-9]{1})[-]([0-9]{2}|[0-9]{1})[-][0-9]{4}" required="true" required placeholder="dd-mm-yyyy" >

                        </div>
                      </div>
                     <div id="def">
                     <table class="table table-striped">
                     <tr>
                     <td>Sr.#</td>
                     <td>Name</td>
                     <td>specialization</td>
                     <td>Contact</td>
                     <td>Status</td>
                     
                     
                     </tr>
                       <?php if($teacher){?>
                     <?php $var=1; foreach ($teacher as $key => $value) {
                         
                     ?>
                     <tr>
                     <td><?php echo $var; ?></td>
                     <td><?php echo $value['firstname']." ".$value['lastname'];?></td>
                     <td><?php echo $value['specialization'];?></td>
                    <td><?php echo $value['contact'];?></td>
                    <td> 
                    <?php foreach ($Attendancestatus as $key => $dt) { ?>
                      
                     
                    <input type="radio" <?php if($dt["name"]=="P"){echo "checked";}  ?> name="status[<?php echo $value['id'];?>]"  required="required" value="<?php echo $dt['id']  ?>"/>&nbsp;<span style="color:black;font-size:15px"> <?php echo $dt['name'];?></span>
                     &nbsp;
                     
                     <?php  }?>
                     </td>
                     </tr>
                     <?php $var++;?>
                    <?php } ?>
                     <?php }else{ ?>

                            <tr><td colspan = "5" style="text-align:center">No Record Found</td></tr>
                    <?php } ?>
                     </table>
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <button style="float:right;" id="send" type="submit" class="btn btn-success" <?php if(empty($teacher)) echo "disabled"?> >Save</button>
                        </div>
                      </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>
  <!-- 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>
    <!-- Jquery UI-daterangepicker -->
    <script src="<?php echo base_url(); ?>assets/vendors/datepicker/jquery-ui.min.js"></script>
    <script src="<?php echo base_url()?>assets/select/js/select2.min.js"></script>
    <!--Notify-->
    <script  src="<?php echo base_url(); ?>assets/js/notify.js"></script>
<script>
<?php if($this->user_model->is_super()){ ?>
    $('#branch').select2();
<?php } ?>
    $('#branch').change(function(){
        
        var val=$(this).val();
        //alert(val);
           
          $.ajax({
         url: '<?php echo base_url(); ?>load/teacheragainstbranch/'+val,
        data: {},
        success: function (result) {
            $("tbody.center").html(result);
            
                                     }
                });
        });
</script>
<script>
 $( function() {
    $( ".datepicker" ).datepicker({ dateFormat: 'd-m-yy' , maxDate: "+0" }).val();
  } );
</script>

    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min.js"></script>
      
    <script>
        $(".abc").on("keypress", 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;
        });

         $('.abc').on("paste", function (e) {
            e.preventDefault();
        });
        $(".abc1").on("keypress", 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;
        }); $('.abc1').on("paste", function (e) {
            e.preventDefault();
        });
        $(document).bind("contextmenu", function (e) {
            e.preventDefault();
        });
    </script>
    <script>
function myFunction() {
     $date=$('#date').val();
     $branch=$('#branch').val();
     //alert($date);
         $.ajax({
         url: '<?php echo base_url(); ?>Teacherattendancecr/check_date_att/'+ $date+'/'+$branch,
        data: {},
        success: function (res) {
                            if(res == 1)
                            {
                                 $("#def").show();
                                
                            }
                             else{
                                
                                $.notify("Selected day's Attendance already marked ...", "danger");
                                $("#def").hide();
                               
                             }
                     },
                     error: function(){
                                        alert("failure");
                                    }
                });
     //alert($val);
}
</script>
  </body>
</html>