<?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);



$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>
</head>
<body>
    <div id="app">
        <div class="mian">
                <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"><div onclick="clickforback()" data-v-905dfe8c="" class="backIcon"></div></div>
                            <div data-v-905dfe8c="" class="navbar__content-center"><!----><div data-v-905dfe8c="" class="navbar__content-title">UPI ID</div></div>
                            
                        </div>
                    </div>
                </div>
               
              
        <!--Bank-->
        <div class="bank">
            <div class="box">
                <div data-v-7aa0f84a="" class="c-row m-b-10 c-row-middle">
                    <div data-v-7aa0f84a="" class="van-image" style="width: 40px; height: 40px">
                        <img src="./images/pay_icon_debitcard_red.webp" class="van-image__img">
                    </div>
                    <div data-v-7aa0f84a="" class="p-l-15">Add Bank Card</div>
                </div>
                <div data-v-7aa0f84a="" class="item">
                    <div data-v-7aa0f84a="" class="lab">UPI ID</div>
                    <div data-v-7aa0f84a="" class="input">
                        <input id="upiaddress" data-v-7aa0f84a="" type="text" placeholder="UPI address" class="ipt">
                    </div>
                </div>
                <!-- <div data-v-7aa0f84a="" class="item">
                    <div data-v-7aa0f84a="" class="lab">Account Number</div>
                    <div data-v-7aa0f84a="" class="input">
                        <input id="account" data-v-7aa0f84a="" type="text" placeholder="Account Number" class="ipt">
                    </div>
                </div>
                <div data-v-7aa0f84a="" class="item">
                    <div data-v-7aa0f84a="" class="lab">IFSC Code</div>
                    <div data-v-7aa0f84a="" class="input">
                        <input id="ifsc" data-v-7aa0f84a="" type="text" placeholder="Ifsc Code" class="ipt">
                    </div>
                </div> -->
            </div>  
            <div data-v-7aa0f84a="" class="c-row c-row-center m-t-20 bank-btn">
                    <button onclick="getBankDetails()" data-v-7aa0f84a="" class="btn van-button valve-button--default van-button--normal van-button--block valve-button--round" style="
                color: rgb(255, 255, 255);
                background: rgb(92, 186, 71);
                border-color: rgb(92, 186, 71);
              ">
                        <div data-v-7aa0f84a="" class="van-button__content">
                            <span data-v-7aa0f84a="" class="van-button__text">
                                Add UPI
                            </span>
                        </div>
                    </button>
                </div>
        </div>  
        <!--Bank-->

    </div>
    </div>
</body>

</html>


<script>
   function clickforback()
   {
      window.open('index.php','_self')
   }






   function getBankDetails()
   {
       var upiId = document.getElementById('upiaddress').value;

       if(upiId == "")
       {
         alert('Sorry Required Details..!!');
       }
       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('withdraw.php','_self');
            }
            else{
                alert(myArr.remark);
            }
        }
        xhttp.open("GET", "addbankAccount.php?userKey="+<?= $userKey; ?>+"&upi="+upiId);
        xhttp.send(); 




       }
   }

</script>