Skip to content

Commit

Permalink
✨ Use new interface for ride along (#2710)
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrLevin authored Jun 26, 2024
1 parent 464082b commit f8179f5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 21 deletions.
47 changes: 32 additions & 15 deletions resources/views/includes/status.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use App\Http\Controllers\Backend\Helper\StatusHelper;use App\Http\Controllers\Backend\Transport\StationController;
use App\Http\Controllers\Backend\Transport\StatusController;use App\Http\Controllers\Backend\User\ProfilePictureController;use Illuminate\Support\Facades\Gate;
@endphp
@php /** @var App\Models\Status $status */ @endphp
<div class="card status mb-3" id="status-{{ $status->id }}"
data-trwl-id="{{$status->id}}"
data-date="{{userTime($status->checkin->departure, __('dateformat.with-weekday'))}}"
Expand Down Expand Up @@ -237,21 +238,37 @@ class="like {{ auth()->user() && $status->likes->where('user_id', auth()->user()
</li>
@else
<li>
<button type="button" class="dropdown-item join"
data-trwl-linename="{{$status->checkin->trip->linename}}"
data-trwl-stop-name="{{$status->checkin->destinationStopover->station->name}}"
data-trwl-trip-id="{{$status->checkin->trip_id}}"
data-trwl-destination="{{$status->checkin->destination}}"
data-trwl-arrival="{{$status->checkin->arrival}}"
data-trwl-start="{{$status->checkin->origin}}"
data-trwl-departure="{{$status->checkin->departure}}"
data-trwl-event-id="{{$status->event?->id}}"
>
<div class="dropdown-icon-suspense">
<i class="fas fa-user-plus" aria-hidden="true"></i>
</div>
{{__('status.join')}}
</button>
@if(auth()->check() && auth()->user()->hasRole('open-beta'))
<a href="{{ route('stationboard', [
'tripId' => $status->checkin->trip->id,
'lineName' => $status->checkin->trip->linename,
'start' => $status->checkin->originStopover->station->id,
'destination' => $status->checkin->destinationStopover->station->id,
'departure' => $status->checkin->originStopover->departure_planned->toIso8601String(),
'idType' => 'trwl'
]) }}" class="dropdown-item">
<div class="dropdown-icon-suspense">
<i class="fas fa-user-plus" aria-hidden="true"></i>
</div>
{{__('status.join')}}
</a>
@else
<button type="button" class="dropdown-item join"
data-trwl-linename="{{$status->checkin->trip->linename}}"
data-trwl-stop-name="{{$status->checkin->destinationStopover->station->name}}"
data-trwl-trip-id="{{$status->checkin->trip_id}}"
data-trwl-destination="{{$status->checkin->destination}}"
data-trwl-arrival="{{$status->checkin->arrival}}"
data-trwl-start="{{$status->checkin->origin}}"
data-trwl-departure="{{$status->checkin->departure}}"
data-trwl-event-id="{{$status->event?->id}}"
>
<div class="dropdown-icon-suspense">
<i class="fas fa-user-plus" aria-hidden="true"></i>
</div>
{{__('status.join')}}
</button>
@endif
</li>
<x-mute-button :user="$status->user" :dropdown="true"/>
<x-block-button :user="$status->user" :dropdown="true"/>
Expand Down
17 changes: 12 additions & 5 deletions resources/vue/components/CheckinLineRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
required: false,
default: {}
},
fastCheckinIbnr: {
fastCheckinId: {
type: Number,
required: false,
},
Expand Down Expand Up @@ -69,7 +69,7 @@ export default {
}
return !remove;
});
if (this.$props.fastCheckinIbnr) {
if (this.$props.fastCheckinId) {
this.fastCheckin();
}
});
Expand All @@ -79,9 +79,16 @@ export default {
});
},
fastCheckin() {
const destination = this.lineRun.stopovers.find((item) => {
return Number(item.evaIdentifier) === Number(this.fastCheckinIbnr);
})
let destination = null;
if (this.useInternalIdentifiers) {
destination = this.lineRun.stopovers.find((item) => {
return Number(item.id) === Number(this.fastCheckinId);
});
} else {
destination = this.lineRun.stopovers.find((item) => {
return Number(item.evaIdentifier) === Number(this.fastCheckinId);
});
}
if (destination) {
this.handleSetDestination(destination);
Expand Down
2 changes: 1 addition & 1 deletion resources/vue/components/Stationboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export default {
<template #body v-if="showLineRun">
<CheckinLineRun
:selectedTrain="selectedTrain"
:fastCheckinIbnr="fastCheckinIbnr"
:fastCheckinId="fastCheckinIbnr"
:useInternalIdentifiers="useInternalIdentifiers"
v-model:destination="selectedDestination"
/>
Expand Down

0 comments on commit f8179f5

Please sign in to comment.