Skip to content

Add item quantity tracking with increment/decrement #3

@akifbayram

Description

@akifbayram

Problem

Items are currently plain strings with no quantity information. Users tracking consumables (screws, batteries, envelopes) have to manually edit the item name to include counts (e.g., "AA Batteries (12)"), which is fragile and unsearchable.

Proposed Solution

Upgrade items from string[] to a structured format supporting optional quantities.

Data Model

Items in the bins.items JSON column change from:

["Screwdriver", "AA Batteries", "Tape"]

to:

[
  { "name": "Screwdriver" },
  { "name": "AA Batteries", "qty": 12 },
  { "name": "Tape" }
]
  • qty is optional — items without it display as before (no "×1")
  • Quantities are positive integers (min 1 when set)

Migration

  • Server migration converts existing string[] items to { name: string }[] on startup
  • Backward-compatible: API accepts both formats during transition, normalizes on write

UI/UX

Bin Detail Page — Items List

  • Each item row: [name] [qty badge] [+] [-] [×]
  • Qty badge: pill showing count (e.g., ×12), only visible when qty is set
  • + / - buttons: increment/decrement with optimistic UI
  • Decrementing to 0 prompts: "Remove item or set to 1?"
  • Tapping the qty badge opens an inline number input for direct editing
  • Items without qty show a subtle + Add qty link on hover/tap

Items Page (/items)

  • Show quantity next to item name: "AA Batteries ×12 — in Toolbox"
  • Total quantity across bins if same item name appears in multiple bins

Quick-Add

  • Support natural language: "12 AA Batteries" → { name: "AA Batteries", qty: 12 }
  • AI extraction already structured — extend prompt to output qty field

Scope

  • No unit tracking (pieces vs kg) in v1 — just integer counts
  • No low-stock alerts in v1
  • Export/import updated to handle structured items (backward-compatible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions