diff --git a/app/Http/Controllers/JournalEntryController.php b/app/Http/Controllers/JournalEntryController.php index ddbb443..59b5d1a 100644 --- a/app/Http/Controllers/JournalEntryController.php +++ b/app/Http/Controllers/JournalEntryController.php @@ -76,7 +76,7 @@ class JournalEntryController extends Controller ['value' => 'cup', 'label' => 'cup'], ['value' => 'oz', 'label' => 'oz'], ['value' => 'g', 'label' => 'grams'], - ['value' => 'servings', 'label' => 'servings'], + ['value' => 'serving', 'label' => 'servings'], ]) ->with('default_date', Carbon::createFromFormat('Y-m-d', $date)); } @@ -94,7 +94,7 @@ class JournalEntryController extends Controller ['value' => 'cup', 'label' => 'cup'], ['value' => 'oz', 'label' => 'oz'], ['value' => 'g', 'label' => 'grams'], - ['value' => 'servings', 'label' => 'servings'], + ['value' => 'serving', 'label' => 'servings'], ]); } @@ -111,7 +111,7 @@ class JournalEntryController extends Controller 'ingredients.amount' => ['required', 'array', new ArrayNotEmpty], 'ingredients.amount.*' => ['required_with:ingredients.id.*', 'nullable', new StringIsDecimalOrFraction], 'ingredients.unit' => ['required', 'array'], - 'ingredients.unit.*' => ['nullable', 'string'], + 'ingredients.unit.*' => ['required_with:ingredients.id.*'], 'ingredients.id' => ['required', 'array', new ArrayNotEmpty], 'ingredients.id.*' => 'required_with:ingredients.amount.*|nullable', 'ingredients.type' => ['required', 'array', new ArrayNotEmpty], diff --git a/app/Http/Controllers/RecipeController.php b/app/Http/Controllers/RecipeController.php index 9b16bb0..fca807a 100644 --- a/app/Http/Controllers/RecipeController.php +++ b/app/Http/Controllers/RecipeController.php @@ -133,7 +133,8 @@ class RecipeController extends Controller ['value' => 'tbsp', 'label' => 'tbsp.'], ['value' => 'cup', 'label' => 'cup'], ['value' => 'oz', 'label' => 'oz'], - ['value' => 'grams', 'label' => 'g'], + ['value' => 'g', 'label' => 'grams'], + ['value' => 'serving', 'label' => 'servings'], ])); } @@ -157,7 +158,7 @@ class RecipeController extends Controller 'ingredients.amount' => ['required', 'array', new ArrayNotEmpty], 'ingredients.amount.*' => ['required_with:ingredients.id.*', 'nullable', new StringIsDecimalOrFraction], 'ingredients.unit' => ['required', 'array'], - 'ingredients.unit.*' => 'nullable|string', + 'ingredients.unit.*' => ['required_with:ingredients.id.*'], 'ingredients.detail' => ['required', 'array'], 'ingredients.detail.*' => 'nullable|string', 'ingredients.id' => ['required', 'array', new ArrayNotEmpty], diff --git a/resources/views/journal-entries/partials/entry-item-input.blade.php b/resources/views/journal-entries/partials/entry-item-input.blade.php index 447f4e4..819dd28 100644 --- a/resources/views/journal-entries/partials/entry-item-input.blade.php +++ b/resources/views/journal-entries/partials/entry-item-input.blade.php @@ -41,7 +41,7 @@ class="block w-full" :options="$units" :selectedValue="$unit ?? null"> - + diff --git a/resources/views/recipes/partials/ingredient-input.blade.php b/resources/views/recipes/partials/ingredient-input.blade.php index dc4627f..d77f797 100644 --- a/resources/views/recipes/partials/ingredient-input.blade.php +++ b/resources/views/recipes/partials/ingredient-input.blade.php @@ -12,7 +12,7 @@ class="block" :options="$ingredients_units" :selectedValue="$unit ?? null"> - +