Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion resources/tailwind-app/pages/Trip/TripCreation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,11 @@ function submit(): void {

api.trips
.createTrip(formData)
.then((response) => {
.then(async (response) => {
const result = response.data?.data;
if (result.uuid) {
await router.replace({ name: 'trip-edit', params: { uuid: result.uuid } });
}
router.push({
name: 'line-run',
query: {
Expand Down
19 changes: 18 additions & 1 deletion resources/tailwind-app/pages/Trip/TripEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { trans } from 'laravel-vue-i18n';
import { DateTime } from 'luxon';
import { Notyf } from 'notyf';
import { computed, inject, ref } from 'vue';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import { Api, HafasTravelType, StationResource, TripResource } from '../../../types/Api.gen';
import StationAutocomplete from '../../components/StationAutocomplete.vue';
import StopoverEditor from '../../components/Trip/StopoverEditor.vue';
Expand All @@ -27,6 +27,7 @@ import AppLayout from '../../layouts/AppLayout.vue';
const api = new Api({ baseUrl: window.location.origin + '/api' });
const notyf = inject('notyf') as Notyf;
const route = useRoute();
const router = useRouter();

const tripUuid = computed(() => route.params.uuid as string);

Expand Down Expand Up @@ -160,6 +161,19 @@ async function addStopover(): Promise<void> {
}
}

function checkIn(): void {
if (!trip.value) return;
router.push({
name: 'line-run',
query: {
tripId: trip.value.tripId,
lineName: trip.value.lineName,
category: trip.value.category,
direction: trip.value.destination?.name,
},
});
}

fetchTrip(true);
</script>

Expand All @@ -171,6 +185,9 @@ fetchTrip(true);
</router-link>
<h1 class="text-2xl font-bold">{{ trans('trip.edit.title') }}</h1>
<span v-if="refreshing && trip" class="loading loading-spinner loading-xs opacity-50" />
<button v-if="trip" type="button" class="btn btn-primary btn-sm ml-auto" @click="checkIn">
{{ trans('stationboard.btn-checkin') }}
</button>
</div>

<div v-if="notFound" role="alert" class="alert alert-error">
Expand Down
Loading