From 3ccb58cf697aaaca5e7c409b0c18ff4cc256e7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Sun, 17 Mar 2024 13:37:18 +0100 Subject: [PATCH 1/5] :sparkles: move trip creation from closed to open beta see #2411 --- lang/de.json | 3 +- lang/en.json | 3 +- resources/views/admin/layout.blade.php | 4 -- resources/views/admin/trip/create.blade.php | 9 ----- resources/views/beta/trip-creation.blade.php | 18 +++++++++ .../views/closed-beta/trip-creation.blade.php | 11 ------ resources/views/stats/stats.blade.php | 37 ++++++++++++------- .../TripCreation/TripCreationForm.vue | 34 +++++++++++------ routes/web.php | 8 ++-- routes/web/admin.php | 3 -- 10 files changed, 72 insertions(+), 58 deletions(-) delete mode 100644 resources/views/admin/trip/create.blade.php create mode 100644 resources/views/beta/trip-creation.blade.php delete mode 100644 resources/views/closed-beta/trip-creation.blade.php diff --git a/lang/de.json b/lang/de.json index ff6bf8220..32f626834 100644 --- a/lang/de.json +++ b/lang/de.json @@ -758,5 +758,6 @@ "error.419": "Zeitüberschreitung", "error.429": "Zu viele Anfragen", "error.500": "Interner Serverfehler", - "support.rate_limit_exceeded": "Du hast vor kurzem bereits eine Support-Anfrage erstellt. Bitte warte noch etwas, bevor du eine weitere Anfrage erstellst." + "support.rate_limit_exceeded": "Du hast vor kurzem bereits eine Support-Anfrage erstellt. Bitte warte noch etwas, bevor du eine weitere Anfrage erstellst.", + "create-trip-manually": "Fahrt manuell erstellen" } diff --git a/lang/en.json b/lang/en.json index 00a541ee1..61fbeda89 100644 --- a/lang/en.json +++ b/lang/en.json @@ -758,5 +758,6 @@ "error.419": "Page Expired", "error.429": "Too Many Requests", "error.500": "Server Error", - "support.rate_limit_exceeded": "You have recently created a support request. Please wait a bit before creating another request." + "support.rate_limit_exceeded": "You have recently created a support request. Please wait a bit before creating another request.", + "create-trip-manually": "Create trip manually" } diff --git a/resources/views/admin/layout.blade.php b/resources/views/admin/layout.blade.php index 20046d61a..7d29debe4 100644 --- a/resources/views/admin/layout.blade.php +++ b/resources/views/admin/layout.blade.php @@ -58,10 +58,6 @@ class="brand-image me-3" style="width: 30px; opacity: 0.8"> Checkin - - - Trips - Stations diff --git a/resources/views/admin/trip/create.blade.php b/resources/views/admin/trip/create.blade.php deleted file mode 100644 index a54a7492c..000000000 --- a/resources/views/admin/trip/create.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('admin.layout') - -@section('title', 'Create new trip manually') - -@section('content') -
- -
-@endsection diff --git a/resources/views/beta/trip-creation.blade.php b/resources/views/beta/trip-creation.blade.php new file mode 100644 index 000000000..c4363070d --- /dev/null +++ b/resources/views/beta/trip-creation.blade.php @@ -0,0 +1,18 @@ +@extends('layouts.app') + +@section('title', 'Create trip manually') + +@section('content') +
+
+ @if(app()->getLocale() !== 'en') + + @endif + + +
+
+@endsection diff --git a/resources/views/closed-beta/trip-creation.blade.php b/resources/views/closed-beta/trip-creation.blade.php deleted file mode 100644 index 08fe81ac8..000000000 --- a/resources/views/closed-beta/trip-creation.blade.php +++ /dev/null @@ -1,11 +0,0 @@ -@extends('layouts.app') - -@section('title', 'Create trip manually') - -@section('content') -
-
- -
-
-@endsection diff --git a/resources/views/stats/stats.blade.php b/resources/views/stats/stats.blade.php index e387c7b3c..ba6661d20 100644 --- a/resources/views/stats/stats.blade.php +++ b/resources/views/stats/stats.blade.php @@ -35,23 +35,32 @@
@include('stats.includes.global_cards') -

- {{__('experimental-features')}} -

-
+ @endif
diff --git a/resources/vue/components/TripCreation/TripCreationForm.vue b/resources/vue/components/TripCreation/TripCreationForm.vue index 725293ad9..669197e38 100644 --- a/resources/vue/components/TripCreation/TripCreationForm.vue +++ b/resources/vue/components/TripCreation/TripCreationForm.vue @@ -97,7 +97,7 @@ export default { window.location.href = `/trains/trip/?${new URLSearchParams(query).toString()}`; }); } - if(data.status === 422) { + if (data.status === 422) { data.json().then((result) => { alert(result.message); }); @@ -121,20 +121,24 @@ export default {

- Create trip manually (closed-beta) + Create trip manually

- Beta users only + Beta

- This form is currently for testing purposes only. - Beta users can create a trip with manually entered data. - All Users can check in to this trip. - It should be tested if the trip is created correctly and all data required for the trip is present, so no - (500) errors occur or if features are missing which are not mentioned in the limitations section. + Please note, that the creation of trips is currently in beta. + You can create trips manually by entering the stations and times. + There are some limitations, which are listed below. +
+ If you encounter any issues, please report them to us. + + Report issue + +
@@ -166,7 +170,8 @@ export default {
- +
    -
  • Only stations available in DB-HAFAS are supported
  • -
  • Stopovers can't be created yet
  • -
  • Polyline is generated straight from origin to destination (Brouter generation will apply if the difference between air distance and distance by train isn't too big)
  • +
  • Only stations available in the time table of DB Navigator are supported
  • +
  • + The map lines are generated straight from the given stations + (we try to find a route via Brouter, but this can be result in wrong data) +
  • +
  • The trip is generally created public - so if you checkin to a trip, everyone who can see your status can ride with you.
  • +
  • The operator can't be set in this form (possible via API)
  • +
  • There are no visible error messages for this form. So, if nothing happens on submit... sorry. There is an error.
diff --git a/routes/web.php b/routes/web.php index ab7e46fd0..83cd26558 100644 --- a/routes/web.php +++ b/routes/web.php @@ -123,9 +123,11 @@ * All of these routes can only be used by fully registered users. */ Route::middleware(['auth', 'privacy'])->group(function() { - Route::view('/beta/trip-creation', 'closed-beta.trip-creation') - ->can('create-manual-trip') - ->name('beta.trip-creation'); + + Route::redirect('/beta/trip-creation', '/trip/create'); //TODO: remove after 2024-06 + Route::view('/trip/create', 'beta.trip-creation') + ->middleware(['can:create-manual-trip']) + ->name('trip.create'); Route::post('/ics/createToken', [IcsController::class, 'createIcsToken']) ->name('ics.createToken'); //TODO: Replace with API Endpoint diff --git a/routes/web/admin.php b/routes/web/admin.php index 7ac6d1345..161f81c93 100644 --- a/routes/web/admin.php +++ b/routes/web/admin.php @@ -43,9 +43,6 @@ }); Route::prefix('trip')->group(function() { - Route::view('/create', 'admin.trip.create') - ->name('admin.trip.create'); - Route::get('/{id}', [TripController::class, 'renderTrip']) ->name('admin.trip.show'); }); From 3639758e0f5756217d11f3084f317751fb365739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Tue, 2 Apr 2024 14:20:23 +0200 Subject: [PATCH 2/5] move permission --- database/seeders/Constants/PermissionSeeder.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/database/seeders/Constants/PermissionSeeder.php b/database/seeders/Constants/PermissionSeeder.php index ab2076f9e..5ec2a1a57 100644 --- a/database/seeders/Constants/PermissionSeeder.php +++ b/database/seeders/Constants/PermissionSeeder.php @@ -56,7 +56,10 @@ public function run(): void { $roleEventModerator->givePermissionTo($permissionDenyEvents); $roleEventModerator->givePermissionTo($permissionUpdateEvents); + //Assign permissions to closed-beta role + $roleClosedBeta->revokePermissionTo($permissionCreateManualTrip); //now in open-beta + //Assign permissions to open-beta role - $roleClosedBeta->givePermissionTo($permissionCreateManualTrip); + $roleOpenBeta->givePermissionTo($permissionCreateManualTrip); } } From 639fd4dc3344394531c9244b29d8209207b2f2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Tue, 2 Apr 2024 14:30:49 +0200 Subject: [PATCH 3/5] add button --- lang/de.json | 3 ++- lang/en.json | 3 ++- resources/views/stationboard.blade.php | 16 +++++++++++++++- resources/views/stats/stats.blade.php | 7 ------- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lang/de.json b/lang/de.json index 3205a61f8..c41bb014a 100644 --- a/lang/de.json +++ b/lang/de.json @@ -759,5 +759,6 @@ "error.429": "Zu viele Anfragen", "error.500": "Interner Serverfehler", "support.rate_limit_exceeded": "Du hast vor kurzem bereits eine Support-Anfrage erstellt. Bitte warte noch etwas, bevor du eine weitere Anfrage erstellst.", - "create-trip-manually": "Fahrt manuell erstellen" + "missing-journey": "Ist deine Fahrt nicht dabei?", + "create-journey": "Fahrt erstellen" } diff --git a/lang/en.json b/lang/en.json index b6eb46058..3f37faa9b 100644 --- a/lang/en.json +++ b/lang/en.json @@ -759,5 +759,6 @@ "error.429": "Too many requests", "error.500": "Server error", "support.rate_limit_exceeded": "You have recently created a support request. Please wait a bit before creating another request.", - "create-trip-manually": "Create trip manually" + "missing-journey": "Haven't found your Journey?", + "create-journey": "Create journey" } diff --git a/resources/views/stationboard.blade.php b/resources/views/stationboard.blade.php index cac6ba1e5..40f96cb5d 100644 --- a/resources/views/stationboard.blade.php +++ b/resources/views/stationboard.blade.php @@ -10,8 +10,22 @@ + + +
+
+

+ Beta + {{__('missing-journey')}} +

+ + + {{__('create-journey')}} + +
+ @else @include('includes.station-autocomplete')
diff --git a/resources/views/stats/stats.blade.php b/resources/views/stats/stats.blade.php index ba6661d20..48fbae446 100644 --- a/resources/views/stats/stats.blade.php +++ b/resources/views/stats/stats.blade.php @@ -52,13 +52,6 @@ {{__('stats.daily.description')}} - @can('create-manual-trip') -
  • - - {{__('create-trip-manually')}} - -
  • - @endcan @endif
    From 34992dab859eaa9fd2fd3b21dee5263960616b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Tue, 2 Apr 2024 14:32:02 +0200 Subject: [PATCH 4/5] no message --- resources/views/stationboard.blade.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/views/stationboard.blade.php b/resources/views/stationboard.blade.php index 40f96cb5d..b0e88dbf9 100644 --- a/resources/views/stationboard.blade.php +++ b/resources/views/stationboard.blade.php @@ -13,7 +13,6 @@ station-id="{{$station->id}}" @endisset> -

    @@ -25,7 +24,6 @@ {{__('create-journey')}}

    - @else @include('includes.station-autocomplete')
    From 3c678a9539838df9f73fab4338f46efec1d5bd39 Mon Sep 17 00:00:00 2001 From: Levin Herr Date: Fri, 5 Apr 2024 15:20:24 +0200 Subject: [PATCH 5/5] Update database/seeders/Constants/PermissionSeeder.php --- database/seeders/Constants/PermissionSeeder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/seeders/Constants/PermissionSeeder.php b/database/seeders/Constants/PermissionSeeder.php index 5ec2a1a57..12fd0aa0b 100644 --- a/database/seeders/Constants/PermissionSeeder.php +++ b/database/seeders/Constants/PermissionSeeder.php @@ -56,7 +56,7 @@ public function run(): void { $roleEventModerator->givePermissionTo($permissionDenyEvents); $roleEventModerator->givePermissionTo($permissionUpdateEvents); - //Assign permissions to closed-beta role + //Revoke permissions from closed-beta role $roleClosedBeta->revokePermissionTo($permissionCreateManualTrip); //now in open-beta //Assign permissions to open-beta role