mirror of https://github.com/kcal-app/kcal.git
Check for NULL before fraction conversion
This commit is contained in:
parent
63f22274a5
commit
f3f2dd8b6f
|
|
@ -67,6 +67,13 @@
|
||||||
|
|
||||||
<div class="flex items-center space-x-4">
|
<div class="flex items-center space-x-4">
|
||||||
<!-- Serving size -->
|
<!-- Serving size -->
|
||||||
|
@php
|
||||||
|
if (!empty($food->serving_size)) {
|
||||||
|
$old_value = \App\Support\Number::fractionStringFromFloat($food->serving_size);
|
||||||
|
} else {
|
||||||
|
$old_value = null;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
<div>
|
<div>
|
||||||
<x-inputs.label for="serving_size" :value="__('Serving size')"/>
|
<x-inputs.label for="serving_size" :value="__('Serving size')"/>
|
||||||
|
|
||||||
|
|
@ -75,7 +82,7 @@
|
||||||
type="text"
|
type="text"
|
||||||
name="serving_size"
|
name="serving_size"
|
||||||
size="10"
|
size="10"
|
||||||
:value="old('serving_size', \App\Support\Number::fractionStringFromFloat($food->serving_size))"/>
|
:value="old('serving_size', $old_value)"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Serving unit -->
|
<!-- Serving unit -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue