<?php include("common/header2.php");
include("common/connection.php");

if(isset($_GET['type']))
{
    $TYPE= $_GET['type'];
    $query=mysqli_query($db,"select * from tbl_signup where status='$TYPE'");
    
}else
{
    $query=mysqli_query($db,"select * from tbl_signup where status='1' limit 800");
}



  
?>
 

        <div class="page-wrapper">
          
            <div class="container-fluid">
              
                <div class="row">
                    <div class="col-12">
                        
                        <div class="card">
                            <div class="card-body">
                                <h5 class="card-title">Manage User Auto Pool</h5>
                                 <div class="table-responsive">
      <table id="zero_config" width="400px" class="table table-striped table-bordered">
                                        <thead>
                                            <tr>
                <th>#</th>
                <th>Name</th>
                 <th>Contact</th>
                      <th>Sponsor</th>
                        <th>Status</th>
                                <th>Balance</th>
                                        <th>Fund Wallet</th>
                                                <th>P1</th>   
                                                 <th>P2</th>
                                                       <th>P3</th>
                                                             <th>P4</th>
                                                                   <th>P5</th>
                                                                         <th>P6</th>
                                                                              
                                                  <th>Action</th>
            
            </tr>
            </thead>
              <tbody>
    <?php 

    $sn=1;
    while($row=mysqli_fetch_array($query)){
        
        
     
    ?>
            <tr>
                <td><?php echo $sn++;  $newid=$row['id']; ?></td>
               
                <td><?php echo  $row['name']; ?><br>
                SL<?php echo $newuserid= $row['sponsor_code']; ?> </br>
    
                <br>
              <h4><?php  echo    check_round($row['my_level']); ?> </h4>
                 
                            <a  href="../user/userlogin.php?id=<?php echo $row['sponsor_code'];?>&sing=<?php echo $row['signup_id'];?>" target="_blank">
<button type="button" class="btn btn-warning btn-sm remove"> <i class=" fas fa-eye">User Login Here</i></button> 
</a> 
</br>
</br>
                 
                            <a  href="add_autopoolteam.php?id=<?php echo $row['sponsor_code'];?>&sing=<?php echo $row['signup_id'];?>" target="_blank">
<button type="button" class="btn btn-warning btn-sm remove"> <i class=" fas fa-eye">Add Autopool</i></button> 
</a> 






                
                </td>
                <td>  <?php echo $row['mobile']; ?></td>
                
                
                <td>
                <?php echo $row['sponsorname']; ?><br>SL<?php echo $row['sponsorid']; ?></td>
                <td>Active</td>
                <td><?php echo $row['wallet_amount']; ?></td>
                  <td><?php echo $row['amount']; ?></td>
                  <td>  
                <?php 
                
             ECHO  $p1=  aiseanega($newuserid,'bronze')
                
                
                ?>
                </td>
                      
                   <td> 
                          <?php 
                
             ECHO  $p2=  aiseanega($newuserid,'silver')
                
                
                ?>
                         </td>
                         
                        <td> 
                          <?php 
                
             ECHO  $p3=  aiseanega($newuserid,'gold')
                
                
                ?>
                         </td>
                         
                          <td> 
                           <?php 
                
             ECHO  $p4=  aiseanega($newuserid,'emerald')
                
                
                ?>
                         </td>
                         
                         
                          <td> 
                             <?php 
                
             ECHO  $p5=  aiseanega($newuserid,'topaz')
                
                
                ?>
                         </td>
                         
                         
                          <td> 
                             <?php 
                
             ECHO  $p6=  aiseanega($newuserid,'ruby')
                
                
                ?>
                         </td>
                         
                         
                        
                          <td> 
                        
                         </td>
              
            </tr>
            
    <?php } ?>
        </tbody>
                
          </table>
        </div>
     
      </div>
    </div>
  </div>
</section>
 
          </div>
          <div class="content-overlay"></div>
        </div>
      </div>
    </div>
 <?php
include("common/footer.php");
?>
  <script src="assets/extra-libs/DataTables/datatables.min.js"></script>
     <link href="assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.css" rel="stylesheet">
    <link href="dist/css/style.min.css" rel="stylesheet">
     <script>
        /****************************************
         *       Basic Table                   *
         ****************************************/
        $('#zero_config').DataTable();
        
        
         $('.copy_text').click(function (e) {
   e.preventDefault();
   var copyText = $(this).attr('href');

   document.addEventListener('copy', function(e) {
      e.clipboardData.setData('text/plain', copyText);
      e.preventDefault();
   }, true);

   document.execCommand('copy');  
   
   alert('copied text: ' + copyText); 
 });
    </script>