diff --git a/app/Http/Controllers/FrontendTransportController.php b/app/Http/Controllers/FrontendTransportController.php index 0b6b06b6f..97562b619 100644 --- a/app/Http/Controllers/FrontendTransportController.php +++ b/app/Http/Controllers/FrontendTransportController.php @@ -5,7 +5,9 @@ use App\DataProviders\Hafas; use App\Exceptions\HafasException; use App\Http\Controllers\TransportController as TransportBackend; +use App\Models\Trip; use Illuminate\Http\JsonResponse; +use Illuminate\View\View; /** * @deprecated Content will be moved to the backend/frontend/API packages soon, please don't add new functions here! @@ -22,4 +24,10 @@ public function TrainAutocomplete(string $station): JsonResponse { abort(503, $e->getMessage()); } } + + public function getTrip(int $tripId): View { + return view('trip-info', [ + 'trip' => Trip::findOrFail($tripId) + ]); + } } diff --git a/lang/de.json b/lang/de.json index 0fbf5fe5e..f5f665a01 100644 --- a/lang/de.json +++ b/lang/de.json @@ -819,5 +819,14 @@ "welcome.stats.million": "Millionen", "welcome.stats.distance": "kilometer gereist", "welcome.stats.registered": "Registrierte user", - "welcome.stats.duration": "Jahre Reisezeit" + "welcome.stats.duration": "Jahre Reisezeit", + "trip-info.title": ":linename am :date", + "trip-info.stopovers": "Zwischenhalte", + "trip-info.stopover": "Zwischenhalt", + "trip-info.departure": "Abfahrt", + "trip-info.arrival": "Ankunft", + "trip-info.in-this-connection": "In dieser Verbindung", + "trip-info.user": "User", + "trip-info.origin": "Abfahrtsort", + "trip-info.destination": "Zielort" } diff --git a/lang/en.json b/lang/en.json index f1ff57fb2..26f7da0ba 100644 --- a/lang/en.json +++ b/lang/en.json @@ -819,5 +819,14 @@ "welcome.stats.million": "Million", "welcome.stats.distance": "kilometers travelled", "welcome.stats.registered": "users registered", - "welcome.stats.duration": "years travel time" + "welcome.stats.duration": "years travel time", + "trip-info.title": ":linename at :date", + "trip-info.stopovers": "Stopovers", + "trip-info.stopover": "Stopover", + "trip-info.departure": "Departure", + "trip-info.arrival": "Arrival", + "trip-info.in-this-connection": "In this connection", + "trip-info.user": "User", + "trip-info.origin": "Origin", + "trip-info.destination": "Destination" } diff --git a/resources/views/trip-info.blade.php b/resources/views/trip-info.blade.php new file mode 100644 index 000000000..a9f9816d0 --- /dev/null +++ b/resources/views/trip-info.blade.php @@ -0,0 +1,75 @@ +@extends('layouts.app') + +@section('title', __('trip-info.title', ['linename' => $trip->linename, 'date' => $trip->departure->format('d.m.Y')])) + +@section('content') +
+
+
+

{{__('trip-info.title', ['linename' => $trip->linename, 'date' => $trip->departure->format('d.m.Y')])}}

+ +
+ Diese Seite gehört zu den experimentellen Features von Träwelling. + Daher sieht sie auch nicht schön aus, zeigt nur generische Infos und ist nirgends verlinkt. + Du kannst sie gerne verbessern und einen PullRequest schicken. +
+
+ +
+

{{__('trip-info.stopovers')}}

+ + + + + + + + + + + @foreach($trip->stopovers as $stopover) + + + + + + @endforeach + +
{{__('trip-info.stopover')}}{{__('trip-info.arrival')}}{{__('trip-info.departure')}}
{{$stopover->station->name}}{{$stopover->arrival->format('H:i')}}{{$stopover->departure->format('H:i')}}
+
+ +
+

{{__('trip-info.in-this-connection')}}

+ + + + + + + + + + @foreach($trip->checkins as $checkin) + @can('view', $checkin->status) + + + + + + @endcan + @endforeach + +
{{__('trip-info.user')}}{{__('trip-info.origin')}}{{__('trip-info.destination')}}
+ + {{$checkin->user->name}} + {{$checkin->user->name}} + + {{$checkin->originStopover->station->name}}{{$checkin->destinationStopover->station->name}}
+
+
+
+ +@endsection diff --git a/routes/web.php b/routes/web.php index 6b59c0ec5..9cba54ba4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -85,6 +85,9 @@ ->whereNumber('id') ->name('status'); +Route::get('/trip/{id}', [FrontendTransportController::class, 'getTrip']) + ->whereNumber('id'); + /** * These routes can be used by logged in users although they have not signed the privacy policy yet. */