Panly API docsstaging

Screens / Item editor

Item editor

Create or edit a menu item, its recipe and image. Materials can link an existing recipe from the recipe picker (linked as is, no recipe write) or open the recipe editor. Saving runs item_commit: ingredient, recipe, then the item, and retires an unused recipe unless it may be shared. Opened from the slim Items list (PAN-58), a tracked item whose recipe is not loaded yet shows a skeleton and blocks Save until recipes and ingredients arrive, so it can never be saved as Not tracked; opened by link (item not in the list's snapshot) it loads the whole catalogue. "In stock now" shows stock below zero in red (PAN-62). For a This-item ingredient whose minimum the API reports, "Restock to (optional)" sits under "Low-stock alert at" (PAN-67): prefilled from par_quantity, checked while typing ("Must be at least the minimum."), and sent as par_quantity with min_quantity (empty clears it). A 422 on par_quantity or min_quantity shows on that field in the app's own words. Units come from a fixed list (PAN-95): an existing ingredient's unit is locked once the API says unit_locked, and a legacy ingredient whose unit is not on the list shows a one-time "Choose a unit" prompt. Ingredient lines in the recipe have a unit selector limited to the ingredient's family, defaulting to its stock unit; a "Converted to 0,25 kg" line shows under it, and `unit` is sent only when it differs from the stock unit. Unit errors (422 validation_failed on quantity, unit_family_mismatch) are worded by code, not from the server text. New category (PAN-128): a 409 category_exists is not an error; the editor uses `existing` from the body (or re-reads the categories) and shows an inline hint that the category already exists.

App routes
/items/new /items/:id
Access
items.manage
Screen code
lib/screens/items/item_editor_page.dart
lib/screens/items/item_editor_controller.dart
lib/domain/catalog/item_commit.dart
lib/screens/items/item_recipe_field.dart
lib/screens/recipes/widgets/recipe_picker_sheet.dart
lib/screens/items/widgets/restock_to_field.dart
lib/domain/stock/restock_rules.dart
lib/screens/items/widgets/unit_legacy_prompt.dart
lib/widget/common/unit_picker.dart
lib/widget/common/locked_unit_row.dart
lib/widget/common/unit_error_text.dart
lib/screens/items/widgets/category_exists_hint.dart
Source
elmermj/panly-app @ pre-staging-test (72aaffd)

API calls (19)

CallWhy the screen makes itWhere in the app code
GET /v1/menus
List menus
Every menu (category), all pages, limit 100: with the lookups for a tracked item, or the full load lib/screens/items/item_editor_controller.dart:166
lib/data/catalog/catalog_remote.dart:73
lib/screens/items/item_editor_controller.dart:185
lib/data/catalog/catalog_remote.dart:33
GET /v1/menu-items
List menu items
Every menu item, all pages: only the full load, when the item was opened by link lib/screens/items/item_editor_controller.dart:185
lib/data/catalog/catalog_remote.dart:34
GET /v1/recipes
List recipes
Every recipe, all pages: for a tracked item whose recipe the list did not hand over, or the full load lib/screens/items/item_editor_controller.dart:166
lib/data/catalog/catalog_remote.dart:74
lib/screens/items/item_editor_controller.dart:185
lib/data/catalog/catalog_remote.dart:35
GET /v1/ingredients
List ingredients
Every ingredient, all pages: for a tracked item's stock card (tracking mode, Can make, cost), or the full load; par_quantity prefills Restock to lib/screens/items/item_editor_controller.dart:166
lib/data/catalog/catalog_remote.dart:75
lib/screens/items/item_editor_controller.dart:185
lib/data/catalog/catalog_remote.dart:36
GET /v1/me
Get the signed-in account, its role here and the current merchant
Storage usage for the image cap: with the lookups, or the full load lib/screens/items/item_editor_controller.dart:166
lib/data/catalog/catalog_remote.dart:102
lib/screens/items/item_editor_controller.dart:185
lib/data/catalog/catalog_remote.dart:39
GET /v1/recipes
List recipes
Recipe picker (q, cursor, pages) lib/screens/items/item_recipe_field.dart:200
lib/screens/recipes/widgets/recipe_picker_controller.dart:64
lib/data/repositories/recipe_repository.dart:19
GET /v1/ingredients/{ingredientId}
Get ingredient
Unit and stock for a linked recipe's ingredients not in the catalogue snapshot lib/screens/items/item_editor_controller.dart:289
lib/screens/items/item_editor_controller.dart:332
lib/domain/usecases/recipes/recipe_usecase.dart:41
lib/data/repositories/recipe_repository.dart:54
POST /v1/ingredients
Create ingredient
Create the item's ingredient (with min_quantity and par_quantity for a This-item ingredient), or a new ingredient from the picker lib/screens/items/item_editor_controller.dart:443
lib/domain/catalog/item_commit.dart:129
lib/screens/items/item_editor_controller.dart:776
lib/data/catalog/catalog_remote.dart:132
PATCH /v1/ingredients/{ingredientId}
Update ingredient name, unit, low-stock minimum or restock target
Update the item's ingredient: name, unit, and min_quantity with par_quantity (null clears it) lib/domain/catalog/item_commit.dart:138
lib/data/catalog/catalog_remote.dart:149
POST /v1/recipes
Create recipe with ingredient lines
Create the recipe lib/domain/catalog/item_commit.dart:154
lib/domain/catalog/item_commit.dart:175
lib/data/catalog/catalog_remote.dart:153
PUT /v1/recipes/{recipeId}
Replace recipe (name and ingredient lines)
Replace the recipe lib/domain/catalog/item_commit.dart:178
lib/data/catalog/catalog_remote.dart:158
POST /v1/menu-items
Create menu item
Create the menu item lib/domain/catalog/item_commit.dart:196
lib/data/catalog/catalog_remote.dart:166
PATCH /v1/menu-items/{menuItemId}
Update menu item
Update the menu item lib/domain/catalog/item_commit.dart:199
lib/data/catalog/catalog_remote.dart:171
DELETE /v1/recipes/{recipeId}
Delete recipe (menu items keep existing, recipe unlinked)
Delete the recipe the item no longer uses lib/domain/catalog/item_commit.dart:204
lib/data/catalog/catalog_remote.dart:162
POST /v1/menus
Create menu
Create a menu (category) inline lib/screens/items/item_editor_controller.dart:708
lib/data/catalog/catalog_remote.dart:111
lib/data/catalog/catalog_remote.dart:279
POST /v1/menu-items/{menuItemId}/image/upload-url
Request presigned upload URL for menu item image
Get a presigned R2 PUT URL lib/screens/items/item_editor_controller.dart:609
lib/data/catalog/catalog_remote.dart:185
POST /v1/menu-items/{menuItemId}/image/confirm
Confirm uploaded menu item image
Confirm the uploaded object
Between upload-url and confirm the app PUTs the bytes straight to the presigned R2 URL (item_editor_controller.dart:572, catalog_remote.dart:183). That request is not an API call.
lib/screens/items/item_editor_controller.dart:624
lib/data/catalog/catalog_remote.dart:216
DELETE /v1/menu-items/{menuItemId}/image
Remove menu item image
Remove the image lib/screens/items/item_editor_controller.dart:660
lib/data/catalog/catalog_remote.dart:220
DELETE /v1/menu-items/{menuItemId}
Delete menu item (also deletes its image object); 409 if ordered
Delete the item lib/screens/items/item_editor_controller.dart:762
lib/data/catalog/catalog_remote.dart:176

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.