diff --git a/resources/views/tracker.blade.php b/resources/views/tracker.blade.php index d70a79b..673f7ba 100644 --- a/resources/views/tracker.blade.php +++ b/resources/views/tracker.blade.php @@ -20,6 +20,9 @@
Current location
').openPopup(); + /* + * Add all checkins link href. + */ + document.getElementById("allCheckinsLink").href = window.location.pathname + '/all'; + /* * Changes the currently-selected popup. */ diff --git a/routes/web.php b/routes/web.php index 1e7ff84..7e0b8f7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -19,7 +19,7 @@ Route::get('/past-trips', function () { return view('past-trips'); }); -Route::get('/{tripId?}', function ($tripId = null) { +Route::get('/{tripId?}/{showAll?}', function ($tripId = null, $showAll = false) { if (!$tripId && !config('app.current_trip_id')) return view('no-trip'); /* @@ -32,7 +32,7 @@ Route::get('/{tripId?}', function ($tripId = null) { $cachedDataUpdatedAt = new DateTime($cachedData->trip->updated_at); $now = new DateTime(); if (intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600) <= 5) { - return view('tracker', ['trip' => $cachedData->trip]); + return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($showAll === 'all')]); } } @@ -61,7 +61,7 @@ Route::get('/{tripId?}', function ($tripId = null) { } } - return view('tracker', ['trip' => $data->trip]); + return view('tracker', ['trip' => $data->trip, 'showAllCheckins' => ($showAll === 'all')]); } else { return 'Something went wrong'; }