<?php $__env->startSection('title', 'Users'); ?>
<?php $__env->startSection('page-title', 'All Users'); ?>
<?php $__env->startSection('content'); ?>
<div class="content-card">
    <div class="content-card-header">
        <h3>Users (<?php echo e($users->total()); ?>)</h3>
        <a href="<?php echo e(route('admin.resellers.create')); ?>" class="btn btn-primary btn-sm">+ Add Reseller</a>
    </div>

    <form method="GET" class="row g-2 mb-3">
        <div class="col-md-3">
            <select name="role" class="form-select" onchange="this.form.submit()">
                <option value="">All Roles</option>
                <option value="superadmin" <?php echo e(request('role')=='superadmin'?'selected':''); ?>>Super Admin</option>
                <option value="reseller" <?php echo e(request('role')=='reseller'?'selected':''); ?>>Reseller</option>
                <option value="user" <?php echo e(request('role')=='user'?'selected':''); ?>>User</option>
            </select>
        </div>
        <div class="col-md-4">
            <input type="text" name="q" class="form-control" placeholder="Search name / email / username" value="<?php echo e(request('q')); ?>">
        </div>
        <div class="col-md-2"><button class="btn btn-outline-primary w-100">Filter</button></div>
    </form>

    <div class="table-responsive">
    <table class="table">
        <thead><tr><th>Name</th><th>Username</th><th>Email</th><th>Role</th><th>Status</th><th>Quota</th><th>Actions</th></tr></thead>
        <tbody>
        <?php $__empty_1 = true; $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr>
                <td><img src="<?php echo e($u->avatarUrl()); ?>" class="user-avatar-sm me-2"><?php echo e($u->displayName()); ?></td>
                <td><?php echo e($u->username); ?></td>
                <td><?php echo e($u->email); ?></td>
                <td><span class="user-role-badge role-<?php echo e($u->role); ?>"><?php echo e($u->role); ?></span></td>
                <td>
                    <form action="<?php echo e(route('admin.users.toggle', $u)); ?>" method="POST" class="d-inline">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="status" value="<?php echo e($u->status === 'active' ? 'inactive' : 'active'); ?>">
                        <button class="btn btn-sm <?php echo e($u->status === 'active' ? 'btn-success' : 'btn-danger'); ?>">
                            <?php echo e($u->status === 'active' ? 'Active' : 'Inactive'); ?>

                        </button>
                    </form>
                </td>
                <td><?php echo e($u->isReseller() ? $u->blogs_used . '/' . $u->blogs_quota : '—'); ?></td>
                <td>
                    <a href="<?php echo e(route('admin.users.edit', $u)); ?>" class="btn btn-sm btn-outline-primary">Edit</a>
                    <?php if($u->isReseller()): ?>
                        <a href="<?php echo e(route('admin.resellers.quota.edit', $u)); ?>" class="btn btn-sm btn-outline-warning">Quota</a>
                    <?php endif; ?>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr><td colspan="7" class="text-center text-muted py-3">No users found.</td></tr>
        <?php endif; ?>
        </tbody>
    </table>
    </div>
    <?php echo e($users->links()); ?>

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

<?php echo $__env->make('layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp82\htdocs\blog\resources\views/admin/users/index.blade.php ENDPATH**/ ?>