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

<?php

    $invest = DB::table('invest')->paginate(10);


?>

    <div class="col-lg-12">
        <div class="card">
            <div class="card-body">
                <h4 class="card-title">List of All Investment</h4>
                <br>
                <div class="table-responsive">
                    <table class="table color-table primary-table">
                        <thead>
                            <tr>
                                <th scope="col">Date Invested</th>
                                <th scope="col">Username</th>
                                <th scope="col">Amount</th>
                                <th scope="col">Daily Income</th>
                                <th scope="col">Total Earned</th>
                                <th scope="col">Status</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if($invest->count() > 0): ?>
                            <?php $__currentLoopData = $invest; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inv): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                    <?php echo e(\Carbon\Carbon::parse($inv->created_at)->diffForHumans()); ?>

                           
                                </td>

                                <td style="text-transform: lowercase">
                                    <a href="/admin/users/detail/103">
                                        <u>
                                            <?php
                                                $usr = DB::table('users')->where('id', $inv->user_id)->first();
                                            ?>
                                            <?php echo e($usr->username ?? "Empty"); ?>

                                        </u>
                                    </a>
                                </td>
                                <td>
                                    KSH <?php echo e($inv->capital); ?>

                                </td>
                                <td>
                                    KSH <?php echo e($inv->returns); ?>

                                </td>
                                <td>
                                    <b> KSH <?php echo e($inv->returns * $inv->days_paid); ?></b>
                                </td>
                                <td>
                                  
                                        <?php if($inv->status == 1): ?>
                                        <span class="badge  badge-success">
                                            Active
                                        </span>
                                        <?php else: ?>
                                        <span class="badge  badge-warning">
                                            Inactive
                                        </span>
                                        <?php endif; ?>


                                   
                                </td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            <?php else: ?>
    
                            <tr>
                                <td colspan="full">
                                    <p>No Data found</p>
                                </td>
                            </tr>
    
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                <div class="card-footer py-4">
                    <div class="row">
                        <?php echo $invest->withQueryString()->links('pagination::bootstrap-5'); ?>

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

<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/uniquesq/admin.digital-pay.top/resources/views/users/allinvestments.blade.php ENDPATH**/ ?>