<?php
session_start();
include("include/connection.php");
error_reporting(1);
if (!isset($_SESSION['mobile']) && !isset($_SESSION['frontuserid'])) {
echo "<script> 
window.location = './login';
</script>";
} 
?>
<?php 
if(isset($_POST['submit'])){
    
    $ref_num = mysqli_real_escape_string($con,$_POST['refrence']);
    $amt = mysqli_real_escape_string($con,$_POST['deposit']);
    $email = mysqli_real_escape_string($con,$_POST['email']);
    $uid = mysqli_real_escape_string($con,$_SESSION['frontuserid']);

    date_default_timezone_set('Asia/Calcutta');
    $today = date("F j, Y, g:i a"); 
    $deposit = mysqli_query($con, "INSERT INTO `deposits`(`ref_num`, `amount`, `email`, `status`, `uid`, `date`) VALUES('$ref_num', '$amt', '$email', '1','$uid', '$today')");

    if($deposit){
        echo "<script>
        window.location = './myaccount';
    </script>";
    }else{
        echo "Payment failed"; 
    }
}
?>

<!DOCTYPE html>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
       
  <meta name="viewport" content="width=device-width, initial-scale=1">
  
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.slim.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>

     <?php

$Query=mysqli_query($con,"select * from tbl_website WHERE id=1");
$rows=mysqli_fetch_array($Query);
?>
       <title><?php echo $rows['title'];  ?></title>
        <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" data-react-helmet="true" />
        <!--<style>
        	@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

            *{
                margin: 0;
                padding: 0;
                box-sizing: border-box;
                font-family: 'Poppins', sans-serif !important;
            }
            body{
                background-color: #FFF;
                margin: 0 auto;
                padding: 0;
                max-width: 375px;
            }
            .logo{
                font-size: 26px;
                color: #0081FF;
                padding: 20px 0;
                font-weight: bold;
                text-align: center;
                text-shadow: 1px 1px 1px rgba(0,0,0,.1);
            }
            .nav-tabs>li>a{
                color: black ;
                font-weight: bold !important;
            }
            .active>a{
                color: #0081FF !important;
            }
            h1{
                width: 100%;
                font-size: 16px;
                padding: 30px 20px 0 20px;
                color: #121212;
                margin: 0 auto;
                font-weight: 400;
            }
            h5{
                padding: 30px 20px 0 20px;
                width: 500px;
                margin: 0 auto;
                font-size: 14px;
                color: #121212;
            }
            h2{
                width: 320px;
                font-size: 12px;
                color: #999;
                font-weight: 400;
                padding: 0 10px;
                margin: 0 auto;
                line-height: 1.5;
            }

            h2 span{
                color: #666;
            }
            .box{
                height: auto;
                margin: 20px auto;
                border: 3px solid #0081FF !important;
                box-sizing: border-box;
                /*box-shadow: none;*/
                border-radius: 5px;
            }
            .box p{
                border-bottom: 1px solid #CCC;
                margin: 0;
                line-height: 36px;
                padding: 5px 10px;
            }
            .box p:last-child{
                border: 0 none;
            }
            .box .label{
                font-size: 14px;
                color: #666;
                display: block;
                text-align: left;
                margin-right: 10px;
                line-height: 1.2;
                vertical-align: middle;
            }
            .box .value{
                font-size: 9px;
                color: #000;
                display: inline-block;
                width:auto;
                font-weight: bold;;
                line-height: 1.2;
                vertical-align: middle;
            }
            .box button{
                vertical-align: middle;;
            }
            .toast{
                height: 60px;
                width: 140px;
                background-color: rgba(0,0,0,.5);
                border-radius: 5px;
                position:absolute;
                left: 50%;
                top: 30%;
                margin-left: -70px;
                margin-top: -30px;
                line-height: 60px;
                color: #FFF;
                text-align: center;
                white-space: nowrap;
            }
            
            .center {
              line-height: 1.5;
              display: inline-block;
              vertical-align: middle;
            }
            .container{
                width :100%;
                padding: 0 !important;
            }
            .tab-content{
                width: 100% !important;
            }
            .tab-content>div>h1{
                width: 100% !important;
            }
            .box{
                width: 100% !important;
                padding: 10px ;
            }
            .value{
                padding: .2em .6em .3em !important;
            }
            .copyBtn{
                float: right;
                background-color: #0081FF !important;
                color: white !important;
                font-weight: bold;
            }
            .paymentRefForm{
                display: flex;
                flex-direction: column;
            }
            .paymentRefForm>.form-group>label{
                font-weight: bold !important;
                padding-left: 7px;
            }
            .paymentRefForm>.form-group>input{
                background-color: white;
                font-size: 12px;
                border: none;
                box-shadow: 0px 1px 50px 1px rgba(0, 0, 0, 0.1) !important;
                border-radius: 5px;
            }
            .submitBtn{
                margin: 0 auto !important;
                background-color: #0081FF !important;
                color: white;
                font-weight:bold;
                margin-top: 16px !important;
            }
            
        </style>-->
        <style>
         .header {
        font-size: 20px;
    color: #fff;
    background-color: #1bb0f3;
    padding-top: 7px;
    padding-left: 10px;
    padding-bottom: 10px;
    min-height: 35px;
    line-height: 35px;
}
.cell{
    font-size: 17px;
    min-height: 10px;
    padding-bottom: 7px;
    padding-right: 20px;
    border-right: 1px solid #c1c1c1;
    border-left: 1px solid #c1c1c1;
    border-bottom: 1px solid #c1c1c1;
    padding-left: 20px;
    display: flex;
    align-items: center;
}
.cell span {
    padding-left: 10px;
    word-break: break-all;
}
.copybtn {
       min-width: 100px;
    height: 30px;
    line-height: 17px;
    border-radius: 5px;
    background: #00bcf8;
    font-size: 18px;
    color: #fff;
    margin-left: auto;
}
.wdr{width:65%;}
        </style>
    </head>
    <body style="background-color:#007bff;">
  
        
        <?php
//$userid=$_SESSION['frontuserid'];
$Query=mysqli_query($con,"select * from tbl_website WHERE id=1");
$row=mysqli_fetch_array($Query);
?>
        
        <div class="title">
            <!--<img src="admin/<?php echo $row['qr_code']; ?>" width="150" height="150">-->
            <!-- <h5>Deposit the Payment amount to below this upi or bank account below. </h5> -->
        </div>
        
        <div class="container">
            <div class="row">
               <div class="col-md-6 mx-auto">
				<div  style="background-color: white;margin-top: 10px;padding: 10px;border-radius: 15px;margin-left: 10px;margin-right: 10px;">
				 	<div style="text-align: center;color: #404040;font-size: 14px;font-weight: bold;">UPI QR code</div><!-- Scan Qrcode -->
					<div style="padding-top: 5px;">
						<div  style="display: none;"><canvas width="150" height="150"></canvas></div>	
						<div  style="text-align: center;font-size: 18px;">
						    
						    <img style="width: 170px;" class="img-fluid" src="<?php echo $row['qr_code']; ?>"></div>
					</div>
					<!--<div style="text-align: center;color: red;font-size: 14px;">Important! The amount must be entered manually</div>
					 -->
					<div style="text-align: center;font-size: 16px;margin-top: 5px;color:red;" ><?php echo $row['upi']; ?></div>
					<div style="text-align: center;font-size: 14px;margin-top: 5px;">
					    
						<button class="btn btn-primary" data-clipboard-text="<?php echo $row['upi']; ?>">Copy UPI ID</button>
					</div>
					<div style="clear: both;"></div>
				</div>
				<div id="appdiv" style="background-color: white; margin-top: 10px; padding: 10px; border-radius: 15px; margin-left: 10px; margin-right: 10px; display: none;">
					<!-- <div style="flex-direction: row;display: flex;">
						<div style="width:65%;text-align: left;color: red;font-size: 16px;line-height: 30px;" id="upi">
						</div>
						<div style="width:35%;text-align: right;">
							<button class="addrCopy" onclick="copyUrl('addrCopy')" data-clipboard-action="copy" data-clipboard-target="#upi">Copy UPI ID</button>
						</div>
					</div> -->
					<div style="color:red;font-size: 12px;font-weight: bold;padding: 0px 0px 5px 0px;">Choose one of App to jump to process your payment</div>
					<!--<div style="flex-direction: flex;display: flex;width: 238px;margin:0 auto;">
						<div class="appdiv">
							<img src="assets/img/paytm.9f5af82.png" width="90%" >
						</div>
						<div class="appdiv" style="margin-left: 10px;">
							<img src="assets/img/phonepe.3b505ba.png" width="130%" >
						</div>
						<div class="appdiv" style="margin-left: 10px;">
							<img src="assets/img/googlepay.fa5536b.png" width="100%" >
						</div>
						<div class="appdiv" style="margin-left: 10px;">
							<img src="assets/img/bhim.fcebeaa.png" width="110%" >
						</div>
					</div>
					<div style="margin-top: 5px;"></div>
					<div style="flex-direction: flex;display: flex;width: 238px;margin:0 auto;">
						<div class="appdiv">
							<img src="assets/img/whatsapp.5342f8b.png" width="100%" >
						</div>
						<div class="appdiv" style="margin-left: 10px;">
							<img src="assets/img/amazon.be5477c.png" width="170%" >
						</div>
						<div class="appdiv" style="margin-left: 10px;">
							<img src="assets/img/mobikwik.a09fc62.png" width="120%" >
						</div>
						<div class="appdiv" style="margin-left: 10px;">
							<img src="assets/img/freecharge.476628d.png" width="90%">
						</div>
					</div>-->
					<div style="clear: both;"></div>
				</div>
				<!-- <div id="bankInfoDiv" style="display:none;background-color: white;margin-top: 10px;padding: 10px;border-radius: 15px;margin-left: 10px;margin-right: 10px;">
					<div style="color:red;font-size: 12px;font-weight: bold;">If UPI can't pay,please use IMPS to transfer</div>
					<div style="text-align: left;font-size: 12px; margin-top: 5px;">Bank name </div>
					<div style="flex-direction: row;display: flex;">
						<div style="width:75%;text-align: left;color: red;" id="payeeBankName">
						</div>
						<div style="width:25%;text-align: right;">
							<button style="height: 25px;padding:3px 10px 3px 10px;" class="addrCopy" onclick="copyUrl('addrCopy')" data-clipboard-action="copy" data-clipboard-target="#payeeBankName">Copy</button>
						</div>
					</div>
					<div style="text-align: left;font-size: 12px;">Account name </div>
					<div style="flex-direction: row;display: flex;">
						<div style="width:75%;text-align: left;color: red;" id="payeeName">
						</div>
						<div style="width:25%;text-align: right;">
							<button style="height: 25px;padding:3px 10px 3px 10px;" class="addrCopy" onclick="copyUrl('addrCopy')" data-clipboard-action="copy" data-clipboard-target="#payeeName">Copy</button>
						</div>
					</div>
					<div style="text-align: left;font-size: 12px;">Account No. </div>
					<div style="flex-direction: row;display: flex;">
						<div style="width:75%;text-align: left;color: red;" id="payeeAccount">
						</div>
						<div style="width:25%;text-align: right;">
							<button style="height: 25px;padding:3px 10px 3px 10px;" class="addrCopy" onclick="copyUrl('addrCopy')" data-clipboard-action="copy" data-clipboard-target="#payeeAccount">Copy</button>
						</div>
					</div>
					<div style="text-align: left;font-size: 12px;">IFSC </div>
					<div style="flex-direction: row;display: flex;">
						<div style="width:75%;text-align: left;color: red;" id="payeeIfsc">
						</div>
						<div style="width:25%;text-align: right;">
							<button style="height: 25px;padding:3px 10px 3px 10px;" class="addrCopy" onclick="copyUrl('addrCopy')" data-clipboard-action="copy" data-clipboard-target="#payeeIfsc">Copy</button>
						</div>
					</div>
					<div style="clear: both;"></div>
				</div> -->
				<div style="font-size: 14px;background-color: white;margin-top: 10px;padding: 10px;border-radius: 15px;margin-left: 10px;margin-right: 10px;">
					<div style="">
						<div style="color:red;font-size: 12px;font-weight: bold;">Step 1</div>
						<div style="border-bottom: 1px #dedede solid;padding-bottom: 5px;">
							Copy the UPI ID to your Phonepe (Paytm or UPI App)
						</div>
					</div>
					<div style="margin-top: 5px;">
						<div style="color:red;font-size: 12px;font-weight: bold;">Step 2</div>
						<div style="">
							Input the amount and process your payment through the Phonepe (Paytm or UPI App)
						</div>
					</div>
					<div style="clear: both;"></div>
				</div>
				<div style="background-color: white;margin-top: 10px;padding: 10px 10px;border-radius: 15px;margin-left: 10px;margin-right: 10px;">
					<div style="text-align: left;color: red;font-size: 12px;">I have paid,submit the UTR to confirm the payment(Necessary)</div>
					<div style="flex-direction: row;display: flex;margin-top: 5px;">
						<div style="width:75%;text-align: left;">
							<input id="" type="text" style="height: 38px;width: 100%;border-radius: 8px;border: 1px solid #a0a0a0;" placeholder="Enter 12-bit UTR/Ref.no/Reference number" spellcheck="false" data-ms-editor="true">
						</div>
						<div style="width:25%;text-align: right;">
							<button class="btn btn-primary" style="">Submit</button>
						</div>
					</div>
					<!-- <div style="text-align: center;color: #a0a0a0;font-size: 14px;margin-top: 10px;margin-bottom: 10px;"></div> -->
					<div style="clear: both;"></div>
				</div>
				<div style="text-align: center;margin-top: 20px;color:white;font-size: 12px;">
					<img alt="" src="assets/img/secure.png" height="16px" style="vertical-align: middle;"> 100% Secure Payments Powered by QR Pay
				</div>
				<div style="text-align: center;margin-top: 10px;">
					<img alt="" src="assets/img/paytm.60ece9c3.png" height="20px">
					<img alt="" src="assets/img/g-pay.eca8cecb.png" height="20px">
					<img alt="" src="assets/img/phone-pe.ff616d58.png" height="20px" style="border-radius: 8px;">
					<img alt="" src="assets/img/bhim.f99faf63.png" height="20px">
					<img alt="" src="assets/img/download.png" height="20px">
					<img alt="" src="assets/img/india.54a3e0d3.png" height="20px">
					<img alt="" src="assets/img/india-f.5be5caf7.png" height="20px">
				</div>
			</div>
                
                
            </div>
        </div>
        
        
        
        
        
        
        
        
        
        
        
        
<!-- BANK AND UPI SECTION START  ->

<div class="container">
    <ul class="nav nav-tabs">
         <li class="active"><a data-toggle="tab" href="#qrcode">QR CODE</a></li>
        <li ><a data-toggle="tab" href="#home">UPI</a></li>
        <!--<li><a data-toggle="tab" href="#menu1">BANK</a></li>->
    </ul>

<div class="tab-content">
     <div id="qrcode" class="tab-pane fade in active">
        <h1><b>Step 1. <br>SCAN QRCODE </b></h1>
        <div class="box" style="margin-bottom: 0;">        
            <p style="margin-left:50px;">
            <img src="admin/<?php echo $row['qr_code']; ?>" width="200" height="200"> 
             <!--<img src="assets/img/qr_final.png" width="200" height="200">->
            </p>
           
        </div>
  </div>
  <div id="home" class="tab-pane fade in">
        <h1><b>Step 1. <br> Copy UPI Information</b></h1>
        <div class="box" style="margin-bottom: 0;">        
            <p>
                <!--<span class="label">Upi Id.&nbsp;: (upi)</span>->
                <span class="label">UPI ID</span>
                <span class="value"><?php echo $row['upi']; ?></span>
                <button class="btn copyBtn" data-clipboard-text="<?php echo $row['upi']; ?>">Copy</button>
            </p>
           
        </div>
  </div>
  <div id="menu1" class="tab-pane fade">    
        <h1><b>Step 1. <br>Copy Bank Information</b></h1>
        <div class="box" style="margin-bottom: 0;">
        
            <p>
                <span class="label">Account No.&nbsp;:</span>
                <span class="value"><?php echo $row['acc_no']; ?></span>
                <button  class="btn copyBtn" data-clipboard-text="<?php echo $row['acc_no']; ?>">Copy</button>
            </p>
            <p>
                <span class="label">IFSC Code&nbsp;:</span>
                <span class="value"><?php echo $row['ifsc_code']; ?></span>
                <button class="btn copyBtn" data-clipboard-text="<?php echo $row['ifsc_code']; ?>">Copy</button>
            </p>
             <p>
                <span class="label">Bank Name&nbsp;:</span>
                <span class="value"><?php echo $row['bank_name']; ?></span>
                <button class="btn copyBtn" data-clipboard-text="<?php echo $row['bank_name']; ?>">Copy</button>
            </p>
             <p>
                <span class="label">Name&nbsp;:</span>
                <span class="value"><?php echo $row['name']; ?></span>
                <button class="btn copyBtn" data-clipboard-text="<?php echo $row['name']; ?>">Copy</button>
            </p>
        </div>    
  </div>
</div>
<div>
<h1><b>Step 2.<br> Open online banking or wallet, transfer the amount to the QR Code or UPI  or Bank account</b></h1>
</div>
<!-- BANK AND UPI SECTION END  ->
<!-- PAYMENT VERIFICATION START  ->
<div><h1><b>Step 3. <br>Enter Payment details below and complete Recharge.</b></h1></div>
<div class="box" style="padding:30px;border:4px solid black">
<form class="paymentRefForm" action="save.php" method="POST" autocomplete="off">
    <div class="form-group">
        <label style="margin:0;">Payment Reference Number</label>
        <div><span style="color:#0081FF; font-size:12px;">* copy UTR number from your transaction and paste here</span></div>
        <input class="form-control" type="text" name="refrence" placeholder="Enter Payment Reference Number" required>
        
    </div>
    <div class="form-group">
        <label style="">Deposit Amount</label>
        <input class="form-control" type="text" name="deposit" value="<?php echo $_SESSION['userammount']; ?>" readonly>
    </div>
    <div class="form-group">
        <label>Registerd Phone Number</label>
        <input class="form-control" type="text" name="phone" value="<?php echo $_SESSION['mobile']; ?>" readonly>
    </div>
    <input class="btn  btn-primary submitBtn" type="submit" name="submit" value="Submit" >
</form>
</div>
</div>



<!-- PAYMENT VERIFICATION END  -->


        
    

        <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js"></script>
        <script type="text/javascript">
            function showToast(text){
                var ele = document.createElement("div");
                ele.className = "toast";
                ele.innerHTML = text;
                document.body.appendChild(ele);
                setTimeout(function(){
                    document.body.removeChild(ele);
                }, 2000)
            }
            var btns = document.querySelectorAll('.btn');
            var clipboard = new ClipboardJS(btns);
            clipboard.on('success', function(e) {
                showToast("COPY SUCCESS");
            });

            clipboard.on('error', function(e) {
                showToast("COPY FAIL");
            });
            
        </script>
    </body>
</html>