<?php $__env->startSection('body_class', 'depositpage'); ?>
<?php $__env->startSection('content'); ?>
<div class="master-main mainContent maincontent-design2 middlebackground background-design5">
    <div class="container">
        <div class="row multi">
            
            <?php echo $__env->make('frontend.desktop.pages.account.components.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

            
            <div class="col-xs-12 col-sm-9 tabbed main-content">
                <div class="content-inner-container referral-member-content">
                    
                    
                    <div class="btn-group-md">
                        <button type="button" class="btn btn-default alignbtn" onclick="clickTab('/desktop/account/referral')">Daftar Anggota Referral</button>
                        <button type="button" class="btn btn-default alignbtn active">Anggota Referral</button>
                        <button type="button" class="btn btn-default alignbtn" onclick="clickTab('/desktop/account/referralbonus')">Bonus Referral</button>
                    </div>

                    <h2 class="main-content-page-title" style="text-align: center;">Anggota Referral</h2>
                    <h4 style="text-align: center;">Total Referral anda: <span class="referral-count"><?php echo e($totalReferral); ?></span></h4>

                    <div class="summary-container referralsummary">
                        
                        
                        <form action="<?php echo e(url()->current()); ?>" method="GET" id="filterForm">
                            <input type="hidden" name="start_date" id="start_date" value="<?php echo e($startDate); ?>">
                            <input type="hidden" name="end_date" id="end_date" value="<?php echo e($endDate); ?>">
                            
                            <div class="filter">
                                <div class="input-group">
                                    <div class="input-container datetime-range">
                                        <label for="filter-datetime-range" class="input-label">Tanggal</label>
                                        <input type="text" id="filter-datetime-range" class="input-filter datetime-range form-control" readonly style="cursor: pointer;" />
                                    </div>
                                </div>
                                
                                <input type="submit" value="Cari" id="filterMemberBtn" class="btn-filter-search btn-theme" />
                            </div>
                        </form>

                        <div class="result-container">
                            <div id="SummaryResult" class="summary-result">
                                
                                
                                <div class="container hdr">
                                    <div class="row hdr">
                                        <div class="col-xs-2 hdr-no">No</div>
                                        <div class="col-xs-5 hdr-user">User</div>
                                        <div class="col-xs-5 hdr-date">Tanggal Masuk</div>
                                    </div>
                                </div>

                                
                                <div class="container content-container">
                                    <?php $__empty_1 = true; $__currentLoopData = $reffc; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                        <div class="container data">
                                            <div class="row data-container">
                                                <div class="col-xs-2 data-no"><?php echo e(($reffc->currentPage() - 1) * $reffc->perPage() + $loop->iteration); ?></div>
                                                <div class="col-xs-5 data-user"><?php echo e($item->reff_code ?? 'Unknown'); ?></div>
                                                <div class="col-xs-5 data-date"><?php echo e(\Carbon\Carbon::parse($item->created_at)->format('Y-m-d')); ?></div>
                                            </div>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                        <div class="container sts" style="display: block; margin-top:0;">
                                            <div class="container inner">
                                                <div class="row sts-container">
                                                    <div class="col-xs-12 summary-timestamp" style="text-align: center;">
                                                        Daftar anggota referral rujukan tidak ditemukan.
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>

                        
                        <?php if($reffc->hasPages()): ?>
                        <div class="container nav-page">
                            <div class="row nav-page-container">
                                <div class="col-xs-12 pages">
                                    <span class="page-prev">
                                        <a href="<?php echo e($reffc->previousPageUrl()); ?>" class="btn-page-prev <?php echo e($reffc->onFirstPage() ? 'readonly' : ''); ?>"><</a>
                                    </span>
                                    <div class="number-container">
                                        <span style="color:#fff">Halaman <?php echo e($reffc->currentPage()); ?> dari <?php echo e($reffc->lastPage()); ?></span>
                                    </div>
                                    <span class="page-next">
                                        <a href="<?php echo e($reffc->nextPageUrl()); ?>" class="btn-page-next <?php echo e(!$reffc->hasMorePages() ? 'readonly' : ''); ?>">></a>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>

<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />

<style>
    .daterangepicker { z-index: 999999 !important; background-color: #222 !important; color: #fff !important; border: 1px solid #444 !important; }
    .daterangepicker .calendar-table { background-color: #222 !important; border: none !important; }
    .daterangepicker td.off, .daterangepicker td.off.in-range { background-color: #111 !important; color: #555 !important; }
    .daterangepicker td.active, .daterangepicker td.active:hover { background-color: #f3c300 !important; color: #000 !important; }
    .daterangepicker .ranges li:hover, .daterangepicker .ranges li.active { background-color: #f3c300 !important; color: #000 !important; }
</style>

<script>
    var isClickTab = false;
    function clickTab(tab) {
        if (isClickTab) return;
        isClickTab = true;
        window.location.href = tab;
    }

    $(document).ready(function () {
        const displayDateFormat = "YYYY-MM-DD";
        let defaultStart = '<?php echo e(\Carbon\Carbon::parse($startDate)->format("Y-m-d")); ?>';
        let defaultEnd = '<?php echo e(\Carbon\Carbon::parse($endDate)->format("Y-m-d")); ?>';
        let isSearchActive = "<?php echo e($isSearch); ?>";

        let daterangeInput = $("#filter-datetime-range");
        daterangeInput.val(isSearchActive == "1" ? (defaultStart + ' - ' + defaultEnd) : 'Lihat Semua');

        daterangeInput.daterangepicker({
            autoApply: true,
            opens: 'left',
            startDate: defaultStart,
            endDate: defaultEnd,
            maxDate: moment().format(displayDateFormat),
            locale: { format: displayDateFormat, separator: ' - ' },
            ranges: {
                'Lihat Semua': [moment().subtract(10, 'years'), moment()],
                'Hari ini': [moment().startOf('day'), moment().endOf('day')],
                'Kemarin': [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')],
                '7 Hari Terakhir': [moment().subtract(6, 'days').startOf('day'), moment().endOf('day')]
            }
        });

        daterangeInput.on('apply.daterangepicker', function(ev, picker) {
            if(picker.startDate.year() < moment().year() - 5) {
                $(this).val('Lihat Semua');
                $('#start_date').val('');
                $('#end_date').val('');
            } else {
                $(this).val(picker.startDate.format(displayDateFormat) + ' - ' + picker.endDate.format(displayDateFormat));
                $('#start_date').val(picker.startDate.format("YYYY-MM-DD 00:00:00"));
                $('#end_date').val(picker.endDate.format("YYYY-MM-DD 23:59:59"));
            }
        });
    });
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('frontend.desktop.pages.account.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /www/wwwroot/website/sewa/dragon158/resources/views/frontend/desktop/pages/account/pages/referralmember.blade.php ENDPATH**/ ?>