<?php $__env->startSection('content'); ?>
    <div class="card card--lg custom--card">
        <div class="card-body">
            <!-- Header -->
            <div class="d-flex justify-content-between align-items-center mb-4">
                <h5 class="mb-0"><?php echo e($pageTitle); ?></h5>
            </div>

            <!-- Referral Link Section -->
            <div class="form--group-lg">
                <label class="form-label form--label required"><?php echo app('translator')->get('Referral Link'); ?></label>
                <div class="input-group input--group">
                    <input type="text" class="form-control form--control referralURL"
                        value="<?php echo e(route('home', ['reference' => $user->username])); ?>" readonly>
                    <button type="button" class="input-group-text copytext" id="copyBoard">
                        <i class="fas fa-copy"></i>
                    </button>
                </div>
                <p class="fs-14 mt-1">
                    <?php echo app('translator')->get('Share this referral link to invite users. Every time they make a deposit, you will earn a commission of :commission% of total deposit.', ['commission' => gs()->referral_commission]); ?>
                </p>
            </div>

            <!-- Data Tables -->
            <div class="row mt-5">
                <!-- Referred Users Table -->
                <div class="col-xxl-3">
                    <div class="table-section mb-3">
                        <div class="table-area">
                            <h6 class="mb-3"><?php echo app('translator')->get('Referred Users'); ?></h6>
                            <table class="table table--custom table-responsive--xl">
                                <thead>
                                    <tr>
                                        <th><?php echo app('translator')->get('Name'); ?></th>
                                        <th><?php echo app('translator')->get('Joined At'); ?></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__empty_1 = true; $__currentLoopData = $referredUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $referred): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                        <tr>
                                            <td>
                                                <span class="fw-bold"><?php echo e($referred->username); ?></span>
                                            </td>
                                            <td>
                                                <small>
                                                    <?php echo e(showDateTime($referred->created_at, 'd M, Y')); ?>

                                                    <br>
                                                    <span
                                                        class="text-muted"><?php echo e($referred->created_at->diffForHumans()); ?></span>
                                                </small>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                        <tr>
                                            <td colspan="2" class="text-center">
                                                <?php echo app('translator')->get('No referred users found.'); ?>
                                            </td>
                                        </tr>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>


                <!-- Referral Commissions Table -->
                <div class="col-xxl-9">
                    <div class="table-section">
                        <div class="table-area">
                            <h6 class="mb-3"><?php echo app('translator')->get('Referral Commissions'); ?></h6>
                            <table class="table table--custom table-responsive--xl">
                                <thead>
                                    <tr>
                                        <th><?php echo app('translator')->get('Transaction ID'); ?></th>
                                        <th><?php echo app('translator')->get('Amount'); ?></th>
                                        <th><?php echo app('translator')->get('Details'); ?></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__empty_1 = true; $__currentLoopData = $referralCommissions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                        <tr>
                                            <td>
                                                <span class="fw-bold"><?php echo e($transaction->trx); ?></span>
                                                <br>
                                                <small><?php echo e($transaction->created_at->format('d M, Y')); ?></small>
                                            </td>
                                            <td>
                                                <span class="text-nowrap"><?php echo e(showAmount($transaction->amount)); ?></span>
                                            </td>
                                            <td>
                                                <span><?php echo e($transaction->details); ?></span>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                        <tr>
                                            <td colspan="4" class="text-center">
                                                <?php echo app('translator')->get('No referral commissions found.'); ?>
                                            </td>
                                        </tr>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                            <?php if($referralCommissions->hasPages()): ?>
                                <div class="mt-3">
                                    <?php echo e(paginateLinks($referralCommissions)); ?>

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

<?php $__env->startPush('script'); ?>
    <script>
        (function($) {
            "use strict";
            $('#copyBoard').on('click', function() {
                var copyText = document.getElementsByClassName("referralURL");
                copyText = copyText[0];
                copyText.select();
                copyText.setSelectionRange(0, 99999);
                /*For mobile devices*/
                document.execCommand("copy");
                copyText.blur();
                this.classList.add('copied');
                setTimeout(() => this.classList.remove('copied'), 1500);
            });
        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('Template::layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/mojibor/work.mojibor.com/core/resources/views/templates/basic/user/referral_commission.blade.php ENDPATH**/ ?>