flask-base/templates/admin_system.html

68 lines
3.0 KiB
HTML

{% extends "base.html" %}
{% block title %}System Admin{% endblock %}
{% block content %}
<div class="container mt-4">
<h2>System Administration</h2>
<div class="card mt-3">
<div class="card-header">Manage Users</div>
<div class="card-body">
<table class="table">
<thead>
<tr>
<th>Email</th>
<th>Company</th>
<th>System Admin</th>
<th>Company Admin</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.email }}</td>
<td>{{ user.company.name if user.company else '-' }}</td>
<td>{% if user.is_system_admin %}✓{% endif %}</td>
<td>{% if user.is_company_admin %}✓{% endif %}</td>
<td>
<form method="POST" style="display:inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="user_id" value="{{ user.id }}">
<div class="btn-group" role="group">
{% if not user.is_system_admin %}
<button name="action" value="promote_system" class="btn btn-sm btn-success">System+</button>
{% else %}
<button name="action" value="demote_system" class="btn btn-sm btn-warning">System-</button>
{% endif %}
{% if user.company_id and not user.is_company_admin %}
<button name="action" value="promote_company" class="btn btn-sm btn-primary">Company+</button>
{% elif user.is_company_admin %}
<button name="action" value="demote_company" class="btn btn-sm btn-warning">Company-</button>
{% endif %}
</div>
<button name="action" value="delete" class="btn btn-sm btn-danger">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card mt-3">
<div class="card-header">Registered Companies</div>
<ul class="list-group list-group-flush">
{% for company in companies %}
<li class="list-group-item">
{{ company.name }} ({{ company.users|length }} users)
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}