diff --git a/app/Http/Controllers/JournalDateController.php b/app/Http/Controllers/JournalDateController.php new file mode 100644 index 0000000..0b89140 --- /dev/null +++ b/app/Http/Controllers/JournalDateController.php @@ -0,0 +1,21 @@ +route('journal-entries.show'); + } + +} diff --git a/app/Http/Controllers/JournalEntryController.php b/app/Http/Controllers/JournalEntryController.php index f1692fe..7e296fe 100644 --- a/app/Http/Controllers/JournalEntryController.php +++ b/app/Http/Controllers/JournalEntryController.php @@ -8,6 +8,7 @@ namespace App\Http\Controllers; use App\Http\Requests\StoreFromNutrientsJournalEntryRequest; use App\Http\Requests\StoreJournalEntryRequest; use App\Models\Food; +use App\Models\Goal; use App\Models\JournalEntry; use App\Models\Recipe; use App\Support\ArrayFormat; @@ -53,11 +54,20 @@ class JournalEntryController extends Controller } } + // Get all goals as options to change for the date. + $goalOptions = Goal::whereUserId(Auth::user()->id) + ->orderBy('name') + ->get() + ->map(function (Goal $goal) { + return ['value' => $goal->id, 'label' => $goal->name]; + }); + return view('journal-entries.index') ->with('entries', $entries) ->with('sums', $sums) - ->with('goal', $goal) + ->with('currentGoal', $goal) ->with('goalProgress', $goalProgress) + ->with('goalOptions', $goalOptions) ->with('date', $date); } diff --git a/resources/views/journal-entries/index.blade.php b/resources/views/journal-entries/index.blade.php index 8a8d893..10dcc43 100644 --- a/resources/views/journal-entries/index.blade.php +++ b/resources/views/journal-entries/index.blade.php @@ -100,14 +100,25 @@