55 lines
2.0 KiB
HTML
55 lines
2.0 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<h1 class="h3">Admin dashboard</h1>
|
|
</div>
|
|
|
|
<div class="row mt-4">
|
|
<div class="col-md-6">
|
|
<h2 class="h5">Companies</h2>
|
|
<form method="post" action="{{ url_for('admin.create_company') }}" class="card card-body mb-3">
|
|
<div class="input-group">
|
|
<input class="form-control" name="name" placeholder="New company name" required />
|
|
<button class="btn btn-success" type="submit">Add</button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="list-group">
|
|
{% for c in companies %}
|
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.company_detail', company_id=c.id) }}">
|
|
{{ c.name }}
|
|
<span class="text-muted">(users: {{ c.users|length }}, displays: {{ c.displays|length }}, playlists: {{ c.playlists|length }})</span>
|
|
</a>
|
|
{% else %}
|
|
<div class="text-muted">No companies yet.</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<h2 class="h5">Users</h2>
|
|
<div class="list-group">
|
|
{% for u in users %}
|
|
<div class="list-group-item d-flex justify-content-between align-items-center">
|
|
<div>
|
|
<div><strong>{{ u.username }}</strong> {% if u.is_admin %}<span class="badge bg-dark">admin</span>{% endif %}</div>
|
|
<div class="text-muted">
|
|
{% if u.company %}Company: {{ u.company.name }}{% else %}No company{% endif %}
|
|
</div>
|
|
</div>
|
|
<div>
|
|
{% if not u.is_admin %}
|
|
<form method="post" action="{{ url_for('admin.impersonate', user_id=u.id) }}">
|
|
<button class="btn btn-warning btn-sm" type="submit">Impersonate</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="text-muted">No users yet.</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|