<?php 
ob_start();
session_start();
if($_SESSION['userid']=="")
{header("location:login.php");exit();}?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php include'head.php' ?>
<link rel="stylesheet" href="assets/css/style.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="description" content="Bitter Mobile Template">
<meta name="keywords" content="bootstrap, mobile template, bootstrap 4, mobile, html, responsive" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<style>
.float{
	position:fixed;
	width:40px;
	height:40px;
	bottom:40px;
	right:0px;
	background-color: white;
	color:#FFFFFF;
	border-radius:50px;
	text-align:center;
  font-size:30px;
	box-shadow: 2px 2px 3px #999;
  z-index:100;

   top:70%;
}

.my-float{
    	color:#FFFFFF;
	margin-top:3px;
}
.btn1 { 
    border: 1px solid white;
        color: white;
    height:45px; 
    width:264px;background-color:#DB0477
    
}
h3{ font-weight:normal; font-size:20px;}
.btn .error{margin-top: 55px;}
.btn-group {
box-shadow: none;
}
#alert h4{font-size: 1rem;}
#alert p{font-size: 13px; margin-top:20px;}
#alert .modal-content{border-radius:3px}
#alert .modal-dialog{padding:20px; margin-top:130px;}
#confirm .modal-dialog{padding:20px; margin-top:130px;}
.inner-addon select.error {
    font-size: 16px;
    position: unset;
}
.textbox {
     box-shadow: 0px 0px;
  height: auto;
  width: 300;
  color: #fff;
  outline: none;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 400;
  margin: 0px 0;
  cursor: pointer;
  transition: all 0.4s ease;
}
img{
    width: 25px;
    height: 25px;
}
.appContent1{
    position: fixed;
width: 100%;
    padding: 15px;
    box-sizing: border-box;
    background: #fff;
    box-shadow: 0 3px 1px -2px rgb(0 0 0 / 20%), 0 2px 2px 0 rgb(0 0 0 / 14%), 0 1px 5px 0 rgb(0 0 0 / 12%);
    transition: .3s cubic-bezier(.25,.8,.5,1);
}
.boxinput{width: 100%;

    display: flex;
    justify-content: center;}
   .underinput{ 
    width: 95%;
    height: 48px;
    border-radius: 4px;
    box-shadow: 0 3px 1px -2px rgb(0 0 0 / 20%), 0 2px 2px 0 rgb(0 0 0 / 14%), 0 1px 5px 0 rgb(0 0 0 / 12%);
    transition: background .3s cubic-bezier(.25,.8,.5,1);
    padding: 0 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
   }
   .underinputpassword{ 
    width: 95%;
    height: 48px;
     border-bottom: 1px solid black;
    transition: background .3s cubic-bezier(.25,.8,.5,1);
    padding: 0 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
   }
     .underinputbank{ 
    width: 95%;
    height: 48px;
  
    transition: background .3s cubic-bezier(.25,.8,.5,1);
    padding: 0 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
   }
   .fee{
       padding: 30px 15px 15px;
    box-sizing: border-box;
    font-size: 14px;
    color: #212121;
   }
   .payment_box{
       width: 100%;
    padding-left: 4%;
    box-sizing: border-box;
    margin-bottom: 10px;
   }
   .payment_text{
       height: 38px;
    line-height: 38px;
    font-size: 14px;
    color: #757575;
   }
   .van-radio{
       height: 48px;
    line-height: 48px;
    font-size: 16px;
   }
   .van-radio__icon{
       -webkit-box-flex: 0;
    -webkit-flex: none;
    flex: none;
    height: 1em;
    font-size: 20px;
    line-height: 1em;
    cursor: pointer;
   }
   .van-radio__label {
    margin-left: 8px;
    color: #323233;
    line-height: 20px;
}
.van-cell__title {
    display: flex;
    flex-direction: row;
}
.recharge_btn{
    width: 100%;
    padding: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0 24px;
}
.rechabtn{
    background: #009688;
    color: #fff;
    font-size: 14px;
    border-radius: 2px;
    border: 0;
    padding: 14px 0;
    text-align: center;
    width: 52%;
}
</style>
</head>

<body>
<?php
include("include/connection.php");
$userid=$_SESSION['userid'];?>


<!-- App Header -->
<div class="appHeader1">
<div class="left">
            <a href="/mine.php" onClick="goBack();" class="icon goBack">
                <i class="icon ion-md-arrow-back"></i>
            </a>
            <div class="pageTitle">Withdrawal</div>
              </div> <div class="right"> 
  <a  href="withdrawalrecord.php" role="button" style="font-size:20px;">
    <img src="images/sidebar.png"></a>
 </div>
</div>
<!-- * App Header --> 
<!-- App Capsule -->
<div id="appCapsule">
  <div class="appContent1">
<h5 style="font-size: 24px;
    font-weight: 400;" class="text-center m-2">Balance: <span>₹ <?php echo number_format(wallet($con,'amount',$userid), 2);?></span></h5>

      
    <form  action="#" id="paymentForm" method="post" class="" autocomplete="off">
    <div class="boxinput">
      <div class="underinput">
      <img src="images/bankcard.png">
       <input style="padding-left: 20px;" type="number" id="userammount" name="userammount" class="form-control textbox" placeholder="Enter withdrawal amount" onKeyPress="return isNumber(event)" maxlength="6">
      </div></div>
      
      
       <div class="fee">
          Fee : <span id="fee">0.00</span>, to Account : <span id="toAccount">0.00</span><input type="hidden" id="toAccountInput" name="userammount_1"/>
      </div>
      
      
            <div class="payment_box">
                <p class="payment_text">Payout</p>
                
                <div  role="radiogroup" class="van-radio-group">
                    <div  role="radio" tabindex="0" aria-checked="true" class="van-radio">
                          <input type="radio" hidden name="optionsname" value="bank" checked>
                           <i style="padding-right: 45px;padding-left: 10px;" class="fa fa-check" aria-hidden="true"> </i>
                            <span class="van-radio__label"><span  class="text">Bankcard</span></span></div></div>
                
            </div>
                
          
       
          <div class="boxinput">
       <div style="" class="underinputbank">
         
               
        <img  src="images/walletb.png" >
         <select class="form-control select2 textbox" name="acid" id="acid" style="padding-left:45px;">
              <option value="">Select Bank Detail</option>
            </select>
      </div>    </div> <br> 
      <div class="boxinput">
       <div class="underinputpassword">
     <img  src="images/icons/key-img.png" >
        <input type="password" id="password" name="password" class="form-control textbox" placeholder="Enter Login Password" required >
      </div></div>
      
      

<input type="hidden" name="userid" value="<?php echo $userid;?>">
<input type="hidden" name="action" value="withdrawal">
      <div class="text-center recharge_btn">
   <button type="submit" class="rechabtn" > Withdrawal </button>

        </div>
            </div>  </div>
      </div>
    </form>
  </div>
</div>

<!-- appCapsule -->

<?php include("include/footer.php");?>
<div id="alert" class="modal fade" role="dialog">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      <div class="modal-body" id="alertmessage"> </div>
      <div class="text-center pb-1">
    <a type="button" class="text-info" data-dismiss="modal">OK</a>
    </div> 
    </div>
  </div>
</div>



<div id="privacy" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
    <div class="modal-header">
   <h5 style="font-weight:normal;">Withdrawal Timming</h5>
              </div>
      <div class="modal-body responsive">
     <strong>Monday to Saturday</strong><br>
 <strong>10:00 AM to 5:00 PM</strong>
<!-- <strong>Withdrawal Limit Reached!!</strong><br>
  <strong>Try Again Tomorrow </strong>-->
      </div>
      <div class="modal-footer">
    <a class="pull-left" data-dismiss="modal"><strong>OK</strong></a>
              </div>
    </div>
  </div>
</div>
<script src="assets/js/lib/jquery-3.4.1.min.js"></script> 
<!-- Bootstrap--> 
<script src="assets/js/lib/popper.min.js"></script> 
<script src="assets/js/lib/bootstrap.min.js"></script> 
<!-- Owl Carousel --> 
<script src="assets/js/plugins/owl.carousel.min.js"></script> 
<!-- Main Js File --> 
<script src="assets/js/app.js"></script>
<script src="assets/js/jquery.validate.min.js"></script>
<?php include('assets/js/withdrawal.js.php'); ?>

  <script>
    var userid = <?php echo $userid ?>;
    // alert(userid);
    $(document).ready(function() {
      var dataString = 'userid=' + userid + "& type=" + "bank";
      $.ajax({
        type: "POST",
        url: "ajax_bankdetail.php",
        data: dataString,
        cache: false,
        success: function(html) { //alert(html);
          $("#acid").html(html);
        }
      })
    })
  </script>
<script>
$(document).ready(function(){
    $('#userammount').on('keyup',function(){
       var percentage = 0.05;
       var balance = account = toAccount = 0;
       balance = $('#userammount').val();
       account = (balance * percentage).toFixed(2);;
       
       account = Math.round(account);
       
       toAccount = balance - account;
    //   toAccount = toAccount.toFixed(2);
       console.log('balance : '+ balance + 'account : '+ account)
       $('#toAccount').html(toAccount);
       $('#toAccountInput').val(toAccount);
       $('#fee').html(account);
    });
});


	/*window.oncontextmenu = function () {
				return false;
			}*/
			$(document).keydown(function (event) {
				if (event.keyCode == 123) {
					return false;
				}
				else if ((event.ctrlKey && event.shiftKey && event.keyCode == 73) || (event.ctrlKey && event.shiftKey && event.keyCode == 74)) {
					return false;
				}
			});
			
</script>
<script>
document.addEventListener("keydown", function (event) {
    if (event.ctrlKey) {
        event.preventDefault();
    }   
});	
</script>      
</body>
</html>