mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
feat(journal): fitlering journal timetables by head vehicle unit name or type
This commit is contained in:
@@ -15,7 +15,8 @@ export namespace Journal {
|
|||||||
| 'search-issuedFrom'
|
| 'search-issuedFrom'
|
||||||
| 'search-terminatingAt'
|
| 'search-terminatingAt'
|
||||||
| 'search-via'
|
| 'search-via'
|
||||||
| 'select-categoryCode';
|
| 'select-categoryCode'
|
||||||
|
| 'search-headUnit';
|
||||||
|
|
||||||
export type TimetableSearchType = {
|
export type TimetableSearchType = {
|
||||||
[key in TimetableSearchKey]: string;
|
[key in TimetableSearchKey]: string;
|
||||||
|
|||||||
@@ -199,6 +199,7 @@
|
|||||||
"search-date-from": "Date (UTC+2 / CEST)",
|
"search-date-from": "Date (UTC+2 / CEST)",
|
||||||
"search-date-to": "Date (UTC+2 / CEST)",
|
"search-date-to": "Date (UTC+2 / CEST)",
|
||||||
"select-categoryCode": "Train category",
|
"select-categoryCode": "Train category",
|
||||||
|
"search-headUnit": "Traction unit (e.g. EP09, ET22-401)",
|
||||||
"sort-mass": "mass",
|
"sort-mass": "mass",
|
||||||
"sort-speed": "speed",
|
"sort-speed": "speed",
|
||||||
"sort-length": "length",
|
"sort-length": "length",
|
||||||
|
|||||||
@@ -196,6 +196,7 @@
|
|||||||
"search-date-from": "Data (UTC+2 / CEST)",
|
"search-date-from": "Data (UTC+2 / CEST)",
|
||||||
"search-date-to": "Data (UTC+2 / CEST)",
|
"search-date-to": "Data (UTC+2 / CEST)",
|
||||||
"select-categoryCode": "Kategoria pociągu",
|
"select-categoryCode": "Kategoria pociągu",
|
||||||
|
"search-headUnit": "Pojazd trakcyjny (np. EP09, ET22-137)",
|
||||||
"sort-routeDistance": "kilometraż",
|
"sort-routeDistance": "kilometraż",
|
||||||
"sort-allStopsCount": "stacje",
|
"sort-allStopsCount": "stacje",
|
||||||
"sort-beginDate": "data",
|
"sort-beginDate": "data",
|
||||||
|
|||||||
+3
-1
@@ -253,8 +253,10 @@ export namespace API {
|
|||||||
pn?: number;
|
pn?: number;
|
||||||
tn?: number;
|
tn?: number;
|
||||||
|
|
||||||
returnType?: 'all' | 'short' | 'detailed';
|
headUnitName?: string;
|
||||||
|
headUnitType?: string;
|
||||||
|
|
||||||
|
returnType?: 'all' | 'short' | 'detailed';
|
||||||
sortBy?: Journal.TimetableSorter['id'];
|
sortBy?: Journal.TimetableSorter['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,8 +173,9 @@ export default defineComponent({
|
|||||||
'search-issuedFrom': '',
|
'search-issuedFrom': '',
|
||||||
'search-via': '',
|
'search-via': '',
|
||||||
'search-terminatingAt': '',
|
'search-terminatingAt': '',
|
||||||
'select-categoryCode': '',
|
'search-headUnit': '',
|
||||||
'search-date-from': ''
|
'search-date-from': '',
|
||||||
|
'select-categoryCode': ''
|
||||||
} as Journal.TimetableSearchType);
|
} as Journal.TimetableSearchType);
|
||||||
|
|
||||||
const countFromIndex = ref(0);
|
const countFromIndex = ref(0);
|
||||||
@@ -296,6 +297,8 @@ export default defineComponent({
|
|||||||
async fetchHistoryData() {
|
async fetchHistoryData() {
|
||||||
this.extraInfoIndexes.length = 0;
|
this.extraInfoIndexes.length = 0;
|
||||||
|
|
||||||
|
const queryParams: API.TimetableHistory.QueryParams = {};
|
||||||
|
|
||||||
const driverName = this.searchersValues['search-driver'].trim() || undefined;
|
const driverName = this.searchersValues['search-driver'].trim() || undefined;
|
||||||
const trainNo = this.searchersValues['search-train'].trim() || undefined;
|
const trainNo = this.searchersValues['search-train'].trim() || undefined;
|
||||||
const authorName = this.searchersValues['search-dispatcher'].trim() || undefined;
|
const authorName = this.searchersValues['search-dispatcher'].trim() || undefined;
|
||||||
@@ -305,6 +308,7 @@ export default defineComponent({
|
|||||||
const via = this.searchersValues['search-via'].trim() || undefined;
|
const via = this.searchersValues['search-via'].trim() || undefined;
|
||||||
const terminatingAt = this.searchersValues['search-terminatingAt'].trim() || undefined;
|
const terminatingAt = this.searchersValues['search-terminatingAt'].trim() || undefined;
|
||||||
const categoryCode = this.searchersValues['select-categoryCode'].trim() || undefined;
|
const categoryCode = this.searchersValues['select-categoryCode'].trim() || undefined;
|
||||||
|
const headUnit = this.searchersValues['search-headUnit'].trim() || undefined;
|
||||||
|
|
||||||
let dateFromISO: string | undefined = undefined;
|
let dateFromISO: string | undefined = undefined;
|
||||||
let dateToISO: string | undefined = undefined;
|
let dateToISO: string | undefined = undefined;
|
||||||
@@ -320,8 +324,6 @@ export default defineComponent({
|
|||||||
dateToISO = dateTo.toISOString();
|
dateToISO = dateTo.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryParams: API.TimetableHistory.QueryParams = {};
|
|
||||||
|
|
||||||
this.filterList
|
this.filterList
|
||||||
.filter((f) => f.isActive)
|
.filter((f) => f.isActive)
|
||||||
.forEach((f) => {
|
.forEach((f) => {
|
||||||
@@ -393,6 +395,17 @@ export default defineComponent({
|
|||||||
queryParams['sortBy'] =
|
queryParams['sortBy'] =
|
||||||
this.sorterActive.id != 'timetableId' ? this.sorterActive.id : undefined;
|
this.sorterActive.id != 'timetableId' ? this.sorterActive.id : undefined;
|
||||||
|
|
||||||
|
// Head unit params
|
||||||
|
if (headUnit) {
|
||||||
|
const [headUnitName, headUnitNumber] = headUnit.split('-');
|
||||||
|
|
||||||
|
if (headUnitNumber && !isNaN(Number(headUnitNumber))) {
|
||||||
|
queryParams['headUnitName'] = `${headUnitName}-${headUnitNumber}`;
|
||||||
|
} else {
|
||||||
|
queryParams['headUnitType'] = headUnitName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (JSON.stringify(this.currentQueryParams) != JSON.stringify(queryParams))
|
if (JSON.stringify(this.currentQueryParams) != JSON.stringify(queryParams))
|
||||||
this.dataStatus = Status.Data.Loading;
|
this.dataStatus = Status.Data.Loading;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user