<?php

include("../config.php");
session_start();

if(isset($_SESSION["user_login"])){
	$userid = $_SESSION["user_login"];
}else{
		header("location: ../register-login.php");
	}
	

		//Admin info
		$stmt="SELECT * FROM users WHERE userid = :userid";
		$stmt=$pdo->prepare($stmt);
		$stmt->bindParam("userid", $userid, PDO::PARAM_STR);
		$stmt->execute();
		$row=$stmt->fetch();
		$userimage = (!empty($row["profilepix"]) ? "../img/users/".$row["profilepix"]: "../img/avatar.png");
		
		
		
		if(!isset($_GET["user"])){
			header("location:users.php");
		}else{
			$theUser = intval($_GET["user"]);
		}
		
		
		//get user info
		$stmt="SELECT * FROM users WHERE userid = :userid";
		$stmt=$pdo->prepare($stmt);
		$stmt->bindParam("userid", $theUser, PDO::PARAM_STR);
		$stmt->execute();
		$userInfo=$stmt->fetch();
		$userimg = (!empty($userInfo["profilepix"]) ? "../img/users/".$userInfo["profilepix"]: "../img/avatar.png");
		
		
		
		//get users Acct Bal
		$stmt=$pdo->prepare("SELECT * FROM account WHERE userid = :userid");
		$stmt->bindParam(":userid", $theUser, PDO::PARAM_STR);
		$stmt->execute();
		$Act = $stmt->fetch();
		
		
		
		
		//Investment Random ref ID
		$gen = "1234ABCDEFGHI567890JKLMNOPQRSTUVWXYZ";
		$shuff = str_shuffle($gen);
		$ref = substr($shuff,0,25);
		
	
	
?>

<style>
form label{
	font-weight:500!important;
	color:#444;
	cursor:pointer;
	font-size:16px!important;
}

.btt{
	margin:4px;
	background-color: #4477a9!important;
	border-color: #4587c7!important;
}

.prime-hover{
	color:#4583c3;
	font-weight:500;
	cursor:pointer;
}
.prime-hover:hover{
	color:#3d77b3;
}
select{
	-moz-appearance:none;
	-webkit-appearance:none;
	appearance:none;
	text-indent:1px;
	text-overflow:'';
}	
</style>


<!DOCTYPE html>

<html lang="en">

<head>

        <meta charset="utf-8" />

        <title> Management Funds | Six Digital Assets</title>

        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <meta name="keywords" content="trade, trading, forex, investing, invest, investment, investor, money, chart, bitcoin, ethereum, USDT, coins, cryptocurrencies, crypto, profit, market, online money, money online,">
    <meta name="description" content="Six Digital Assets provides a full investment service focused on the Bitcoin and cryptocurrency trading market. A certified legal investment company incorporated and headquartered in Australia.">
    <meta name="author" content="Six Digital Assets">

        <meta http-equiv="X-UA-Compatible" content="IE=edge" />

      

            <link rel="stylesheet" type="text/css" href="w3.css">

        <!-- Bootstrap Css -->

        <link href="assets/css/bootstrap.min.css" id="bootstrap-stylesheet" rel="stylesheet" type="text/css" />

        <!-- Icons Css -->

        <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />

        <!-- App Css-->

        <link href="assets/css/app.min.css" id="app-stylesheet" rel="stylesheet" type="text/css" />

		<link href="../css/style7eda3860.css" rel="stylesheet">

    </head>



    <body>


	<div class='coversoverlay'>
	<center><img src="../img/loader.gif" style="width:60px; margin-top:20%;"></center>
	</div>

  <!-- Begin page -->
  <div id="wrapper" style="overflow:auto!important">

   
   
   <!-- Topbar Start -->
	<?php
	include("header.php");
	?>
    <!-- end Topbar -->
   

    <!-- ========== Left Sidebar Start ========== -->
    <div class="left-side-menu">

      <div class="slimscroll-menu">

        <!-- User box -->
        <div class="user-box text-center ">

          <div class="dropdown">
            <a href="#" class="user-name dropdown-toggle h5 mt-2 mb-1 d-block" data-toggle="dropdown" aria-expanded="false"></a>
            <div class="dropdown-menu user-pro-dropdown">




            </div>
          </div>


        </div>

        <!--- Sidemenu -->
        <?php include("sidebar.php");?>
		
        <!-- End Sidebar -->
        <div class="clearfix"></div>



                </div>

                <!-- Sidebar -left -->



            </div>

            <!-- Left Sidebar End -->






            <div class="content-page" >

                <div class="content" style="width: 100%;color: white;">



                    <!-- Start Content-->

                    <div class="container-fluid" >

                        <div id="google_translate_element"></div>

                         <div class="row">

                            <div class="col-md-12" style="padding-left:0px; padding-right:0px">
                            
						
						<span id="result"></span>
						
				<div class="col-md-7" style="margin-top:20px!important;margin: auto;">
				
                <div class="card-box" style="background-image:radial-gradient(ellipse closest-side, rgba(225, 225, 225, 0),#e9f3fb);">
				<h2 align="center" style='color:#767e80'>Manage Funds</h2>
				<div class="dropdown-divider"></div><br>
		
				
			   
              <center>
				<button class="btn btn-primary btt" id="dropBonus"><i class="fa fa-plus"></i>&nbsp; Bonus</button>
				<button class="btn btn-primary btt" id="dropInvest"><i class="fa fa-plus"></i>&nbsp; Invest</button>
				<button class="btn btn-primary btt" id="dropPenalty"><i class="fa fa-plus"></i>&nbsp; Penalty</button>
				<button class="btn btn-primary btt" id="dropRef"><i class="fa fa-plus"></i>&nbsp; Referral Commission</button>
			</center>
			
			<div class="dropdown-divider"></div><br>
			
			
		<center><img src="<?php echo $userimg;?>" class="avatars"></center><br>
		<div style="color:#405972; font-size:16px; margin-bottom:10px;text-align:center"><b><?php echo htmlspecialchars($userInfo["fullName"]);?>
		</b></div>

			<!--Bonus Tab-->
			<div id="addBonus" class="display-none">
			<center>
				<h3 align="center" style='color:#767e80;margin-bottom:20px;border:1px solid #d3d3d3;padding:5px;width:250px;border-radius:10px'>
				Add Bonus</h3>
			</center>
			
				<div style="color:#405972; font-size:14px; margin-top:4px;text-align:center">
				<b>Account Balance</b>
				<br><h3 style="margin-top:4px;font-weight:500">$ <span class="Bbal"><?php echo number_format(intval($Act["balance"]))?></span>.00 
				<span id="add"></span></h3></div>
				<div class="dropdown-divider" style="border-color:#e9eff5;"></div>
				
			  
			<div class="row" style="margin-left:0px;">
			<div class="form-group col-md-12">
            
			<label for="bonus" style="font-size:17px;">Bonus Amount</label>
			<br><input type="number" name="bonus" placeholder="$ 0.00" step="0.01" id="bonus" class="form-control">
            
			<label for="bonusDesc" style="font-size:17px;margin-top:20px">Description</label>
			<br><input type="text" name="bonusDesc" placeholder="Describe transaction" id="bonusDesc" class="form-control">
			
			</div>
			</div>
			<div style="margin-left:10px;">
			<div style="color:#888;line-height:17px;font-size:14px;">
			<input type="checkbox" id="checkBonus" style="width:20px;outline:none;">
			<label for="checkBonus" style="margin-left: 5px;">Notify the user</label></div>
			
			<br><button class="btn btn-primary btt" id="processBonus">Add Bonus</button>
			</div>
			</div>
	
	<section id="sucB" class="display-none sucs">
	<div style="color:#2ecc71;font-size:17px;display:flex;justify-content:center;place-items:center; text-align:center;margin:0px auto 20px auto;">
	<span>Bonus request Sent</span> &nbsp; <span><img src="../img/tick.png" width="25"></span></div>
		
	<center><div class="btn btnss" id="AnotherB"> Another Transaction</div></center>
	</section>	
			 
			<!--/Bonus Tab-->
			
			
			
			
			
			
			<!--Invest Tab-->
			<div id="addInvest" class="display-none">
			<center>
				<h3 align="center" style='color:#767e80;margin-bottom:20px;border:1px solid #d3d3d3;padding:5px;width:250px;border-radius:10px'>
				Add Investment</h3>
			</center>
			
				<div style="color:#405972; font-size:14px; margin-top:4px;text-align:center">
				<b>Account Balance</b>
				<br><h3 style="margin-top:4px;font-weight:500">$ <span class="Bbal"><?php echo number_format(intval($Act["balance"]))?></span>.00 
				<span id="plann"></span></h3></div>
				<div class="dropdown-divider" style="border-color:#e9eff5;"></div>
				
			  
			<div style="margin:12px 22px;font-size:18px;color:#326ca9;">Investment Plans</div>
				<div class="dropdown-divider"></div>


				   <div class="plans">
				  
				  <div class="inner-plan">
				  <div class="inner-plan-head">
				  <h4>BRONZE</h4>
					<text>$100 - $999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  4% ROI After 3 days<br><div class="dropdown-divider" style="border-color: #d2d2d3;"></div>
				  </div>
				  </div>
				  
				  <div class="inner-plan">
				  <div class="inner-plan-head">
				  <h4>SILVER</h4>
					<text>$1,000 - $4,999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  6% ROI After 3 days <div class="dropdown-divider" style="border-color: #d2d2d3;"></div>
				  </div>
				  </div>
				  
				  </div>
				  
				  
				  
				  <div class="plans">
				  
				  <div class="inner-plan">
				  <div class="inner-plan-head">
				  <h4>GOLD</h4>
					<text>$5,000 - $49,999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  8% ROI After 3 days <div class="dropdown-divider" style="border-color: #d2d2d3;"></div>
				  </div>
				  </div>
				  
				  <div class="inner-plan">
				  <div class="inner-plan-head">
				  <h4>PLATINUM</h4>
					<text>$5,000 - $49,999</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  10% ROI After 3 days <div class="dropdown-divider" style="border-color: #d2d2d3;"></div>
				  </div>
				  </div>
				  
				  <div class="inner-plan">
				  <div class="inner-plan-head">
				  <h4>VIP</h4>
					<text>$150,000 - Unlimited</text>
				  </div>
				  <div style="padding:10px;color:#436289;font-size:15px;line-height:1.5;">
				  15% ROI After 3 days<br><div class="dropdown-divider" style="border-color: #d2d2d3;"></div>
				  </div>
				  </div>
				  
				  </div>
				  
				  

				  
				  
				  
				  <div class="form-group" style="padding:10px;">
                  <label for="amount" style="font-size:16px;margin:10px 0px 10px 13px"> Select Amount</label>
					
					<div class="col-sm-12">
					 <select class="form-control form-control-lg" id="amount" name="amount">
					 <option selected id="selected" value="50">$ 50.00</option>
					 <option value="100">$ 100.00</option>
					 <option value="300">$ 300.00</option>
					 <option value="1000">$ 1,000.00</option>
					 <option value="3000">$ 3,000.00</option>
					 <option value="5000">$ 5,000.00</option>
					 <option value="8000">$ 8,000.00</option>
					 <option value="10000">$ 10,000.00</option>
					 <option value="20000">$ 20,000.00</option>
					 <option value="30000">$ 30,000.00</option>
					 </select>
					 
                    </div>
                  </div>
				  
				  
				  
				  
			<div class="text-priary prime-hover" id="addAmount" style="margin:8px 20px 20px;font-size:15px;">+ Other Amount</div>
			
			<!--custom amount - optional-->
			<div class="display-none" id="addAmountDrop" style="padding:10px;">
			<div class="display-none row" style="margin-left:10px;display:flex;place-items:center;">
			<div class="form-group">
            <label for="customAmount">Custome Amount</label>
			<br><input type="number" style="width:200px" name="customAmount" placeholder="$ 0.00" step="0.01" id="customAmount" class="form-control">
            </div>
			<div id="closeaddAmountDrop" style="padding:20px 15px" class="fas fa-times prime-hover"></div>	
            </div>
			<div style="color:#888;line-height:17px; margin-left:10px;font-size:14px;">Minimum amount $100. Maximum amount $Unlimited</div>
			
            </div>
			
			<div class="form-group" style="padding:10px;">
			<div class="col-md-12">
			<label for="invDesc" style="font-size:17px;margin:15px">Description</label>
			<br><input type="text" name="invDesc" placeholder="Describe transaction" id="invDesc" class="form-control">
			</div>
			</div>
				  
				  <div class="dropdown-divider"></div>
				  <br>
				   <div class="form-group" style="padding:5px;">
                    <label for="ref" required style="margin-left:10px"><i class="fas fa-qrcode"></i> Transaction Ref ID</label>
                    <div class="col-sm-12">
                    <input type="text" name="ref" readonly class="form-control" id="ref" value="<?php echo htmlspecialchars($ref);?>">
                    <br><br>
					
                  <button id="invest" class="btn btnss btn-block">Process &nbsp;<i class="fas fa-location-arrow"></i></button>
                 </div></div>
               </div>
			   
	<section id="sucI" class="display-none sucs">
	<div style="color:#2ecc71;font-size:17px;display:flex;justify-content:center;place-items:center; text-align:center;margin:0px auto 20px auto;">
	<span>Payment request recorded</span> &nbsp; <span><img src="../img/tick.png" width="25"></span></div>
		
	<div id="plans" class="inner-plan-head" style="text-align:center;margin:2px auto 20px auto; width:170px;text-shadow: 0.1em 0.1em 0.1em #856565;">
	 
	</div>
	
	
	<center>
	
	<div style="color:#657d86;font-size:15px;margin:0px auto 10px auto;">Proceed to approve transaction</div>
	<a href="userStats.php?getUser=<?php echo intval($theUser);?>">
	<div class="btn btn-success">Approve Transaction &nbsp;<i class="fas fa-location-arrow"></i></div></a>
	<br><br>
	<div class="btn btnss" id="AnotherI"> Another Transaction</div></center>
	</section>
			 
			<!--/Invest Tab-->
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			 <!--Penalty Tab-->
			<div id="addPenalty" class="display-none">
			<center>
				<h3 align="center" style='color:#767e80;margin-bottom:20px;border:1px solid #d3d3d3;padding:5px;width:250px;border-radius:10px'>
				Penalty</h3>
			</center>
			
				<div style="color:#405972; font-size:14px; margin-top:4px;text-align:center">
				<b>Account Balance</b>
				<br><h3 style="margin-top:4px;font-weight:500">$ <span class="Bbal"><?php echo number_format(intval($Act["balance"]))?></span>.00 
				<span id="pen"></span></h3></div>
				<div class="dropdown-divider" style="border-color:#e9eff5;"></div>
				
			  
			<div class="row" style="margin-left:0px;">
			<div class="form-group col-md-12">
           
		   <label for="penalty" style="font-size:17px;">Deduction Amount</label>
			<br><input type="number" name="penalty" placeholder="$ 0.00" step="0.01" id="penalty" class="form-control">
            
			<label for="penalDesc" style="font-size:17px;margin-top:20px">Description</label>
			<br><input type="text" name="penalDesc" placeholder="Describe transaction" id="penalDesc" class="form-control">
           
			</div>
			</div>
			<div style="margin-left:10px;">
			<input type="checkbox" id="checkPenalty" style="width:20px;outline:none;">
			<label for="checkPenalty" style="margin-left: 5px;">Notify the user</label>
			
			<br><button id="processPenal" class="btn btn-primary btt">Proceed Deduction</button>
			</div>
			 </div>
			 
	<section id="sucP" class="display-none sucs">
	<div style="color:#2ecc71;font-size:17px;display:flex;justify-content:center;place-items:center; text-align:center;margin:0px auto 20px auto;">
	<span>Penalty Served</span> &nbsp; <span><img src="../img/tick.png" width="25"></span></div>
		
	<center><div class="btn btnss" id="AnotherP"> Another Transaction</div></center>
	</section>
			
			<!--/Penalty Tab-->
			 
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			   <!--Refferral Commission Tab-->
			   
			<div id="addRef" class="display-none">
			<center>
				<h3 align="center" style='color:#767e80;margin-bottom:20px;border:1px solid #d3d3d3;padding:5px;width:250px;border-radius:10px'>
				Ref Commission</h3>
			</center>
			
				<div style="color:#405972; font-size:14px; margin-top:4px;text-align:center">
				<b>Account Balance</b>
				<br><h3 style="margin-top:4px;font-weight:500">$ <span class="Bbal"><?php echo number_format(intval($Act["balance"]))?></span>.00 
				<span id="reff"></span></h3></div>
				<div class="dropdown-divider" style="border-color:#e9eff5;"></div>
				
			  
			<div class="row" style="margin-left:0px;">
			<div class="form-group col-md-12">
            
			<label for="refs" style="font-size:17px;">Commission Amount</label>
			<br><input type="number" name="refs" placeholder="$ 0.00" step="0.01" id="refs" class="form-control">
            
			<label for="refDesc" style="font-size:17px;margin-top:20px">Description</label>
			<br><input type="text" name="refDesc" placeholder="Describe transaction" id="refDesc" class="form-control">
			
			</div>
			</div>
			<div style="margin-left:10px;">
			
			<input type="checkbox" id="checkRef" style="width:20px;outline:none;">
			<label for="checkRef" style="margin-left: 5px;">Notify the user</label>
			
			<br><button  id="processRef" class="btn btn-primary btt">Proceed</button>
			</div></div>
			 
			
	<section id="sucR" class="display-none sucs">
	<div style="color:#2ecc71;font-size:17px;display:flex;justify-content:center;place-items:center; text-align:center;margin:0px auto 20px auto;">
	<span>Commission Sent</span> &nbsp; <span><img src="../img/tick.png" width="25"></span></div>
		
	<center><div class="btn btnss" id="AnotherR"> Another Transaction</div></center>
	</section>
			 <!--/Refferral Commission Tab-->
			 
			  
	<br><br>	  
	<div class="dropdown-divider" style="border-color: #c5d3ea;"></div>	    
	<a href="userStats.php?getUser=<?php echo intval($theUser);?>">
	<div class="btn btnss" style="width:100%; margin-top:4px;"><i class="fa fa-caret-left"></i> &nbsp;Go back </div>
	</a>	
              
				 
						</div>
							</div>  
						   </div>
							</div> <!-- container-fluid -->



                </div> <!-- content -->
                </div> 
              
					</div> 
	
					</div>
               


       

        <!-- Vendor js -->

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



        <!-- knob plugin -->

        <script src="assets/libs/jquery-knob/jquery.knob.min.js"></script>



        <!--Morris Chart-->

        <script src="assets/libs/morris-js/morris.min.js"></script>

        <script src="assets/libs/raphael/raphael.min.js"></script>



        <!-- Dashboard init js-->

        <script src="assets/js/pages/dashboard.init.js"></script>



        <!-- App js -->

        <script src="assets/js/app.min.js"></script>

   
   
   
   
   
   
   
   
   
   <script>
   
   $(document).ready(function(){
		
	
	$('.coversoverlay').hide();
		 
	
	 
	//TAB CONTROLS


	//Bonus Tab
	$("#dropBonus").click(function(){
		$("#bonus").val("");	//clear input
		
		
		//hide other tabs
		$("#addInvest").addClass("display-none");
		$("#addPenalty").addClass("display-none");
		$("#addRef").addClass("display-none");
		
		//revert other tabs btn colors
		$("#dropInvest").addClass("btt");
		$("#dropPenalty").addClass("btt");
		$("#dropRef").addClass("btt");
		
		
		//Show Bonus Tab
		$("#addBonus").removeClass("display-none").slideDown();
		$("#dropBonus").removeClass("btt");
		
		//hide sucess msgs
		$(".sucs").addClass("display-none");
		
	});
		 
		 
		 //Auto Type the Bonus Amount
		 $("#bonus").keyup(function(){
			
			let bonVal = $("#bonus").val();
			
			if(bonVal == ""){
			$("#add").html("");	
			}else{
			$("#add").html("<font color='#01a701'> + $" + bonVal + "</font>");
			}
			
		 });
		 
		 
		 
		 
	//Process User Bonus
	
	$("#processBonus").click(function(){
		
		let amount = $("#bonus").val();
		let description = $("#bonusDesc").val();
		let AddBonus = "AddBonus";
		let user = <?php echo $theUser;?>;
		
		//check if the checkBox is checked so we can notify user
		if($("#checkBonus").is(":checked")){var notifyB = "Notify"}
		
		
		//validate
		if(amount ==""){
			$("#bonus").focus();
			return false
		}else{
		
		
		$.ajax({
			url:'function.php',
			method:'POST',
			data:{amount:amount,AddBonus:AddBonus,user:user,description:description,notifyB:notifyB},
			beforeSend:function(){$(".coversoverlay").show()},
			success:function(data){
			
			$("#result").html(data);
				
				//console.log(data);
				$(".coversoverlay").hide();
				
			}
		});
	}
		
		});
	
	//when Another Transaction is clicked Drop Bonus form again
	$("#AnotherB").click(function(){
	$("#addBonus").slideDown(function(){
		$("#sucB").addClass("display-none");
		
		$("#bonus").val("");	//clear input		
		});
	});
		 
		 
		 
		 
		 
		 
		 
		 
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	//Investment Tab
	
	$("#dropInvest").click(function(){
	
		//hide other tabs
		$("#addBonus").addClass("display-none");
		$("#addPenalty").addClass("display-none");
		$("#addRef").addClass("display-none");
		
		
		//revert other tabs btn colors
		$("#dropBonus").addClass("btt");
		$("#dropPenalty").addClass("btt");
		$("#dropRef").addClass("btt");
		
		//Show Invest Tab
		$("#addInvest").removeClass("display-none").slideDown();;
		$("#dropInvest").removeClass("btt");
		
		//hide sucess msgs
		$(".sucs").addClass("display-none");
	
	});	
	
	
	//Add Custom Amount
	$("#addAmount").click(function(){
		$("#addAmount").fadeOut(100,function(){
		$("#addAmountDrop").removeClass("display-none");
		$("#customAmount").focus();		
		});
		
		//disable select input
		$("#amount").prop("disabled",true);
		$("#amount").val("");
		
	});

	$("#closeaddAmountDrop").click(function(){
		$("#addAmountDrop").addClass("display-none");	
		$("#addAmount").fadeIn(100);
		
		//clear input
		$("#customAmount").val("");
		
		//enable select input
		$("#amount").prop("disabled",false);
		$("#selected").prop("selected",true);
		
	});
		 
		 
		
		 //Process User Investment
	
	$("#invest").click(function(){
		
		
		let amount = $("#amount").val();
		let description = $("#invDesc").val();
		let customAmount = $("#customAmount").val();
		let ref = $("#ref").val();
		let user = <?php echo $theUser;?>;
		
		
		 //validate
		if($("#amount").is(':disabled') && customAmount < 50){
			
			alert("Enter amount greater than $50");
			$("#customAmount").focus();
			return false
		
		}else{
	

		$.ajax({
			url:'function.php',
			method:'POST',
			data:{amount:amount, customAmount:customAmount, ref:ref, user:user, description:description},
			beforeSend:function(){$(".coversoverlay").show()},
			success:function(data){
			
			$("#result").html(data);
				
				//console.log(data);
				$(".coversoverlay").hide();
				
			}
		});
	}
		
		});
	
	//when Another Transaction is clicked Drop Bonus form again
	$("#AnotherI").click(function(){
	$("#addInvest").slideDown(function(){
		$("#sucI").addClass("display-none");
		
		$("#customAmount").val("");	//clear input		
		});
	});
		 
		 
		 
		 
	













		 
	








	





















		
		
		
	//Penalty Tab
	$("#dropPenalty").click(function(){	
	$("#penalty").val("");	//clear input
		
		//hide other tabs
		$("#addBonus").addClass("display-none");
		$("#addInvest").addClass("display-none");
		$("#addRef").addClass("display-none");
		
		
		//revert other tabs btn colors
		$("#dropBonus").addClass("btt");
		$("#dropInvest").addClass("btt");
		$("#dropRef").addClass("btt");
		
		//Show Penalty Tab
		$("#addPenalty").removeClass("display-none").slideDown();;
		$("#dropPenalty").removeClass("btt");
		
		//hide sucess msgs
		$(".sucs").addClass("display-none");
	
	});
		 
		 
		 //Auto Type the Penal Amount
		 $("#penalty").keyup(function(){
			
			let penVal = $("#penalty").val();
			
			if(penVal == ""){
			$("#pen").html("");	
			}else{
			$("#pen").html("<font color='#fb3a3a'> - $" + penVal + "</font>");
			}
			
		 });
		 
		
	
	
	//Process User Penalty
	
	$("#processPenal").click(function(){
		
		let amount = $("#penalty").val();
		let description = $("#penalDesc").val();
		let DeductPenal = "DeductPenal";
		let user = <?php echo $theUser;?>;
		
		//check if the checkBox is checked so we can notify user
		if($("#checkPenalty").is(":checked")){var notifyP = "Notify"}
		
		
		//validate
		if(amount ==""){
			$("#penalty").focus();
			return false
		}else{
		
		
		$.ajax({
			url:'function.php',
			method:'POST',
			data:{amount:amount,DeductPenal:DeductPenal,user:user,description:description,notifyP:notifyP},
			beforeSend:function(){$(".coversoverlay").show()},
			success:function(data){
			
			$("#result").html(data);
				
				//console.log(data);
				$(".coversoverlay").hide();
				
			}
		});
	}
		
		});
	
	//when Another Transaction is clicked Drop Bonus form again
	$("#AnotherP").click(function(){
	$("#addPenalty").slideDown(function(){
		$("#sucP").addClass("display-none");
		
		$("#penalty").val("");	//clear input		
		});
	});
		 
		 
		 
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	//Ref Commission Tab
	
	$("#dropRef").click(function(){
		$("#refs").val("");	//clear input
		
		
		//hide other tabs
		$("#addBonus").addClass("display-none");
		$("#addInvest").addClass("display-none");
		$("#addPenalty").addClass("display-none");
		
		
		//revert other tabs btn colors
		$("#dropBonus").addClass("btt");
		$("#dropInvest").addClass("btt");
		$("#dropPenalty").addClass("btt");
		
		//Show Ref Tab
		$("#addRef").removeClass("display-none").slideDown();;
		$("#dropRef").removeClass("btt");
		
		//hide sucess msgs
		$(".sucs").addClass("display-none");
	
	});
		 
		 
		 //Auto Type the Ref Amount
		 $("#refs").keyup(function(){
			
			let refVal = $("#refs").val();
			
			if(refVal == ""){
			$("#reff").html("");	
			}else{
			$("#reff").html("<font color='#01a701'> + $" + refVal + "</font>");
			}
			
		 });
		 
		
		
	
	
	//Process User Referral Commission
	
	$("#processRef").click(function(){
		
		let amount = $("#refs").val();
		let description = $("#refDesc").val();
		let RefCommision = "RefCommision";
		let user = <?php echo $theUser;?>;
		
		
		//check if the checkBox is checked so we can notify user
		if($("#checkRef").is(":checked")){var notifyR = "Notify"}
		
		
		//validate
		if(amount ==""){
			$("#refs").focus();
			return false
		}else{
		
		
		$.ajax({
			url:'function.php',
			method:'POST',
			data:{amount:amount,RefCommision:RefCommision,user:user,description:description,notifyR:notifyR},
			beforeSend:function(){$(".coversoverlay").show()},
			success:function(data){
			
			$("#result").html(data);
				
				//console.log(data);
				$(".coversoverlay").hide();
				
			}
		});
	}
		
		});
	
	//when Another Transaction is clicked Drop Bonus form again
	$("#AnotherR").click(function(){
	$("#addRef").slideDown(function(){
		$("#sucR").addClass("display-none");
		
		$("#refs").val("");	//clear input		
		});
	});
		 
		 
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		



	
 
 
 
 //UPDATE User
 
 $("#update").click(function(e){
	 e.preventDefault();
	 

		$.ajax({
			url:'function.php',
			method:'POST',
			data:{fullName:fullName,username:username,email:email,phone:phone,address:address,country:country,btc:btc,ethereum:ethereum,usdt:usdt,updateUser:updateUser,theUser:theUser},
			beforeSend:function(){$(".coversoverlay").show()},
			success:function(data){
				$("#result").html(data);
				
				//console.log(data);
				$(".coversoverlay").hide();
				
			}
		});
		
		});

 
 
 
 
 
 
 
 
	 
   });
   
   
   
   
   </script>
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
    </body>

</html>