From 95a027f284ffe31997a9fb3390f0f76e4cce55b9 Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 23 Sep 2022 22:39:38 +0200 Subject: [PATCH] Filtrowanie po nicku autora RJ w dzienniku --- src/components/JournalView/JournalTimetables.vue | 12 ++++++++---- src/locales/en.json | 1 + src/locales/pl.json | 1 + src/types/Journal/JournalTimetablesTypes.ts | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/JournalView/JournalTimetables.vue b/src/components/JournalView/JournalTimetables.vue index 08bdc49..c5f28c8 100644 --- a/src/components/JournalView/JournalTimetables.vue +++ b/src/components/JournalView/JournalTimetables.vue @@ -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']; diff --git a/src/locales/en.json b/src/locales/en.json index 96bc5c4..0247785 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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", diff --git a/src/locales/pl.json b/src/locales/pl.json index c75c24b..966eaa0 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -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ż", diff --git a/src/types/Journal/JournalTimetablesTypes.ts b/src/types/Journal/JournalTimetablesTypes.ts index c38d3f4..4058a08 100644 --- a/src/types/Journal/JournalTimetablesTypes.ts +++ b/src/types/Journal/JournalTimetablesTypes.ts @@ -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 {