<?php
ob_start();
session_start();
date_default_timezone_set("Asia/Jakarta");
include('../config/koneksi.php');
$sid = session_id();
$sql_0 = mysqli_query($conn,"SELECT * FROM `tb_seo` WHERE cuid = 1") or die(mysqli_error());
$s0 = mysqli_fetch_array($sql_0);
$urlweb = $s0['urlweb'];
$urlwebs = $s0['urlweb'];
$pengguna = $s0['user'];
$sql_1a = mysqli_query($conn,"SELECT * FROM `tb_social` WHERE user = '$pengguna'") or die(mysqli_error());
$s1a = mysqli_fetch_array($sql_1a);
$sql_1b = mysqli_query($conn,"SELECT * FROM `tb_user` WHERE user = '$pengguna'") or die(mysqli_error());
$s1b = mysqli_fetch_array($sql_1b);
$ip = $_SERVER['REMOTE_ADDR'];
$date = date('Y-m-d');
$stat = mysqli_query($conn,"INSERT INTO `tb_stat` (`ip`, `date`, `hits`, `page`, `user`) VALUES ('$ip', '$date', 1, 'Beranda', '$pengguna')") or die (mysqli_error());


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

<head>
    <title><?php echo $urlweb; ?>: User Area</title>

    <!-- Meta -->
    <meta charset="utf-8">
    <!-- <meta content="width=device-width, initial-scale=1.0" name="viewport"> -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=0.65, maximum-scale=1, minimum-scale=0.65">
    <meta name="theme-color" content="#272b30">

    <!-- Favicon -->
    <link rel="icon" type="image/png" href="../upload/favicon.png">

    <!-- CSS Global Compulsory -->

    <link rel="stylesheet" href="../assets/home/bootstrap.web.min.css">
    <link href="https://fonts.googleapis.com/css?family=Abel" rel="stylesheet">
    <style>
        .blink_me {
            animation: blinker 1s step-start infinite;
        }

        @keyframes blinker {
            20% {
                opacity: 0.2;
            }
        }
    </style>
    <!-- JS Global Compulsory -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script src="../js/4dv5.js"></script>
    <script>
        function secondtominute(d) {
            var m = Math.floor(d / (60));
            var s = d - (m * 60);
            if (s < 10) s = '0' + s;
            return m + ':' + s;
        }
    </script>

</head>
<?php include('uptop.php'); ?>


    <!--Start topbar header-->
    
    <div class="card-body p-2">
                <?php
                  error_reporting(0);
                  $trxID = $_GET['trxID'];
                  $sql_2 = mysqli_query($conn,"SELECT * FROM `tb_transaksi` WHERE kd_transaksi = '$trxID'") or die(mysqli_error());
                  $s2 = mysqli_fetch_array($sql_2);
                  $metode = $s2['metode'];
                  $getBank = mysqli_query($conn,"SELECT * FROM `tb_bank` WHERE cuid = '$metode'") or die(mysqli_error());
                  $gb = mysqli_fetch_array($getBank);
                ?>
                <div class="mt-2 mb-3 text-white" style="background: #151819; color: #fff; font-size: 18px; padding: 20px 10px;">
                  <div class="row">
                    <div class="col-sm-6">
                      <div class="pb-4">
                        Waktu Transaksi
                        <h5 class="mt-2"><?php echo $s2['date']; ?></h5>
                      </div>
                      <div class="pb-4">
                        No. Transaksi
                        <h5 class="mt-2"><?php echo $s2['kd_transaksi']; ?><i class="fa fa-clone pl-2 clip" onclick="copy_trxaku()" data-clipboard-text="<?php echo $s2['kd_transaksi']; ?>"></i></h5>
                      </div>
                      <div class="pb-4">
                        Jumlah Deposit
                        <h5 class="mt-2">Rp. <?php echo number_format($s2['total']); ?></h5>
                      </div>
                      
                    </div>
                    <div class="col-sm-6">
                      <div class="pb-4">
                        Metode Pembayaran
                        <h5 class="mt-2"><?php echo $gb['akun']; ?></h5>
                      </div>                                
                      <div class="pb-4">
                        No. Rekening Pembayaran<br>
                        <h5 class="mt-2"><?php echo $gb['no_rek']; ?><i class="fa fa-clone pl-2 clip" onclick="copy_virtualku()" data-clipboard-text="<?php echo $gb['no_rek']; ?>"></i></h5>
                        <p>a/n <?php echo $gb['pemilik']; ?></p>
                      </div>
                    </div>
                  </div>
                </div>
                  <form role="form" action="<?php echo $urlweb; ?>/function/konfirmasi.php" method="POST" enctype="multipart/form-data">
                    <div class="mt-2 mb-3 text-white" style="background: #000; color: #fff; padding: 20px 10px;">
                      <p>Jumlah Transfer</p>
                      <input type="text" name="nominal" class="form-control" value="<?php echo $s2['total']; ?>" readonly>
                      <input type="hidden" name="trxID" class="form-control" value="<?php echo $s2['kd_transaksi']; ?>">
                    </div>
                    <button type="submit" name="submit" value="submit" class="btn btn-warning text-dark">Konfirmasi</button>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include('footer.php'); ?>
 <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
        <script>
            const copyBtn = document.getElementById('copyBtn')
            const copyText = document.getElementById('copyText')
            
            copyBtn.onclick = () => {
                copyText.select();    // Selects the text inside the input
                document.execCommand('copy');    // Simply copies the selected text to clipboard 
                 Swal.fire({         //displays a pop up with sweetalert
                    icon: 'success',
                    title: 'Text copied to clipboard',
                    showConfirmButton: false,
                    timer: 1000
                });
            }
        </script>
</body>
</html>

