Screens / Shopping list
Shopping list
Stock at or under its minimum plus anything that ran out (status=restock, PAN-61), opened from the Stock page. Rows are grouped by last_supplier (A-Z, "No supplier" last; Out before Low, then by name) and show the Low/Out level, stock and minimum. The suggested amount is par_quantity (Restock to) minus stock, or the minimum minus stock when there is no target (negative stock adds up); it can be changed per row. Ticks and changed amounts are kept on the device per business (with the last loaded rows, so the list still shows offline; Receive is off then). Share and copy: the text is "Shopping list · <business>", the date, then every row in list order (checked or not) as "- Name: amount unit" under its supplier header (headers left out when no supplier is known). On a phone, Share opens the OS share sheet, anchored to the Share button's position (the iPad popover needs a non-empty origin, so a 1x1 fallback is used before layout; PAN-69), and falls back to copying where there is none; the desktop has Copy list in the header and a Text for WhatsApp preview with Copy in the side pane. Copying shows "List copied. Paste it in WhatsApp." Neither makes an API call. "Receive N into stock" opens a sheet with one block per supplier (amount prefilled, total cost typed, one date) and books each block as one stock-in. Empty state: "Nothing to buy". Add item (PAN-74/PAN-76, one sheet) searches stock and sets an ingredient's Low-stock minimum and Restock to; the API has no shopping-list write, so adding means setting that alert. Rows open the same levels sheet. The page needs `shopping.manage`.
- App routes
/stock/shopping-list- Access
- shopping.manage
- Screen code
lib/screens/shopping_list/shopping_list_page.dartlib/screens/shopping_list/shopping_list_controller.dartlib/screens/shopping_list/shopping_list_bindings.dartlib/screens/shopping_list/widgets/shopping_receive_sheet.dartlib/screens/shopping_list/widgets/shopping_action_bar.dartlib/domain/stock/shopping_list_rules.dartlib/data/stock/shopping_list_store.dartlib/core/utils/text_share.dartlib/screens/shopping_list/widgets/shopping_add_sheet.dartlib/screens/shopping_list/widgets/shopping_levels_sheet.dart- Source
- elmermj/panly-app @ pre-staging-test (72aaffd)
API calls (5)
| Call | Why the screen makes it | Where in the app code |
|---|---|---|
GET /v1/ingredientsList ingredients |
Every page of status=restock, limit 100 (low and out together). Reads par_quantity for the suggested amount, last_supplier for the groups, min_quantity and stock_quantity for the level | lib/screens/shopping_list/shopping_list_controller.dart:146lib/screens/shopping_list/shopping_list_controller.dart:158lib/data/repositories/stock_repository.dart:39lib/data/stock/stock_remote.dart:39 |
GET /v1/expense-categoriesList expense categories |
When Receive opens (once per visit): the first cost-of-goods category books the stock-ins; with none, Receive stays closed with "Add a cost-of-goods expense category before receiving stock." | lib/screens/shopping_list/shopping_list_page.dart:143lib/screens/shopping_list/shopping_list_controller.dart:272lib/data/repositories/stock_repository.dart:100lib/data/stock/stock_remote.dart:77 |
POST /v1/expensesCreate expense (ingredient lines auto-add stock) |
Receive into stock: one stock-in per supplier block (ingredient_lines, supplier, note "From shopping list", incurred_on from the sheet), one after another Not idempotent, so the app never retries by itself: it stops at the first failed block and a second try sends only the blocks that did not save. A 422 on ingredient_lines[i].quantity, .line_cost or supplier marks that field. Received rows lose their ticks and the list reloads. |
lib/screens/shopping_list/widgets/shopping_receive_sheet.dart:100lib/screens/shopping_list/shopping_list_controller.dart:315lib/data/repositories/stock_repository.dart:111lib/data/stock/stock_remote.dart:114 |
GET /v1/ingredientsList ingredients |
Add item sheet: stock search (`q`, first 100) with what is in stock and each alert on every row | lib/screens/shopping_list/widgets/shopping_add_sheet.dart:77lib/screens/shopping_list/shopping_list_controller.dart:383lib/data/repositories/stock_repository.dart:32lib/data/stock/stock_remote.dart:39 |
PATCH /v1/ingredients/{ingredientId}Update ingredient name, unit, low-stock minimum or restock target |
Save the levels sheet or Add item: only the changed min_quantity (Low-stock minimum) and par_quantity (Restock to); the name goes as it is and the unit is never sent (PAN-95). The list reloads afterwards | lib/screens/shopping_list/widgets/shopping_levels_sheet.dart:197lib/screens/shopping_list/shopping_list_controller.dart:397lib/data/repositories/stock_repository.dart:62lib/data/repositories/catalog_repository.dart:73lib/data/catalog/catalog_remote.dart:149 |
Each call links to its operation in the API reference. Code locations are file:line in panly-app at 72aaffd, listed from the screen down to the line that sends the request.