Skip to content

feat: add item quantity support#66

Closed
akifbayram wants to merge 15 commits intomainfrom
feat/item-quantity
Closed

feat: add item quantity support#66
akifbayram wants to merge 15 commits intomainfrom
feat/item-quantity

Conversation

@akifbayram
Copy link
Owner

Summary

  • Adds a quantity column to the bin_items table, enabling users to track how many of each item they have in a bin
  • Full-stack implementation: schema migration, API endpoints (POST/PUT/PATCH for items with quantity), export/import support, and AI integration (suggestions, commands, text structuring all handle quantities)
  • UI updates: inline editable quantity fields on items, quantity support in create/edit forms, bulk add, quick add, and AI suggestion panels
  • New item list print mode with configurable options (group by bin, show quantities, show notes) and dedicated print stylesheet
  • Fixes double-tap-to-edit issue on touch devices

Test plan

  • Verify adding items with quantities via bin create and edit forms
  • Verify inline quantity editing in item list (view mode)
  • Verify PATCH /api/bins/:id/items/:itemId/quantity endpoint
  • Verify quantities preserved through export/import cycle
  • Verify AI suggestions include quantity values
  • Verify AI commands (add/remove items) handle quantities
  • Verify item list print mode renders correctly
  • Run cd server && npx vitest run — server tests pass (including new binItems tests)
  • Run npx vitest run — client tests pass

- Add quantity INTEGER DEFAULT NULL to bin_items table
- Include quantity in BIN_SELECT_COLS json_object
- Add quantity: number | null to BinItem TypeScript interface
- Update POST handler to parse quantity from item objects
- Add quantity to inner SELECT in BIN_SELECT_COLS subquery
- Add ALTER TABLE migration for existing databases
- Add test for adding items with quantity
- Add updateItemQuantity client function and update renameItem signature
- Add quantity stepper (−/+) in view mode, qty input in edit mode
- Show ×quantity in read-only item list
- Confirm dialog when decrementing to zero
- Fix BinItem type references in BinCreateForm and tests
Unify quantity editing across view and edit modes using simple text
inputs instead of +/− stepper buttons. Quantities now flow through
the edit form state and are persisted via the update API as item
objects with { name, quantity }. Server replaceBinItems also preserves
quantity when receiving object-shaped items.
…eference

Update all user-facing and API documentation to reflect the new optional
quantity field on bin items, including the new PATCH quantity endpoint,
mixed string/object item format, AI quantity extraction, export format
changes, and MCP tool descriptions.
…ents

Wire quantity field through AI context, schemas, providers, command
parsing/execution, text structuring, batch routes, and all related
UI components (suggestions panel, bulk add, quick add, bin create/edit).
Extract shared quantity helpers into src/lib/itemQuantities.ts.
Use onTouchEnd to trigger item editing immediately on first tap,
bypassing the sticky :hover state that caused a layout shift and
required a second tap. Also narrow transition-all to transition-opacity
on the delete button to prevent subtle height changes on hover.
Introduce a Labels/Item List toggle on the print page. When "Item List"
is selected, bins render as a tabular item sheet (with optional
checkboxes and quantities) instead of QR labels. PDF download is hidden
in item-list mode. Print mode persists via localStorage and can be
pre-selected with ?mode=items URL param.
@akifbayram akifbayram closed this Mar 7, 2026
@akifbayram akifbayram deleted the feat/item-quantity branch March 7, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant