diff --git a/config/app.php b/config/app.php
index f8008d4..7cffa1e 100644
--- a/config/app.php
+++ b/config/app.php
@@ -58,7 +58,7 @@ return [
'asset_url' => env('ASSET_URL'),
- 'trip' => env('TRIP'),
+ 'current_trip_id' => env('CURRENT_TRIP_ID'),
/*
|--------------------------------------------------------------------------
diff --git a/resources/views/no-trip.blade.php b/resources/views/no-trip.blade.php
new file mode 100644
index 0000000..5894b6d
--- /dev/null
+++ b/resources/views/no-trip.blade.php
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ Tracking | Ben Goldsworthy
+
+
+
+
+
+
+
+
+
+ No Trip in Progress at the Moment
+ Past trips
+
+
+
+
+
diff --git a/resources/views/past-trip.blade.php b/resources/views/past-trip.blade.php
new file mode 100644
index 0000000..4c4b1a9
--- /dev/null
+++ b/resources/views/past-trip.blade.php
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+ Tracking | Ben Goldsworthy
+
+
+
+
+
+
+
+
+
+ Where in the World was Ben?
+ Current trip
+ Past trips
+
+ Tracking started: {{ date('j M Y (G:H)', strtotime($trip->date_start)) }} |
+ (Last update: {{ date('j M Y (G:H)', strtotime($trip->updated_at)) }})
+
+
+
+
+
+
+
+ @foreach(array_reverse($trip->checkins) as $checkin)
+@if($checkin->id != 2607)
+ -
+
+ {{ $checkin->title ?? "[No title]" }}
{{ date('j M Y (G:H)', strtotime($checkin->date)) }}
+ {{ $checkin->note ?? "[No note]" }}
+@if($checkin->image_url)
+
+@endif
+
+
+@endif
+ @endforeach
+
+
+
+
+
+
+
diff --git a/resources/views/past-trips.blade.php b/resources/views/past-trips.blade.php
new file mode 100644
index 0000000..de3d48f
--- /dev/null
+++ b/resources/views/past-trips.blade.php
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ Tracking | Ben Goldsworthy
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/views/tracker.blade.php b/resources/views/tracker.blade.php
index 1dc69d9..b615a85 100644
--- a/resources/views/tracker.blade.php
+++ b/resources/views/tracker.blade.php
@@ -19,6 +19,7 @@
Where in the World is Ben?
+ Past trips
Tracking started: {{ date('j M Y (G:H)', strtotime($trip->date_start)) }} |
{{ ($trip->is_active) ? "Active" : "Ended" }} |
@@ -38,7 +39,7 @@
{{ $checkin->title ?? "[No title]" }}
{{ date('j M Y (G:H)', strtotime($checkin->date)) }}
{{ $checkin->note ?? "[No note]" }}
@if($checkin->image_url)
-
+
@endif
@@ -66,6 +67,7 @@
var marker = null, popupMarkup = null;
@foreach($trip->checkins as $checkin)
+ @if($checkin->id != 2602)
marker = L.marker([{{ $checkin->location->latitude }}, {{ $checkin->location->longitude }}]).addTo(map);
popupMarkup = '
';
@@ -74,6 +76,7 @@
marker.bindPopup(popupMarkup).openPopup();
checkinMarkers[{{ $checkin->id }}] = marker;
+ @endif
@endforeach
var currLocation = L.marker(
diff --git a/routes/web.php b/routes/web.php
index f563875..eda0073 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -15,16 +15,40 @@ use GuzzleHttp\Client;
*/
Route::get('/', function () {
+ if (config('app.current_trip_id')) {
+ $client = new Client([
+ 'base_uri' => 'https://app.wayward.travel/',
+ 'timeout' => 3.0
+ ]);
+
+ $response = $client->get('trip/'.config('app.current_trip_id').'/user/zmld8ko6qy7d9j3xvq10/json');
+
+ if ($response->getStatusCode() == 200) {
+ $data = json_decode($response->getBody());
+ return view('tracker', ['trip' => $data->trip]);
+ } else {
+ return 'Something went wrong';
+ }
+ } else {
+ return view('no-trip');
+ }
+});
+
+Route::get('/past-trips', function () {
+ return view('past-trips');
+});
+
+Route::get('/past-trip/{tripId}', function ($tripId) {
$client = new Client([
'base_uri' => 'https://app.wayward.travel/',
'timeout' => 3.0
]);
- $response = $client->get('trip/'.config('app.trip').'/user/zmld8ko6qy7d9j3xvq10/json');
+ $response = $client->get('trip/'.$tripId.'/user/zmld8ko6qy7d9j3xvq10/json');
if ($response->getStatusCode() == 200) {
$data = json_decode($response->getBody());
- return view('tracker', ['trip' => $data->trip]);
+ return view('past-trip', ['trip' => $data->trip]);
} else {
return 'Something went wrong';
}