diff --git a/app/Http/Controllers/JournalEntryController.php b/app/Http/Controllers/JournalEntryController.php
index e3dcfae..ddbb443 100644
--- a/app/Http/Controllers/JournalEntryController.php
+++ b/app/Http/Controllers/JournalEntryController.php
@@ -34,15 +34,15 @@ class JournalEntryController extends Controller
'user_id' => Auth::user()->id,
'date' => $date,
])->get())
- ->with('date', Carbon::createFromFormat('Y-m-d', $date))
- ->with('nutrients', ['calories', 'fat', 'cholesterol', 'carbohydrates', 'sodium', 'protein']);
+ ->with('date', Carbon::createFromFormat('Y-m-d', $date));
}
/**
* Show the form for creating a new resource.
*/
- public function create(): View
+ public function create(Request $request): View
{
+ $date = $request->date ?? Carbon::now()->toDateString();
$ingredients = [];
if ($old = old('ingredients')) {
foreach ($old['amount'] as $key => $amount) {
@@ -77,7 +77,8 @@ class JournalEntryController extends Controller
['value' => 'oz', 'label' => 'oz'],
['value' => 'g', 'label' => 'grams'],
['value' => 'servings', 'label' => 'servings'],
- ]);
+ ])
+ ->with('default_date', Carbon::createFromFormat('Y-m-d', $date));
}
/**
diff --git a/resources/views/components/ingredient-picker.blade.php b/resources/views/components/ingredient-picker.blade.php
index a8c703d..8638e5c 100644
--- a/resources/views/components/ingredient-picker.blade.php
+++ b/resources/views/components/ingredient-picker.blade.php
@@ -25,7 +25,8 @@
+ x-bind:data-name="result.name"
+ x-bind:data-detail="result.detail">
@@ -77,7 +78,7 @@
if (selected.dataset.id) {
this.$refs.ingredients.value = selected.dataset.id;
this.$refs.ingredients_type.value = selected.dataset.type;
- this.$refs.ingredients_name.value = selected.dataset.name;
+ this.$refs.ingredients_name.value = `${selected.dataset.name}, ${selected.dataset.detail}`;
this.searching = false;
}
}
diff --git a/resources/views/components/search-view.blade.php b/resources/views/components/search-view.blade.php
index 9c42cb2..d9d50b0 100644
--- a/resources/views/components/search-view.blade.php
+++ b/resources/views/components/search-view.blade.php
@@ -5,7 +5,7 @@
autocomplete="off"
class="w-full mb-4"
@input.debounce.400ms="search($event)" />
-
+
{{ $results }}
exists)@method('put')@endif
@csrf
-
+
-
+
-
+
-
+
-
+
@php
if (!empty($food->serving_size)) {
@@ -62,7 +62,7 @@
@@ -85,7 +86,7 @@
-
+
@foreach ($nutrients as $nutrient)
@@ -102,7 +103,7 @@
:value="ucfirst($nutrient) . ' (g)'"/>
- Foods
+
diff --git a/resources/views/journal-entries/create.blade.php b/resources/views/journal-entries/create.blade.php
index 85e5020..c2d340b 100644
--- a/resources/views/journal-entries/create.blade.php
+++ b/resources/views/journal-entries/create.blade.php
@@ -22,7 +22,7 @@
@include('journal-entries.partials.entry-item-input', $ingredient)
@endforeach
- @include('journal-entries.partials.entry-item-input')
+ @include('journal-entries.partials.entry-item-input', ['default_date' => $default_date])
diff --git a/resources/views/journal-entries/index.blade.php b/resources/views/journal-entries/index.blade.php
index ffe2656..c9ffa86 100644
--- a/resources/views/journal-entries/index.blade.php
+++ b/resources/views/journal-entries/index.blade.php
@@ -1,6 +1,17 @@
- {{ Auth::user()->name }}'s Journal
+
+
+ {{ Auth::user()->name }}'s Journal
+
{{ $date->format('D, j M Y') }}
+
+
+
+ New Entry
+
+
@@ -37,7 +48,7 @@
{{ Str::ucfirst($meal) }}
- @foreach($nutrients as $nutrient)
+ @foreach(\App\Support\Nutrients::$all as $nutrient)
{{ round($entries->where('meal', $meal)->sum($nutrient), 2) }}g
{{ $nutrient }}@if(!$loop->last), @endif
@endforeach
@@ -57,7 +68,7 @@
nutrients:
- @foreach($nutrients as $nutrient)
+ @foreach(\App\Support\Nutrients::$all as $nutrient)
{{ round($entry->{$nutrient}, 2) }}g
{{ $nutrient }}@if(!$loop->last), @endif
@endforeach
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 76371b9..1ee9541 100644
--- a/resources/views/journal-entries/partials/entry-item-input.blade.php
+++ b/resources/views/journal-entries/partials/entry-item-input.blade.php
@@ -4,7 +4,7 @@
diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php
index 3b67f39..380d6b4 100644
--- a/resources/views/layouts/navigation.blade.php
+++ b/resources/views/layouts/navigation.blade.php
@@ -9,70 +9,10 @@
-
-
-
-
-
-
-
-
-
- View Journal
- Add Entries
- Add Nutrient Entry
-
-
-
-
-
-
-
-
-
-
-
-
- Add Recipe
- List Recipes
-
-
-
-
-
-
-
-
-
-
-
-
- Add Food
- List Foods
-
-
+
+ Journal
+ Recipes
+ Foods
diff --git a/resources/views/recipes/edit.blade.php b/resources/views/recipes/edit.blade.php
index c4af530..3acb360 100644
--- a/resources/views/recipes/edit.blade.php
+++ b/resources/views/recipes/edit.blade.php
@@ -12,35 +12,33 @@