

<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="container-header">
        <h1><?php echo e($title); ?></h1>
    </div>

    <div class="card mb-25">
        <div class="card-body">
            <form method="get" class="filter-form">
                <div class="row">
                    <div class="form-group width-33">
                        <label class="form-label">Type</label>
                        <select name="type" class="form-control">
                            <option value="">All</option>
                            <option value="credit" <?php echo e(request('type') === 'credit' ? 'selected' : ''); ?>>Credit</option>
                            <option value="debit" <?php echo e(request('type') === 'debit' ? 'selected' : ''); ?>>Debit</option>
                        </select>
                    </div>
                    <div class="form-group width-33" style="margin-top: 26px;">
                        <button class="btn btn-primary" type="submit">Filter</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="card table-card">
        <div class="table-header">
            <form method="get" action="<?php echo e(route('backend.logs.transactions')); ?>" class="table-search-form">
                <?php if(request('type')): ?><input type="hidden" name="type" value="<?php echo e(request('type')); ?>"><?php endif; ?>
                <div class="table-search">
                    <input type="text" name="search" class="search-input" placeholder="Search by reference, amount, user..." value="<?php echo e($search ?? ''); ?>">
                    <i class="las la-search"></i>
                </div>
                <button type="submit" class="btn btn-secondary search-btn">Search</button>
                <?php if(!empty($search)): ?>
                    <a href="<?php echo e(route('backend.logs.transactions', request()->only('type'))); ?>" class="btn btn-outline">Clear</a>
                <?php endif; ?>
            </form>
        </div>
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>User</th>
                        <th>Type</th>
                        <th>Amount</th>
                        <th>Balance Before</th>
                        <th>Balance After</th>
                        <th>Source</th>
                        <th>Reference</th>
                        <th>Date</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tx): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($transactions->firstItem() + $loop->index); ?></td>
                            <td><?php echo e($tx->user?->email ?? 'N/A'); ?></td>
                            <td><?php echo e(ucfirst($tx->type)); ?></td>
                            <td><?php echo e(number_format($tx->amount, 2)); ?></td>
                            <td><?php echo e(number_format($tx->balance_before, 2)); ?></td>
                            <td><?php echo e(number_format($tx->balance_after, 2)); ?></td>
                            <td><?php echo e($tx->source ?? '-'); ?></td>
                            <td><?php echo e($tx->reference ?? '-'); ?></td>
                            <td><?php echo e($tx->created_at?->format('Y-m-d H:i')); ?></td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr><td colspan="9" class="text-center">No transactions found.</td></tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>

        <?php if($transactions instanceof \Illuminate\Pagination\LengthAwarePaginator): ?>
            <div class="pagination-wrapper">
                <?php echo e($transactions->links('vendor.pagination.default')); ?>

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


<?php echo $__env->make('backend.layout.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\HP\Desktop\nbverify\mine\resources\views/backend/logs/transactions.blade.php ENDPATH**/ ?>