<?php 
session_start();
require('connect.php');
require '../app/assist.php';
$assist = new assist;
$alert_msg = '';
$updatealert = '';
if($_SESSION['goodlogin'] != true){
//   header('location:../index.php');
    
}else{
if(isset($_REQUEST['client_email']) || isset($_SESSION['client_email'])){
if(isset($_REQUEST['client_email'])){
$_SESSION['client_email'] = $_REQUEST['client_email'];
}
	$client_id = $_SESSION['client_email'];
  if(isset($_POST['update_balance'])){
	 $new_balance = $_REQUEST['new_balance'];
$sendtoData = "UPDATE new_customer SET wallet_balance = '$new_balance' WHERE customer_email = '$client_id'";
$querytoData = mysqli_query($cxn, $sendtoData);
if($querytoData){
	$updatealert = '<div class="alert alert-success">UPDATE SUCCESSFUL</div>';
}else{
	$updatealert = '<div class="alert alert-danger">UPDATE NOT SUCCESSFUL</div>';
}
}
$getDatae = "SELECT * FROM new_customer WHERE customer_email = '$client_id'";
						$retrieveDatae = mysqli_query($cxn, $getDatae);
						if($retrieveDatae){
						$sendDataw = mysqli_fetch_array($retrieveDatae);
						}
if(isset($_REQUEST['unique']) && isset($_REQUEST['confirm'])){
	$newstartdate = date('Y-m-d H:i:s');
	$intv_id = $_REQUEST['unique'];
	$sendtoData = "UPDATE investment SET starting_date = '$newstartdate', ad_confirm = 'yes' WHERE investment_unique = '$intv_id'";
	$querytoData = mysqli_query($cxn, $sendtoData);
	if($querytoData){    
		// echo 'good';
	}
}
					}	
				else{
				// 	header('location:view_account.php');
			  }
			}	
  ?>
<!DOCTYPE html>
<html lang="en">

<head>
<title>DASHBOARD - CONTROL PANEL</title>
	<link rel="shortcut icon" href="images/bicon.png">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script>
		addEventListener("load", function () {
			setTimeout(hideURLbar, 0);
		}, false);

		function hideURLbar() {
			window.scrollTo(0, 1);
		}
	</script>
	<!-- css files -->
	<link href="css/bootstrap.css" rel='stylesheet' type='text/css' /><!-- bootstrap css -->
	<link href="css/istyle.css" rel='stylesheet' type='text/css' /><!-- custom css -->
	<link href="css/style.css" rel='stylesheet' type='text/css' /><!-- custom css -->
	<link href="css/font-awesome.min.css" rel="stylesheet"><!-- fontawesome css -->
	<!-- //css files -->

	<!-- google fonts -->
	<link
		href="//fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&amp;subset=devanagari,latin-ext"
		rel="stylesheet">

	<!-- //google fonts -->

<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/popper.min.js"></script>
</head>

<body>
	<!-- //header -->
	<header>
		<div class="container">
			<!-- nav -->
			<nav class="pt-3">
				<div id="logo">
					<h1> <a href="index.php" class="text-white">CONTROL PANEL</a></h1>
				</div>
				<label for="drop" class="toggle">Menu</label>
				<input type="checkbox" id="drop" />
				<ul class="menu mt-md-2 ml-auto">
					<li class="mr-lg-4 mr-2"><a href="index.php" class="text-white">Dashboard</a></li>
					<li class="mr-lg-4 mr-2"><a href="view_account.php" class="text-white"><div class="badge badge-dark p-2">View accounts</div></a></li>
					<li class="mr-lg-4 mr-2"><a href="view_messages.php" class="text-white">View Messages</a></li>
					<li class="mr-lg-4 mr-2"><a href="logout.php" class="text-white">Logout</a></li>
				</ul>
			</nav>
			<!-- //nav -->
		</div>
	</header>
	<!-- //header -->
	<!-- inner banner -->
	<div class="inner-banner2" id="home">
		<div class="container">
		</div>
	</div>
	<!-- inner banner -->

	<!-- TRACKING ORDER -->
	<section class="py-5" id="">
		<div class="container py-md-3">
			<h4 class="heading text-center text-white"> <span class="fa fa-book"></span> WITHDRAWAL REQUEST</h4>
			<div class="row">
			<center><?php echo $alert_msg;?></center>
				<div class="col-lg-12 acct-wrapper">
						
					<table class="table">
						<thead>
							<td>withdrawal Means</td>
							<td>Invest Email</td>
							<!-- <td>Wallet Address</td> -->
							<td>Wallet Amount</td>
							<!-- <td>Withdraw Status</td> -->
							<!-- <td></td> -->
						</thead>
						<?php
						$getData = "SELECT * FROM withdrawal WHERE withdrawal_email = '$client_id'";
						$retrieveData = mysqli_query($cxn, $getData);
						if($retrieveData){
					
							$countall = mysqli_num_rows($retrieveData);
							while($sendData = mysqli_fetch_array($retrieveData)){
						?>			
						<tr>
							<td><?php echo $sendData['withdraw_type']; ?></td>
							<td>
							<?php echo $sendData['withdrawal_email']; ?></td>
							<!-- <td><?php //echo $sendData['wallet_address']; ?></td> -->
							<td><?php echo $sendData['withdrawal_amt']; ?> BTC</td>
							<!-- <td><?php //echo $sendData['withdrawal_status']; ?></td> -->
							<td>
							<?php 
							// if($sendData['withdrawal_status'] == 'success'){
							// 	echo '<span class="badge badge-success">Paid!</span>';
							// }elseif($sendData['withdrawal_status'] == 'fail'){
							// 	echo '<span class="badge badge-danger">Failed!</span>';
							// }else{
							?>
							<!-- <a href="delete.php?chtopaid=true&with_id=<?php //echo $sendData['withdrawal_invest_unique']; ?>" class="btn btn-sm btn-success">Change Status to Paid!</a></td> -->
						</tr>
						<?php
						//  }
					}} ?>
					</table>
				</div>
			</div>
		</div>
		</div>
	</section>

</body>

</html>