mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
dodatkowe info o postojach w dzienniku RJ
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<transition-group class="journal-list" tag="ul" name="list-anim">
|
<transition-group class="journal-list" tag="ul" name="list-anim">
|
||||||
<li
|
<li
|
||||||
v-for="{ timetable, sceneryList, stockHistoryComp, ...item } in computedTimetableHistory"
|
v-for="{ timetable, stockHistoryComp, stops, ...item } in computedTimetableHistory"
|
||||||
class="journal_item"
|
class="journal_item"
|
||||||
:key="timetable.id"
|
:key="timetable.id"
|
||||||
@click="item.showExtra.value = !item.showExtra.value"
|
@click="item.showExtra.value = !item.showExtra.value"
|
||||||
@@ -67,39 +67,39 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<div class="scenery-list">
|
<div class="stop-list">
|
||||||
<span
|
<span class="stop-list-item" v-for="(stop, i) in stops" :data-confirmed="stop.confirmed">
|
||||||
v-for="(scenery, i) in sceneryList.filter((_, i) =>
|
<span v-if="i > 0"> > </span>
|
||||||
!item.showExtra.value ? i == 0 || i == sceneryList.length - 1 : true
|
|
||||||
)"
|
<span>{{ stop.stopName }}</span>
|
||||||
:key="scenery.name"
|
|
||||||
:class="{ confirmed: scenery.confirmed }"
|
<span v-if="stop.scheduledArrivalDate || stop.scheduledDepartureDate">
|
||||||
|
<span> (</span>
|
||||||
|
<span v-if="stop.scheduledArrivalDate"
|
||||||
|
>p.
|
||||||
|
<s
|
||||||
|
class="text--grayed"
|
||||||
|
v-if="stop.realArrivalDate && stop.scheduledArrivalDate != stop.realArrivalDate && stop.confirmed"
|
||||||
|
>{{ stop.scheduledArrivalDate }}</s
|
||||||
>
|
>
|
||||||
<span v-if="i > 0">
|
{{ stop.realArrivalDate || stop.scheduledArrivalDate }}
|
||||||
>
|
|
||||||
<span v-if="!item.showExtra.value && i == 1 && sceneryList.length > 2">
|
|
||||||
... (+{{ sceneryList.length - 2 }}) >
|
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="stop.scheduledArrivalDate && stop.scheduledDepartureDate">
|
||||||
|
/ <span v-if="stop.stopTime">{{ stop.stopTime }}{{ stop.stopType }} / </span>
|
||||||
</span>
|
</span>
|
||||||
{{ scenery.name }}
|
<span v-if="stop.scheduledDepartureDate"
|
||||||
|
>o.
|
||||||
<!-- Data odjazdu ze stacji początkowej -->
|
<s
|
||||||
<span v-if="i == 0" v-html="scenery.beginDateHTML"></span>
|
class="text--grayed"
|
||||||
|
v-if="
|
||||||
<!-- Data przyjazdu do stacji końcowej -->
|
stop.realDepartureDate && stop.scheduledDepartureDate != stop.realDepartureDate && stop.confirmed
|
||||||
<span
|
"
|
||||||
v-else-if="i == sceneryList.length - 1 || (i == 1 && !item.showExtra.value)"
|
>
|
||||||
v-html="scenery.endDateHTML"
|
{{ stop.scheduledDepartureDate }}
|
||||||
></span>
|
</s>
|
||||||
|
{{ stop.realDepartureDate || stop.scheduledDepartureDate }}</span
|
||||||
<!-- Data przyjazdu i odjazdu ze stacji pośredniej -->
|
>
|
||||||
<span v-if="item.showExtra.value && i > 0 && i < sceneryList.length - 1">
|
<span>)</span>
|
||||||
<span v-if="timetable.checkpointArrivals && i < timetable.checkpointArrivals.length">
|
|
||||||
(p. {{ localeTime(timetable.checkpointArrivals[i], $i18n.locale)
|
|
||||||
}}<span v-if="timetable.checkpointDepartures && i < timetable.checkpointDepartures.length">
|
|
||||||
/ o. {{ localeTime(timetable.checkpointDepartures[i], $i18n.locale) }}</span
|
|
||||||
>)
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -235,7 +235,6 @@ export default defineComponent({
|
|||||||
computedTimetableHistory() {
|
computedTimetableHistory() {
|
||||||
return this.timetableHistory.map((timetable) => ({
|
return this.timetableHistory.map((timetable) => ({
|
||||||
timetable,
|
timetable,
|
||||||
sceneryList: this.getSceneryList(timetable),
|
|
||||||
stockHistoryComp: timetable.stockHistory
|
stockHistoryComp: timetable.stockHistory
|
||||||
.slice()
|
.slice()
|
||||||
.reverse()
|
.reverse()
|
||||||
@@ -252,6 +251,64 @@ export default defineComponent({
|
|||||||
stockLength: Number(historyData[3]) || undefined,
|
stockLength: Number(historyData[3]) || undefined,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
stops: timetable.sceneriesString.split('%').map((stopName, i, arr) => {
|
||||||
|
/* Internal error with scheduledBeginDate & scheduledEndDate being mixed up with respectively
|
||||||
|
beginDate and endDate, kurwa mać */
|
||||||
|
|
||||||
|
const scheduledArrivalDateString = timetable.checkpointArrivalsScheduled?.at(i);
|
||||||
|
const scheduledDepartureDateString = timetable.checkpointDeparturesScheduled?.at(i);
|
||||||
|
const arrivalDateString = timetable.checkpointArrivals?.at(i);
|
||||||
|
const departureDateString = timetable.checkpointDepartures?.at(i);
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
return {
|
||||||
|
stopName,
|
||||||
|
scheduledArrivalDate: null,
|
||||||
|
realArrivalDate: null,
|
||||||
|
scheduledDepartureDate: this.localeTime(
|
||||||
|
scheduledDepartureDateString || timetable.beginDate,
|
||||||
|
this.$i18n.locale
|
||||||
|
),
|
||||||
|
realDepartureDate: this.localeTime(
|
||||||
|
departureDateString || timetable.scheduledBeginDate,
|
||||||
|
this.$i18n.locale
|
||||||
|
),
|
||||||
|
|
||||||
|
confirmed: i < timetable.confirmedStopsCount,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (i == arr.length - 1)
|
||||||
|
return {
|
||||||
|
stopName,
|
||||||
|
scheduledArrivalDate: this.localeTime(scheduledArrivalDateString || timetable.endDate, this.$i18n.locale),
|
||||||
|
realArrivalDate: this.localeTime(arrivalDateString || timetable.scheduledEndDate, this.$i18n.locale),
|
||||||
|
scheduledDepartureDate: null,
|
||||||
|
realDepartureDate: null,
|
||||||
|
|
||||||
|
confirmed: timetable.fulfilled,
|
||||||
|
};
|
||||||
|
|
||||||
|
const stopInfo = timetable.checkpointStopTypes?.at(i)?.split(',');
|
||||||
|
|
||||||
|
return {
|
||||||
|
stopName,
|
||||||
|
realArrivalDate: arrivalDateString ? this.localeTime(arrivalDateString, this.$i18n.locale) : null,
|
||||||
|
scheduledArrivalDate: scheduledArrivalDateString
|
||||||
|
? this.localeTime(scheduledArrivalDateString, this.$i18n.locale)
|
||||||
|
: null,
|
||||||
|
|
||||||
|
realDepartureDate: departureDateString ? this.localeTime(departureDateString, this.$i18n.locale) : null,
|
||||||
|
scheduledDepartureDate: scheduledDepartureDateString
|
||||||
|
? this.localeTime(scheduledDepartureDateString, this.$i18n.locale)
|
||||||
|
: null,
|
||||||
|
|
||||||
|
stopTime: Number(stopInfo?.at(0)) || null,
|
||||||
|
stopType: stopInfo?.at(1) || null,
|
||||||
|
|
||||||
|
confirmed: i < timetable.confirmedStopsCount,
|
||||||
|
};
|
||||||
|
}),
|
||||||
showExtra: ref(false),
|
showExtra: ref(false),
|
||||||
currentHistoryIndex: ref(0),
|
currentHistoryIndex: ref(0),
|
||||||
}));
|
}));
|
||||||
@@ -259,34 +316,6 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getSceneryList(timetable: TimetableHistory) {
|
|
||||||
return timetable.sceneriesString.split('%').map((name, i) => {
|
|
||||||
const beginDateHTML =
|
|
||||||
' (o. ' +
|
|
||||||
(timetable.beginDate != timetable.scheduledBeginDate
|
|
||||||
? `<s class='text--grayed'>${this.localeTime(timetable.beginDate, this.$i18n.locale)}</s> `
|
|
||||||
: '') +
|
|
||||||
`<span>${this.localeTime(timetable.scheduledBeginDate, this.$i18n.locale)}</span>)`;
|
|
||||||
|
|
||||||
const endDateHTML =
|
|
||||||
' (p. ' +
|
|
||||||
(timetable.endDate != timetable.scheduledEndDate && timetable.fulfilled
|
|
||||||
? `<s class='text--grayed'>${this.localeTime(
|
|
||||||
timetable.fulfilled ? timetable.endDate : timetable.scheduledEndDate,
|
|
||||||
this.$i18n.locale
|
|
||||||
)}</s> `
|
|
||||||
: '') +
|
|
||||||
`<span>${this.localeTime(
|
|
||||||
timetable.fulfilled || (timetable.terminated && !timetable.fulfilled)
|
|
||||||
? timetable.scheduledEndDate
|
|
||||||
: timetable.endDate,
|
|
||||||
this.$i18n.locale
|
|
||||||
)}</span>)`;
|
|
||||||
|
|
||||||
return { name, confirmed: i < timetable.confirmedStopsCount, beginDateHTML, endDateHTML };
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
showTimetable(timetable: TimetableHistory) {
|
showTimetable(timetable: TimetableHistory) {
|
||||||
if (!timetable) return;
|
if (!timetable) return;
|
||||||
if (timetable.terminated) return;
|
if (timetable.terminated) return;
|
||||||
@@ -418,9 +447,10 @@ ul.stock-list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.scenery-list {
|
.stop-list {
|
||||||
color: #adadad;
|
color: #adadad;
|
||||||
span.confirmed {
|
|
||||||
|
&-item[data-confirmed='true'] {
|
||||||
color: #a3eba3;
|
color: #a3eba3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ export interface TimetableHistory {
|
|||||||
|
|
||||||
checkpointArrivals?: string[];
|
checkpointArrivals?: string[];
|
||||||
checkpointDepartures?: string[];
|
checkpointDepartures?: string[];
|
||||||
|
|
||||||
|
checkpointArrivalsScheduled?: string[];
|
||||||
|
checkpointDeparturesScheduled?: string[];
|
||||||
|
|
||||||
|
checkpointStopTypes?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SceneryTimetableHistory {
|
export interface SceneryTimetableHistory {
|
||||||
|
|||||||
Reference in New Issue
Block a user