

<?php $__env->startSection('content'); ?>



  <div class="app-container">
    <header>
        
        <div class="logo">Referral Program</div>
    </header>

    <section class="referral-section">
        <div class="referral-stats">
            <div class="stat-card">
                <h3>Total Referrals</h3>
                <p><?php echo e($totalReferrals); ?></p>
            </div>
            <div class="stat-card">
                <h3>Earned Rewards</h3>
                <p>$<?php echo e(number_format($totalRewards, 2)); ?></p>
            </div>
        </div>

        <div class="referral-link">
            <h3>Your Referral Link</h3>
            <div class="link-container">
                <input type="text" value="<?php echo e(url('/register?ref=' . $user->username)); ?>" readonly>
                <button class="btn-copy">
                    <i class="fas fa-copy"></i>
                </button>
            </div>
        </div>

        <div class="referral-rules">
            <h3>Referral Rules</h3>
            <ul>
                <li>Earn <?php echo e($settings->referral_percentage); ?>% for each friend who signs up</li>
                 
                <li>No limit on referral earnings</li>
            </ul>
        </div>

        <div class="referral-history">
            <h3>Referral History</h3>
            <div class="referral-list">
                <?php $__currentLoopData = $referrals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $referral): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="referral-item">
                <div class="referral-info">
                    <h4><?php echo e($referral->referredUser->username); ?></h4>
                    <p>Signed up on <?php echo e($referral->created_at->format('m/d/Y')); ?></p>
                </div>
                <div class="referral-reward">
                    <p>+$<?php echo e(number_format($referral->reward, 2)); ?></p>
                </div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                
            </div>
        </div>
    </section>

<script>
    document.querySelector('.btn-copy').addEventListener('click', function() {
    const input = this.previousElementSibling; // Target the input field
    input.select();
    input.setSelectionRange(0, 99999); // For mobile devices
    document.execCommand('copy'); // Copy the text

    // Show SweetAlert success popup
    Swal.fire({
        icon: 'success',
        title: 'Copied!',
        text: 'Referral link copied to clipboard!',
        timer: 2000,
        showConfirmButton: false,
    });
});


</script>
						
<?php $__env->stopSection(); ?>
 
<?php echo $__env->make('layouts.user', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/qfsworl3/public_html/resources/views/user/referral.blade.php ENDPATH**/ ?>