Add budget-constrained restocking with submitted order tracking - #235
Open
andercsantos wants to merge 3 commits into
Open
Add budget-constrained restocking with submitted order tracking#235andercsantos wants to merge 3 commits into
andercsantos wants to merge 3 commits into
Conversation
Adds a Restocking page that recommends which below-reorder-point items to replenish within an available budget, and surfaces submitted restock orders on the Orders page. - Restocking view + useRestocking composable: budget slider ($5K-$250K), greedy allocation by priority, and an explicit "excluded, over budget" table so skipped items are visible rather than silently dropped - GET/POST /api/restock-orders; POST recomputes the basket total server-side so the budget check cannot be bypassed by a tampered request - Order ETA uses the longest lead time in the basket, since an order is only complete once its slowest line arrives - lead_time_days added to InventoryItem (defaults to 14 when absent) and populated across inventory.json - Submitted restock orders section on Orders, fetched in parallel with the filtered order list; restock orders take no filter params - en/ja locale strings; 16 backend tests covering budget, validation, and lead-time math Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
getChangePercent already returns a signed string, so the literal "+" in the template rendered "++50.0%". The stable and decreasing cards omit the literal "+", which is why only the increasing card was affected. Co-Authored-By: Claude Opus 5 (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
Adds a Restocking page that recommends which below-reorder-point items to replenish within an available budget, and surfaces submitted restock orders on the Orders page.
Changes
Frontend
Restocking.vueview +useRestocking.jscomposable — budget slider ($5K–$250K), greedy allocation by priority, and an explicit "excluded, over budget" table so skipped items stay visible rather than being silently droppedgetRestockOrders/createRestockOrderinapi.jsBackend
GET/POST /api/restock-orders. POST recomputes the basket total server-side, so the budget check can't be bypassed by a tampered requestlead_time_daysadded toInventoryItem(defaults to 14 when absent), populated acrossinventory.jsonAlso fixed
Demand.vuerendered++50.0%on the increasing-trend card —getChangePercentalready returns a signed string and the template added a second+. Separate commit.Testing
tests/backend/test_restocking.pycovering budget enforcement, item validation, and lead-time math+50.0%,+20.0%,+18.8%,-30.0%Note
The budget allocator is greedy by priority, so it can leave money unspent — a $50K budget allocates $49,472 while
PSU-505is excluded for being "over by $410". Reasonable for a demo, but worth flagging if backfilling cheaper items into the remainder is preferred.🤖 Generated with Claude Code