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