fix(admin): delete feedback alerts + informative block errors (issue #127)

- locations/categories GET pass req.query.error/success to views
- locations/categories EJS render dismissible error/success alerts (modeled on catalog.ejs)
- Delete errors include blocking counts + 'Remove X first' hints
- 🔒 lock hint on rows with linked categories/products/subcategories
- 18 new tests (adminDeleteFeedback.test.js); 48 total pass
This commit is contained in:
NW
2026-08-04 17:05:06 +01:00
parent bd3391c111
commit 88a15acb29
6 changed files with 238 additions and 10 deletions

View File

@@ -1,3 +1,15 @@
<% if (error) { %>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<%= error %>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<% } %>
<% if (success) { %>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<%= success %>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<% } %>
<a href="/catalog" class="btn btn-sm btn-outline-secondary mb-2">« Back to Catalog</a>
<div class="panel panel-icon mb-3">
<div class="panel-hdr">
@@ -71,6 +83,9 @@
<input type="hidden" name="_csrf" value="<%= csrfToken %>">
<button class="btn btn-sm btn-danger">Delete</button>
</form>
<% if (l.category_count > 0 || l.product_count > 0) { %>
<span class="text-warning" title="Blocks deletion">🔒</span>
<% } %>
</td>
</tr>
<% }); %>