ezidam/crates/ezidam/templates/pages/admin/apps/list.html.tera

136 lines
5 KiB
Text

{% extends "shell" %}
{% block content %}
{% set new_app_label = "New application" %}
{% set new_app_link = "apps/new" %}
<div class="page-header d-print-none">
<div class="container-xl">
<div class="row align-items-center">
{% if apps | length != 0 %}
<div class="col">
<div class="page-pretitle">
Admin dashboard
</div>
<h2 class="page-title">
Applications
</h2>
</div>
<div class="col-auto ms-auto">
<div class="btn-list">
<a href="{{ new_app_link }}" class="btn btn-primary d-none d-sm-inline-block">
{% include "icons/plus" %}
{{ new_app_label }}
</a>
<a href="{{ new_app_link }}" class="btn btn-primary d-sm-none btn-icon"
aria-label="{{ new_app_label }}">
{% include "icons/plus" %}
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
{% if flash %}
<div class="alert alert-{{flash.0}}" role="alert">
<h4 class="alert-title">{{ flash.1 }}</h4>
</div>
{% endif %}
{% if apps | length != 0 %}
<div class="card">
<div id="table-default" class="table-responsive">
<table class="table table-hover">
<!-- Table header -->
<thead>
<tr>
<th>
<button class="table-sort" data-sort="sort-name">Name</button>
</th>
<th>
<button class="table-sort" data-sort="sort-status">Status</button>
</th>
<th>
<button class="table-sort" data-sort="sort-creation-date">Creation Date</button>
</th>
<th>
<button class="table-sort" data-sort="sort-id">ID</button>
</th>
<th>
<button class="table-sort" data-sort="sort-redirect-uri">Redirect URI</button>
</th>
<th class="w-1">
Actions
</th>
</tr>
</thead>
<tbody class="table-tbody">
<!-- Table content -->
{% for app in apps %}
<tr>
<td class="sort-name">{{ app.label }}</td>
<td class="sort-status">
{% if app.is_archived == true %}
<span class="badge bg-danger me-1"></span> Archived
{% else %}
<span class="badge bg-success me-1"></span> Active
{% endif %}
</td>
<td class="sort-creation-date" data-date="{{ app.created_at | date(timestamp=true) }}">
{{ app.created_at | date() }}
</td>
<td class="sort-id">{{ app.id }}</td>
<td class="sort-redirect-uri">{{ app.redirect_uri }}</td>
<td>
<a href="#">Details</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% else %}
<div class="d-flex flex-column justify-content-center">
<div class="empty">
<p class="empty-title">No registered applications</p>
<p class="empty-subtitle text-muted">
Register an application to allow users access it with ezidam.
</p>
<div class="empty-action">
<a href="{{ new_app_link }}" class="btn btn-primary">
{% include "icons/plus" %}
{{ new_app_label }}
</a>
</div>
</div>
</div>
{% endif %}
</div>
</div>
{% endblock content %}
{% block libs_js %}
<script src="/libs/list.js/list.min.js" defer></script>
{% endblock lib_js %}
{% block additional_js %}
<script>
document.addEventListener("DOMContentLoaded", function () {
const list = new List('table-default', {
sortClass: 'table-sort',
listClass: 'table-tbody',
valueNames: ['sort-name', 'sort-status',
{attr: 'data-date', name: 'sort-date'},
'sort-id', 'sort-redirect-uri',
]
});
})
</script>
{% endblock additional_js %}