|
-
+
#{{ historyItem.id }}
|
@@ -37,11 +37,16 @@
{{ historyItem.trainNo }}
{{ historyItem.route.replace('|', ' -> ') }} |
- {{ historyItem.driverName }} |
+
+
+ {{ historyItem.driverName }}
+
+ |
+
{{ historyItem.authorName }}
{{ $t('scenery.timetable-author-unknown') }}
@@ -99,18 +104,20 @@ export default defineComponent({
},
methods: {
- async fetchAPIData(countFrom = 0, countLimit = 15) {
+ async fetchAPIData() {
if (!this.station && !this.onlineScenery) {
this.dataStatus = Status.Data.Loaded;
return;
}
try {
- const requestString = `api/getTimetables?issuedFrom=${
- this.station?.name || this.onlineScenery?.name
- }&countFrom=${countFrom}&countLimit=${countLimit}`;
-
- const response: API.TimetableHistory.Response = await (await http.get(requestString)).data;
+ const response: API.TimetableHistory.Response = await (
+ await http.get('api/getTimetables', {
+ params: {
+ issuedFrom: this.station?.name
+ }
+ })
+ ).data;
this.historyList = response;
@@ -121,9 +128,12 @@ export default defineComponent({
},
navigateToHistory() {
- this.$router.push(
- `/journal/timetables?issuedFrom=${this.station?.name || this.onlineScenery?.name}`
- );
+ this.$router.push({
+ path: '/journal/timetables',
+ query: {
+ 'search-issuedFrom': this.station?.name || this.onlineScenery?.name
+ }
+ });
}
},
components: { Loading }
diff --git a/src/locales/en.json b/src/locales/en.json
index 89fa7b4..448ff59 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -144,7 +144,8 @@
"filter-withComments": "COMMENTS",
"filter-twr": "HIGH RISK CARGO",
"filter-skr": "EXCEEDED GAUGE",
- "filter-twr-skr": "ALL TYPES",
+ "filter-twr-skr": "BOTH TYPES",
+ "filter-all-specials": "ALL",
"filter-common": "NO WARNINGS",
"filter-passenger": "PASSENGER",
"filter-freight": "FREIGHT",
@@ -156,9 +157,9 @@
"filter-clear": "CLEAR FILTERS",
"filter-section-timetable-status": "TIMETABLE STATUS",
- "filter-section-twrskr": "WARNINGS",
+ "filter-section-special": "SPECIAL TYPE",
- "filter-all": "ALL ENTRIES",
+ "filter-all-statuses": "ALL",
"filter-abandoned": "ABANDONED",
"filter-fulfilled": "FULFILLED",
"filter-active": "ACTIVE"
diff --git a/src/locales/pl.json b/src/locales/pl.json
index b79cbe0..85abab9 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -133,7 +133,8 @@
"filter-noComments": "BEZ UWAG",
"filter-twr": "WYS. RYZYKA",
"filter-skr": "SKRAJNIA",
- "filter-twr-skr": "WSZYSTKIE",
+ "filter-twr-skr": "TWR/SKR",
+ "filter-all-statuses": "WSZYSTKIE",
"filter-common": "ZWYKŁE",
"filter-passenger": "PASAŻERSKIE",
"filter-freight": "TOWAROWE",
@@ -145,9 +146,9 @@
"filter-clear": "WYŁĄCZ FILTRY",
"filter-section-timetable-status": "STATUS ROZKŁADU JAZDY",
- "filter-section-twrskr": "UWAGI",
+ "filter-section-special": "TYPY SPECJALNE",
- "filter-all": "WSZYSTKIE",
+ "filter-all-specials": "WSZYSTKIE",
"filter-abandoned": "PORZUCONE",
"filter-fulfilled": "WYPEŁNIONE",
"filter-active": "AKTYWNE"
diff --git a/src/views/JournalDispatchers.vue b/src/views/JournalDispatchers.vue
index 381e5b0..9dab4d1 100644
--- a/src/views/JournalDispatchers.vue
+++ b/src/views/JournalDispatchers.vue
@@ -166,6 +166,15 @@ export default defineComponent({
},
methods: {
+ handleRouteParams() {
+ this.$router.push({
+ query: {
+ 'search-date': this.searchersValues['search-date'] || undefined,
+ 'search-station': this.searchersValues['search-station'] || undefined,
+ 'search-dispatcher': this.searchersValues['search-dispatcher'] || undefined
+ }
+ });
+ },
handleScroll(e: Event) {
const listElement = e.target as HTMLElement;
const scrollTop = listElement.scrollTop;
@@ -178,21 +187,19 @@ export default defineComponent({
},
handleQueries(query: LocationQuery) {
- const queryKeys = Object.keys(query);
-
- if (queryKeys.includes('sceneryName')) this.setSearchers('', `${query.sceneryName}`, '');
- if (queryKeys.includes('dispatcherName'))
- this.setSearchers('', '', `${query.dispatcherName}`);
+ // if (queryKeys.includes('sceneryName')) this.setSearchers('', `${query.sceneryName}`, '');
+ // if (queryKeys.includes('dispatcherName'))
+ // this.setSearchers('', '', `${query.dispatcherName}`);
},
- setSearchers(date: string, station: string, dispatcher: string) {
- this.searchersValues['search-date'] = date;
- this.searchersValues['search-station'] = station;
- this.searchersValues['search-dispatcher'] = dispatcher;
+ setSearchers(searchers: { [key: string]: string }) {
+ this.searchersValues['search-date'] = searchers['search-date'] ?? '';
+ this.searchersValues['search-station'] = searchers['search-station'] ?? '';
+ this.searchersValues['search-dispatcher'] = searchers['search-dispatcher'] ?? '';
},
resetOptions() {
- this.setSearchers('', '', '');
+ this.setSearchers({});
this.sorterActive.id = 'timestampFrom';
this.fetchHistoryData();
diff --git a/src/views/JournalTimetables.vue b/src/views/JournalTimetables.vue
index 56e9095..56f31bf 100644
--- a/src/views/JournalTimetables.vue
+++ b/src/views/JournalTimetables.vue
@@ -5,9 +5,9 @@
{
+ const searchVal = this.searchersValues[k as Journal.TimetableSearchKey];
+
+ acc[k] = searchVal || undefined;
+
+ return acc;
+ },
+ {} as { [k: string]: string | undefined }
+ ),
+ ...this.filterList.reduce(
+ (acc, f) => {
+ if (f.isActive) acc[f.filterSection] = f.default ? undefined : f.id;
+ return acc;
+ },
+ {} as { [k: string]: string | undefined }
+ )
+ }
+ });
+ },
+
handleScroll(e: Event) {
const listElement = e.target as HTMLElement;
const scrollTop = listElement.scrollTop;
@@ -247,32 +293,28 @@ export default defineComponent({
},
handleQueries(query: LocationQuery) {
- const queryKeys = Object.keys(query);
-
- if (queryKeys.includes('timetableId'))
- this.setSearchers('', '', `#${query.timetableId}`, '', '');
- if (queryKeys.includes('issuedFrom'))
- this.setSearchers('', '', '', '', `${query.issuedFrom}`);
- if (queryKeys.includes('authorName'))
- this.setSearchers('', '', '', `${query.authorName}`, '');
+ this.setOptions(query as any);
},
- setSearchers(
- date: string,
- driver: string,
- train: string,
- dispatcher: string,
- issuedFrom: string
- ) {
- this.searchersValues['search-date'] = date;
- this.searchersValues['search-driver'] = driver;
- this.searchersValues['search-train'] = train;
- this.searchersValues['search-dispatcher'] = dispatcher;
- this.searchersValues['search-issuedFrom'] = issuedFrom;
+ setOptions(options: { [key: string]: string }) {
+ this.searchersValues['search-date'] = options['search-date'] ?? '';
+ this.searchersValues['search-driver'] = options['search-driver'] ?? '';
+ this.searchersValues['search-train'] = options['search-train'] ?? '';
+ this.searchersValues['search-dispatcher'] = options['search-dispatcher'] ?? '';
+ this.searchersValues['search-issuedFrom'] = options['search-issuedFrom'] ?? '';
+
+ this.sorterActive.id =
+ (options['sorter-active'] as Journal.TimetableSorterKey) ?? 'timetableId';
+
+ this.filterList.forEach((f) => {
+ f.isActive =
+ options[f.filterSection] === f.id ||
+ (options[f.filterSection] === undefined && f.default);
+ });
},
resetOptions() {
- this.setSearchers('', '', '', '', '');
+ this.setOptions({});
this.sorterActive.id = 'timetableId';
@@ -282,6 +324,7 @@ export default defineComponent({
this.initFilters.find((initFilter) => initFilter.id == f.id)?.isActive || false)
);
+ this.handleRouteParams();
this.fetchHistoryData();
},
@@ -340,12 +383,12 @@ export default defineComponent({
queryParams['fulfilled'] = 1;
break;
- case Journal.TimetableFilterId.ALL:
+ case Journal.TimetableFilterId.ALL_STATUSES:
queryParams['terminated'] = undefined;
queryParams['fulfilled'] = undefined;
break;
- case Journal.TimetableFilterId.TWR_SKR:
+ case Journal.TimetableFilterId.ALL_SPECIALS:
queryParams['twr'] = undefined;
queryParams['skr'] = undefined;
break;
@@ -356,7 +399,12 @@ export default defineComponent({
break;
case Journal.TimetableFilterId.SKR:
- queryParams['twr'] = undefined;
+ queryParams['twr'] = 0;
+ queryParams['skr'] = 1;
+ break;
+
+ case Journal.TimetableFilterId.TWR_SKR:
+ queryParams['twr'] = 1;
queryParams['skr'] = 1;
break;
|