modified: app.py

modified:   templates/admin_giveaways.html
This commit is contained in:
SimolZimol
2024-09-12 16:06:23 +02:00
parent b673585bf8
commit 0ac3dc09aa
2 changed files with 155 additions and 65 deletions

View File

@@ -4,14 +4,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin - Giveaways</title>
<title>Manage Giveaways</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
th a {
color: inherit;
text-decoration: none;
}
</style>
</head>
<body>
@@ -31,12 +25,15 @@
<div class="container mt-5">
<h1 class="text-center">Giveaways Management</h1>
<table class="table table-bordered table-hover mt-4">
<thead class="thead-dark">
<p class="text-center">Manage all active and inactive giveaways in the system.</p>
<table class="table table-striped mt-4">
<thead>
<tr>
<th><a href="{{ url_for('admin_giveaways', sort='id', order='asc' if sort_field == 'id' and order == 'desc' else 'desc') }}">ID</a></th>
<th><a href="{{ url_for('admin_giveaways', sort='platform', order='asc' if sort_field == 'platform' and order == 'desc' else 'desc') }}">Platform</a></th>
<th><a href="{{ url_for('admin_giveaways', sort='name', order='asc' if sort_field == 'name' and order == 'desc' else 'desc') }}">Name</a></th>
<th>ID</th>
<th>Platform</th>
<th>Name</th>
<th>UUID</th>
<th>Game Key</th>
<th>Winner Discord ID</th>
<th>Active</th>
@@ -49,26 +46,26 @@
<td>{{ giveaway.id }}</td>
<td>{{ giveaway.platform }}</td>
<td>{{ giveaway.name }}</td>
<td>{{ giveaway.uuid }}</td>
<td>{{ giveaway.game_key }}</td>
<td>{{ giveaway.winner_dc_id or 'Not Assigned' }}</td>
<td>{{ giveaway.winner_dc_id }}</td>
<td>{{ 'Yes' if giveaway.aktiv else 'No' }}</td>
<td>
{% if giveaway.aktiv %}
<span class="badge badge-success">Active</span>
{% else %}
<span class="badge badge-danger">Inactive</span>
{% endif %}
</td>
<td>
<a href="{{ url_for('edit_giveaway', giveaway_id=giveaway.id) }}" class="btn btn-primary btn-sm">Edit</a>
<a href="{{ url_for('edit_giveaway', id=giveaway.id) }}" class="btn btn-sm btn-primary">Edit</a>
<form method="POST" action="{{ url_for('delete_giveaway', id=giveaway.id) }}" style="display: inline;">
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</form>
<form method="POST" action="{{ url_for('toggle_active', id=giveaway.id) }}" style="display: inline;">
<button type="submit" class="btn btn-sm {{ 'btn-success' if not giveaway.aktiv else 'btn-warning' }}">
{{ 'Activate' if not giveaway.aktiv else 'Deactivate' }}
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>