feat: unified Catalog page with Location→Category→Subcategory→Product tree

- New /catalog page with tree view: Location (🌍) → Category (📂) → Subcategory (📁) → Product
- Add/delete locations, categories, subcategories, products from one page
- JS-powered subcategory dropdown filtered by category
- Sticky sidebar with Add Location/Category/Product forms
- Responsive grid layout (tree + forms side by side, stacks on mobile)
- Navigation simplified: Catalog replaces separate Locations/Categories/Products
- Old routes still accessible for backward compatibility
- Subcategories table migration (006_subcategories.js)
- subcategory_id column added to products table
- Seed data includes subcategories (VPN, Accounts, Hardware, etc.)
This commit is contained in:
NW
2026-06-22 21:12:05 +01:00
parent 2012435370
commit c7bf3f132c
17 changed files with 693 additions and 69 deletions

View File

@@ -230,10 +230,98 @@ pre { font-size: 0.8rem; white-space: pre-wrap; word-break: break-all; max-width
.seed-card h2 { margin-bottom: 0.5rem; }
.seed-card p { margin-bottom: 1rem; color: var(--muted); }
.catalog-grid {
display: grid;
grid-template-columns: 1fr 360px;
gap: 1.5rem;
align-items: start;
}
@media (max-width: 900px) {
.catalog-grid { grid-template-columns: 1fr; }
}
.catalog-tree h2 { margin-bottom: 0.75rem; }
.catalog-forms { position: sticky; top: 1rem; }
.tree-node { margin-left: 0; }
.tree-location > .tree-children { margin-left: 0; }
.tree-children {
margin-left: 1.5rem;
border-left: 2px solid var(--border);
padding-left: 0.75rem;
}
.tree-label {
display: flex;
align-items: center;
gap: 0.4rem;
padding: 0.35rem 0;
flex-wrap: wrap;
}
.tree-label strong { font-size: 0.95rem; }
.tree-icon { font-size: 1rem; }
.tree-meta {
font-size: 0.78rem;
color: var(--muted);
margin-left: 0.25rem;
}
.tree-empty {
font-size: 0.85rem;
color: var(--muted);
margin: 0.3rem 0;
padding-left: 1.5rem;
}
.tree-product {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.3rem 0;
margin-left: 1.5rem;
border-left: none;
}
.tree-product .tree-name { font-weight: 500; font-size: 0.9rem; }
.tree-add {
margin: 0.3rem 0 0.3rem 1.5rem;
}
.tree-location {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 0.75rem 1rem;
margin-bottom: 0.75rem;
}
.tree-location > .tree-children { margin-left: 0; border-left: none; padding-left: 0; }
.tree-node:not(.tree-location) .tree-children {
margin-left: 1rem;
border-left: 2px solid var(--border);
padding-left: 0.5rem;
}
.form-row {
display: flex;
gap: 0.5rem;
}
.form-row input { flex: 1; }
@media (max-width: 640px) {
.topnav { flex-direction: column; align-items: flex-start; }
.logout-btn { margin-left: 0; }
.stats-grid { grid-template-columns: 1fr 1fr; }
table { font-size: 0.8rem; }
th, td { padding: 0.4rem; }
.catalog-grid { grid-template-columns: 1fr; }
}