<?php
session_start();
require_once '../../../../classconn/class.user.php';
require_once '../../../../action/usercontrol/setup.php';
require_once '../../../../action/sessiontimer/intimer.php';
require_once '../../../../action/usercontrol/logout.php';
require_once '../../../../action/getIP/ip.php';
//retrieve users latest 5 referrals
$stmt = $actionParam->runQuery("SELECT * FROM tbl_user WHERE ref_email=:email ORDER BY userID DESC LIMIT 5");
$stmt->execute(array(":email"=>$uemail));
$refRow=$stmt->fetchAll(PDO::FETCH_ASSOC);

$stmt = $actionParam->runQuery("SELECT SUM(amount) as amount FROM tbl_earning WHERE email=:email");
$stmt->execute(array(":email"=>$uemail));
$profitRow=$stmt->fetch(PDO::FETCH_ASSOC);

//retrieve user's investment history
$stmt = $actionParam->runQuery("SELECT * FROM tbl_earning WHERE email=:email ORDER BY userID DESC LIMIT 5");
$stmt->execute(array(":email"=>$uemail));
$investRow=$stmt->fetchAll(PDO::FETCH_ASSOC);


if(isset($_POST['btn-withdraw'])){
    header("Location: withdraw");
    exit;
}
$price_in_btc = file_get_contents("https://blockchain.info/tobtc?currency=USD&value=" . ($userRow['balance']+ $profitRow['amount']));
?>
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
 
<head>
    <meta charset="utf-8">
    <meta name="keywords" content="" />
    <meta name="author" content="" />
    <meta name="robots" content="" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="csrf-token" content="j2felOkY7ZDPe8U2OKlK4XR6FmzR8xVoF9E0qZZQ">
    <meta name="description" content="Some description for the page" />
    <meta property="og:title" content="BitXprofits - Crypto Laravel Admin Dashboard" />
    <meta property="og:description" content="BitXprofits | Dashboard Light" />
    <meta property="og:image" content="../social-image.png" />
    <meta name="format-detection" content="telephone=no">
    <title>BitXprofits | Dashboard</title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="public/images/favicon.png">
    <link href="public/vendor/chartist/css/chartist.min.css" rel="stylesheet" type="text/css" />
    <link href="public/vendor/owl-carousel/owl.carousel.css" rel="stylesheet" type="text/css" />
    <link href="public/vendor/bootstrap-select/dist/css/bootstrap-select.min.css" rel="stylesheet" type="text/css" />
    <link href="public/css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>

    <!--*******************
        Preloader start
    ********************-->
    <div id="preloader">
        <div class="sk-three-bounce">
            <div class="sk-child sk-bounce1"></div>
            <div class="sk-child sk-bounce2"></div>
            <div class="sk-child sk-bounce3"></div>
        </div>
    </div>
    <!--*******************
        Preloader end
    ********************-->


    <!--**********************************
        Main wrapper start
    ***********************************-->
    <div id="main-wrapper">

        <!--**********************************
            Nav header start
        ***********************************-->
        
        <!--**********************************
            Nav header end
        ***********************************-->

        <!--**********************************
            Header start
        ***********************************-->
        <!--**********************************
  	Sidebar end
***********************************-->
        <!--**********************************
            Sidebar end
        ***********************************-->

        <?php include_once('includes/header.php'); ?>

        <!--**********************************
            Content body start
        ***********************************-->
        <div class="content-body">
            <!-- row -->

            <div class="container-fluid">
                <div class="form-head mb-sm-5 mb-3 d-flex flex-wrap align-items-center">
                    <h2 class="font-w600 title mb-2 me-auto ">Dashboard</h2>
                    
                </div>
                <div class="">
                        <div class="row">
                            <div class="col-sm-6">
                                <div class="card-bx stacked card">
                                    <img src="public/images/card/card1.jpg" alt="">
                                    <div class="card-info">
                                        <p class="mb-1 text-white fs-14">Main Balance</p>
                                        <div class="d-flex justify-content-between">
                                            <h2 class="num-text text-white mb-5 font-w600">$<?php echo number_format($userRow['balance'],2); ?></h2>
                                            <svg width="55" height="34" viewBox="0 0 55 34" fill="none" xmlns="http://www.w3.org/2000/svg">
                                            <circle cx="38.0091" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
									        <circle cx="17.4636" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
								        </svg>
                                        </div>
                                        <div class="d-flex">
                                        <div class="me-4 text-white">
                                                <p class="fs-12 mb-1 op6">VALID THRU</p>
                                                <span>08/28</span>
                                            </div>
                                            <div class="text-white">
                                                <p class="fs-12 mb-1 op6">CARD HOLDER</p>
                                                <span><?php echo ucfirst($userRow['fullname']); ?></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="card-bx stacked card">
                                    <img src="public/images/card/card2.jpg" alt="">
                                    <div class="card-info">
                                        <p class="fs-14 mb-1 text-white">Profits</p>
                                        <div class="d-flex justify-content-between">
                                            <h2 class="num-text text-white mb-5 font-w600">$<?php echo number_format($userRow['profit'],2); ?></h2>
                                            <svg width="55" height="34" viewBox="0 0 55 34" fill="none" xmlns="http://www.w3.org/2000/svg">
									<circle cx="38.0091" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
									<circle cx="17.4636" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
								</svg>
                                        </div>
                                        <div class="d-flex">
                                            <div class="me-4 text-white">
                                                <p class="fs-12 mb-1 op6">VALID THRU</p>
                                                <span>08/28</span>
                                            </div>
                                            <div class="text-white">
                                                <p class="fs-12 mb-1 op6">CARD HOLDER</p>
                                                <span><?php echo ucfirst($userRow['fullname']); ?></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="card-bx stacked card">
                                    <img src="public/images/card/card3.jpg" alt="">
                                    <div class="card-info">
                                        <p class="mb-1 text-white fs-14">Last Deposit</p>
                                        <div class="d-flex justify-content-between">
                                            <h2 class="num-text text-white mb-5 font-w600">$<?php echo number_format($userRow['last_deposite'],2); ?></h2>
                                            <svg width="55" height="34" viewBox="0 0 55 34" fill="none" xmlns="http://www.w3.org/2000/svg">
									<circle cx="38.0091" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
									<circle cx="17.4636" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
								</svg>
                                        </div>
                                        <div class="d-flex">
                                            <div class="me-4 text-white">
                                                <p class="fs-12 mb-1 op6">VALID THRU</p>
                                                <span>08/28</span>
                                            </div>
                                            <div class="text-white">
                                                <p class="fs-12 mb-1 op6">CARD HOLDER</p>
                                                <span><?php echo ucfirst($userRow['fullname']); ?></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="card-bx stacked card">
                                    <img src="public/images/card/card4.jpg" alt="">
                                    <div class="card-info">
                                        <p class="mb-1 text-white fs-14">Last Withdrawal</p>
                                        <div class="d-flex justify-content-between">
                                            <h2 class="num-text text-white mb-5 font-w600">$<?php echo number_format($userRow['last_withdrawal'],2); ?></h2>
                                            <svg width="55" height="34" viewBox="0 0 55 34" fill="none" xmlns="http://www.w3.org/2000/svg">
									<circle cx="38.0091" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
									<circle cx="17.4636" cy="16.7788" r="16.7788" fill="white" fill-opacity="0.67"/>
								</svg>
                                        </div>
                                        <div class="d-flex">
                                            <div class="me-4 text-white">
                                                <p class="fs-12 mb-1 op6">VALID THRU</p>
                                                <span>08/28</span>
                                            </div>
                                            <div class="text-white">
                                                <p class="fs-12 mb-1 op6">CARD HOLDER</p>
                                                <span><?php echo ucfirst($userRow['fullname']); ?></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                           
              <!--widgets-->
              <div class="row">
                         <div class="col-12">
                             <!-- TradingView Widget BEGIN -->
                                <div class="tradingview-widget-container mb-4">
                                  <div class="tradingview-widget-container__widget"></div>
                                  <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-ticker-tape.js" async>
                                  {
                                  "symbols": [
                                    {
                                      "proName": "FOREXCOM:SPXUSD",
                                      "title": "S&P 500"
                                    },
                                    {
                                      "proName": "FOREXCOM:NSXUSD",
                                      "title": "Nasdaq 100"
                                    },
                                    {
                                      "proName": "FX_IDC:EURUSD",
                                      "title": "EUR/USD"
                                    },
                                    {
                                      "proName": "BITSTAMP:BTCUSD",
                                      "title": "BTC/USD"
                                    },
                                    {
                                      "proName": "BITSTAMP:ETHUSD",
                                      "title": "ETH/USD"
                                    }
                                  ],
                                  "showSymbolLogo": true,
                                  "colorTheme": "light",
                                  "isTransparent": false,
                                  "displayMode": "regular",
                                  "locale": "en"
                                }
                                  </script>
                                </div>
                                <!-- TradingView Widget END -->
                         </div>

                           
                    </div>
                    
                    <!--trading view-->
                    <div class="row">
                        <div class="col-lg-6">
                             <!-- TradingView Widget BEGIN -->
                            <div class="tradingview-widget-container">
                              <div id="tradingview_8acc1"></div>
                              <script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
                              <script type="text/javascript">
                              new TradingView.widget(
                              {
                              "width": "100%",
                              "height": 400,
                              "symbol": "NASDAQ:AAPL",
                              "interval": "D",
                              "timezone": "Etc/UTC",
                              "theme": "light",
                              "style": "1",
                              "locale": "en",
                              "toolbar_bg": "#f1f3f6",
                              "enable_publishing": false,
                              "allow_symbol_change": true,
                              "container_id": "tradingview_8acc1"
                            }
                              );
                              </script>
                            </div>
                            <!-- TradingView Widget END -->
                        </div>

                        <div class="col-lg-6 mt-5 mt-lg-0">
                            <!-- TradingView Widget BEGIN -->
                            <div class="tradingview-widget-container">
                              <div class="tradingview-widget-container__widget"></div>
                              <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-forex-cross-rates.js" async>
                              {
                              "width": "100%",
                              "height": 400,
                              "currencies": [
                                "EUR",
                                "USD",
                                "JPY",
                                "GBP",
                                "CHF",
                                "AUD",
                                "CAD",
                                "NZD",
                                "CNY"
                              ],
                              "isTransparent": false,
                              "colorTheme": "light",
                              "locale": "en"
                            }
                              </script>
                            </div>
                            <!-- TradingView Widget END -->
                        </div>
                    </div>
                    
            </div><br><br><br>

            <!-- TradingView Widget BEGIN -->
            <div class="tradingview-widget-container">
							<div class="tradingview-widget-container__widget"></div>
							<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/key-events/" rel="noopener" target="_blank"><span class="">Daily news roundup</span></a></div>
							<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-timeline.js" async>
							{
							"feedMode": "all_symbols",
							"colorTheme": "light",
							"isTransparent": false,
							"displayMode": "regular",
							"width": "100%",
							"height": 600,
							"locale": "en"
							}
							</script>
							</div>
                      <!-- TradingView Widget END -->
                      <br><br><br>
    
            <div class="col-xl-12">
                                <div class="card">
                                    <div class="card-header pb-2 d-block d-sm-flex flex-wrap border-0">
                                        <div class="mb-3">
                                            <h4 class="fs-20 text-black">Recent Trading Activities</h4>
                                            <p class="mb-0 fs-12">Watch your daily earnings top up...</p>
                                        </div>
                                       
                                    </div>
                                    <div class="card-body tab-content p-0">
                                        <div class="tab-pane active show fade" id="monthly">
                                            <div class="table-responsive">
                                                <table class="table shadow-hover card-table border-no tbl-btn short-one">
                                                    <tbody>
                                                    <?php $count = 1; ?>
                                                      <?php foreach($investRow as $row){ ?>
                                                        <tr>
                                                            <td>
                                                                <span>
                                                                <svg width="50" height="50" viewBox="0 0 63 63" fill="none" xmlns="http://www.w3.org/2000/svg">
																<rect width="63" height="63" rx="14" fill="#625794"/>
																<path d="M25.4813 24.6343L25.4813 24.6343L30.3544 19.7376C30.3571 19.7348 30.3596 19.7323 30.3619 19.7301M25.4813 24.6343L30.7116 20.0875L30.3587 19.7333C30.368 19.7241 30.3756 19.7172 30.3789 19.7143L30.38 19.7133C30.3775 19.7155 30.3709 19.7214 30.3627 19.7293C30.3625 19.7295 30.3622 19.7298 30.3619 19.7301M25.4813 24.6343C24.9214 25.197 24.9234 26.1071 25.4862 26.6672C26.0489 27.2273 26.9591 27.2251 27.5191 26.6624L27.5192 26.6624L29.9377 24.232M25.4813 24.6343L29.9377 24.232M30.3619 19.7301C30.9212 19.1741 31.8279 19.1724 32.389 19.7304C32.3902 19.7316 32.3914 19.7329 32.3927 19.7341L32.3941 19.7356L32.4062 19.7477L37.2691 24.6342L36.9147 24.9869L37.2692 24.6342C37.829 25.1968 37.8271 26.107 37.2642 26.6672C36.7015 27.2272 35.7914 27.225 35.2314 26.6623L35.2313 26.6623L32.8127 24.232L32.8127 42.875C32.8127 43.6689 32.1692 44.3125 31.3752 44.3125C30.5813 44.3125 29.9377 43.6689 29.9377 42.875L29.9377 24.232M30.3619 19.7301C30.3605 19.7315 30.3591 19.7329 30.3577 19.7343L29.9377 24.232M32.3927 19.7342C32.3932 19.7347 32.3937 19.7351 32.3941 19.7356L32.3927 19.7342Z" fill="white" stroke="white"/>
															</svg>
													</span>
                                                            </td>
                                    
                                                            <td class="wspace-no">
                                                                <svg class="me-2" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
													</svg>
                                                                <span class="font-w600 text-black"><?php echo $row['type']; ?></span>
                                                            </td>
                                                            <td>
                                                                <span class="font-w600 text-black"><span class="badge light badge-warning">$<?php echo number_format($row['amount'],2); ?></span></span>
                                                            </td>
                                                            <td>
                                                                <span class="text-black"><?php echo $row['date']; ?></span>
                                                            </td>
                                                            
                                                            <td><a class="btn btn-outline-success float-end" href="javascript:void(0);">Completed</a></td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                            
                                                                <span>
														
													</span>
                                                    <?php $count++; ?>
                                                  <?php } ?>
                                                            </td>
                                                      </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="card-footer border-0 p-0 caret mt-1">
                                        
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--**********************************
            Content body end
        ***********************************-->

        <?php include_once('includes/footer.php'); ?>
    <!--**********************************
        Main wrapper end
    ***********************************-->

    <!--**********************************
        Scripts
    ***********************************-->
    <script data-cfasync="false" src="../../cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script>
    <script src="public/vendor/global/global.min.js" type="text/javascript"></script>
    <script src="public/vendor/bootstrap-select/dist/js/bootstrap-select.min.js" type="text/javascript"></script>
    <script src="public/vendor/chart.js/Chart.bundle.min.js" type="text/javascript"></script>
    <script src="public/vendor/peity/jquery.peity.min.js" type="text/javascript"></script>
    <script src="public/vendor/apexchart/apexchart.js" type="text/javascript"></script>
    <script src="public/vendor/owl-carousel/owl.carousel.js" type="text/javascript"></script>
    <script src="public/js/dashboard/dashboard-1.js" type="text/javascript"></script>
    <script src="public/js/custom.js" type="text/javascript"></script>
    <script src="public/js/deznav-init.js" type="text/javascript"></script>
    <script src="public/js/demo.js" type="text/javascript"></script>
    <script src="public/js/styleSwitcher.js" type="text/javascript"></script>
</body>
</html>