init
This commit is contained in:
38
app/templates/admin/categories.html
Normal file
38
app/templates/admin/categories.html
Normal file
@@ -0,0 +1,38 @@
|
||||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block title %}Manage Categories - Digital Garage Sale{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Manage Categories</h2>
|
||||
|
||||
<a href="{{ url_for('admin.add_category') }}" class="btn btn-primary" style="margin-bottom: 1rem;">Add New Category</a>
|
||||
|
||||
<table style="width: 100%; border-collapse: collapse; margin-top: 1rem;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="border: 1px solid #ddd; padding: 0.5rem; text-align: left;">ID</th>
|
||||
<th style="border: 1px solid #ddd; padding: 0.5rem; text-align: left;">Name</th>
|
||||
<th style="border: 1px solid #ddd; padding: 0.5rem; text-align: left;">Items Count</th>
|
||||
<th style="border: 1px solid #ddd; padding: 0.5rem; text-align: left;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for category in categories %}
|
||||
<tr>
|
||||
<td style="border: 1px solid #ddd; padding: 0.5rem;">{{ category.id }}</td>
|
||||
<td style="border: 1px solid #ddd; padding: 0.5rem;">{{ category.name }}</td>
|
||||
<td style="border: 1px solid #ddd; padding: 0.5rem;">{{ category.items.count() }}</td>
|
||||
<td style="border: 1px solid #ddd; padding: 0.5rem;">
|
||||
<form method="post" action="{{ url_for('admin.delete_category', id=category.id) }}" style="display: inline;" onsubmit="return confirm('Are you sure you want to delete this category? All items in this category will also be deleted.');">
|
||||
<button type="submit" class="btn btn-danger">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" style="border: 1px solid #ddd; padding: 0.5rem; text-align: center;">No categories found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user