<?php
session_start();
@$userKey = $_SESSION['loginKey'];

if($userKey == "")
{
    echo "<script>window.open('login.php','_self')</script>";
}


include "control/activity.php";
$dd = new activity();


$table = "userdetails";
$condition = " where userKey='$userKey'";
$getuserdetails = $dd->single($table,$condition);
$passwordFrom = $getuserdetails['password'];
$wallet = $getuserdetails['wallet'];
$withdrawBalance = $getuserdetails['withdraw_balance'];

$table = "admin_calculation";
$condition = null;
$getAdminDetails = $dd->single($table,$condition);
$fevicon = $getAdminDetails['favicon'];

?>



<!DOCTYPE html>
<html lang="en" translate="no">
<head>
    <meta charset="UTF-8">
    <link rel="icon" type="image/svg+xml" href="temp_img/<?= $fevicon; ?>">
    <meta name="google" content="notranslate">
    <meta name="robots" content="noindex,nofollow">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title><?= $getAdminDetails['title']; ?></title>
    <link rel="stylesheet" href="css/slick.css" />
    <link rel="stylesheet" href="css/modules.css" />
    <link rel="stylesheet" href="css/style.css" />
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/slick.min.js" type="text/javascript"></script>
    <script src="js/main.js" type="text/javascript"></script>
      <style>
    .Recharger__USD__Process {
        display: none;
    }
    
    </style>
</head>
<body>
    <div id="app">
        
        <div class="Recharge__box">
            <div class="Recharge__container">
                <div class="navbar">
                    <div class="navbar-fixed" style="background: linear-gradient(90deg, rgb(207, 3, 5) 0%, rgb(242, 63, 58) 100%);">
                        <div class="navbar__content">
                            <div data-v-905dfe8c="" class="navbar__content-left"  onclick="clicktoBack()"><div data-v-905dfe8c="" class="backIcon"></div></div>
                            <div data-v-905dfe8c="" class="navbar__content-center"><!----><div data-v-905dfe8c="" class="navbar__content-title">Withdraw</div></div>
                            <div data-v-905dfe8c="" class="navbar__content-right"><div data-v-643fef5d="" class="title">Withdraw history</div></div>
                        </div>
                    </div>
                </div>
  
  
  <script>
  function clicktoBack()
  {
    window.open('index.php','_self');
  }

</script>





                <div class="balanceAssets ye">
                    <div class="balanceAssets__header">
                        <div class="balanceAssets__header__left">
                            <img data-v-d42c1f7a="" src="./images/balance.png" alt="Balance">
                            Balance
                        </div>
                    </div>
                    <div class="balanceAssets__main">
                        <p data-v-d42c1f7a="">₹<?= round($wallet,2); ?></p>
                        <img data-v-d42c1f7a="" src="./images/balance-referesh.png" alt="Balance">
                    </div>
                    <div class="balanceAssets__tip">
                        <img data-v-d42c1f7a="" src="./images/cip-7ed1a634.png" alt="CIP">
                    </div>
                </div>
                <div data-v-3b47decf data-v-643fef5d>
                    <div class="Recharge__container-tabcard">
                        <div class="Recharge__container-tabcard__items active" id="Recharge__INR_container">
                            <div class="centers">
                                <div class="Recharge__container-tabcard__top">
                                <img data-v-d42c1f7a="" src="./images/balance.png" alt="Balance">
                                </div>
                                <div data-v-741b09ea="" class="Recharge__container-tabcard__bot">Wallet </div>
                            </div>
                        </div>
                        <div class="Recharge__container-tabcard__items active" id="Recharge__USDT_container">
                            <div class="centers">
                                <div class="Recharge__container-tabcard__top">
                                <img data-v-d42c1f7a="" src="./images/balance.png" alt="Balance">
                                </div>
                                <div data-v-741b09ea="" class="Recharge__container-tabcard__bot">USDT </div>
                            </div>
                        </div>
                    </div>
                </div>
<script>
                $("#Recharge__INR_container").on("click", function() {
                    $(".Recharge__INR_content").show();
                    $(".Recharger__USD__Process").hide();
                    
                })

                $("#Recharge__USDT_container").on("click", function() {
                    $(".Recharge__INR_content").hide();
                    $(".Recharger__USD__Process").show();
                })
                </script>

                <div class="Recharge__INR_content">
                    <div class="Recharge__content-paymoney boxStyle">
                        <div class="Recharge__content-paymoney__title">
                            <img data-v-f1c4791d="" src="./images/saveWallet-ce287b90.png" alt="Deposit amount">
                            <p data-v-f1c4791d="">Withdraw amount</p>
                        </div>
                        <div class="bithdrawable_amount">
                            <div>
                                <span data-v-eee9adef="">Withdrawable balance <h6 data-v-eee9adef="" class="red">₹<?= round($getuserdetails['withdraw_balance'],2); ?></h6></span>
                                <input data-v-eee9adef="" type="button" value="All">
                            </div>
                            <div>
                                <span data-v-eee9adef="">Withdrawal amount received</span>
                                <div data-v-eee9adef="" class="rightD"><span data-v-eee9adef="" class="yellow">₹<?= round($getuserdetails['twithdraw'],2); ?></span></div>
                            </div>
                        </div>
                        <div class="Recharge__content-paymoney__money-input">
                            <div data-v-f1c4791d="" class="place-div">₹</div>
                            <div class="van-cell van-field amount-input">
                                <div class="van-cell__value van-field__value">
                                    <div class="van-field__body">
                                        <input type="tel" inputmode="numeric" id="van-field-4-input" class="van-field__control" placeholder="Please enter the amount">
                                    </div>
                                </div>
                            </div>
                            <div data-v-f1c4791d="" class="place-right"><img data-v-f1c4791d="" src="./images/clean-82487515.png" alt="Close"></div>
                        </div>
                        <div class="conBox m-t-5">
                            <div data-v-25d9c352="" class="des">Payment Method</div>
                            <div class="box m-b-10">
                                <div class="list">
                                   <?php
                                      $table = "user_bank_card_list";
                                      $condition = " where user_key_id='$userKey'";
                                      $getUpiList = $dd->fetch_multi($table,$condition);
                                      foreach($getUpiList as $key){
                                   ?>

                                    <div data-v-25d9c352="" class="item c-row c-row-between c-row-middle-center">
                                        <div data-v-25d9c352="" class="name van-ellipsis">
                                            <span data-v-25d9c352=""><?= $key->bankholder; ?></span>
                                        </div>
                                        <div data-v-25d9c352="" class="name van-ellipsis">
                                            <span data-v-25d9c352=""><?= $key->bankname; ?></span>
                                        </div>
                                        <div data-v-25d9c352="" class="name van-ellipsis">
                                            <span data-v-25d9c352=""><?= $key->bankaccount; ?></span>
                                        </div>
                                        <div data-v-25d9c352="" class="name van-ellipsis">
                                            <span data-v-25d9c352=""><?= $key->bankifsc; ?></span>
                                        </div>

                                        <div data-v-25d9c352="" class="icon action c-row c-row-middle-center">
                                            <input type="radio" id="getUpiIdFrom" name="abc" onclick='setUpiValue("<?= $key->bankholder; ?>", "<?= $key->bankname; ?>", "<?= $key->bankaccount; ?>", "<?= $key->bankifsc; ?>")'/>
                                        </div>

                                    </div>
                                  <?php } ?>
                                </div>
                                <div data-v-25d9c352="" class="c-row c-row-center">
                                    <div data-v-25d9c352="" class="add c-row c-row-middle-center m-t-10 m-b-10" onclick="location.href='addBankcard.php'">
                                        <span data-v-25d9c352="" class="plus c-row c-row-middle-center">
                                        <i data-v-25d9c352="" class="van-icon van-icon-plus" style="color: rgb(245, 98, 93); font-size: 14px;"></i>
                                        </span> Add Bank Card
                                    </div>
                                </div>
                            </div>
                        </div>


                        <input id="bankholder" type="hidden"/>
                        <input id="bankname" type="hidden"/>
                        <input id="bankaccount" type="hidden"/>
                        <input id="bankifsc" type="hidden"/>
                        <!-- Enter Password -->
                        <div class="requiredBox m-t-20">
                            <div data-v-25d9c352="" class="box c-row c-row-between c-row-middle p-l-10">
                                <img data-v-25d9c352="" height="13px" width="25px" src="./images/withdrawalpass.png">
                                <input data-v-d8986e5e="" id="getFromPassword" data-v-25d9c352="" placeholder="Enter Password" class="pw-input input">
                            </div>
                        </div>
                        
                        <!-- Withdraw Money -->
                        <div data-v-25d9c352="" class="c-row c-row-center m-t-30 p-b-30 withdrawal-btn">
                            <button onclick="getActionforwithdraw()" data-v-25d9c352="" class="btn van-button valve-button--default van-button--normal van-button--block valve-button--round" style="color: rgb(255, 255, 255); background: rgb(242, 65, 59); border-color: rgb(242, 65, 59);">
                            <div data-v-25d9c352="" class="van-button__content"><span data-v-25d9c352="" class="van-button__text"> Withdraw Money </span></div>
                            </button>
                        </div>



<script>
  function setUpiValue(a,b,c,d)
  {  
      document.getElementById("bankholder").value=a;
      document.getElementById("bankname").value=b;
      document.getElementById("bankaccount").value=c;
      document.getElementById("bankifsc").value=d;
  }




function getActionforwithdraw()
{
    var amount = document.getElementById('van-field-4-input').value;
    var bankholder = document.getElementById('bankholder').value;
    var bankname = document.getElementById('bankname').value;
    var bankaccount = document.getElementById('bankaccount').value;
    var bankifsc = document.getElementById('bankifsc').value;

    var password = document.getElementById('getFromPassword').value;
    
    if(amount == "" || bankholder=="" || bankname=="" || bankaccount=="" || bankaccount=="" || password=="")
    {
        alert('All fields are required..!!'); 
    }else{
    
     if(amount >= <?= $withdrawBalance; ?> || amount >= <?= $wallet; ?> )
        {
           alert('Sorry Balance low..!!');         
        }else{

               const xhttp = new XMLHttpRequest();
                xhttp.onload = function() {
                    var demo_show = this.responseText;
                    const myArr = JSON.parse(demo_show);
                    if(myArr.status == "success")
                    {
                        alert(myArr.remark);
                        window.open('index.php','_self');
                    }
                    else{
                        alert(myArr.remark);
                    }
                }
                xhttp.open("GET", "withdrawBalance.php?userKey="+<?= $userKey; ?>+"&am="+amount+"&bankholder="+bankholder+"&bankname="+bankname+"&bankaccount="+bankaccount+"&bankifsc="+bankifsc+"&pass="+password);
                xhttp.send(); 

        }
    }
}
</script>

                        <!-- Bank Box -->
                        <div data-v-25d9c352="" class="bankBox m-b-15 m-t-5 ">
                            <div data-v-25d9c352="" class="box">
                                <div data-v-25d9c352="" class="item c-row c-row-middle">
                                    <div data-v-25d9c352="" class="m-r-10 van-image" style="width: 30px; height: 30px;"><img src="./images/withdrawal.png" class="van-image__img"></div>
                                    <div data-v-25d9c352="">1. Withdraw fee <?= $getAdminDetails['withdraw_fee']; ?>%</div>
                                </div>
 <?php
  $table = "account_history";
  $clm = "amount";
  $condition = "where userKey='$userKey' AND game_name='Wingo'";
  $getTotalBetAmount = $dd->getSum($table,$clm,$condition);
 ?>
                                
                                
                                
                                <!---->
                                <div data-v-25d9c352="" class="item c-row c-row-middle">
                                    <div data-v-25d9c352="" class="m-r-10 van-image" style="width: 30px; height: 30px;"><img src="./images/withdrawalwallet.png" class="van-image__img"></div>
                                    <div data-v-25d9c352="">2.Total bet amount ₹ <?= round($getTotalBetAmount['data'][0],2); ?></div>
                                </div>
                                <!--<div data-v-25d9c352="" class="item c-row c-row-middle">-->
                                <!--    <div data-v-25d9c352="" class="m-r-10 van-image" style="width: 30px; height: 30px;"><img src="./images/withdrawalmin.png" class="van-image__img"></div>-->
                                <!--    <div data-v-25d9c352="">3.Withdrawal time 00:00-23:59</div>-->
                                <!--</div>-->
                                <!--<div data-v-25d9c352="" class="item c-row c-row-middle">-->
                                <!--    <div data-v-25d9c352="" class="m-r-10 van-image" style="width: 30px; height: 30px;"><img src="./images/withdrawalmin.png" class="van-image__img"></div>-->
                                <!--    <div data-v-25d9c352="">4.Daily withdrawal times 2</div>-->
                                <!--</div>-->
                                <div data-v-25d9c352="" class="item c-row c-row-middle">
                                    <div data-v-25d9c352="" class="m-r-10 van-image" style="width: 30px; height: 30px;"><img src="./images/withdrawalmin.png" class="van-image__img"></div>
                                    <div data-v-25d9c352="">5. Withdrawal amount range <?= $getAdminDetails['withdraw_limit']; ?>-50000 in 24 Hour in 3 Time.</div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                
                  <div class="Recharger__USD__Process">
                 <div class="bankadd-container">
                    <a href="javascript:void(0)" onclick="location.href='addUsdtBank.php'">
                        <div class="bankadd-btn">
                            <img src="images/add-icon.png" alt="Add Account">
                            <span>Add Address</span>
                        </div>
                    </a>
                </div>
                <!--<div class="guid">Need to add beneficiary information to be able to withdraw money</div>-->
                
                <ul class="bank-list_wrapper">
                    <?php
                    $table = "user_upi_list";
                    $condition = " where user_key_id='$userKey'";
                    $getUpiList = $dd->fetch_multi($table,$condition);
                    foreach($getUpiList as $key){
                    ?>
                    <li class="bank-item">
                        <div class="bank-item-inner">
                            <div class="bank-icon"><img src="images/bankIcon.4de01f6cc3822b43f49e.png" alt=""><span class="bank-name"><?= $key->binance_address; ?></span></div>
                            <!--div class="account-no"><?= $key->bankaccount; ?></div-->
                            <img src="images/arrow-right.png" alt="" class="left-arrow">
                            <input type="radio" id="getusdtIdFrom" name="abc" onclick='setUSDTValue("<?= $key->binance_address; ?>")'/>
                        </div>
                    </li>
                   
                    <?php } ?>
                </ul>
                
                
                <div class="Recharge__content">
                    <div class="Recharge__content-paymoney boxStyle">
                        <!--div data-v-25d9c352="" class="select_account item c-row c-row-between c-row-middle-center">
                            <div data-v-25d9c352="" class="name van-ellipsis">
                                <span data-v-25d9c352=""><?= $getuserdetails['account']; ?></span>
                            </div>
                            <div data-v-25d9c352="" class="icon action c-row c-row-middle-center">
                                <input type="radio" id="getUpiIdFrom" name="abc" onclick='setUpiValue("<?= $getuserdetails['account']; ?>")'/>
                            </div>
                        </div-->
                        <div class="Recharge__content-paymoney__money-input">
                            <div data-v-f1c4791d="" class="place-div">$</div>
                            <div class="van-cell van-field amount-input">
                                <div class="van-cell__value van-field__value">
                                    <div class="van-field__body">
                                        <input type="tel" inputmode="numeric" id="usdt_amount" class="van-field__control" placeholder="Please enter the amount">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="bithdrawable_amount">
                            <div>
                                <span data-v-eee9adef="">Withdrawable balance <h6 data-v-eee9adef="" class="red">$ <?= round($getuserdetails['wallet']/85,2); ?></h6></span>
                                <input data-v-eee9adef="" type="button" value="All">
                            </div>
                            <!--<div>-->
                            <!--    <span data-v-eee9adef="">Withdrawal amount received</span>-->
                            <!--    <div data-v-eee9adef="" class="rightD"><span data-v-eee9adef="" class="yellow">₹<?= round($getuserdetails['twithdraw'],2); ?></span></div>-->
                            <!--</div>-->
                        </div>
                        
                        <input id="usdt_amount" type="hidden"/>
                        <!-- Enter Password -->
                        <div class="requiredBox m-t-20">
                            <div data-v-25d9c352="" class="box c-row c-row-between c-row-middle p-l-10">
                                <svg xmlns="http://www.w3.org/2000/svg" width="25px" height="25px" viewBox="0 0 24 24"><path fill="var(--main-color)" d="M22 18v4h-4v-3h-3v-3h-3l-2.26-2.26c-.55.17-1.13.26-1.74.26a6 6 0 0 1-6-6a6 6 0 0 1 6-6a6 6 0 0 1 6 6c0 .61-.09 1.19-.26 1.74zM7 5a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2"></path></svg>
                                <input data-v-d8986e5e="" id="getFromUSDTPassword" data-v-25d9c352="" placeholder="Enter Password" class="pw-input input">
                            </div>
                        </div>
                        <div class="btn">
                            <button onclick="getActionforwithdrawusdt()" class="link-btn" style="background:linear-gradient(90deg, rgb(207, 3, 5) 0%, rgb(242, 63, 58) 100%);color: rgb(255, 255, 255);padding: 13px 10px;display: block;width: 100%;">Withdraw</button>
                        </div>
                       
                        
                        <!-- Withdraw Money -->
                      

<script>
  function setUSDTValue(a)
  {  
      document.getElementById("getusdtIdFrom").value=a;
     
  }




function getActionforwithdrawusdt()
{
    var amount = document.getElementById('usdt_amount').value;
    var amountininr = amount*85;
    
    var upiId = document.getElementById('getusdtIdFrom').value;
    
    var password = document.getElementById('getFromUSDTPassword').value;
    
    if(amount == "" || upiId=="" || password=="")
    {
        alert('All fields are required..!!'); 
    }else{
    
     if(amountininr >= <?= $withdrawBalance; ?> || amountininr >= <?= $wallet; ?> )
        {
          alert('Sorry Balance low..!!');         
        }else{
              

              const xhttp = new XMLHttpRequest();
                xhttp.onload = function() {
                    var demo_show = this.responseText;
                    const myArr = JSON.parse(demo_show);
                    if(myArr.status == "success")
                    {
                        alert(myArr.remark);
                        window.open('index.php','_self');
                    }
                    else{
                        alert(myArr.remark);
                    }
                }
                xhttp.open("GET", "withdrawUsdtBalance.php?userKey="+<?= $userKey; ?>+"&am="+amount+"&amininr="+amountininr+"&usdt="+upiId+"&pass="+password);
                xhttp.send(); 
                }
        
    }
}

</script>
                        <!-- Bank Box -->
                        <div class="w-rule-container">
                            <!-- <div class="list">-->
                            <!--    <span>Need to bet <span class="text-red">₹0.00</span> to be able to withdraw</span>-->
                            <!--</div >-->
                            <div class="list">
                                <span>Withdraw time <span class="text-red">00:05-23:55</span></span>
                            </div>
                            <div class="list">
                                <span>Inday Remaining Withdrawal Times <span class="text-red">3</span></span>
                            </div>
                             <div class="list">
                                <span>Withdrawal amount range <span class="text-red">₹110.00-₹100,000.00</span></span>
                            </div>
                            <div class="list">
                                <span>Please confirm your beneficial account information before withdrawing. If your information is incorrect, our company will not be liable for the amount of loss</span>
                            </div>
                            <div class="list">
                                <span>If your beneficial information is incorrect, please contact customer service</span>
                            </div>
                        </div>
                                
                    </div>
                </div>
                </div>

            </div>
        </div>
        
        <?php include "footer.php"; ?>
    </div>
</body>

</html>