Add Restocking tab with budget-driven recommendations#116
Open
rbreitz wants to merge 4 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
architecture.htmloverview of the system, tech stack, and data flow.Commits
How it works
Backend — three new endpoints in
server/main.py:GET /api/restocking/recommendations?budget=N— priority 1: items wherequantity_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 insubmitted_orders(in-memory list inserver/mock_data.py, resets on backend restart). Computesexpected_deliveryfrom 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.vuegains a "Submitted Restocking Orders" section above All Orders.Test plan
server/(uv run python main.py), hitGET /api/restocking/recommendations?budget=100000— expect 4 items (TMP-201, PSU-508, SRV-301, SRV-302) totaling ~$86,525.POST /api/restocking/submitwith the recommendations — expectRST-YYYYMMDD-HHMMSSorder number,expected_delivery= today + max line-item lead time.GET /api/restocking/submittedreturns the submitted order./restockingpage loads, slider changes update recommendations (debounced), Place Order shows success card./ordersshows "Submitted Restocking Orders" section with the order; section is hidden when there are no submitted orders./orders— submitted list resets (in-memory only, expected for the demo).