<?php 
$query="SELECT id,memberID,fname,mname,lname,address,billingcontact,floorno,amount,billingdate,b.name AS package,c.name AS reseller,IP,MAC,a.active FROM ".$prefix."member_personal AS a,".$prefix."package AS b,".$prefix."reseller AS c WHERE a.package=b.pid AND a.reseller=c.pid AND a.active=2";
$memberType=mysqli_query($linkid,$query);
?>
<script type="text/javascript">
/*------------------------------------Delete Student---------------------------------------------*/
 function delMember(id)
	{
	   var row=confirm("Do you want to delete member permanently?");
	   if(row==true)
	   {
		 deleteMember(id);	 
	   }
	   else 
	   return false;
	 }
	 
	function deleteMember(id)
	{
	  var param="id="+id;
	  //alert(param);
	  $.ajax({
		type: "POST",
		url: "modules/member/deleteMember.php",
		data:param,
		cache: false,
		success: function(html)
		{
		//alert(html)
		$(".bar"+id).slideUp('slow', function() {$(this).remove();});
		}
		});
	 }
///////////////////////////////////////////////////////////////////////////////////////
 function blockMember(id)
	{
	   var row=confirm("Do you want to block member temporary?");
	   if(row==true)
	   {
		 bMember(id);	 
	   }
	   else 
	   return false;
	 }
	 
	function bMember(id)
	{
	  var param="id="+id;
	  //alert(param);
	  $.ajax({
		type: "POST",
		url: "modules/member/blockMember.php",
		data:param,
		cache: false,
		success: function(html)
		{
		//alert(html)
		$(".bar"+id).slideUp('slow', function() {$(this).remove();});
		}
		});
	 }
///////////////////////////////////////////////////////////////////////////////////////
 function activeMember(id)
	{
	   var row=confirm("Do you want to active member again?");
	   if(row==true)
	   {
		 acMember(id);	 
	   }
	   else 
	   return false;
	 }
	 
	function acMember(id)
	{
	  var param="id="+id;
	  //alert(param);
	  $.ajax({
		type: "POST",
		url: "modules/member/activeMember.php",
		data:param,
		cache: false,
		success: function(html)
		{
		//alert(html)
		$(".bar"+id).slideUp('slow', function() {$(this).remove();});
		}
		});
	 }	 
</script>

<div id="contentwrapper">
  <div class="main_content">
    <nav>
      <div id="jCrumbs" class="breadCrumb module">
        <ul>
          <li> <a href="#"><i class="icon-home"></i></a> </li>
          <li> <a href="#">Manage</a> </li>
          <li> <a href="index.php?tab=member">Trash Member Datagrid</a> </li>
        </ul>
      </div>
    </nav>
    <div class="row-fluid">
      <div class="span12">
        <h3 class="heading">Trash Members</h3>
        <table class="table table-striped table-bordered dTableR" id="dt_tools">
          <thead>
            <tr>
              <th>ID</th>
              <th>Name</th>
              <th>Address</th>
              <th>Floor</th>
              <th>Reseller</th>
              <th>Package</th>
              <th>Amount</th>
              <th width="10%">Action</th>
            </tr>
          </thead>
          <tbody>
            <?php 
								  if($memberType)
									{
									while($mydata = mysqli_fetch_assoc($memberType))
									{
								  ?>
            <tr class="bar<?php echo $mydata['id']?>">
              <td><?php echo $mydata['memberID'];?></td>
              <td><a target="_blank" href="member-summary-report-view.php?mID=<?php echo $mydata['memberID'];?>" title="View"><?php echo $mydata['fname']." ".$mydata['mname']." ".$mydata['lname']?></a><br />
                <img src="img/phn.png" width="16" />:<?php echo $mydata['billingcontact'];?></td>
              <td><?php echo $mydata['address']?></td>
              <td><?php echo $mydata['floorno']?></td>
              <td><?php echo $mydata['reseller']?></td>
              <td><?php echo $mydata['package']?></td>
              <td><?php echo $mydata['amount']?></td>
              <td><div class="pull-left">
                  <div class="btn-group"> <a class="btn dropdown-toggle btn-mini" data-toggle="dropdown" href="#"> <i class="icon-cog"></i> <span class="caret"></span> </a>
                    <ul class="dropdown-menu">                      
                      <li><a href="#" onclick="activeMember('<?php echo $mydata['id']?>')">Active</a></li>
                    </ul>
                  </div>
                </div>
                <!--<a href="index.php?tab=view-student?id=<?php echo $mydata['id']?>" class="sepV_a" title="View"><i class="icon-eye-open"></i></a>-->
                <!--<a href="javascript:void(0);" onclick="delMember('<?php echo $mydata['id']?>')" title="Delete"><i class="icon-trash"></i></a> -->
                <a href="javascript:void(0);">
                <?php
				if($mydata['active']==1) echo "<img src='images/unlocked.png' alt='Active' title='Active' border='0'>";
				 else echo "<img src='images/locked.png' alt='Inactive' title='Inactive'  border='0'>";
				?>
                </a> <a  target="_blank" href="member-details-print.php?id=<?php echo $mydata['id']?>" class="sepV_a" title="Print"><i class="splashy-printer"></i></a> </td>
            </tr>
            <?php 
				 }
				 } 
?>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
