diff --git a/.idea/trwl.iml b/.idea/trwl.iml index 767a03049..d2eeaea44 100644 --- a/.idea/trwl.iml +++ b/.idea/trwl.iml @@ -5,7 +5,6 @@ - diff --git a/app/Http/Controllers/API/v1/TripController.php b/app/Http/Controllers/API/v1/TripController.php index da7b5eba0..389db6bd1 100644 --- a/app/Http/Controllers/API/v1/TripController.php +++ b/app/Http/Controllers/API/v1/TripController.php @@ -30,7 +30,7 @@ class TripController extends Controller * -> later solve the problem for non-existing stations */ public function createTrip(Request $request): TripResource { - if (!auth()->user()?->hasRole('closed-beta')) { + if (!auth()->user()?->can('create-manual-trip')) { abort(403, 'this endpoint is currently only available for beta users'); } diff --git a/resources/js/app.js b/resources/js/app.js index 68e785007..e271050f5 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,8 +1,8 @@ /** * Here, we include all of our external dependencies */ -import { Notyf } from "notyf"; -import { createApp } from "vue"; +import {Notyf} from "notyf"; +import {createApp} from "vue"; import NotificationBell from "../vue/components/NotificationBell.vue"; import ActiveJourneyMap from "../vue/components/ActiveJourneyMap.vue"; import Stationboard from "../vue/components/Stationboard.vue"; @@ -15,10 +15,11 @@ import "./components/maps"; import CheckinSuccessHelper from "../vue/components/CheckinSuccessHelper.vue"; import {i18nVue} from "laravel-vue-i18n"; import TagHelper from "../vue/components/TagHelper.vue"; +import TripCreationForm from "../vue/components/TripCreation/TripCreationForm.vue"; window.notyf = new Notyf({ duration: 5000, - position: { x: "right", y: window.innerWidth > 480 ? "top" : "bottom" }, + position: {x: "right", y: window.innerWidth > 480 ? "top" : "bottom"}, dismissible: true, ripple: true, types: [ @@ -43,11 +44,11 @@ window.notyf = new Notyf({ ], }); -document.addEventListener("DOMContentLoaded", function() { +document.addEventListener("DOMContentLoaded", function () { // get language query parameter let fallbackLang = "en"; - const urlParams = new URLSearchParams(window.location.search); - const lang = urlParams.get("language"); + const urlParams = new URLSearchParams(window.location.search); + const lang = urlParams.get("language"); if (lang && lang.startsWith("de_")) { fallbackLang = "de"; @@ -95,7 +96,9 @@ document.addEventListener("DOMContentLoaded", function() { }); app5.mount("#tag-helper"); - + const app6 = createApp({}); + app6.component("TripCreationForm", TripCreationForm); + app6.mount("#trip-creation-form"); }); /** diff --git a/resources/views/admin/trip/create.blade.php b/resources/views/admin/trip/create.blade.php index da67a3868..a54a7492c 100644 --- a/resources/views/admin/trip/create.blade.php +++ b/resources/views/admin/trip/create.blade.php @@ -3,15 +3,6 @@ @section('title', 'Create new trip manually') @section('content') - -
- This form is currently for testing purposes only. - Admins can create a trip with manually entered data. - 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. -
-
diff --git a/resources/views/closed-beta/trip-creation.blade.php b/resources/views/closed-beta/trip-creation.blade.php new file mode 100644 index 000000000..08fe81ac8 --- /dev/null +++ b/resources/views/closed-beta/trip-creation.blade.php @@ -0,0 +1,11 @@ +@extends('layouts.app') + +@section('title', 'Create trip manually') + +@section('content') +
+
+ +
+
+@endsection diff --git a/resources/vue/components/TripCreation/TripCreationForm.vue b/resources/vue/components/TripCreation/TripCreationForm.vue index 9b47ff875..abab9368e 100644 --- a/resources/vue/components/TripCreation/TripCreationForm.vue +++ b/resources/vue/components/TripCreation/TripCreationForm.vue @@ -1,6 +1,5 @@