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


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


?>

<div class="col-lg-7">
    <div class="page-header-title">
        <div class="d-inline">
            <div class="card-header">
                <h5>Approved Deposit History </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 class="feather icon-search f-15"></i>
                    </button>
                </div>
            </form>

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

<div class="col-xl-12 col-md-12">
    <!-- DOM/Jquery table start -->
    <div class="card">
        <div class="card-block">
            <div class="table-responsive dt-responsive">
                <table id="dom-jqry"
                    class="table table-striped table-bordered nowrap">
                    <thead>
                        <tr>
                            <th>Date</th>
                            <th>Method</th>
                            <th>Transaction #</th>
                            <th>Username</th>
                            <th>Amount</th>
                            <th>Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if($deposits->count() > 0): ?>

                        <?php $__currentLoopData = $deposits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e(\Carbon\Carbon::parse($d->created_at)->diffForHumans()); ?>

                            </td>
                            <td><?php echo e($d->method); ?></td>
                            <td><?php echo e($d->transaction); ?></td>
                            <td style="text-transform: lowercase">
                                <?php
                                    
                                $thisguy = DB::table('users')->where('username', $d->username)->first();
                                $iduser = $thisguy->id ?? 1;

                                ?>
                                <a href="<?php echo e(route('viewuser', $iduser)); ?>">
                                    <u>
                                        <?php echo e($thisguy->username ?? $d->username); ?>

                                    </u>
                                </a> 
                            </td>
                            <td>KSH <?php echo e($d->amount); ?></td>
                            <td>
                                <span
                                    class="label label-success"><?php echo e($d->status); ?></span>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php else: ?>

                        <tr>
                            <td>
                                <center> No Data Found</center>
                            </td>
                        </tr>
 
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
            <div class="card-footer py-4">
                <nav aria-label="...">

                </nav>
            </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/deno/Desktop/adminPanel/resources/views/deposits/all.blade.php ENDPATH**/ ?>