<?php
session_start();
require_once '../../../../classconn/class.user.php';
require_once '../../../../action/usercontrol/setup.php';
require_once '../../../../action/sessiontimer/intimer.php';
require_once '../../../../action/invoice/create.php';
require_once '../../../../action/usercontrol/logout.php';
$price_in_btc = file_get_contents("https://blockchain.info/tobtc?currency=USD&value=" . $userRow['balance']);
$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);
?>

<!DOCTYPE html>
<html lang="en">


<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<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">
    <title>Sescentigate | DepositFunds</title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="images/favicon.png">
    <!-- Custom Stylesheet -->
    <link rel="stylesheet" href="vendor/nice-select/css/nice-select.css">
    <link rel="stylesheet" href="vendor/waves/waves.min.css">
    <link rel="stylesheet" href="css/style.css">
</head>

<body>

    <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>

    <div id="main-wrapper">

        <div class="header dashboard">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-xl-12">
                        <nav class="navbar navbar-expand-lg navbar-light px-0 justify-content-between">
                            <a class="navbar-brand" href="index"><img src="images/logo.png" alt=""></a>

                            <div class="header-right d-flex my-2 align-items-center">
                                <div class="language">
                                   
                                </div>
                                <div class="dashboard_log">
                                    <div class="profile_log dropdown">
                                        <div class="user" data-toggle="dropdown">
                                            <span class="thumb"><i class="mdi mdi-account"></i></span>
                                            <span class="arrow"><i class="la la-angle-down"></i></span>
                                        </div>

                                        <div class="dropdown-menu dropdown-menu-right">
                                            <div class="user-email">
                                                <div class="user">
                                                    <i class="thumb"><i class="mdi mdi-account"></i></i>
                                                    <div class="user-info">
                                                        <h6><?php echo ucfirst($userRow['fullname']); ?></h6>
                                                        <span><?php echo ucfirst($userRow['email']); ?></span>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="user-balance">
                                                <div class="available">
                                                    <p>Available</p>
                                                    <span><?php echo number_format($userRow['balance'],2); ?> USD</span>
                                                </div>
                                                <div class="total">
                                                    <p>Total Profits</p>
                                                    <span><?php echo number_format($userRow['profit'],2); ?> USD</span>
                                                </div>
                                            </div>
                                            <a href="profilesettings" class="dropdown-item">
                                                <i class="mdi mdi-account"></i> Profile
                                            </a>
                                            <a href="deposits" class="dropdown-item">
                                                <i class="mdi mdi-history"></i> History
                                            </a>
                                            <a href="?logout" class="dropdown-item logout">
                                                <i class="mdi mdi-logout"></i> Logout
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
        <div class="sidebar">
            <div class="menu">
                <ul>
                    <li>
                        <a href="index" data-toggle="tooltip" data-placement="right" title="Dashboard">
                            <span><i class="mdi mdi-view-dashboard"></i></span>
                        </a>
                    </li>
                    <li>
                        <a href="depositfunds" data-toggle="tooltip" data-placement="right" title="Deposit">
                            <span><i class="mdi mdi-face-profile"></i></span>
                        </a>
                    </li>

                    <li>
                        <a href="crypto" data-toggle="tooltip" data-placement="right" title="Buy Crypto">
                            <span><i class="mdi mdi-tumblr-reblog"></i></span>
                        </a>
                    </li>
                    
                    <li>
                        <a href="deposits" data-toggle="tooltip" data-placement="right" title="Transactions">
                            <span><i class="mdi mdi-database"></i></span>
                        </a>
                    </li>
                    <li>
                        <a href="profilesettings" data-toggle="tooltip" data-placement="right" title="Profile">
                            <span><i class="mdi mdi-account"></i></span>
                        </a>
                    </li>
                    <li>
                        <a href="?logout" data-toggle="tooltip" data-placement="right" title="Logout">
                            <span><i class="mdi mdi-power"></i></span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>

        <div class="page-title dashboard">
            <div class="container">
                <div class="row">
                    <div class="col-6">
                        <div class="page-title-content">
                            <p>Welcome Back,
                                <span><?php echo ucfirst($userRow['fullname']); ?></span>
                            </p>
                        </div>
                    </div>
                    <div class="col-6">
                        <ul class="text-right breadcrumbs list-unstyle">
                           
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <div class="content-body">
            <div class="container">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="card sub-menu">
                            <div class="card-body">
                                <ul class="d-flex">
                                    
                                    <li class="nav-item">
                                        <a href="depositfunds" class="nav-link">
                                            <i class="mdi mdi-heart"></i>
                                            <span>Deposit</span>
                                        </a>
                                    </li>
                                    <li class="nav-item">
                                        <a href="withdraw" class="nav-link">
                                            <i class="mdi mdi-pentagon"></i>
                                            <span>Withdraw</span>
                                        </a>
                                    </li>
                                    <li class="nav-item">
                                        <a href="invest" class="nav-link">
                                            <i class="mdi mdi-diamond"></i>
                                            <span>Invest</span>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="col-xl-12">
                        <div class="card">
                            <div class="card-header">
                                <h4 class="card-title">Deposit Funds</h4>
                            </div>
                            <div class="col-sm-7">
                        <?php if(isset($msg)) echo $msg; ?>
                        <?php if(isset($_GET['low-funds'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                You cannot deposit less than $1,000
                            </div>
                        <?php } ?>
                        <small>Funds are sent directly to your account balance on your member dashboard. <b>The value should be entered in USD.</b></small>
                        </div>
                            <div class="card-body">
                                <div class="row justify-content-center">
                                    <div class="col-xl-8">
                                        <form action="" class="py-5" method="post">

                                            <div class="form-group row align-items-center">
                                                <div class="col-sm-4">
                                                    <label for="inputEmail3" class="col-form-label">Amount USD
                                                        <br/>
                                                        <small>Minimum amount : 1000 USD</small>
                                                    </label>
                                                </div>
                                                <div class="col-sm-8">
                                                    <div class="input-group mb-3">
                                                        <div class="input-group-prepend">
                                                            <label class="input-group-text bg-primary"><i
                                                                    class="mdi mdi-currency-usd fs-18 text-white"></i></label>
                                                        </div>
                                                        <input onkeyup="convert()" type="text" class="form-control text-right" id="usd" name="amount"
                                                            placeholder="4999"  required autofocus="">
                                                    </div>
                                                </div>
                                            </div>
                                            <?php
                                            $usd = 500;
                                            $btc = file_get_contents("https://blockchain.info/tobtc?currency=USD&value=" . $usd);
                                            ?>
                                            <div class="form-group row align-items-center">
                                                <div class="col-sm-4">
                                                    <label for="inputEmail3" class="col-form-label">Amount BTC
                                                        <br />
                                                        <small>Equivalent BTC value</small>
                                                    </label>
                                                </div>
                                                <div class="col-sm-8">
                                                    <div class="input-group mb-3">
                                                        <div class="input-group-prepend">
                                                            <label class="input-group-text bg-primary"><i
                                                                    class="cc BTC-alt text-white"></i></label>
                                                        </div>
                                                        <input type="text" id="btc" name="btc" class="form-control text-right"
                                                            placeholder="<?php echo $btc; ?>" required autofocus="" readonly>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="text-right">
                                                <button class="btn btn-primary" name="btn-submit">Deposit Now</button>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-xl-12">
                        <div class="card">
                            <div class="card-header">
                                <h4 class="card-title">Important Information</h4>
                            </div>
                            <div class="card-body">
                                <div class="important-info">
                                    <ul>
                                        <li>
                                            <i class="mdi mdi-checkbox-blank-circle"></i>
                                            Enter the amount to be deposited in USD and the equivalent btc value will be provided to you in the box above.
                                        </li>
                                        <li>
                                            <i class="mdi mdi-checkbox-blank-circle"></i>
                                            BTC network deposits will be credited to your account after
                                                12 network confirmations.
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>



        <div class="footer dashboard">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-8 col-12">
                        <div class="copyright">
                            <p>© Copyright
                                <script>
                                    var CurrentYear = new Date().getFullYear()
                                    document.write(CurrentYear)
                                </script> <a href="https://sescentigate.com">Sescentigate</a> All Rights Reserved
                            </p>
                        </div>
                    </div>
                    <div class="col-sm-4 col-12">
                        <div class="footer-social">
                            <ul>
                            <div id="google_translate_element"></div>
                    <script type="text/javascript">
                    function googleTranslateElementInit() {
                      new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
                    }
                    </script>

                    <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
      function convert(){
                  var usd = document.getElementById('usd').value;
                  $.ajax({
                      type:"GET",
                      url: "https://min-api.cryptocompare.com/data/price?fsym=USD&tsyms=BTC,EUR",
                      dataType: 'text',
                      success: function(data)
                      {
                          var ret1 = data.replace('{"BTC":','');
                          var tmp1 = ret1.split(",");
                          document.getElementById('btc').value=(''+tmp1[0]*usd);
                      }
                  });
      };
      </script>

    <script src="js/global.js"></script>

    <script src="vendor/waves/waves.min.js"></script>

    <script src="js/scripts.js"></script>
</body>


</html>