imap-mail-filter-service/app/templates/accounts.html

52 lines
1.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Konten — IMAP Mail Filter{% endblock %}
{% block content %}
<h1>IMAP-Konten</h1>
<a href="/accounts/new" role="button">Neues Konto</a>
{% if accounts %}
<table>
<thead>
<tr>
<th>Name</th>
<th>Server</th>
<th>Benutzer</th>
<th>Status</th>
<th>Letzter Poll</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for acc in accounts %}
<tr>
<td>{{ acc.name }}</td>
<td>{{ acc.imap_host }}:{{ acc.imap_port }}</td>
<td>{{ acc.username }}</td>
<td>{{ "Aktiv" if acc.enabled else "Deaktiviert" }}</td>
<td>{{ acc.last_poll_at or "Noch nie" }}</td>
<td>
<div role="group">
<a href="/accounts/{{ acc.id }}/edit" role="button" class="outline small">Bearbeiten</a>
<button class="outline small contrast" onclick="deleteAccount({{ acc.id }}, '{{ acc.name }}')">Löschen</button>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>Noch keine Konten vorhanden.</p>
{% endif %}
{% endblock %}
{% block scripts %}
<script>
async function deleteAccount(id, name) {
if (!confirm(`Konto "${name}" wirklich löschen? Alle Filterregeln werden ebenfalls gelöscht.`)) return;
await fetch(`/api/accounts/${id}`, {method: 'DELETE'});
location.reload();
}
</script>
{% endblock %}