Add departure id to departures
This commit is contained in:
parent
f33b3c21fe
commit
02776c4c90
@ -1,6 +1,6 @@
|
|||||||
<div class="departures" v-responsive>
|
<div class="departures" v-responsive>
|
||||||
<ul class="departures__list list-underlined">
|
<ul class="departures__list list-underlined">
|
||||||
<departure :departure="departure" v-for="departure in departures"/>
|
<departure :departure="departure" :key="departure.id" v-for="departure in departures"/>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="alert alert-info" v-if="stops.length === 0">
|
<div class="alert alert-info" v-if="stops.length === 0">
|
||||||
<fa :icon="['fal', 'info-circle']"/>
|
<fa :icon="['fal', 'info-circle']"/>
|
||||||
|
@ -3,14 +3,15 @@ import { Line } from "./line";
|
|||||||
import { Moment } from "moment";
|
import { Moment } from "moment";
|
||||||
|
|
||||||
export interface Departure {
|
export interface Departure {
|
||||||
display: string;
|
id: string;
|
||||||
|
display: string;
|
||||||
estimated: Moment;
|
estimated: Moment;
|
||||||
scheduled?: Moment;
|
scheduled?: Moment;
|
||||||
stop: Stop;
|
stop: Stop;
|
||||||
line: Line;
|
line: Line;
|
||||||
delay: number;
|
delay: number;
|
||||||
|
|
||||||
vehicle?: Vehicle;
|
vehicle?: Vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Vehicle {
|
export interface Vehicle {
|
||||||
|
@ -11,6 +11,13 @@ class Departure implements Fillable
|
|||||||
{
|
{
|
||||||
use FillTrait;
|
use FillTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unique identifier of departure, can be meaningless.
|
||||||
|
* @var string
|
||||||
|
* @Serializer\Type("string")
|
||||||
|
*/
|
||||||
|
private $key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about line.
|
* Information about line.
|
||||||
* @var Line
|
* @var Line
|
||||||
@ -58,6 +65,16 @@ class Departure implements Fillable
|
|||||||
*/
|
*/
|
||||||
private $scheduled;
|
private $scheduled;
|
||||||
|
|
||||||
|
public function getKey(): string
|
||||||
|
{
|
||||||
|
return $this->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setKey(string $key): void
|
||||||
|
{
|
||||||
|
$this->key = $key;
|
||||||
|
}
|
||||||
|
|
||||||
public function getLine(): Line
|
public function getLine(): Line
|
||||||
{
|
{
|
||||||
return $this->line;
|
return $this->line;
|
||||||
|
@ -58,6 +58,7 @@ class GenericScheduleRepository extends DatabaseRepository implements ScheduleRe
|
|||||||
$last = $entity->getTrip()->getTrack()->getStopsInTrack()->last()->getStop();
|
$last = $entity->getTrip()->getTrack()->getStopsInTrack()->last()->getStop();
|
||||||
|
|
||||||
return Departure::createFromArray([
|
return Departure::createFromArray([
|
||||||
|
'id' => sprintf('%s::%s', $entity->getTrip()->getId(), $entity->getDeparture()->format('H:i')),
|
||||||
'scheduled' => $entity->getDeparture(),
|
'scheduled' => $entity->getDeparture(),
|
||||||
'stop' => $stop,
|
'stop' => $stop,
|
||||||
'display' => $last->getName(),
|
'display' => $last->getName(),
|
||||||
|
@ -70,6 +70,7 @@ class ZtmGdanskDepartureRepository implements DepartureRepository
|
|||||||
$estimated = (clone $scheduled)->addSeconds($delay['delayInSeconds']);
|
$estimated = (clone $scheduled)->addSeconds($delay['delayInSeconds']);
|
||||||
|
|
||||||
return Departure::createFromArray([
|
return Departure::createFromArray([
|
||||||
|
'id' => sprintf('%s::%s', $delay['routeId'], $scheduled->format('H:i')),
|
||||||
'scheduled' => $scheduled,
|
'scheduled' => $scheduled,
|
||||||
'estimated' => $estimated,
|
'estimated' => $estimated,
|
||||||
'stop' => $stop,
|
'stop' => $stop,
|
||||||
|
@ -126,17 +126,15 @@
|
|||||||
<fa :icon="['fal', 'star']" fixed-width class="mr-1"></fa>
|
<fa :icon="['fal', 'star']" fixed-width class="mr-1"></fa>
|
||||||
Zapisane
|
Zapisane
|
||||||
</h2>
|
</h2>
|
||||||
<button class="btn btn-action" @click="visibility.picker = 'search'">
|
<button class="btn btn-action" @click="visibility.picker = 'sech'">
|
||||||
<fa :icon="['fal', 'search']" fixed-witdth></fa>
|
<fa :icon="['fal', 'search']" fixed-witdth></fa>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</header>
|
</header>
|
||||||
<div class="transition-box" style="overflow: hidden;">
|
<div class="transition-box" style="overflow: hidden;">
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<keep-alive>
|
<stop-finder @select="add" :blacklist="stops" v-if="visibility.picker === 'search'"></stop-finder>
|
||||||
<stop-finder @select="add" :blacklist="stops" v-if="visibility.picker === 'search'"></stop-finder>
|
<favourites v-else-if="visibility.picker === 'favourites'"></favourites>
|
||||||
<favourites v-else-if="visibility.picker === 'favourites'"></favourites>
|
|
||||||
</keep-alive>
|
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user