<?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>
<?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="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="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="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 active" href="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 " href="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="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="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="password.php"><span class="glyphicon glyphicon-user"></span>Password</a>
            </div>
        </div>

        
        <div class="provider">
            <div class="provider-group">
                <img src="<?php echo $urlweb; ?>/upload/referral.jpg" alt="" style="width: 100%;" class="mobile-only">

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

<div class="panel panel-danger" style="border-radius:10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
    <div class="panel-heading" style="background-color:#d9534f; color:#fff; border-radius:10px 10px 0 0;">
        <strong><span class="glyphicon glyphicon-user"></span> REFERAL</strong>
    </div>
    <div class="panel-body" style="padding:20px; font-family: 'Abel', sans-serif; font-size:14px;">

        <p>Anda akan mendapatkan <strong>Bonus Referal</strong> setiap player yang mendaftar melalui link anda:</p>

        <div class="row" style="margin-top:15px;">

            <!-- Link Referal -->
            <div class="col-xs-6" style="padding-right:10px;">
                <div class="panel panel-success" style="border-radius:8px;">
                    <div class="panel-heading" style="background-color:#5cb85c; color:#fff; border-radius:8px 8px 0 0;">Link Referal</div>
                    <div class="panel-body" style="padding:10px;">
                        <div class="input-group">
                            <input type="text" class="form-control" id="text-copy" value="<?php echo $urlweb; ?>register.php/?ref=<?php echo $u['user']; ?>" readonly style="border-radius:5px;">
                            <span class="input-group-btn">
                                <button class="btn btn-success copy-btn" type="button" onclick="copyReferal()"><span class="glyphicon glyphicon-copy"></span> Copy</button>
                            </span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Keterangan -->
            <div class="col-xs-6" style="padding-left:10px;">
                <div class="panel panel-info" style="border-radius:8px;">
                    <div class="panel-heading" style="background-color:#5bc0de; color:#fff; border-radius:8px 8px 0 0;">Keterangan</div>
                    <div class="panel-body" style="padding:10px;">
                        <table class="table table-striped" style="margin-bottom:0;">
                            <tr>
                                <td>Total Refferal</td>
                                <td><strong><?php echo $u['reff']; ?></strong></td>
                            </tr>
                            <tr>
                                <td>Total Penghasilan</td>
                                <td><strong>
                                    <?php
                                    $hitungKomisi = mysqli_query($conn,"SELECT SUM(total) as komisi FROM `tb_transaksi` WHERE userID = '$userID' AND jenis = 3 AND status = 1") or die(mysqli_error());
                                    $hk = mysqli_fetch_array($hitungKomisi);
                                    $komisi = $hk['komisi'];
                                    echo 'IDR '.number_format($komisi,0,",",".");
                                    ?>
                                </strong></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>

        </div>

        <div style="margin-top:15px; font-size:13px; color:#555;">
            Setiap player yang melakukan deposit melalui refferal Anda, maka Anda akan mendapatkan total penghasilan.
        </div>

    </div>
</div>

<script>
function copyReferal() {
    var copyText = document.getElementById("text-copy");
    copyText.select();
    copyText.setSelectionRange(0, 99999); /* For mobile devices */
    document.execCommand("copy");
    Swal.fire({
        icon: 'success',
        title: 'Berhasil!',
        text: 'Link referal telah disalin.',
        timer: 1500,
        showConfirmButton: false
    });
}
</script>


        <script type="text/javascript">
            $(document).ready(function(){
                $('.copy-btn').on("click", function(){
                    $("#text-copy").select();
                    document.execCommand("copy");
                    alert('<?php echo $urlweb; ?>/register/?ref=<?php echo $u['user']; ?>');
                })
            })
        </script>

        <div id="referal_content">
            <div class="panel panel-danger">
                <div class="panel-heading"><strong><span class="glyphicon glyphicon-tasks" ></span>List Referal</strong>
                    <span style="float:right; margin-top:-4px; width:190px; display:inline">
                        <form class="form-group-sm">
                            <label style="float:left; margin-top:3px; margin-right:10px;">Sort</label>
                            <select class="form-control" id="refsort" page="1" style="width:150px; height:25px; border-radius:3px; float:right">\
                                <option value="j" selected="">Join Date</option>
                                <option value="u">Username</option>
                                <option value="b">Bonus Referal</option>
                            </select>
                        </form>
                    </span>
                </div>
                <div class="table-responsive">

                    <table class="table table-striped table-hover">

                        <tr>
                            <th style="width:1px">No</th>
                            <th>User Referal</th>
                            <th>Join Date</th>
                            <th>Saldo</th>
                        </tr>
                         <tbody>
                        <?php
                        $sql_refferal = mysqli_query($conn,"SELECT * FROM `tb_user` WHERE uplineID = '$userID' AND cuid != '$userID' ORDER BY cuid DESC") or die(mysqli_error());
                        $no = 0;
                        while($sr = mysqli_fetch_array($sql_refferal)){
                          $no++;
                          $reffID = $sr['cuid'];

                          $hitungKomisi1 = mysqli_query($conn,"SELECT * FROM tb_user RIGHT JOIN tb_transaksi ON tb_user.cuid = tb_transaksi.cuid") or die(mysqli_error());
                          $hk1 = mysqli_fetch_array($hitungKomisi1);
                          
                          ?>
                          <td class="vertical-align:middle text-white"><?php echo $no; ?></td>
                          <td class="vertical-align:middle text-white"><?php echo $sr['user']; ?></td>
                          <td class="vertical-align:middle text-white"><?php echo $sr['join_date']; ?></td>
                          <td class="vertical-align:middle text-white">IDR <?php echo $hk1['total']; ?></td>
                              
                      <?php } ?>
                  </tbody>
                  </table>
              </div>
              <ul class="pagination"></ul>
              <script data-cfasync="false" src=""></script><script>
                $(document).ready(function() {
                    $('[data-toggle="tooltip"]').tooltip();
                });
            </script>
        </div>

        <a class="btn btn-primary btn-block" href="?statement&amp;head=home" role="button" style="font-weight:bold; margin-top:20px"><span class="glyphicon glyphicon-menu-left"></span>Kembali</a>
        <script>
            $(document).ready(function() {
                getReferal(1, 'j');
            });
        </script>


        <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 style="color:#CCC">23/05 </span><strong>2757</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">SG METRO </span><span style="color:#CCC">23/05 </span><strong>5708</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">SYDNEY </span><span style="color:#CCC">23/05 </span><strong>4454</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">HAIPHONG </span><span style="color:#CCC">23/05 </span><strong>7076</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">SINGAPORE </span><span style="color:#CCC">22/05 </span><strong>1263</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">MALAYSIA </span><span style="color:#CCC">23/05 </span><strong>7084</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">MACAU </span><span style="color:#CCC">23/05 </span><strong>5292</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">QATAR </span><span style="color:#CCC">07/05 </span><strong>2516</strong></span>
                    <span style="margin-left:30px;"><span style="color:#FC0 ">HONGKONG </span><span style="color:#CCC">23/05 </span><strong>6022</strong></span>
                    <div style="clear:both"></div>
                </span></marquee>
            </div>

        </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 - 2023 Copyright <?php echo $s0['instansi']; ?>. All Rights Reserved.
</div>


<!--tampilan /m/ versi mobile bawah trakhir alias footer--><!--next halaman footer-->
<?php include('footer.php'); ?>




</body>

</html>
