 <div class="content-wrapper">
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark">All Volunteer</h1>
          </div>
          <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">All Volunteer</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">View All Volunteer</h3>
          </div>
            <div class="card-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>id</th>
                  <th>Name</th>
                  <th>Contact</th>
                  <th>Address</th>
                  <th>Date</th>
                  <th>Email</th>
                </tr>
                </thead>
                <tbody>
                <?php $i=1; 
                foreach ($all_users as $key => $user):
                ?>
                <tr>
                  <td><?php echo $user->user_stock_point_code ?></td>
                  <td><?php echo $user->user_name ?></td>
                  <td>
                    <span class="badge badge-success">Mob : <?php echo $user->user_mobile ?></span>
                    <br/>
                    <span class="badge badge-warning">Email : <?php echo $user->user_email ?></span>
                  </td>
                  <td><?php echo $user->user_address ?></td>
                  <td><?php echo date('d-m-Y', strtotime($user->created_at)) ?></td>
                  <td><a href="<?php echo base_url(); ?>/admin/email/send_email/<?php echo $user->user_id; ?>/1" class="btn btn-success btn-xs"><i class="fa fa-envelope" aria-hidden="true"></i> Send</a></td>
                </tr>
                <?php $i++; ?>
                <?php endforeach; ?>
                </tbody>
              </table>
            </div>
          </div>
      </div>
    </section>
  </div>
  <script>
$(document).ready(function () {  
    $('#email_all').on('click', function(e) {  
       if($(this).is(':checked',true))    
       {  
          $(".sub_chk_pop").prop('checked', true);    
       } 
       else 
       {    
          $(".sub_chk_pop").prop('checked',false);    
       }    
    });  

    $('#email_pop_up').on('click', function(e) 
    {  
      var allVals = [];    
      $(".sub_chk_pop:checked").each(function() 
      {    
          allVals.push($(this).attr('data-id'));  
      });    
      
      if(allVals.length <=0)    
      {    
          alert("Please Select Atleast One User.");    
      }  
      else 
      {    
        var check = confirm("Are you sure?");    
        if(check == true){    
          var join_selected_values = allVals.join(",");   
          $.ajax({  
              url: '<?php echo base_url()?>admin/user/send_email',  
              type: 'POST',  
              data: 'ids='+join_selected_values,  
              success: function (data) {  
                console.log(data);  
                $(".sub_chk_pop:checked").each(function() 
                {    
                    $(this).parents("tr").remove();  
                });  
                alert("Item Deleted successfully.");  
              },  
              error: function (data) {  
                  alert(data.responseText);  
              }  
          });  
        $.each(allVals, function( index, value ) {  
            $('table tr').filter("[data-row-id='" + value + "']").remove();  
        });  
      }    
    }    
  }); 
});
</script>