mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 22:08:12 +00:00
Nowy filtr dla historii rozkładów jazdy
This commit is contained in:
@@ -60,7 +60,7 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const sorterOptions = ['date', 'distance', 'total-stops'];
|
const sorterOptions = ['timetableId', 'beginDate', 'distance', 'total-stops'];
|
||||||
|
|
||||||
const translatedSorterOptions = computed(() =>
|
const translatedSorterOptions = computed(() =>
|
||||||
sorterOptions.map((id) => ({
|
sorterOptions.map((id) => ({
|
||||||
|
|||||||
+2
-1
@@ -179,7 +179,8 @@
|
|||||||
|
|
||||||
"option-distance": "distance",
|
"option-distance": "distance",
|
||||||
"option-total-stops": "total stops",
|
"option-total-stops": "total stops",
|
||||||
"option-date": "date"
|
"option-beginDate": "date",
|
||||||
|
"option-timetableId": "timetable ID"
|
||||||
},
|
},
|
||||||
"scenery": {
|
"scenery": {
|
||||||
"users": "PLAYERS ONLINE",
|
"users": "PLAYERS ONLINE",
|
||||||
|
|||||||
+2
-1
@@ -180,7 +180,8 @@
|
|||||||
|
|
||||||
"option-distance": "kilometraż",
|
"option-distance": "kilometraż",
|
||||||
"option-total-stops": "stacje",
|
"option-total-stops": "stacje",
|
||||||
"option-date": "data"
|
"option-beginDate": "data",
|
||||||
|
"option-timetableId": "ID rozkładu"
|
||||||
},
|
},
|
||||||
"scenery": {
|
"scenery": {
|
||||||
"users": "GRACZE ONLINE",
|
"users": "GRACZE ONLINE",
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ export default defineComponent({
|
|||||||
error: null,
|
error: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const sorterActive = ref({ id: 'date', dir: -1 });
|
const sorterActive = ref({ id: 'timetableId', dir: -1 });
|
||||||
const searchedDriver = ref('');
|
const searchedDriver = ref('');
|
||||||
const searchedTrain = ref('');
|
const searchedTrain = ref('');
|
||||||
|
|
||||||
@@ -266,21 +266,22 @@ export default defineComponent({
|
|||||||
props: {
|
props: {
|
||||||
searchedDriver?: string;
|
searchedDriver?: string;
|
||||||
searchedTrain?: string;
|
searchedTrain?: string;
|
||||||
maxCount?: number;
|
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
this.historyDataStatus.status = DataStatus.Loading;
|
this.historyDataStatus.status = DataStatus.Loading;
|
||||||
|
|
||||||
const queries: string[] = [];
|
const queries: string[] = [];
|
||||||
|
|
||||||
if (!props.searchedDriver && !props.searchedTrain) queries.push('count=15');
|
|
||||||
if (props.maxCount) queries.push(`count=${props.maxCount}`);
|
|
||||||
if (props.searchedDriver) queries.push(`driver=${props.searchedDriver}`);
|
if (props.searchedDriver) queries.push(`driver=${props.searchedDriver}`);
|
||||||
if (props.searchedTrain) queries.push(`train=${props.searchedTrain}`);
|
if (props.searchedTrain) queries.push(`train=${props.searchedTrain}`);
|
||||||
|
|
||||||
// Z API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
|
// Z API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
|
||||||
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');
|
||||||
|
else if (this.sorterActive.id == 'beginDate') queries.push('sortBy=beginDate');
|
||||||
|
else queries.push('sortBy=timetableId');
|
||||||
|
|
||||||
|
queries.push('countLimit=15')
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user