Panly API docsstaging

Screens / Recipe editor

Recipe editor

Create, edit or delete a recipe and its ingredient lines. /recipes/new needs `items.manage`; /recipes/:id opens with `items.view` and is read-only without `items.manage`. Each line uses the unit and stock_quantity the recipe returns (PAN-56), so there is no request per ingredient; stock below zero shows in red (PAN-62). Lines have a unit selector (PAN-95) limited to the ingredient's family; the line shows the amount as entered (250 g) and the converted amount under it, and `unit` is sent only when it differs from the stock unit. The ingredient picker reads GET /v1/ingredients, which needs `stock.view` (PAN-88). The "shared by N items" note comes from used_by_items.

App routes
/recipes/new /recipes/:id
Access
items.manage (new), items.view (open)
Screen code
lib/screens/recipes/recipe_editor_page.dart
lib/screens/recipes/recipe_editor_controller.dart
lib/screens/recipes/recipe_editor_lines.dart
lib/screens/recipes/widgets/add_ingredient_sheet.dart
lib/screens/recipes/widgets/ingredient_picker_controller.dart
lib/screens/recipes/widgets/recipe_line_quantity.dart
lib/widget/common/line_unit.dart
lib/widget/common/unit_picker.dart
Source
elmermj/panly-app @ pre-staging-test (72aaffd)

API calls (6)

CallWhy the screen makes itWhere in the app code
GET /v1/recipes/{recipeId}
Get recipe
Load the recipe: lines carry the ingredient's unit and stock_quantity, and used_by_items drives the shared note lib/screens/recipes/recipe_editor_controller.dart:177
lib/data/repositories/recipe_repository.dart:22
GET /v1/ingredients
List ingredients
Add-ingredient picker (q, cursor, pages) lib/screens/recipes/recipe_editor_lines.dart:268
lib/screens/recipes/widgets/ingredient_picker_controller.dart:98
lib/data/repositories/recipe_repository.dart:49
POST /v1/ingredients
Create ingredient
Create a new ingredient from the picker lib/screens/recipes/widgets/ingredient_picker_controller.dart:148
lib/data/repositories/recipe_repository.dart:58
POST /v1/recipes
Create recipe with ingredient lines
Create the recipe lib/screens/recipes/recipe_editor_controller.dart:294
lib/data/repositories/recipe_repository.dart:26
PUT /v1/recipes/{recipeId}
Replace recipe (name and ingredient lines)
Replace the name and every line lib/screens/recipes/recipe_editor_controller.dart:295
lib/data/repositories/recipe_repository.dart:36
DELETE /v1/recipes/{recipeId}
Delete recipe (menu items keep existing, recipe unlinked)
Delete the recipe (the server unlinks its items) lib/screens/recipes/recipe_editor_controller.dart:316
lib/data/repositories/recipe_repository.dart:44

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.