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

<div class="container-header"><h2 class="title"><?php echo e($title); ?></h2></div>

<div class="card">
    <div class="table-header" style="margin-bottom:16px;">
        <form method="GET" style="display:flex;gap:10px;">
            <select name="status" class="form-control" style="width:160px;height:40px;">
                <option value="">All Status</option>
                <option value="pending" <?php echo e(request('status')=='pending'?'selected':''); ?>>Pending</option>
                <option value="approved" <?php echo e(request('status')=='approved'?'selected':''); ?>>Approved</option>
                <option value="rejected" <?php echo e(request('status')=='rejected'?'selected':''); ?>>Rejected</option>
            </select>
            <button type="submit" class="btn btn-primary" style="height:40px;">Filter</button>
        </form>
    </div>
    <div class="table-responsive">
        <table class="table">
            <thead><tr><th>#</th><th>User</th><th>Amount</th><th>Proof</th><th>Status</th><th>Date</th><th>Actions</th></tr></thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $upgrades; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr>
                    <td><?php echo e($upgrades->firstItem() + $i); ?></td>
                    <td><strong><?php echo e($u->user->fname); ?> <?php echo e($u->user->lname); ?></strong><br><small><?php echo e($u->user->email); ?></small></td>
                    <td><?php echo e($u->amount); ?></td>
                    <td>
                        <?php if($u->payment_proof): ?>
                            <a href="<?php echo e(asset($u->payment_proof)); ?>" target="_blank" class="btn" style="height:32px;padding:0 10px;font-size:12px;background:var(--bg-secondary);color:var(--text-primary);">View Proof</a>
                        <?php else: ?> —
                        <?php endif; ?>
                    </td>
                    <td><span class="status <?php echo e($u->status==='approved'?'success':($u->status==='rejected'?'failed':'pending')); ?>"><?php echo e(ucfirst($u->status)); ?></span></td>
                    <td><?php echo e($u->created_at->format('M d, Y')); ?></td>
                    <td>
                        <?php if($u->status === 'pending'): ?>
                        <div style="display:flex;gap:8px;">
                            <form method="POST" action="<?php echo e(route('backend.marketplace.upgrades.approve', $u->id)); ?>">
                                <?php echo csrf_field(); ?>
                                <button type="submit" class="btn" style="height:32px;padding:0 12px;font-size:12px;background:#dcfce7;color:#16a34a;">Approve</button>
                            </form>
                            <form method="POST" action="<?php echo e(route('backend.marketplace.upgrades.reject', $u->id)); ?>">
                                <?php echo csrf_field(); ?>
                                <button type="submit" class="btn" style="height:32px;padding:0 12px;font-size:12px;background:#fef2f2;color:#dc2626;">Reject</button>
                            </form>
                        </div>
                        <?php endif; ?>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr><td colspan="7" style="text-align:center;padding:40px;color:var(--text-secondary);">No upgrade requests found.</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
    <div class="pagination-wrapper">
        <div class="pagination-links"><?php echo e($upgrades->links()); ?></div>
    </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:\xampp\htdocs\jjd\socialnum\sstack\mine\core\resources\views/backend/marketplace/upgrades.blade.php ENDPATH**/ ?>