Files
fruehstuecksapp/views/accounts.ejs

78 lines
3.1 KiB
Plaintext

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Konten - Frühstückskonten Verwaltung</title>
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<div class="container">
<header>
<h1>Frühstückskonten Verwaltung</h1>
<% if (typeof user !== 'undefined' && user) { %>
<nav>
<span>Angemeldet als: <strong><%= user.username %></strong> (<%= user.role %>) |
<a href="/dashboard">Dashboard</a> |
<a href="/accounts">Konten</a>
<% if (user.role === 'admin') { %>
| <a href="/items">Artikel</a>
| <a href="/users">Benutzer</a>
<% } %>
| <a href="/logout">Abmelden</a>
</span>
</nav>
<% } %>
</header>
<main>
<h2>Kontenverwaltung</h2>
<div class="actions">
<a href="/accounts/new" class="btn">Neues Konto anlegen</a>
</div>
<table class="data-table">
<thead>
<tr>
<th>Name</th>
<th>Kontostand</th>
<th>Erstellt am</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<% if (typeof accounts !== 'undefined' && accounts.length > 0) { %>
<% accounts.forEach(function(account) { %>
<tr>
<td><%= account.name %></td>
<td class="balance"><%= account.balance.toFixed(2) %> €</td>
<td><%= new Date(account.created_at).toLocaleDateString('de-DE') %></td>
<td>
<a href="/accounts/<%= account.id %>">Details</a>
| <a href="/accounts/<%= account.id %>/deposit">Einzahlen</a>
| <a href="/accounts/<%= account.id %>/withdraw">Abbuchen</a>
<% if (typeof isAdmin !== 'undefined' && isAdmin) { %>
| <a href="/accounts/<%= account.id %>/edit">Bearbeiten</a>
<% } %>
</td>
</tr>
<% }); %>
<% } else { %>
<tr>
<td colspan="4">Keine Konten vorhanden</td>
</tr>
<% } %>
</tbody>
</table>
<p>Gesamt: <%= typeof accounts !== 'undefined' ? accounts.length : 0 %> Konten</p>
</main>
<footer>
<p>&copy; 2024 Frühstückskonten Verwaltung</p>
</footer>
</div>
</body>
</html>