diff --git a/controllers/RecipesController.php b/controllers/RecipesController.php index 8f992492..4b975d2f 100644 --- a/controllers/RecipesController.php +++ b/controllers/RecipesController.php @@ -30,13 +30,13 @@ class RecipesController extends BaseController foreach ($recipes as $recipe) { $selectedRecipe = $recipe; - $selectedRecipePositions = $this->Database->recipes_pos()->where('recipe_id', $recipe->id); + $selectedRecipePositions = $this->Database->recipes_pos()->where('recipe_id', $recipe->id)->orderBy('ingredient_group'); break; } } $selectedRecipeSubRecipes = $this->Database->recipes()->where('id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved WHERE recipe_id = :1 AND includes_recipe_id != :1)', $selectedRecipe->id)->orderBy('name')->fetchAll(); - $selectedRecipeSubRecipesPositions = $this->Database->recipes_pos()->where('recipe_id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved WHERE recipe_id = :1 AND includes_recipe_id != :1)', $selectedRecipe->id)->fetchAll(); + $selectedRecipeSubRecipesPositions = $this->Database->recipes_pos()->where('recipe_id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved WHERE recipe_id = :1 AND includes_recipe_id != :1)', $selectedRecipe->id)->orderBy('ingredient_group')->fetchAll(); return $this->AppContainer->view->render($response, 'recipes', [ 'recipes' => $recipes, diff --git a/migrations/0043.sql b/migrations/0043.sql index 14af620b..691e9f0b 100644 --- a/migrations/0043.sql +++ b/migrations/0043.sql @@ -38,3 +38,6 @@ LEFT JOIN recipes_nestings_resolved rnr LEFT JOIN recipes_fulfillment rf ON rnr.includes_recipe_id = rf.recipe_id GROUP BY r.id; + +ALTER TABLE recipes_pos +ADD ingredient_group TEXT; diff --git a/views/recipeposform.blade.php b/views/recipeposform.blade.php index 7b5e6e72..574f51fe 100644 --- a/views/recipeposform.blade.php +++ b/views/recipeposform.blade.php @@ -68,6 +68,11 @@ +
+ + +
+
diff --git a/views/recipes.blade.php b/views/recipes.blade.php index 32837d7b..e671be2c 100644 --- a/views/recipes.blade.php +++ b/views/recipes.blade.php @@ -101,7 +101,11 @@
{{ $L('Ingredients') }}
@endif