<?php
include('session.php');

?>

<html lang="en">

<head>
    <title><?php echo $s0['instansi']; ?>: 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="<?php echo $urlwebs; ?>/upload/favicon.png">

    <!-- CSS Global Compulsory -->

    <link rel="stylesheet" href="<?php echo $urlwebs; ?>/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="<?php echo $urlwebs; ?>/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>
<body>
<?php include('uptop.php'); ?>


    

        <div class="clearfix"></div>
        <link rel="stylesheet" href="<?php echo $urlwebs; ?>/assets/home/m.css">
        
        <!-- MAIN TAB -->

        <?php include('navtab.php'); ?>


        <div class="tab-content">

            <div id="dashboard_wrap" class="tab-pane fade in active">
                <div class="row" style="margin-bottom:0px">
                    <div class="col-xs-3" style="padding-right:2px">
                        <a class="btn btn-default btn-block " href="<?php echo $urlwebs; ?>/m/index.php"><span class="glyphicon glyphicon-calendar"></span>Statement</a>
                    </div>
                    <div class="col-xs-3" style="padding-right:1px; padding-left: 1px;">
                        <a class="btn btn-default btn-block " href="<?php echo $urlwebs; ?>/m/history.php"><span class="glyphicon glyphicon-calendar"></span>History</a>
                    </div>
                    <div class="col-xs-3" style="padding-right:1px; padding-left: 2px;">
                        <a class="btn btn-default btn-block " href="<?php echo $urlwebs; ?>/m/memo.php"><span class="glyphicon glyphicon-edit"></span>Memo<span class="badge badgeTotal" style="margin-left:5px; margin-right:10px; font-size:9px; font-weight:bold"></span></a>
                    </div>
                    <div class="col-xs-3" style="padding-left:2px">
                        <a class="btn btn-default btn-block " href="<?php echo $urlwebs; ?>/m/refferal.php"><span class="glyphicon glyphicon-user"></span>Referal</a>
                    </div>
                </div>
                <div class="row" style="margin-bottom:10px">
                    <div class="col-xs-3" style="padding-right:2px">
                        <a class="btn btn-default btn-block active" href="<?php echo $urlwebs; ?>/m/deposit.php"><span class="glyphicon glyphicon-import"></span>Deposit</a>
                    </div>
                    <div class="col-xs-3" style="padding-left:1px; padding-right:1px;">
                        <a class="btn btn-default btn-block " href="<?php echo $urlwebs; ?>/m/withdraw.php"><span class="glyphicon glyphicon-export"></span>Withdraw</a>
                    </div>
                    <div class="col-xs-3" style="padding-left:2px; padding-right:1px">
                        <a class="btn btn-default btn-block " href="<?php echo $urlwebs; ?>/m/rekening.php"><span class="glyphicon glyphicon-briefcase"></span>Rekening<span style="position:absolute; font-size: 10px; margin-top: -8px; margin-left:-85px">⭐</span></a>
                    </div>
                    <div class="col-xs-3" style="padding-left:2px">
                        <a class="btn btn-default btn-block " href="<?php echo $urlwebs; ?>/m/password.php"><span class="glyphicon glyphicon-user"></span>Password</a>
                    </div>
                </div>

                <div id=""></div>
                <div id="">
                    <!--di bawah ini adalah kolom deposit-->
    
                    <div class="panel panel-danger">
                        <div class="panel-heading">
                            <strong><span class="glyphicon glyphicon-import"></span>DEPOSIT</strong>
                        </div>
                        <div class="panel-body">
                        <?php
                             error_reporting(0);
                             $useridnya = $u['cuid'];
                             $cekTransaksi = mysqli_query($conn,"SELECT * FROM `tb_transaksi` WHERE userID = '$useridnya' AND jenis = 1 AND transaksi = 'Top Up' AND status = 0") or die(mysqli_error());
                             $ct = mysqli_num_rows($cekTransaksi);
                             if($ct > 0){
                               echo '
                                 <div class="alert alert-success alert-dismissible mb-2" role="alert">
                                   <button type="button" class="close" data-dismiss="alert">&times;</button>
                                   <div class="alert-message">
                                     <span>Anda masih memiliki Permintaan Deposit yang Belum Diproses. Silahkan Tunggu Hingga Proses Deposit Sebelumnya Selesai.</span>
                                   </div>
                                 </div>
                               ';
                             }
                             else {
                               if (!empty($_GET['notif'])) {
                                 if ($_GET['notif'] == 1) {
                                   echo '
                                     <div class="alert alert-warning alert-dismissible mb-2" role="alert">
                                       <button type="button" class="close" data-dismiss="alert">&times;</button>
                                       <div class="alert-icon">
                                         <i class="fa fa-exclamation-triangle"></i>
                                       </div>
                                       <div class="alert-message">
                                         <span><strong>Warning!</strong> Minimal Deposit adalah IDR 10.000</span>
                                       </div>
                                     </div>
                                   ';
                                }
                               }
                             ?>                      
                           <form class="form-group-sm deposit_form" action="<?php echo $urlwebs; ?>/function/deposit.php" method="post" enctype="multipart/form-data">
  <div class="form-group">
    <label>Rekening Asal</label>
    <select name="pay_from" class="form-control">
      <option value="<?php echo $sbs['cuid']; ?>">
        <?php echo $sbs['akun']; ?> - <?php echo $sbs['no_rek']; ?> - <?php echo $sbs['pemilik']; ?>
      </option>
    </select>
    <input class="form-control" type="hidden" name="userID" value="<?php echo $u['cuid']; ?>" readonly>
  </div>

  <div class="form-group">
    <label>Rekening Tujuan Deposit</label>
    <select name="metode" class="form-control" id="metodeSelect" required>
      <?php
      $sql_bank = mysqli_query($conn,"SELECT * FROM `tb_bank` WHERE userID = 1 AND status = 1 ORDER BY cuid ASC") or die(mysqli_error($conn));
      while($sb = mysqli_fetch_array($sql_bank)){
      ?>
        <option 
          value="<?php echo $sb['cuid']; ?>" 
          data-image="<?php echo $urlwebs; ?>/upload/<?php echo $sb['image']; ?>"
          data-akun="<?php echo $sb['akun']; ?>">
          <?php echo $sb['akun']; ?> - <?php echo $sb['no_rek']; ?> a/n <?php echo $sb['pemilik']; ?>
        </option>
      <?php } ?>
    </select>

    <!-- Preview Gambar -->
    <div id="bankPreview" style="margin-top:10px; display:none; text-align:center;">
      <a id="downloadLink" href="#" download>
        <img id="bankImage" src="" alt="Bank Preview">
      </a>
      <p id="qrisNote" style="display:none; margin-top:8px; font-weight:bold; color:#333;">
        Scan QRIS di atas untuk menyelesaikan pembayaran
      </p>
    </div>

    <label style="margin-top:15px;">Bonus Deposit</label>
    <select name="gameid" class="form-control">
      <option value=""> Pilih </option>
      <?php
      $sql_transaksi = mysqli_query($conn,"SELECT * FROM `tb_post` WHERE kategori = 0 AND cuid NOT IN(SELECT gameid FROM `tb_transaksi` WHERE userID = '$userID' AND jenis = 1 AND status = 1) ORDER BY cuid ASC") or die(mysqli_error());
      while($st = mysqli_fetch_array($sql_transaksi)){
      ?>
        <option value="<?php echo $st['cuid']; ?>">
          <?php echo ucwords(strtolower($st['title'])); ?>
        </option>
      <?php } ?>
    </select>
  </div>

  <div class="well well-sm" style="margin-top: 15px; margin-bottom:10px">
    Agar deposit cepat diproses masukan kode unik<br>Wajib : 555 
    <span class="glyphicon glyphicon-briefcase" style="margin-left: 5px"></span>Rekening
  </div>

  <div class="form-group">
    <label>Jumlah</label>
    <input type="text" name="nominal" placeholder="Masukan Jumlah Deposit" class="form-control text-right" value="">
  </div>

  

  <input type="submit" class="btn btn-info btn-block" name="submit" value="Selanjutnya">
</form>

                            <?php } ?>
                        </div>
                    </div>
                    <a class="btn btn-primary btn-block" href="?deposit&amp;head=home" role="button" style="font-weight:bold; margin-top:20px"><span class="glyphicon glyphicon-menu-left"></span>Kembali</a>


                    <div style="margin-top:20px">

                        <div class="well well-sm" style="padding-top: 5px; padding-bottom:2px;">
                        <marquee><span class="broadcast" style="color: #white; width: 100%"><?php echo $s0['news']; ?></span></marquee>
                        </div>
                        <div class="well well-sm bankOnline" style="margin-top:-10px; text-align:center"><span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>BCA</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>Mandiri</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>BNI</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>BRI</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>CIMB</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>PANIN</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>DANA</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>OVO</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>GOPAY</strong> : <span class="text-success">ONLINE</span></span>
                            <span style="margin-left:10px; margin-right:10px; white-space:nowrap"><strong>LinkAja</strong> : <span class="text-success">ONLINE</span></span>
                        </div>
                       <div class="well well-sm" style="margin-top:-10px; padding-bottom:2px;">  
  <marquee>
    <span class="listkeluaran" style="white-space:nowrap">
      <span style="margin-left:30px;">
        <span style="color:#FC0">HK SIANG </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>2757</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">SG METRO </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>5708</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">SYDNEY </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>4454</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">HAIPHONG </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>7076</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">SINGAPORE </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>1263</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">MALAYSIA </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>7084</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">MACAU </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>5292</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">QATAR </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>2516</strong>
      </span>

      <span style="margin-left:30px;">
        <span style="color:#FC0">HONGKONG </span>
        <span class="tgl" style="color:#CCC"></span>
        <strong>6022</strong>
      </span>

      <div style="clear:both"></div>
    </span>
  </marquee>
</div>

<script>
  // Ambil tanggal hari ini
  const today = new Date();
  const dd = String(today.getDate()).padStart(2, '0');
  const mm = String(today.getMonth() + 1).padStart(2, '0');
  const formattedDate = dd + "/" + mm;

  // Update semua span class="tgl"
  document.querySelectorAll(".tgl").forEach(el => {
    el.textContent = formattedDate + " ";
  });
</script>

                    </div>

                    <a class="btn btn-danger btn-block" href="/" role="button" style="font-weight:bold; margin-top:20px"><span class="glyphicon glyphicon-menu-left"></span>Log out</a>

                </div>





                <div id="games_wrap" class="tab-pane fade in ">

                </div>















            </div>



        </div>
        <div class="well well-sm container-fluid text-center" style="margin:0px; padding:5px; border-radius:0px; padding-bottom: 55px">
            © 2018 - 2025 Copyright <?php echo $s0['instansi']; ?>. All Rights Reserved.
        </div>
        
        <script>
  const metodeSelect = document.getElementById('metodeSelect');
  const bankPreview  = document.getElementById('bankPreview');
  const bankImage    = document.getElementById('bankImage');
  const downloadLink = document.getElementById('downloadLink');
  const qrisNote     = document.getElementById('qrisNote');

  metodeSelect.addEventListener('change', function(){
    const selectedOption = this.options[this.selectedIndex];
    const imgPath = selectedOption.getAttribute('data-image');
    const akun    = selectedOption.getAttribute('data-akun');

    if(imgPath && imgPath.trim() !== ""){
      bankPreview.style.display = 'block';
      bankImage.src = imgPath;
      downloadLink.href = imgPath;

      if(akun.toUpperCase() === "QRIS"){
        bankImage.style.maxWidth = "350px"; // besar untuk QRIS
        bankImage.style.border   = "2px solid #000";
        bankImage.style.padding  = "8px";
        bankPreview.style.textAlign = "center";
        qrisNote.style.display = "block";
      } else {
        bankImage.style.maxWidth = "120px"; // kecil untuk bank biasa
        bankImage.style.border   = "1px solid #ccc";
        bankImage.style.padding  = "4px";
        bankPreview.style.textAlign = "left";
        qrisNote.style.display = "none";
      }
    } else {
      bankPreview.style.display = 'none';
      qrisNote.style.display = "none";
    }
  });

  // trigger default pilihan pertama saat halaman load
  window.addEventListener('load', function(){
    metodeSelect.dispatchEvent(new Event('change'));
  });
</script>

<script src="<?php echo $urlwebs; ?>/assets/home/main.js"></script>
       <!--tampilan /m/ versi mobile bawah trakhir alias footer--><!--next halaman footer-->
<?php include('footer.php'); ?>





        </div>
 
        </div>
</html>
