Skip to content

Commit

Permalink
🚸 show station data for beta users
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Aug 8, 2024
1 parent 132ab93 commit 551e762
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/Http/Controllers/Frontend/VueFrontendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

namespace App\Http\Controllers\Frontend;

use App\Models\Station;
use Illuminate\Http\Request;
use Illuminate\View\View;

class VueFrontendController
{
public function stationboard(): View {
return view('vuestationboard', []);
public function stationboard(Request $request): View {
return view('vuestationboard', [
'station' => Station::find((int) $request->stationId)
]);
}
}
1 change: 0 additions & 1 deletion app/Models/Station.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* @property double $longitude
* @property int $time_offset
* @property bool $shift_time
* @property Event[] $events
* @property Carbon $created_at
* @property Carbon $updated_at
*
Expand Down
21 changes: 21 additions & 0 deletions resources/sass/app-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
--mdb-body-color: #{$dm-body};
--mdb-modal-bg: #{$dm-base};

--mdb-accordion-bg: #{$dm-base};
--mdb-accordion-color: #{$dm-body};
--mdb-accordion-border-color: #{$dm-base-20};
--mdb-accordion-header-bg: #{$dm-base};
--mdb-accordion-header-color: #{$dm-body};
--mdb-accordion-header-border-color: #{$dm-base-20};
--mdb-accordion-header-hover-bg: #{$dm-base-10};
--mdb-accordion-header-hover-color: #{$dm-body};
--mdb-accordion-header-hover-border-color: #{$dm-base-20};

--mdb-link-color: #{$dm-lightblue};
--mdb-btn-hover-color: #{$dm-lightblue};
--mdb-btn-focus-color: #{$dm-lightblue};
Expand All @@ -30,6 +40,17 @@
color: $white;
}

.accordion-item {
background-color: $dm-base;
color: $white;
border: 1px solid $dm-base-20;
}

.accordion-button {
background-color: $dm-base;
color: $white;
}

.card {
background-color: $dm-base-5;
}
Expand Down
116 changes: 116 additions & 0 deletions resources/views/vuestationboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,122 @@
</a>
</div>
@endif

@if(isset($station) && auth()->user()?->hasRole('open-beta'))
<div class="accordion mt-4">
<div class="accordion-item">
<h2 class="accordion-header" id="headingStationMeta">
<button
data-mdb-collapse-init
class="accordion-button"
type="button"
data-mdb-toggle="collapse"
data-mdb-target="#collapseOne"
aria-expanded="true"
aria-controls="collapseOne"
>
<span class="badge bg-info me-2">Beta</span>
Zeige verfügbare Daten zur Station
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show"
aria-labelledby="headingStationMeta"
data-mdb-parent="#accordionStationMeta">
<div class="accordion-body">
<table class="table table-hover table-striped">
<tr>
<th>Bezeichnung (Fahrplan)</th>
<td>{{$station->name}}</td>
</tr>
<tr>
<th>Träwelling ID</th>
<td>{{$station->id}}</td>
</tr>
<tr>
<th>HAFAS-ID oder IBNR</th>
<td>{{$station->ibnr}}</td>
</tr>
<tr>
<th>Koordinaten</th>
<td>
<a href="https://www.openstreetmap.org/?mlat={{$station->latitude}}&mlon={{$station->longitude}}&zoom=14"
target="_blank">
{{$station->latitude}}, {{$station->longitude}}
</a>
</td>
</tr>
<tr>
<th>Zeitzonen-Offset</th>
<td>{{$station->time_offset}}</td>
</tr>
<tr>
<th>Shift time</th>
<td>{{$station->shift_time}}</td>
</tr>
</table>

<hr/>
<h2 class="fs-5">OpenData</h2>

<span>Wir versuchen in nächster Zeit mehr Daten von <a
href="https://www.wikidata.org/wiki/">Wikidata</a> zu beziehen.</span>
@isset($station->wikidata_id)
<span>
Diese Station ist bereits mit einem <a
href="https://www.wikidata.org/wiki/{{ $station->wikidata_id }}"
target="_blank">Wikidata-Objekt</a> verknüpft.
</span>

<br/>
<br/>

<table class="table table-hover table-striped">
<tr>
<th>Bezeichnung</th>
<td>
@foreach($station->names as $localizedName)
<span class="badge bg-secondary me-1">
{{$localizedName->language}}: {{$localizedName->name}}
</span>
@endforeach
</td>
</tr>
<tr>
<th>IFOPT</th>
<td>{{$station->ifopt}}</td>
</tr>
<tr>
<th>RL100</th>
<td>{{$station->rilIdentifier}}</td>
</tr>
</table>

<a href="https://www.wikidata.org/wiki/{{ $station->wikidata_id }}"
target="_blank"
class="btn btn-sm btn-outline-secondary float-end">
<i class="fa-solid fa-edit"></i>
Bearbeiten
</a>

<small>
Fehler gefunden? Auf Wikidata bearbeiten!
Derzeit aktualisieren wir die Daten von Wikidata nur sehr unregelmäßig.
Es kann daher lange dauern, bis deine Änderungen hier angezeigt
werden.
</small>
@else
Diese Station ist noch nicht mit einem Wikidata-Objekt verknüpft,
daher können wir aktuell keine weiteren Informationen anzeigen.
<br/><br/>
Du kannst helfen, indem du die Stationsdaten bei Wikidata pflegt.
Wichtig sind insbesondere Identifier wie die IBNR, IFOPT oder das RL-100
Kürzel.
@endisset
</div>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
Expand Down

0 comments on commit 551e762

Please sign in to comment.