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

    <?php
        //fetch users with pagination
        if (!empty($_GET['search'])) {
           $neenoe = request()->query('search');
           //where('title','like','%'.$search.'%')
           $users = DB::table('users')->where('status','active')->where('name','like','%'.$neenoe.'%')->orWhere('email','like','%'.$neenoe.'%')->orWhere('phone','like','%'.$neenoe.'%')->paginate(10);
        }else {
            $users = DB::table('users')->where('status','active')->paginate(10);
        }

        
    ?>
    <div class="col-xl-12 col-md-12">
        <!-- DOM/Jquery table start -->
        <div class="row align-items-end">
            <div class="col-lg-7">
                <div class="page-header-title">
                    <div class="d-inline">
                        <div class="card-header">
                            <h5>Manage Active Users</h5>
                        </div>                       
                    </div>
                </div>
            </div>
            <div class="col-lg-5">
                <div class="page-header-breadcrumb">
                    <div class="col-sm-12">
                        <form method="GET">
                            <?php echo csrf_field(); ?>
                             <div class="input-group input-group-success">
                                <input type="text" name="search" class="form-control" placeholder="Enter username/Trans ID">
                                <button class="input-group-addon">
                                    <i data-feather="search" class="menuicons icon-search f-15"></i>
                                </button>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="card-header">
                <h5>Manage Active Users</h5>
            </div>
            <div class="card-block">
                <div class="table-responsive dt-responsive">
                    <table id="dom-jqry" class="table table-striped table-bordered nowrap">
                        <thead>
                            <tr>
                                <th>Join Time</th>
                                <th>Full Name</th>
                               
                                <th>Username</th>
                                <th>Email</th>
                                <th>Phone</th>
                                <th>Balance</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if($users->count() > 0): ?>
                                <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td style="text-transform: capitalize">
                                            <?php echo e(\Carbon\Carbon::parse($user->created_at)->diffForHumans()); ?>

                                        </td>
                                      
                                        <td style="text-transform: capitalize">
                                            <?php echo e($user->name); ?>

                                        </td>
                                        <td style="text-transform: lowercase">
                                            <a href="/users/user/<?php echo e($user->id); ?>">
                                                <u>
                                                    <?php echo e($user->username); ?>

                                                </u>
                                            </a>
                                        </td>
                                        <td style="text-transform: lowercase">
                                            <?php echo e($user->email); ?>

                                            </td>
                                        <td><?php echo e($user->phone); ?></td>
                                        <td>
                                            KES.<?php echo e($user->balance); ?>

                                        </td>
                                        <td>
                                            <a href="<?php echo e(env('APP_URL')); ?>/users/user/<?php echo e($user->id); ?>"
                                               
                                                class="btn btn-success btn-mini  f-18">
                                                <i class="menuicons" data-feather="eye"></i>
                                            </a>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                                <tr>
                                    <td><p>No user Found</p></td>
                                </tr>
                            <?php endif; ?>



                        </tbody>
                    </table>
                </div>
                <div class="card-footer py-4">
                    <div class="row">
                        <?php echo $users->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/hqpzspxr/adminpanel.ebay7.1ai.co.ke/resources/views/users/activeusers.blade.php ENDPATH**/ ?>