        
              <style>
    .dataTables_filter { visibility: true;}
    #def{
  display:none;
}

.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" id="scroll">
                  <h2>Student Attendance View</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" >
               
                <!--////////////////////////////////////////////////////////////////////////////////////////////////////////////////-->
                
                <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12 text-right" for="name">Date <span class="text-danger"></span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="input" class="form-control date datepicker" id="doa" name="date" pattern="([0-9]{2}|[0-9]{1})[-]([0-9]{2}|[0-9]{1})[-][0-9]{4}" required-temp="true" placeholder="dd-mm-yyyy" 
                          style="width:50%;">                  <br>
                        </div>
                </div>
                <div class="row">
                  <div class="col-md-3 col-md-offset-3">
                   <button style="float:right;background-color:#169F85; color:white;" id="btn_search" type="submit" class="btn btn-succes">Search</button>
                  </div>
                </div><hr><br>
                          
                        <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap">
                    <thead class="center">
                      <tr>
                        <th>#</th>
                        <th>SID</th>
                        <th style="width:150px;">Student Name</th>
                        <th>Class</th>
                        <th>Section</th>
                        <th>Date</th>
                        <th>Branch</th>
                        <th>Status</th>
                      </tr>
                    </thead>


                    <tbody class="center">
                      <?php
                      $i=1; foreach ($studentatt as $key => $value)
                      
                       { ?>
                      <tr>
                        <td><?php echo $i++; ?></td>
                        <td><?php echo $value['sid']; ?></td>
                        <td><?php echo $value['student_name']; ?></td>
                        <td><?php echo $value['class_name']; ?></td>
                        <td><?php echo $value['section_name']; ?></td>
                        <td><?php echo date("d-m-Y",strtotime($value['date'])); ?></td>
                        <td><?php echo $value['b_name']; ?></td>
                        <td><?php echo $value['status']; ?></td>
                      </tr>
                      <?php } ?>
                      
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
         

                </div>
              </div>
            </div>

          </div>
        </div>
      </div>
      <!-- /page content -->

      <!-- footer content -->
      <footer>
        <div class="pull-right">
          Prudmac
        </div>
        <div class="clearfix"></div>
      </footer>
      <!-- /footer content -->
    </div>
  </div>
<div id='ajaxload' style='position:fixed;top:0;left:0;bottom:0; width:100%;height:100%;z-index:1000;background:rgba(2,132,130,0.5);display:none;'>
            <i class='fa fa-spinner fa-spin fa-4x' style='position: relative;top: 50%;left: 60%;margin-top: -50px;margin-left: -40px;'></i>
        </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>
      <!-- Jquery UI-daterangepicker -->
    <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>
    
     <!-- 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/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/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>
    <!--/ Datatables -->
    <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>
        $('#status').click(function(){
            alert($( 'input[name=status]' ).val());
        });
    </script>
        
    
    <script>
        
     $( function() {
        $( '.date' ).datepicker({ dateFormat: 'd-m-yy' }).val();
      } );
    
        function date(selector) {
            var dNow = new Date();
            var localdate = dNow.getFullYear()+'/' +(dNow.getMonth() + 1)+'/' + dNow.getDate();
           
        };
    </script>
    <script>

        $("#btn_search").click(function(){
            var br = '';
            var val=$('.date').val();
            if(val == '') { val = 0 ;}
            $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
        $.ajax({
         url: '<?php echo base_url(); ?>/load/againstdatestudentatt_student/'+val,
        data: {},
        success: function (result) 
        {
            $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
        $("#datatable-buttons").dataTable().fnDestroy();
               setTimeout(function(){ 
               $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
                dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
        }
        });
        });
       // <window.location='<?= base_url(); ?>student/studentatt_show/'+$val;>
    </script> 



  <script>
    $(document).ready(function() {
      var handleDataTableButtons = function() {
        if ($("#datatable-buttons").length) {
          $("#datatable-buttons").DataTable({
                dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              buttons: [
                {
                  extend: "copy",
                    className: "btn-sm"
                },
                {
                  extend: "csv",
                    className: "btn-sm"
                },
                {
                  extend: "excel",
                  
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                    className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                    className: "btn-sm"
                },
                {
                  extend: "print",
                  className: "btn-sm"
                },
                
              ],
              responsive: true
          });
        }
      };

      TableManageButtons = function() {
        "use strict";
        return {
          init: function() {
            handleDataTableButtons();
          }
        };
      }();

      TableManageButtons.init();
    });
  
  </script>
  <!-- /Datatables -->
  <script>
    function edit(id,event){
    //alert(id);
    var br = $('#branch').val();
    //alert(br);exit();
  event.preventDefault();
  $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
  $.ajax({
     url: '<?php echo base_url(); ?>Student/get_record/'+id+'/'+br,
        data: {},
         success: function (result)
          { 
            $(document).ajaxStop(function() {
          $('#ajaxload').hide();
      });
            var obj=JSON.parse(result);
          //  alert(obj.status_id);
           $("#edit_id").val(obj.id);
            $("#name").val(obj.student_name);
            $("#class").val(obj.class_name);
            $("#section").val(obj.section_name);
            $("#date1").val(obj.date);
            // $('#status').find(':radio[name=status][value="'+obj.status_id+'"]').prop('checked', false);
            $("#status").val(obj.status_id);
             $('#def').show();
         $('html, body').animate({
        scrollTop: $("#scroll").offset().top
    }, 1000);
            
            }
      });
}
</script>
<script>
   $(document).ready(function() { 
    $("#new_type").click(function(event){
        //alert($("#edit_id").val());
  event.preventDefault();
   $('#def').hide();
  var value=$("#new_type").val();
  var date=$("#date1").val();
  var status = $('input[name=status]:checked').val();
 $('input[name="status"]').prop('checked', false);
//   alert(status);exit();
  
if( date=="" || status=="")
  {
    alert("Please fill the fields");
    $('#def').show();
    return false;
  }
if(value=="Update")
{
  var id=$("#edit_id").val();
  var date=$("#date1").val();
  
  $(document).ajaxStart(function() {
                 $('#ajaxload').show();
             });
   $.ajax({
    url:'<?php echo base_url()?>Student/studentatt_upd/'+id+"/"+date+"/"+status,data:{},
    success: function (result) {
  $(document).ajaxStop(function() {
          $('#ajaxload').hide();
      });
      $.notify("Attendance Successfully Updated..", "success");
           $("#datatable-buttons").dataTable().fnDestroy();
           setTimeout(function(){ 
               $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
                dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
           }
  });

}
});//end if for button type checking
});
</script>
<script>
function delete_att(id,event){
    //alert(id);
    var br = $('#branch').val();
    //alert(br);
  event.preventDefault();
  $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
  $.ajax({
     url: '<?php echo base_url(); ?>Student/delete_record/'+id+'/'+br,
        data: {},
         success: function (result)
          { 
            $(document).ajaxStop(function() {
          $('#ajaxload').hide();
            });
          $.notify("Attendance Successfully Deleted..", "success");
           $("#datatable-buttons").dataTable().fnDestroy();
           setTimeout(function(){ 
               $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
                dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4, 5, 6 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
         
            
            }
      });
}
</script>
</body>
</html>