mockapi/templates/admin/oauth/users.html
2026-03-16 05:47:01 +00:00

111 lines
No EOL
4.7 KiB
HTML

{% extends "base.html" %}
{% block title %}OAuth Users - Mock API Admin{% endblock %}
{% block content %}
<div class="content-header d-flex justify-content-between align-items-center">
<div>
<h1><i class="bi bi-people"></i> OAuth Users</h1>
<p class="lead">Manage OAuth 2.0 resource owner accounts.</p>
</div>
</div>
{% if error %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ error }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endif %}
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Username</th>
<th scope="col">Email</th>
<th scope="col">Status</th>
<th scope="col">Created</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td><span class="badge bg-secondary">#{{ user.id }}</span></td>
<td><code>{{ user.username }}</code></td>
<td>{{ user.email if user.email else '<span class="text-muted"></span>' }}</td>
<td>
{% if user.is_active %}
<span class="badge bg-success">Active</span>
{% else %}
<span class="badge bg-secondary">Inactive</span>
{% endif %}
</td>
<td><small class="text-muted">{{ user.created_at.strftime('%Y-%m-%d') }}</small></td>
<td>
<form method="post" action="/admin/oauth/users/{{ user.id }}/toggle" style="display:inline;">
<button type="submit" class="btn btn-sm btn-outline-{{ 'warning' if user.is_active else 'success' }}" onclick="return confirm('Are you sure you want to toggle active status?')" title="{{ 'Deactivate' if user.is_active else 'Activate' }}">
<i class="bi bi-{{ 'x-circle' if user.is_active else 'check-circle' }}"></i> {{ 'Deactivate' if user.is_active else 'Activate' }}
</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="6" class="text-center text-muted py-4">
<i class="bi bi-inbox display-4"></i>
<p class="mt-2">No OAuth users found.</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if total_pages > 1 %}
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
{% if page > 1 %}
<li class="page-item">
<a class="page-link" href="/admin/oauth/users?page={{ page - 1 }}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
{% endif %}
{% for p in range(1, total_pages + 1) %}
{% if p == page %}
<li class="page-item active"><a class="page-link" href="#">{{ p }}</a></li>
{% else %}
<li class="page-item"><a class="page-link" href="/admin/oauth/users?page={{ p }}">{{ p }}</a></li>
{% endif %}
{% endfor %}
{% if page < total_pages %}
<li class="page-item">
<a class="page-link" href="/admin/oauth/users?page={{ page + 1 }}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
</div>
</div>
{% endblock %}