<title>Share & Earn - https://akotamicrojobs.net</title>

<?php $__env->startSection('css'); ?>
 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
    <link rel="stylesheet" href="https://akotamicrojobs.net/resources/css/argon.css" type="text/css">
    <link rel="stylesheet" href="https://akotamicrojobs.net/resources/css/myapp.css" type="text/css">
    

<style>
    .table th {
        background-color: rgba(250, 250, 250, 1); /* White faded background */
        color: #000066; /* Black font color */
        font-size: 12px;
    }
    /* Remove vertical borders for table cells and adjust horizontal border color */
    .table-no-vertical-border th,
    .table-no-vertical-border td {
        border-left: none;  /* Remove left border */
        border-right: none; /* Remove right border */
        border-color: rgba(0, 0, 0, 0.1); /* Adjust the border color (0.1 for a very faint line) */
    }
    .table td {
        font-size: 14px;
        color: #000;
    }
    .list:hover {
        cursor: pointer;
        opacity: 0.5;
    }
    
    
</style>
<?php $__env->stopSection(); ?>

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

<div class="row mt-2 mb-4 justify-content-center">
    <div class="col-md-5">
        <div class="card card-with-shadow-sm h-100">
            <div class="card-body px-4">
                <div class="d-flex align-items-center justify-content-between mb-2">
                    <h4 class="text-gray-400 m-0">Your Affiliate Link</h4>
                </div>
                <div class="form-group">
                    <div class="input-group input-group-alternative">
                        <input class="form-control font-weight-600" value="<?php echo e(url('/refer-user/'.Auth::user()->code)); ?>" id="aff-link" type="text" readonly>
                        <div class="input-group-prepend">
                            <span class="input-group-text" onclick="copyAddress()"><i class="fas fa-copy"></i></span>
                        </div>
                   </div>
                </div>
                <div class="bg-blue py-5 px-4 rounded">
                  <p class="d-flex flex-nowrap m-0">
                    <span class="mr-2"><strong class="font-weight-bold text-white"></strong></span>
                    <span class="text-white"><strong><b><?php echo e(Auth::user()->total_refer); ?></b></strong> User joined by your reffer link.</span>
                  </p>
                  <p style="margin-top: 10px" class="text-yellow"> Hello sir, you can now earn more by referring your friends. You will Get  <b>5%</b>  referral’s commission for each DEPOSIT & you will get <b>1%</b> TASK commission from your referrals each completed task . </p>
                </div>
           </div>
       </div>
    </div>

    <div class="col-md-4 mt-2">
        <div class="card">
            <div class="card-body">
                <div class="row justify-content-between align-items-center">
                    <div class="col">
                        <h2 class="font-weight-bold mb-0 limited-offer__heading">Affiliate Program</h2>
                    </div>
                    <div class="col-auto">
                        <span class="badge badge-lg badge-success drk_black_theme">Activated</span>
                    </div>
                </div>
                <p style="padding: 5px;margin-top: 10px">Post your affiliate link on blogs, websites, forums, social media or write Actupjob review - Refer new members (Freelancers &amp; Business Owner) and earn commission revenue!</p>
            </div>
        </div>
    </div>
</div>

  
    
    <div class="card">
    <div class="card-header">
           <div class="referral-income">
            <h2>Total Referral Income: <?php echo e(number_format($totalReferralIncome, 2)); ?>$ </h2>
                </div>
        <p>Total Generations: 
            <?php if($maxGeneration <= $totalGenerations): ?> 
                <?php echo e($maxGeneration); ?>

            <?php else: ?>
                <?php echo e($totalGenerations); ?>

            <?php endif; ?>
        </p>

     

    </div>
    <div class="card-body">
        <div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>Generation</th>
                        <th>User ID</th>
                        <th>Joined Date</th>
                        <th>User Name</th>
                        <th>Status</th>
                        <th>Sub-Referrals</th>
                    </tr>
                </thead>
              <tbody>
    <?php $__currentLoopData = $referrals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $generation => $users): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php if($generation <= $maxGeneration): ?> 
            <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td><?php echo e($generation); ?></td>
                    <td><?php echo e($user['code']); ?></td>
                    <td><?php echo e($user['joined_date']); ?></td>
                    <td><?php echo e($user['name']); ?></td>
                    <td>
                        <?php if($user['premium_status'] == 1): ?>
                            <span class="text-success">Verified</span>
                        <?php else: ?>
                            <span class="text-danger">Not Verified</span>
                        <?php endif; ?>
                    </td>
                    <td>
                        <?php if(count($user['children']) > 0): ?>
                         <?php
                            $verifiedCount = 0;
                            $notVerifiedCount = 0;
                        ?>
                        
                        <ul>
                            <?php $__currentLoopData = $user['children']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $child): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li>
                                    <?php echo e($loop->iteration); ?>. <?php echo e($child['name']); ?> (ID: <?php echo e($child['code']); ?>)
                                    - 
                                    <?php if($child['premium_status'] == 1): ?>
                                        <span class="text-success">Verified</span>
                                        <?php $verifiedCount++; ?>
                                    <?php else: ?>
                                        <span class="text-danger">Not Verified</span>
                                        <?php $notVerifiedCount++; ?>
                                    <?php endif; ?>
                                </li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                        
                        <div class="verification-summary">
                            <p>Verified: <strong><?php echo e($verifiedCount); ?></strong> | Not Verified: <strong><?php echo e($notVerifiedCount); ?></strong></p>
                        </div>

                        <?php else: ?>
                            No Sub-Referrals
                        <?php endif; ?>
                    </td>
                </tr>
                <!--<?php if(count($user['children']) > 0): ?>-->
                <!--    <tr>-->
                <!--        <td colspan="6">-->
                            <!-- Recursive display for children -->
                <!--            <?php $__currentLoopData = $user['children']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $child): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>-->
                <!--                <strong>Child:</strong> <?php echo e($child['name']); ?> (ID: <?php echo e($child['code']); ?>) <br>-->
                <!--            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>-->
                <!--        </td>-->
                <!--    </tr>-->
                <!--<?php endif; ?>-->
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <?php endif; ?>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>

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


    

</div>


    
<script>
    function copyAddress() {
        const copyText = document.getElementById("aff-link");
        copyText.select();
        copyText.setSelectionRange(0, 99999);
        document.execCommand("copy");
    }
</script>

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

<?php $__env->startSection('js'); ?>
<script>
    function copyReferLink() {
        var referLink = document.getElementById('refer_link');
        var range = document.createRange();
        range.selectNode(referLink);
        window.getSelection().removeAllRanges(); // Clear previous selections
        window.getSelection().addRange(range); // Select the link
        document.execCommand('copy'); // Copy the selected text
        window.getSelection().removeAllRanges(); // Clear the selection
        alert('Link copied!');
    }
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('user.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/sakibwe1/microjobtwo.sakibwebtech.website/resources/views/user/pages/referral.blade.php ENDPATH**/ ?>