Dodano odświeżony widok historii rozkładów jazdy

This commit is contained in:
2022-02-04 01:16:31 +01:00
parent f7e22bea2c
commit 959f35e203
4 changed files with 68 additions and 40 deletions
+2 -4
View File
@@ -199,12 +199,10 @@
"search": "Search", "search": "Search",
"search-train": "Train no.", "search-train": "Train no.",
"search-driver": "Driver name", "search-driver": "Driver name",
"driver-name": "Driver:",
"route-length": "Route length:", "route-length": "Route length:",
"station-count": "Stations:", "station-count": "Stations:",
"begins-at": "Begins at:", "dispatcher-name": "Created by",
"terminates-at": "Terminates at:", "timetable-day": "Timetable created at",
"terminates-at-actual": "Terminates at (actual time):",
"timetable-active": "ACTIVE", "timetable-active": "ACTIVE",
"timetable-fulfilled": "FULFILLED", "timetable-fulfilled": "FULFILLED",
"timetable-abandoned": "ABANDONED" "timetable-abandoned": "ABANDONED"
+2 -4
View File
@@ -199,12 +199,10 @@
"search": "Szukaj", "search": "Szukaj",
"search-train": "Numer pociągu", "search-train": "Numer pociągu",
"search-driver": "Nick maszynisty", "search-driver": "Nick maszynisty",
"driver-name": "Maszynista:",
"route-length": "Kilometraż:", "route-length": "Kilometraż:",
"station-count": "Stacje:", "station-count": "Stacje:",
"begins-at": "Rozpoczęcie:", "dispatcher-name": "Wystawiony przez dyżurnego",
"terminates-at": "Zakończenie (planowe):", "timetable-day": "Rozkład z dnia",
"terminates-at-actual": "Zakończenie (rzeczywiste):",
"timetable-active": "AKTYWNY", "timetable-active": "AKTYWNY",
"timetable-fulfilled": "WYPEŁNIONY", "timetable-fulfilled": "WYPEŁNIONY",
"timetable-abandoned": "PORZUCONY" "timetable-abandoned": "PORZUCONY"
+23 -8
View File
@@ -3,14 +3,29 @@ import { defineComponent } from 'vue';
export default defineComponent({ export default defineComponent({
methods: { methods: {
localeDate(dateString: string, locale: string) { localeDate(dateString: string, locale: string) {
return new Date(dateString).toLocaleDateString(locale == 'pl' ? 'pl-PL' : 'en-GB', { return new Date(dateString).toLocaleDateString(locale == 'pl' ? 'pl-PL' : 'en-GB', {
weekday: "long", weekday: "long",
day: "numeric", day: "numeric",
month: "2-digit", month: "2-digit",
year: "numeric", year: "numeric",
hour:"2-digit", hour: "2-digit",
minute: "2-digit" minute: "2-digit"
}) })
},
localeDay(dateString: string, locale: string) {
return new Date(dateString).toLocaleDateString(locale == 'pl' ? 'pl-PL' : 'en-GB', {
day: "numeric",
month: "2-digit",
year: "numeric"
})
},
localeTime(dateString: string, locale: string) {
return new Date(dateString).toLocaleTimeString(locale == 'pl' ? 'pl-PL' : 'en-GB', {
hour: "2-digit",
minute: "2-digit"
})
} }
} }
}) })
+41 -24
View File
@@ -22,21 +22,25 @@
<div class="history_item-top"> <div class="history_item-top">
<span> <span>
<span @click="navigateToTrain(!item.terminated ? item.trainNo : null)" style="cursor: pointer"> <span @click="navigateToTrain(!item.terminated ? item.trainNo : null)" style="cursor: pointer">
<b class="text--primary">{{ item.trainCategoryCode }}</b> <b class="text--primary">{{ item.trainCategoryCode }}&nbsp;</b>
{{ item.trainNo }} <b>{{ item.trainNo }}</b>
| {{ item.driverName }}
| {{ item.timetableId }}
</span> </span>
<div> <div>
<b>{{ item.route.replace('|', ' - ') }}</b> <b>{{ item.route.replace('|', ' - ') }}</b>
</div> </div>
<hr style="margin: 0.25em 0" />
<div class="scenery-list"> <div class="scenery-list">
<span <span
v-for="(scenery, i) in sceneryList(item)" v-for="(scenery, i) in sceneryList(item)"
:key="scenery.name" :key="scenery.name"
:class="{ confirmed: scenery.confirmed }" :class="{ confirmed: scenery.confirmed }"
> >
{{ i > 0 ? ' - ' : '' }} {{ scenery.name }} {{ i > 0 ? ' > ' : '' }} {{ scenery.name }}
</span> </span>
</div> </div>
</span> </span>
@@ -59,11 +63,34 @@
</b> </b>
</div> </div>
<div style="margin: 1em 0"> <div class="schedule-dates" style="margin-top: 1em;">
<div> <div>{{ $t('history.timetable-day') }} {{ localeDay(item.beginDate, $i18n.locale) }}</div>
<b>{{ $t('history.driver-name') }}</b>
{{ item.driverName }} <!-- Data odjazdu ze stacji początkowej -->
<b>{{ item.route.split('|')[0] }}:</b>
<s v-if="item.beginDate != item.scheduledBeginDate" class="text--grayed">
{{ localeTime(item.scheduledBeginDate, $i18n.locale) }}
</s>
<span>{{ localeTime(item.beginDate, $i18n.locale) }} </span>&bull;
<!-- Data przyjazdu na stację końcową / porzucenia -->
<b v-if="(item.fulfilled && item.terminated) || !item.terminated"
>{{ item.route.split('|').slice(-1)[0] }}:</b
>
<i v-else>{{ $t('history.timetable-abandoned') }} </i>
<s v-if="item.endDate != item.scheduledEndDate" class="text--grayed">
{{ localeTime(item.scheduledEndDate, $i18n.locale) }}
</s>
<span>{{ localeTime(item.endDate, $i18n.locale) }} </span>
<!-- Nick dyżurnego -->
<div v-if="item.authorName" class="text--grayed">
<b>{{ $t('history.dispatcher-name') }} {{ item.authorName }}</b>
</div> </div>
</div>
<div style="margin-top: 1em;">
<div> <div>
<b>{{ $t('history.route-length') }}</b> <b>{{ $t('history.route-length') }}</b>
{{ !item.fulfilled ? item.currentDistance + ' /' : '' }} {{ !item.fulfilled ? item.currentDistance + ' /' : '' }}
@@ -75,21 +102,6 @@
{{ item.confirmedStopsCount }} / {{ item.confirmedStopsCount }} /
{{ item.allStopsCount }} {{ item.allStopsCount }}
</div> </div>
<div>
<b>{{ $t('history.begins-at') }}</b>
{{ localeDate(item.beginDate, $i18n.locale) }}
</div>
<div>
<b>{{ $t('history.terminates-at') }}</b>
{{ localeDate(item.scheduledEndDate, $i18n.locale) }}
</div>
<div v-if="item.terminated">
<b>{{ $t('history.terminates-at-actual') }}</b>
{{ localeDate(item.endDate, $i18n.locale) }}
</div>
</div> </div>
</li> </li>
</ul> </ul>
@@ -150,6 +162,9 @@ interface TimetableHistory {
terminated: boolean; terminated: boolean;
fulfilled: boolean; fulfilled: boolean;
authorName?: string;
authorId?: number;
} }
const initFilters = { const initFilters = {
@@ -266,8 +281,6 @@ export default defineComponent({
if (this.sorterActive.id == 'distance') queries.push('sortBy=routeDistance'); if (this.sorterActive.id == 'distance') queries.push('sortBy=routeDistance');
else if (this.sorterActive.id == 'total-stops') queries.push('sortBy=allStopsCount'); else if (this.sorterActive.id == 'total-stops') queries.push('sortBy=allStopsCount');
console.log(queries);
try { try {
const responseData: APIResponse | null = await (await axios.get(`${API_URL}?${queries.join('&')}`)).data; const responseData: APIResponse | null = await (await axios.get(`${API_URL}?${queries.join('&')}`)).data;
@@ -384,6 +397,10 @@ export default defineComponent({
} }
} }
.schedule-dates > * {
margin-right: 0.25em;
}
li, li,
.history_warning { .history_warning {
background: #202020; background: #202020;