mirror of https://github.com/kcal-app/kcal.git
Support "servings" unit and require unit
This commit is contained in:
parent
0eae4af7d6
commit
fc4e7a5fb5
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
class="block w-full"
|
||||
:options="$units"
|
||||
:selectedValue="$unit ?? null">
|
||||
<option value=""></option>
|
||||
<option value="">Unit</option>
|
||||
</x-inputs.select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
class="block"
|
||||
:options="$ingredients_units"
|
||||
:selectedValue="$unit ?? null">
|
||||
<option value=""></option>
|
||||
<option value="" selected>Unit</option>
|
||||
</x-inputs.select>
|
||||
<div class="w-full">
|
||||
<x-ingredient-picker :default-id="$ingredient_id ?? null"
|
||||
|
|
|
|||
Loading…
Reference in New Issue