From 856bfb39b90fd8f62da299cd45cfb3fddba0544c Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Wed, 20 Jan 2021 06:07:34 -0800 Subject: [PATCH] Refactor ingredients for ingredient add (WIP) Currently non-functional as the livewire component does not work inside an Alpine template. --- resources/views/recipes/edit.blade.php | 74 ++++++++++++++------------ 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/resources/views/recipes/edit.blade.php b/resources/views/recipes/edit.blade.php index 9651fc5..d0b8a3f 100644 --- a/resources/views/recipes/edit.blade.php +++ b/resources/views/recipes/edit.blade.php @@ -63,39 +63,47 @@

Ingredients

- @for($i = 0; $i < 20; $i++) - @php - if (isset($recipe->foodAmounts[$i])) { - $foodAmount = $recipe->foodAmounts[$i]; - $amount = \App\Support\Number::fractionStringFromFloat($foodAmount->amount); - $unit = $foodAmount->unit; - $food_id = $foodAmount->food->id; - $food_name = $foodAmount->food->name; - $detail = $foodAmount->detail; - } else { - $foodAmount = new \App\Models\FoodAmount(); - $amount = $food_id = $food_name = $unit = $detail = null; - } - @endphp -
- - - - - - -
- @endfor +
+ @foreach($recipe->foodAmounts as $foodAmount) +
+ + + + + + +
+ @endforeach + + + Add Ingredient + +

Steps