<?php
include("headfile.php");
?>
<!DOCTYPE html>
<html lang="zxx" class="js">

<head>
    <meta charset="utf-8">
    <meta name="author" content="Eagle Winks">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="@@page-discription">
    <!-- Fav Icon  -->
    <link rel="shortcut icon" href="images/favicon.png">
    <!-- Page Title  -->
    <title>Withdrawal List | Eagle Winks Cash Flow</title>
    <!-- StyleSheets  -->
    <link rel="stylesheet" href="css/dashlite.css?ver=1.4.0">
    <link id="skin-default" rel="stylesheet" href="css/theme.css?ver=1.4.0">
</head>

<body class="nk-body npc-crypto has-sidebar has-sidebar-fat ui-clean ">
    <div class="nk-app-root">
        <!-- main @s -->
        <div class="nk-main ">
            <!-- sidebar @s -->
            <?php 
            include("nav.php");
            ?>
            <!-- sidebar @e -->
            <!-- wrap @s -->
            <div class="nk-wrap ">
                <!-- main header @s -->
                 <?php 
            include("header.php");
            ?>
            <div class="nk-content nk-content-fluid">
                    <div class="container-xl wide-lg">
                        <div class="nk-content-body">
                            <div class="nk-block-head">
                                <div class="nk-block-head-content">
                                    <div class="nk-block-head-sub"><span>Withdrawal History</span></div>
                                    <h2 class="nk-block-title fw-normal">Your Withdrawals</h2>
                                    <div class="nk-block-des">
                                        <p>Here you can view all your withdrawals. <p>
                                    </div>
                                </div>
                            </div><!-- .nk-block-head -->
                           
                  <div class="nk-block nk-block-lg">
                                        <div class="nk-block-head">
                                                <h4 class="nk-block-title">Withdrawal List</h4>
                                                
                                            
                                        </div>
                                        <div class="card card-bordered card-preview">
                                            <div class="card-inner">
                                                <table class="datatable-init table">
                                                    <thead>
                                                        <tr>
                                                            <th>Ref ID.</th>
                                                            <th>Date </th>
                                                            <th>Amount</th>
                                                            <th>Status</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <?php
                                                            $sql = $conn->query("SELECT * FROM `user_withdraw` WHERE `code`='$code'");
                                                            while($row = mysqli_fetch_array($sql)){
                                                                $ref_id = $row['ref_id'];
                                                                $amount = $row['amount'];
                                                                $status = $row['status'];
                                                                $date = Date('F d, Y h:mA', strtotime($row['date']));
                                                                $stat = '<div class="user-status user-status-verified">Success</div>';
                                                                
                                                                echo '
                                                                        <tr>
                                                                            <td>'.$ref_id.'</td>
                                                                            <td>'.$date.'</td>
                                                                            <td>'.$amount.'</td>
                                                                            <td>'.$stat.'</td>
                                                                        </tr>
                                                                ';
                                                            }
                                                        ?>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div><!-- .card-preview -->
                                    </div>
                        </div>
                        </div>
                        </div>
                <!-- footer @s -->
                  <?php 
            include("footer.php");
            ?>
                <!-- footer @e -->
            </div>
            <!-- wrap @e -->
        </div>
        <!-- main @e -->
    </div>
    <script src="js/bundle.js?ver=1.4.0"></script>
    <script src="js/scripts.js?ver=1.4.0"></script>
    <script src="js/charts/chart-crypto.js?ver=1.4.0"></script>
</body>

</html>