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.dartlib/screens/items/item_editor_controller.dartlib/domain/catalog/item_commit.dartlib/screens/items/item_recipe_field.dartlib/screens/recipes/widgets/recipe_picker_sheet.dartlib/screens/items/widgets/restock_to_field.dartlib/domain/stock/restock_rules.dartlib/screens/items/widgets/unit_legacy_prompt.dartlib/widget/common/unit_picker.dartlib/widget/common/locked_unit_row.dartlib/widget/common/unit_error_text.dartlib/screens/items/widgets/category_exists_hint.dart- Source
- elmermj/panly-app @ pre-staging-test (72aaffd)
API calls (19)
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.