
 <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark">Student Attandence</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item"><a href="#">Report</a></li>
              <li class="breadcrumb-item active">Student Attandence</li>

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

    <section class="content">
      <div class="container-fluid">
        <div class="card card-default">
          <div class="card-header">
            <h3 class="card-title">All Student Attandence</h3>
            <div class="card-tools">
            </div>
          </div>
          <div class="card-body">
            <form id="data_form">
              <div class="row d-flex align-items-center justify-content-center">
                <div class="col-md-5">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Select A Batch <span class="required">*</span></label>
                     <div class="col-sm-12">
                        <select class="form-control" name="batch" required>
                          <option>Select</option>
                          <?php foreach ($all_batch as $batch):?>
                            <option value="<?php echo $batch->batch_id; ?>"><?php echo $batch->batch_name; ?></option>
                          <?php endforeach; ?>
                        </select>
                     </div>
                  </div>
                </div>
                <div class="col-sm-5">
                  <div class="form-group">
                    <label for="inputEmail" class="col-sm-12 col-form-label">Select A Date <span class="required">*</span></label>
                     <div class="col-sm-12">
                        <input class="form-control" type="date" name="date" required>
                     </div>
                   </div>
                </div>
                <div class="col-sm-2">
                  <div class="form-group">
                     <button name="form1" style="float: right" type="submit" class="btn btn-success btn-block mt-3">Search</button>
                  </div>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </section>

    <section class="content" id="main_content">
      <div class="container-fluid">
        <div class="card card-default">
          <div class="card-header">
            <h3 class="card-title">All Student data</h3>
            <div class="card-tools">
            </div>
          </div>
          <div class="card-body">
            <?php echo form_open(base_url().'admin/students/update_student_attandence');?>
              <div class="row">
                <div class="col-sm-12">
                  <div id="data"></div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                     <button name="form1" style="float: right" type="submit" class="btn btn-success">Save</button>
                  </div>
                </div>
              </div>
            <?php echo form_close();?>
          </div>
        </div>
      </div>
    </section>
  </div>
<style type="text/css">
#main_content
{
  display: none;
}
</style>
<script type="text/javascript">
$("#data_form").submit(function(e) {

  e.preventDefault(); 
  var form = $(this);

  $.ajax({
    beforeSend: function() {
        $(".loader").show();
    },
    type: "POST",
    url: '<?php echo base_url(); ?>/admin/students/get_student_data_by_batch_id',
    data: form.serialize(), 
    success: function(data)
    {
      $('#main_content').show();
      $('#data').html(data);
      $(".loader").hide();
    },
    error:function(argument) {
      console.log(argument.responseText)
    }
  });
});
</script>
