<?php
session_start();
require_once '../../../../classconn/class.user.php';
require_once '../../../../action/usercontrol/setup.php';
require_once '../../../../action/sessiontimer/intimer.php';
require_once '../../../../action/investment/invest.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 | Invest</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 class="dropdown">
                                        
                                    </div>
                                </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">Invest Funds</h4>
                            </div>
                            <div class="col-sm-7">
                       <?php if(isset($msg)) echo $msg; ?>
                        <?php if(isset($_GET['success'])) { ?>
                            <div class="alert alert-success alert-dismissible" role="alert">
                                You have successfully started an investment schedule.
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['invalid'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                You can only place a minimum investment of $1,000.
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['insufficient-balance'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                Insufficient funds to invest.
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['low-funds'])) { ?>
                            <div class="alert alert-warning alert-dismissible" role="alert">
                                To start an investment you must have a minimum of $1,000 in your account balance
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['starter-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the starter plan
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['premium-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the premuim plan
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['hedgefund-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the hedgefund bundle
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['nfp-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the NFP plan
                            </div>
                        <?php } ?>
                         <?php if(isset($_GET['nfpp-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the NFP Premium plan
                            </div>
                        <?php } ?>
                        
                        <?php if(isset($_GET['trial-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the Trial plan
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['fomc-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the FOMC plan
                            </div>
                        <?php } ?>
                        <?php if(isset($_GET['spot-error'])) { ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                The amount is invalid for the Spot Trading plan
                            </div>
                        <?php } ?>
                        </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">Balance
                                                        <br />
                                                        <small>Available Balance</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 type="text" class="form-control text-right"
                                                            placeholder="<?php echo number_format($userRow['balance'],2); ?> "readonly="">
                                                    </div>
                                                </div>
                                            </div>         

                                            <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: 2500 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 type="text" class="form-control text-right" id="amount" name="amount"
                                                            placeholder="999"  required autofocus="">
                                                    </div>
                                                </div>
                                            </div>   

                                            <div class="form-group">
                                            <label class="mr-sm-2">Choose Plan</label>
                                            <div class="input-group mb-3">
                                                <select name="plan" id="plan" class="form-control" required>
                                                <option data-display="Trial" value="trial">Trial Plan 2.5% Monthly | Minimum $1,000 
                                                    </option>
                                                    <option value="starter">Starter 5-10% Monthly |Minimum $2,500 - $9,999</option>
                                                    <option value="premium">Premium 10-15% Monthly |Minimum $10,000 - $99,000</option>
                                                    <option value="hedgefund">HedgeFund 20-25% Monthly |Minimum $500,000</option>
                                                    <option value="nfp">NFP 40-85% Monthly |Minimum $50,000</option>
                                                    <option value="nfpp">NFP Premium 80-150% Monthly |Minimum $250,000</option>
                                                    <option value="spot">Spot 20-25% Monthly |Minimum $100,000</option>
                                                </select>   
                                            </div>
                                        </div>

                                            <div class="text-right">
                                                <button class="btn btn-primary" name="btn-invest">Invest 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>
                                            Choose from any of our affordable investment plans and start earning untill your plan expires.
                                        </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 src="js/global.js"></script>

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

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


</html>