<?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 2" />
    <meta property="og:image" content="../social-image.png" />
    <meta name="format-detection" content="telephone=no">
    <title>BitXprofits | Dashboard 2</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
        ***********************************-->
        <div class="nav-header">
            <a href="index.html" class="brand-logo">
                <svg class="logo-abbr" width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <rect class="svg-logo-rect" width="50" height="50" rx="6" fill="#EA7F67"/>
                    <path class="svg-logo-path"  d="M17.5158 25.8619L19.8088 25.2475L14.8746 11.1774C14.5189 9.84988 15.8701 9.0998 16.8205 9.75055L33.0924 22.2055C33.7045 22.5589 33.8512 24.0717 32.6444 24.3951L30.3514 25.0095L35.2856 39.0796C35.6973 40.1334 34.4431 41.2455 33.3397 40.5064L17.0678 28.0515C16.2057 27.2477 16.5504 26.1205 17.5158 25.8619ZM18.685 14.2955L22.2224 24.6007L29.4633 22.6605L18.685 14.2955ZM31.4751 35.9615L27.8171 25.6886L20.5762 27.6288L31.4751 35.9615Z" fill="white"/>
                </svg>
                <svg class="brand-title" width="74" height="22" viewBox="0 0 74 22" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path class="svg-logo-path"  d="M0.784 17.556L10.92 5.152H1.176V1.12H16.436V4.564L6.776 16.968H16.548V21H0.784V17.556ZM25.7399 21.28C24.0785 21.28 22.6599 20.9347 21.4839 20.244C20.3079 19.5533 19.4025 18.6387 18.7679 17.5C18.1519 16.3613 17.8439 15.1293 17.8439 13.804C17.8439 12.3853 18.1519 11.088 18.7679 9.912C19.3839 8.736 20.2799 7.79333 21.4559 7.084C22.6319 6.37467 24.0599 6.02 25.7399 6.02C27.4012 6.02 28.8199 6.37467 29.9959 7.084C31.1719 7.79333 32.0585 8.72667 32.6559 9.884C33.2719 11.0413 33.5799 12.2827 33.5799 13.608C33.5799 14.1493 33.5425 14.6253 33.4679 15.036H22.6039C22.6785 16.0253 23.0332 16.7813 23.6679 17.304C24.3212 17.808 25.0585 18.06 25.8799 18.06C26.5332 18.06 27.1585 17.9013 27.7559 17.584C28.3532 17.2667 28.7639 16.8373 28.9879 16.296L32.7959 17.36C32.2172 18.5173 31.3119 19.46 30.0799 20.188C28.8665 20.916 27.4199 21.28 25.7399 21.28ZM22.4919 12.292H28.8759C28.7825 11.3587 28.4372 10.6213 27.8399 10.08C27.2612 9.52 26.5425 9.24 25.6839 9.24C24.8252 9.24 24.0972 9.52 23.4999 10.08C22.9212 10.64 22.5852 11.3773 22.4919 12.292ZM49.7783 21H45.2983V12.74C45.2983 11.7693 45.1116 11.0693 44.7383 10.64C44.3836 10.192 43.9076 9.968 43.3103 9.968C42.6943 9.968 42.069 10.2107 41.4343 10.696C40.7996 11.1813 40.3516 11.8067 40.0903 12.572V21H35.6103V6.3H39.6423V8.764C40.1836 7.90533 40.949 7.23333 41.9383 6.748C42.9276 6.26267 44.0663 6.02 45.3543 6.02C46.3063 6.02 47.0716 6.19733 47.6503 6.552C48.2476 6.888 48.6956 7.336 48.9943 7.896C49.3116 8.43733 49.517 9.03467 49.6103 9.688C49.7223 10.3413 49.7783 10.976 49.7783 11.592V21ZM52.7548 4.62V0.559999H57.2348V4.62H52.7548ZM52.7548 21V6.3H57.2348V21H52.7548ZM63.4657 6.3L66.0697 10.444L66.3497 10.976L66.6297 10.444L69.2337 6.3H73.8537L68.9257 13.608L73.9657 21H69.3457L66.6017 16.884L66.3497 16.352L66.0977 16.884L63.3537 21H58.7337L63.7737 13.692L58.8457 6.3H63.4657Z" fill="black"/>
                </svg>
            </a>

            <div class="nav-control">
                <div class="hamburger">
                    <span class="line"></span><span class="line"></span><span class="line"></span>
                </div>
            </div>
        </div>
        <!--**********************************
            Nav header end
        ***********************************-->

        <!--**********************************
            Header start
        ***********************************-->

        <!--**********************************
    Chat box start
***********************************-->
<?php include_once('includes/header.php'); ?>
        <!--**********************************
            Content body end
        ***********************************-->

        <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 class="weather-btn mb-2">
                        <span class="me-3 font-w600 text-black"><i class="fa fa-cloud me-2"></i>21</span>
                        <select class="form-control style-1 default-select  me-3 ">
				<option>Medan, IDN</option>
				<option>Jakarta, IDN</option>
				<option>Surabaya, IDN</option>
			</select>
             </div>
                </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']+ $profitRow['amount'],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/24</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/24</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/24</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/24</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="row">
			<div class="col-xl-4 col-xxl-6 col-lg-6">
                <div class="card">
                    <div class="card-header border-0 pb-0">
                        <h4 class="card-title">Timeline</h4>
                    </div>
                    <div class="card-body">
                        <div id="DZ_W_TimeLine" class="widget-timeline dz-scroll height370">
                            <!-- 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="blue-text">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": "dark",
							"isTransparent": false,
							"displayMode": "regular",
							"width": "100%",
							"height": 600,
							"locale": "en"
							}
							</script>
							</div>
                      <!-- TradingView Widget END -->
                        </div>
                    </div>
                </div>
			</div>
			<div class="col-xl-4 col-xxl-6 col-lg-6">
                <div class="card">
                    <div class="card-header border-0 pb-0">
                        <h4 class="card-title">Economic Calender</h4>
                    </div>
                    <div class="card-body">
                        <div id="DZ_W_TimeLine111" class="widget-timeline dz-scroll style-1 height370">
                            <!-- 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/markets/currencies/economic-calendar/" rel="noopener" target="_blank"><span class="blue-text">Economic Calendar</span></a> by TradingView</div>
                                <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-events.js" async>
                                {
                                "colorTheme": "dark",
                                "isTransparent": false,
                                "width": "510",
                                "height": "600",
                                "locale": "en",
                                "importanceFilter": "-1,0,1",
                                "currencyFilter": "USD,EUR,ITL,NZD,CHF,AUD,FRF,JPY,ZAR,TRL,CAD,DEM,MXN,ESP,GBP"
                                }
                                </script>
                                </div>
                        <!-- TradingView Widget END -->
                        </div>
                    </div>
                </div>
			</div>

            <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>
        <!--**********************************
            Footer start
        ***********************************-->

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

        <!--**********************************
           Support ticket button start
        ***********************************-->

        <!--**********************************
           Support ticket button end
        ***********************************-->


    </div>
    <!--**********************************
        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/webticker/jquery.webticker.min.html" type="text/javascript"></script>
    <script src="public/js/dashboard/dashboard-2.html" type="text/javascript"></script>
    <script src="public/vendor/owl-carousel/owl.carousel.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>

    <script>
        jQuery(document).ready(function() {
            dezSettingsOptions.version = 'dark';
            setTimeout(function() {
                dezSettingsOptions.version = 'dark';
                new dezSettings(dezSettingsOptions);
            }, 1500)
        });
    </script>
    
</body>
</html>