<?php

include('php/database.php');
include('php/security.php');
session_start();
if(logged_in())
{
	header('location:../login.php');
}
$id= $_SESSION['id'];
$results= mysqli_query($connection, "SELECT `date`, `id`, `name`, `email`, `number`, `password`, `phone`, `address`, `country`, `gender`, `image`, `vcode`, `verified`, `verify`, `balance`, `totalbalance`, `investbalance`, `profit`, `totaldeposit`, `totalwithdrawal`, `loanlimit`, `availableloan`, `ongoingloan`, `savings`, `idcard`, `idcardback`, `accountstatus`, `pina`, `pinb`, `pinc`, `pind` FROM users WHERE id ='$id'");
$retrive= mysqli_fetch_array($results);
$date = $retrive['date'];
$id = $retrive['id'];
$name = $retrive['name'];
$email = $retrive['email'];
$number = $retrive['number'];
$password = $retrive['password'];
$phone = $retrive['phone'];
$address = $retrive['address'];
$country = $retrive['country'];
$gender = $retrive['gender'];
$image = $retrive['image'];
$vcode = $retrive['vcode'];
$verified = $retrive['verified'];
$verify = $retrive['verify'];
$balance = $retrive['balance'];
$totalbalance = $retrive['totalbalance'];
$investbalance = $retrive['investbalance'];
$profit = $retrive['profit'];
$totaldeposit = $retrive['totaldeposit'];
$totalwithdrawal = $retrive['totalwithdrawal'];
$loanlimit = $retrive['loanlimit'];
$availableloan = $retrive['availableloan'];
$ongoingloan = $retrive['ongoingloan'];
$savings = $retrive['savings'];
$idcard = $retrive['idcard'];
$idcardback = $retrive['idcardback'];
$accountstatus = $retrive['accountstatus'];
$pina = $retrive['pina'];
$pinb = $retrive['pinb'];
$pinc = $retrive['pinc'];
$pind = $retrive['pind'];

?>



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


<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, viewport-fit=cover">
    <title>Withdraw Funds</title>
    <!-- Favicon and Touch Icons  -->
    <link rel="shortcut icon" href="images/logo.png" />
    <link rel="apple-touch-icon-precomposed" href="images/logo.png" />
    <!-- Font -->
    <link rel="stylesheet" href="fonts/fonts.css" />
    <!-- Icons -->
    <link rel="stylesheet" href="fonts/icons-alipay.css">
    <link rel="stylesheet" href="styles/bootstrap.css">

    <link rel="stylesheet" type="text/css" href="styles/styles.css" />
    <link rel="manifest" href="_manifest.json" data-pwa-version="set_in_manifest_and_pwa_js">
    <link rel="apple-touch-icon" sizes="192x192" href="app/icons/icon-192x192.png">

    <script src="https://cdn.tailwindcss.com"></script>
</head>

<body class="font-sans text-[12px] leading-[20px] font-medium text-textGray bg-white w-full m-auto overflow-hidden">
     <!-- preloade -->
     <div class="preload preload-container">
        <div class="preload-logo">
          <div class="spinner"></div>
        </div>
      </div>
    <!-- /preload -->
    <div class="header">
        <div class="tf-container">
            <div class="tf-statusbar d-flex justify-content-center align-items-center">
                <a href="#" class="back-btn"> <i class="icon-left"></i> </a>
                <h3>Topup </h3>&nbsp; &nbsp; <div  class="gtranslate_wrapper"></div>
<script>window.gtranslateSettings = {"default_language":"en","detect_browser_language":true,"wrapper_selector":".gtranslate_wrapper"}</script>
<script src="https://cdn.gtranslate.net/widgets/latest/dropdown.js" defer></script>
            </div>
        </div>
    </div>
    <div class="content-by-bank mt-3">
        <div class="tf-container">
           
             <form class="tf-form mt-3" action="topup-method.php" method="GET" onsubmit="return validation()">
                
              
               
                <div class="group-input input-field input-money">
                    <label for="">Amout Of Money</label>
                    <input type="text"  id="amount" name="amount" class="search-field value_input st1" type="text">
                    <span class="icon-clear"></span>
                  <div class="error1"></div>
                </div>
				
				
               
                <div class="bottom-navigation-bar bottom-btn-fixed st2">
                    <button type="submit" class="tf-btn accent large">Continue</button>
                </div>

             </form>
<div class="amount-money mt-5">
        <div class="tf-container">
            <h3>Amount Money</h3>
            <ul class="money list-money">
                <li><a class="tag-money" href="#">5000</a> </li>
                <li><a class="tag-money" href="#">10000</a> </li>
                <li><a class="tag-money" href="#">20000</a> </li>
                <li><a class="tag-money" href="#">50000</a> </li>
                <li><a class="tag-money" href="#">100000</a> </li>
                <li><a class="tag-money" href="#">200000</a> </li>
             </ul>
        </div>
    </div>
        </div>
    </div>
    
      <div class="app-section st1 mt-1 mb-5 bg_text-white">
                <div class="tf-container">
                    <div class="trading-month">
                        <h4 class="fw_5 mb-3">Deposit History</h4>
                        <div class="group-trading-history mb-5">
                           
 <?php
    $query = "SELECT * FROM `deposit` WHERE id='$id' ORDER by did DESC";
   $query_run = mysqli_query($connection, $query);
   
   if(mysqli_num_rows($query_run) > 0)
   {
	   while($row = mysqli_fetch_assoc($query_run))
	   {
		   
		 
?>

						   <a class="tf-trading-history" >
                                <div class="inner-left">
                                    <div class="icon-box rgba_primary ">
                                        <i class="icon icon-group-dollar" ></i>
                                    </div>
                                    <div class="content">
                                        <h4><?php echo $row['status'];?></h4>
                                        <p><?php echo $row['date'];?></p>
                                    </div>
                                </div>
                                <span class="num-val green">+ $<?php echo $row['amount'];?></span>
                            </a>
                            	 <?php
								}
   }
   else {
	   echo "No Deposit";
   }
	   ?>
                         
                        </div>
                </div>

                </div>
            </div>


    <script type="text/javascript" src="javascript/jquery.min.js"></script>
    <script type="text/javascript" src="javascript/bootstrap.min.js"></script>
    <script type="text/javascript" src="javascript/main.js"></script>
<script>
	function validation(){
	let id = (id) => document.getElementById(id);

    let classes = (classes) => document.getElementsByClassName(classes);

    let   amount = id("amount"),
	      errorMsg = classes("error1");
		
    
	 var zero = document.getElementById("amount").value;
	
	
	    
	
	
	if(amount.value.trim() ==="") {
    errorMsg[0].innerHTML = '<p style="font-size:12px;" class="  text-danger text-center">Please enter amount</p>';
    amount.style.borderBottom = "2px solid red";
      return false;
  } else {
    errorMsg[0].innerHTML = "";
   amount.style.borderBottom = "";
  } 
if(amount.value.trim() === "0") {
    errorMsg[0].innerHTML = '<p style="font-size:12px;" class="  text-danger text-center">Please enter amount</p>';
    amount.style.borderBottom = "2px solid red";
      return false;
  } else {
    errorMsg[0].innerHTML = "";
   amount.style.borderBottom = "";
  } 
if(zero == 0) {
    errorMsg[0].innerHTML = '<p style="font-size:12px;" class="  text-danger text-center">Please enter amount</p>';
    amount.style.borderBottom = "2px solid red";
      return false;
  } else {
    errorMsg[0].innerHTML = "";
   amount.style.borderBottom = "";
  } 





	return true;
	};
	
  
	</script>
</body>


</html>