Skip to content

Add Restocking tab with budget-driven recommendations#116

Open
rbreitz wants to merge 4 commits into
beck-source:mainfrom
rbreitz:new_feature
Open

Add Restocking tab with budget-driven recommendations#116
rbreitz wants to merge 4 commits into
beck-source:mainfrom
rbreitz:new_feature

Conversation

@rbreitz
Copy link
Copy Markdown

@rbreitz rbreitz commented May 28, 2026

Summary

  • New Restocking tab: budget slider drives recommendations from inventory + demand forecasts, with a Place Order button that submits an in-memory order.
  • Orders tab gains a Submitted Restocking Orders section showing order number, items, lead time, and expected delivery.
  • New architecture.html overview of the system, tech stack, and data flow.
  • CLAUDE.md: added code-style rule to document non-obvious logic with comments.

Commits

  1. Add code style rule: document non-obvious logic with comments
  2. Add architecture overview page
  3. Add restocking backend: recommendations, submit, submitted list
  4. Add restocking frontend: budget-driven recommendations and submission

How it works

Backend — three new endpoints in server/main.py:

  • GET /api/restocking/recommendations?budget=N — priority 1: items where quantity_on_hand < reorder_point (qty = 2 * reorder_point - on_hand); priority 2: items with demand trend = increasing (qty = forecasted_demand * 0.3). Greedy-fills within the budget. Items are matched between inventory and demand forecasts by name (case-insensitive) because the two JSON files use different SKU schemes.
  • POST /api/restocking/submit — stores order in submitted_orders (in-memory list in server/mock_data.py, resets on backend restart). Computes expected_delivery from the max per-category lead time (Circuit Boards 14d, Sensors 7d, Actuators 10d, Controllers 12d, Power Supplies 9d).
  • GET /api/restocking/submitted — returns submitted orders, newest first.

Frontend — new client/src/views/Restocking.vue: $0–$100K budget slider, 300ms debounce, 3 summary cards (items / total cost / budget remaining), recommendations table with Below-reorder / Trend-up badges, then Place Order → success card with order number, expected delivery, and lead time. Orders.vue gains a "Submitted Restocking Orders" section above All Orders.

Test plan

  • Backend: start server/ (uv run python main.py), hit GET /api/restocking/recommendations?budget=100000 — expect 4 items (TMP-201, PSU-508, SRV-301, SRV-302) totaling ~$86,525.
  • Backend: POST /api/restocking/submit with the recommendations — expect RST-YYYYMMDD-HHMMSS order number, expected_delivery = today + max line-item lead time.
  • Backend: GET /api/restocking/submitted returns the submitted order.
  • Frontend: /restocking page loads, slider changes update recommendations (debounced), Place Order shows success card.
  • Frontend: /orders shows "Submitted Restocking Orders" section with the order; section is hidden when there are no submitted orders.
  • Restart backend, refresh /orders — submitted list resets (in-memory only, expected for the demo).

Rebecca Reitz and others added 4 commits May 28, 2026 18:48
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Self-contained HTML page documenting tech stack, system architecture,
data flow, API endpoints, and views. Matches existing slate/gray design
system.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three endpoints powering the new restocking flow:
- GET /api/restocking/recommendations?budget=N — items below reorder
  point first, then trend-up items; greedy-fills within budget.
- POST /api/restocking/submit — stores order in memory, computes
  expected delivery from per-category lead times.
- GET /api/restocking/submitted — returns submitted orders, newest first.

Recommendations match inventory to demand forecasts by item name
(case-insensitive) because the two data files use different SKU
schemes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New Restocking view with a budget slider ($0-$100K, debounced),
recommendations table with reorder-point and trend-up reasoning, and a
Place Order flow that hands off to the existing Orders tab.

Orders tab gains a Submitted Restocking Orders section showing order
number, items, lead time, and expected delivery — appears only when
there are submitted orders.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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