<?php
session_start();
if(!isset($_SESSION['userID'])){
  header("location: ../account/login.html");
}

require_once "../SystemController/DbConnection.php";
$db_handle = new Dbconnection();
$id = $_SESSION['userID'];
$user = $db_handle->runBaseQuery("SELECT * FROM customers WHERE id = $id ");
$firstname = $user[0]['firstname'];
$lastname = $user[0]['surname'];

$balance = $db_handle->runBaseQuery("SELECT * FROM account_balance WHERE userID = $id ");
$balance = ($balance)? number_format($balance[0]['balance']) : "0.00";


$totalwithdrawal = $db_handle->runBaseQuery("SELECT  sum(amount) as total FROM withdrawals WHERE user_id = $id  and status = 1");

$totalwithdrawal = ($totalwithdrawal)? number_format($totalwithdrawal[0]['total']) : "0.00";


$totaldeposit = $db_handle->runBaseQuery("SELECT  sum(amount) as total FROM deposits WHERE user_id = $id  and status = 1");

$totaldeposit = ($totaldeposit)? number_format($totaldeposit[0]['total']) : "0.00";


$tradebalance = $db_handle->runBaseQuery("SELECT trade_balance  FROM trades WHERE user_id = $id  and status = 0");

$tradebalance = ($tradebalance)? "$".number_format($tradebalance[0]['trade_balance']) : "You are currently not trading";
?>
<!DOCTYPE html>
<html lang="zxx">


<!-- Mirrored from demo.dashboardpack.com/marketing-html/ by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 29 Jun 2021 09:57:24 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title>SpaceX Tesla Investments Trades | User Dashboard</title>

    <link rel="icon" href="img/logo.png" type="image/png">
    <link href="vendors/icons/css/all.min.css" rel="stylesheet" type="text/css"/>
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <!-- themefy CSS -->
    <link rel="stylesheet" href="vendors/themefy_icon/themify-icons.css" />
    <!-- select2 CSS -->
    <link rel="stylesheet" href="vendors/niceselect/css/nice-select.css" />
    <!-- owl carousel CSS -->
    <link rel="stylesheet" href="vendors/owl_carousel/css/owl.carousel.css" />
    <!-- gijgo css -->
    <link rel="stylesheet" href="vendors/gijgo/gijgo.min.css" />
    <!-- font awesome CSS -->
    <link rel="stylesheet" href="vendors/font_awesome/css/all.min.css" />
    <link rel="stylesheet" href="vendors/tagsinput/tagsinput.css" />

    <!-- date picker -->
     <link rel="stylesheet" href="vendors/datepicker/date-picker.css" />
     <!-- scrollabe  -->
     <link rel="stylesheet" href="vendors/scroll/scrollable.css" />
    <!-- datatable CSS -->
    <link rel="stylesheet" href="vendors/datatable/css/jquery.dataTables.min.css" />
    <link rel="stylesheet" href="vendors/datatable/css/responsive.dataTables.min.css" />
    <link rel="stylesheet" href="vendors/datatable/css/buttons.dataTables.min.css" />
    <!-- text editor css -->
    <link rel="stylesheet" href="vendors/text_editor/summernote-bs4.css" />
    <!-- morris css -->
    <link rel="stylesheet" href="vendors/morris/morris.css">
    <!-- metarial icon css -->
    <link rel="stylesheet" href="vendors/material_icon/material-icons.css" />

    <!-- menu css  -->
    <link rel="stylesheet" href="css/metisMenu.css">
    <!-- style CSS -->
    <link rel="stylesheet" href="css/custom.css" />
    <link rel="stylesheet" href="css/style.css" />
    
</head>
<body class="crm_body_bg">
    


<!-- main content part here -->
 
 <!-- sidebar  -->
 <!-- sidebar part here -->
 <nav class="sidebar vertical-scroll  ps-container ps-theme-default ps-active-y">
    <div class="logo d-flex justify-content-between">
        <a href="index.php"><img src="img/logo3.png" alt=""></a>
        <div class="sidebar_close_icon d-lg-none">
            <i class="fa fa-times"></i>
        </div>
    </div>
    <ul id="sidebar_menu">
        <li class="">
          <a class=""  href="index.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fas fa-home" ></i>
          </div>
            <span>Dashboard</span>
          </a>
        </li>
        <li class="">
          <a class=""  href="trade.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fas fa-chart-line" ></i>
          </div>
            <span>Trade</span>
          </a>
        </li>
        <li class="">
          <a class=""  href="fund.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fas fa-money-bill-wave-alt" ></i>
          </div>
            <span>Fund Account</span>
          </a>
        </li>
        <li class="">
          <a class=""  href="withdraw.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fa fa-wallet" ></i>
          </div>
            <span>Withdraw</span>
          </a>
        </li> 
        <li class="">
          <a class=""  href="history.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fa fa-history" ></i>
          </div>
            <span>History</span>
          </a>
        </li>
        <li class="">
          <a class=""  href="upgrade.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fa fa-level-up-alt" ></i>
          </div>
            <span>Account Upgrade</span>
          </a>
        </li>
        <li class="">
          <a class=""  href="profile.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fa fa-user" ></i>
          </div>
            <span>Account Profile</span>
          </a>
        </li> 
        <li class="">
          <a class=""  href="resetpass.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fa fa-key" ></i>
          </div>
            <span>Reset Password</span>
          </a>
        </li>
        <li class="">
          <a class=""  href="../apps/logout.php"  aria-expanded="false">
          <!-- <i class="fas fa-th"></i> -->
          <div class="icon_menu">
              <!-- <img src="img/menu-icon/dashboard.svg" alt=""> -->
              <i class="fa fa-sign-out-alt" ></i>
          </div>
            <span>Log Out</span>
          </a>
        </li>                                                         
    </ul>  
</nav>
<!-- sidebar part end -->
 <!--/ sidebar  -->


<section class="main_content dashboard_part large_header_bg">
        <!-- menu  -->
            <div class="container-fluid no-gutters">
        <div class="row">
            <div class="col-lg-12 p-0 ">
                <div class="header_iner d-flex justify-content-between align-items-center">
                    <div class="sidebar_icon d-lg-none">
                        <i class="fa fa-bars"></i>
                    </div>
                    <div class="serach_field-area d-flex align-items-center">

                    </div>
                    <div class="header_right d-flex justify-content-between align-items-center">
                        <div class="header_notification_warp d-flex align-items-center">
<!--                        <li>
                                <a class="bell_notification_clicker nav-link-notify" href="#"> <img src="img/icon/bell.svg" alt="">
                                </a>
                                <div class="Menu_NOtification_Wrap">
                                    <div class="notification_Header">
                                        <h4>Notifications</h4>
                                    </div>
                                    <div class="Notification_body">
                                        <div class="single_notify d-flex align-items-center">
                                            <div class="notify_content">
                                                <p>Lorem ipsum dolor sit amet</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </li> -->
                        </div>
                        <div class="profile_info">
                            <img src="img/sample-qr.png" alt="#">&nbsp;E0UUSO8CT5P STARTER                            <div class="profile_info_iner">
                                <div class="profile_author_name">
                                    <h5> <?php echo $firstname.' '.$lastname; ?> </h5>
                                </div>
                                <div class="profile_info_details">
                                    <a href="profile.php">My Profile </a>
                                    <a href="history.php">Transactions</a>
                                    <a href="../apps/logout.php">Log Out </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!--/ menu  -->
    <div class="main_content_iner ">
        <div class="container-fluid p-0 ">
            <div class="row ">
                <div class="col-lg-12 ">
                    <div class="row beaut" >
                        <div class="col-6" >
                            <h2>Your Balance</h2>
                            <p>$<?php echo $balance; ?></p>
                        </div>
                        <div class="col-6 d-flex flex-row-reverse" >
                            <a href="fund.php" >
                                <span class="btn btn-lg btn-dark" >Deposit</span>
                            </a>                                 
                        </div>
                    </div>
                </div>

                <div class="col-lg-12 beaut">
                    <h3  style="text-align: center; text-decoration:underline;padding: 10px;">ACCOUNT   OVERVIEW</h3><br>
                    <div class="QA_table table-responsive ">
                        <!-- table-responsive -->
                        <table class="table pt-0">
                            <tbody>
                                <tr>
                                    <td>Total Deposit : </td>
                                    <td class="nowrap">$<?php echo $totaldeposit; ?></td>
                                </tr>
                                <tr>
                                    <td>Trade Balance : </td>
                                    <td class="nowrap"><?php echo $tradebalance; ?> </td>
                                </tr>
                                <tr>
                                    <td>Total Withdraw : </td>
                                    <td class="nowrap">$<?php echo $totalwithdrawal; ?> </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div><br>
                <div class="col-lg-12 beaut" >
       <!-- Recent Transactions -->
<div style="visibility:visible;" class="row">
    <div id="recent-transactions"  class="col-12">
        <h6 class="my-2"></h6>
        <div class="card">
            <div style="height:400px;" class="card-content">
               
                <!-- TradingView Widget BEGIN -->
                <div class="tradingview-widget-container">
                  <div class="tradingview-widget-container__widget"></div>
                  <div class="tradingview-widget-copyright"><span class="blue-text">Forex Heat Map</span></div>
                  <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-forex-heat-map.js" async>
                  {
                  "width": "100%",
                  "height": "100%",
                  "currencies": [
                    "EUR",
                    "USD",
                    "JPY",
                    "GBP",
                    "CHF",
                    "AUD",
                    "CAD",
                    "NZD",
                    "CNY"
                  ],
                  "locale": "en"
                }
                  </script>
                </div>
                <!-- TradingView Widget END -->
                              
                                
                        
                              
                        
                              
                            </div>
                        </div>
                    </div>
                </div>                    
                </div>
            </div>
        </div>
    </div>

<!-- footer part -->
<div class="footer_part">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-12">
                <div class="footer_iner text-center">
                    <p>© 2025 <a href="../index.html" >SpaceX Tesla Investments Trades</a> All rights reserved</p>
                </div>
            </div>
        </div>
    </div>
</div></section>
<!-- main content part end -->

<div id="back-top" style="display: none;">
    <a title="Go to Top" href="#">
        <i class="ti-angle-up"></i>
    </a>
</div>

<!-- footer  -->
<script src="js/jquery-3.4.1.min.js"></script>
<!-- popper js -->
<script src="js/popper.min.js"></script>
<!-- bootstarp js -->
<script src="js/bootstrap.min.js"></script>
<!-- sidebar menu  -->
<script src="js/metisMenu.js"></script>
<!-- waypoints js -->
<script src="vendors/count_up/jquery.waypoints.min.js"></script>
<!-- waypoints js -->
<script src="vendors/chartlist/Chart.min.js"></script>
<!-- counterup js -->
<script src="vendors/count_up/jquery.counterup.min.js"></script>

<!-- nice select -->
<script src="vendors/niceselect/js/jquery.nice-select.min.js"></script>
<!-- owl carousel -->
<script src="vendors/owl_carousel/js/owl.carousel.min.js"></script>

<!-- responsive table -->
<script src="vendors/datatable/js/jquery.dataTables.min.js"></script>
<script src="vendors/datatable/js/dataTables.responsive.min.js"></script>
<script src="vendors/datatable/js/dataTables.buttons.min.js"></script>
<script src="vendors/datatable/js/buttons.flash.min.js"></script>
<script src="vendors/datatable/js/jszip.min.js"></script>
<script src="vendors/datatable/js/pdfmake.min.js"></script>
<script src="vendors/datatable/js/vfs_fonts.js"></script>
<script src="vendors/datatable/js/buttons.html5.min.js"></script>
<script src="vendors/datatable/js/buttons.print.min.js"></script>


<script src="js/chart.min.js"></script>
<!-- progressbar js -->
<script src="vendors/progressbar/jquery.barfiller.js"></script>
<!-- tag input -->
<script src="vendors/tagsinput/tagsinput.js"></script>
<!-- text editor js -->
<script src="vendors/text_editor/summernote-bs4.js"></script>
<script src="vendors/am_chart/amcharts.js"></script>

<!-- scrollabe  -->
<script src="vendors/scroll/perfect-scrollbar.min.js"></script>
<script src="vendors/scroll/scrollable-custom.js"></script>


<script src="vendors/chart_am/core.js"></script>
<script src="vendors/chart_am/charts.js"></script>
<script src="vendors/chart_am/animated.js"></script>
<script src="vendors/chart_am/kelly.js"></script>
<script src="vendors/chart_am/chart-custom.js"></script>
<!-- custom js -->
<script src="js/custom.js"></script>
<script src="js/main.js"></script>
<script src="//code.jivosite.com/widget/pfNW6yUA29" async></script>
</body>

<!-- Mirrored from demo.dashboardpack.com/marketing-html/ by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 29 Jun 2021 09:58:17 GMT -->
</html>
