Add bin types: reusable named dimension presets for bins

Bin types store a name, physical W×H in mm, and optional description.
When editing a bin, a type can be selected from a dropdown; this
pre-fills and locks the dimension inputs. Custom dimensions remain
available when no type is selected.

- lib/storage.mjs: bin type CRUD with bt: prefix
- server.mjs: /api/bin-types CRUD routes; type_id accepted on bin
  create/update routes; DELETE protected if any bin references the type;
  type dims copied onto bin when type_id is set
- public/lib/api.mjs: bin type wrappers; rename_bin → update_bin (accepts
  any fields)
- public/templates.html: Types tab in bins section; t-bin-type-row;
  t-dialog-bin-type; type selector in bin editor dialog
- public/app.mjs: all_bin_types state loaded at startup; render_bin_types_list();
  open_bin_type_dialog(); type selector in open_bin_editor(); /bins/types routing
- public/style.css: bin types list styles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-03 03:04:04 +00:00
parent 320c6f1bd9
commit 090f6f3154
6 changed files with 318 additions and 35 deletions

View File

@@ -1993,3 +1993,43 @@ nav {
border-radius: 4px;
max-width: 100%;
}
.bin-types-list {
display: flex;
flex-direction: column;
}
.bin-type-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem 0;
border-bottom: 1px solid var(--border);
gap: 1rem;
}
.bin-type-info {
display: flex;
align-items: baseline;
gap: 0.75rem;
flex: 1;
min-width: 0;
}
.bin-type-name {
font-weight: 500;
}
.bin-type-dims {
font-size: 0.8rem;
color: var(--text-muted);
flex-shrink: 0;
}
.bin-type-desc {
font-size: 0.8rem;
color: var(--text-faint);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}