<?php
@session_start();
include "control/activity.php";

 $dd = new activity();
 $loginStatus = $_SESSION['loginDetails'];


  if(isset($_SESSION['loginDetails'])){

  }else{
     header("Location:dashboard.php");
  }

  if($loginStatus == null){
    echo "<script>window.open('logout.php','_self')</script>";
  }

 
 
  $table = "admin_calculation";
  $condition = null;
  $getAdminDetails = $dd->single($table,$condition);
  
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title><?= $getAdminDetails['title']; ?></title>
</head>
<body>

    <div class="main" id="main">
		  <?php include "menu.php"; ?>
    <div class="right"> 
  <div class="tab-content">


   <?php include "headermenu.php"; ?>


        <!-- Overview -->
         <div id="overview" class="tab-pane active"  >
                <div class="content" >
                  
               <div class="content-wrapper">
                 <div class="container-fluid">

                      <!--======================================================  Content  ====================================================-->                                            
                          <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                              <a href="dashboard.php">Dashboard</a>
                            </li>
                          </ol>

                          <div class="row">
                              <div class="col-xl-12 col-sm-12 mb-12">
                                 <table class="table table-bordered data-table">
                                    <tr>
                                        <th>Sr</th>
                                        <th>Username</th>
                                        <th>Mobile</th>
                                        <th>Funds Request</th>
                                        <th>Action date</th>
                                        <th>Ref Number</th>
                                        <th>Status</th>
                                        <th>Action</th>
                                    </tr>
                                    <?php 
                                      $table = "funds_request INNER JOIN userdetails
                                      ON funds_request.userKey = userdetails.user_key";
                                      $condition = " where funds_request.status='pending'";
                                      $fetchData = $dd->fetch_multi($table,$condition);
                                      foreach($fetchData as $key){
                                        @$i++;
                                    ?>
                                      <tr>
                                        <td><?= $i; ?></td>
                                        <td><?= $key->username; ?></td>
                                        <td><?= $key->mobile; ?></td>
                                        <td>$<?= $key->amount; ?></td>
                                        <td><?= $key->request_date; ?></td>
                                        <td><?= $key->refrence_number; ?></td>
                                        <td><?= $key->status; ?></td>
                                        <td><button onclick='approvedRequest("<?= $key->funds_key; ?>","<?= $key->fullname; ?>","<?= $key->mobile; ?>","<?= $key->join_date; ?>","<?= $key->amount; ?>")'>Approved now</buuton></td>
                                    </tr>

                                    <?php } ?>
                                 </table>
                              </div>
                          </div>
  
                           
      <!--============  FIN DE L'AJOUT  ===============-->
      
      
      
     
      </div>
      <!-- /.container-fluid-->
       </div>  <!-- /content-wrapper-->


                </div>
                </div>
             </div><!--Right panel-->
</div><!--Main-->


</body>
</html>

<?php include "style.php" ?>

<script>
    function approvedRequest(a,b,c,d,ef)
    {
        var vvvttt = confirm('ARE YOU SURE TO TRANSFER USDT : '+ef);
        if(vvvttt == true)
        {
           window.open('usdtTransfer.php?key='+a+'&amm='+ef,'_self');
        }
    }
</script>
