mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Filtrowanie po nicku autora RJ w dzienniku
This commit is contained in:
@@ -112,6 +112,7 @@ export default defineComponent({
|
||||
const searchersValues = reactive({
|
||||
'search-train': '',
|
||||
'search-driver': '',
|
||||
'search-author': '',
|
||||
'search-date': '',
|
||||
} as JorunalTimetableSearchType);
|
||||
|
||||
@@ -163,6 +164,7 @@ export default defineComponent({
|
||||
this.searchersValues['search-date'] = '';
|
||||
this.searchersValues['search-driver'] = '';
|
||||
this.searchersValues['search-train'] = '';
|
||||
this.searchersValues['search-author'] = '';
|
||||
|
||||
this.journalFilterActive = this.journalTimetableFilters[0];
|
||||
this.sorterActive.id = 'timetableId';
|
||||
@@ -210,15 +212,17 @@ export default defineComponent({
|
||||
|
||||
const queries: string[] = [];
|
||||
|
||||
const driver = props.searchers?.['search-driver'].trim();
|
||||
const train = props.searchers?.['search-train'].trim();
|
||||
const driverName = props.searchers?.['search-driver'].trim();
|
||||
const trainNo = props.searchers?.['search-train'].trim();
|
||||
const authorName = props.searchers?.['search-author'].trim();
|
||||
|
||||
const dateString = props.searchers?.['search-date'].trim();
|
||||
const timestampFrom = dateString ? Date.parse(new Date(dateString).toISOString()) - 120 * 60 * 1000 : undefined;
|
||||
const timestampTo = timestampFrom ? timestampFrom + 86400000 : undefined;
|
||||
|
||||
if (driver) queries.push(`driverName=${driver}`);
|
||||
if (train) queries.push(train.startsWith('#') ? `timetableId=${train.replace('#', '')}` : `trainNo=${train}`);
|
||||
if (driverName) queries.push(`driverName=${driverName}`);
|
||||
if (trainNo) queries.push(trainNo.startsWith('#') ? `timetableId=${trainNo.replace('#', '')}` : `trainNo=${trainNo}`);
|
||||
if (authorName) queries.push(`authorName=${authorName}`);
|
||||
if (timestampFrom && timestampTo) queries.push(`timestampFrom=${timestampFrom}`, `timestampTo=${timestampTo}`);
|
||||
|
||||
// Z API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
"search-driver": "Driver name",
|
||||
"search-dispatcher": "Dispatcher name",
|
||||
"search-station": "Scenery name",
|
||||
"search-author": "Timetable author name",
|
||||
"search-date": "Timetable date (CEST / GMT+2)",
|
||||
|
||||
"sort-mass": "mass",
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
"search-driver": "Nick maszynisty",
|
||||
"search-dispatcher": "Nick dyżurnego",
|
||||
"search-station": "Nazwa scenerii",
|
||||
"search-author": "Nick autora rozkładu jazdy",
|
||||
"search-date": "Data rozkładu jazdy (czas polski)",
|
||||
|
||||
"sort-distance": "kilometraż",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { JournalFilterType } from '../../scripts/enums/JournalFilterType';
|
||||
|
||||
export type JorunalTimetableSearchType = {
|
||||
[key in 'search-driver' | 'search-train' | 'search-date']: string;
|
||||
[key in 'search-driver' | 'search-train' | 'search-date' | 'search-author']: string;
|
||||
};
|
||||
|
||||
export interface JournalTimetableFilter {
|
||||
|
||||
Reference in New Issue
Block a user