mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Filtry dziennika dyżurnych
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="journal-timetables">
|
<section class="journal-timetables">
|
||||||
<div class="journal-wrapper">
|
<div class="journal-wrapper">
|
||||||
|
<journal-options
|
||||||
|
@on-filter-change="search"
|
||||||
|
@on-input-change="search"
|
||||||
|
@on-sorter-change="search"
|
||||||
|
:sorter-option-ids="['timestampFrom', 'duration']"
|
||||||
|
/>
|
||||||
|
|
||||||
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
||||||
<img :src="icons.arrow" alt="return arrow" />
|
<img :src="icons.arrow" alt="return arrow" />
|
||||||
</button>
|
</button>
|
||||||
@@ -43,7 +50,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<span :data-status="doc.isOnline"
|
<span :data-status="doc.isOnline"
|
||||||
>{{ doc.isOnline ? $t('history.online-since') : 'OFFLINE' }} </span
|
>{{ doc.isOnline ? $t('journal.online-since') : 'OFFLINE' }} </span
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
{{ new Date(doc.timestampFrom).toLocaleTimeString('pl-PL', { timeStyle: 'short' }) }}
|
{{ new Date(doc.timestampFrom).toLocaleTimeString('pl-PL', { timeStyle: 'short' }) }}
|
||||||
@@ -56,7 +63,7 @@
|
|||||||
<span v-if="doc.timestampTo">
|
<span v-if="doc.timestampTo">
|
||||||
>
|
>
|
||||||
{{ new Date(doc.timestampTo).toLocaleTimeString('pl-PL', { timeStyle: 'short' }) }}
|
{{ new Date(doc.timestampTo).toLocaleTimeString('pl-PL', { timeStyle: 'short' }) }}
|
||||||
({{ $t('history.duty-lasted') }} {{ calculateDuration(doc.currentDuration!) }})
|
({{ $t('journal.duty-lasted') }} {{ calculateDuration(doc.currentDuration!) }})
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -81,7 +88,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, provide, Ref, ref } from 'vue';
|
import { computed, defineComponent, JournalFilter, JournalSearcher, provide, reactive, Ref, ref } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import SearchBox from '@/components/Global/SearchBox.vue';
|
import SearchBox from '@/components/Global/SearchBox.vue';
|
||||||
@@ -92,7 +99,6 @@ import ActionButton from '@/components/Global/ActionButton.vue';
|
|||||||
import JournalOptions from '@/components/JournalView/JournalOptions.vue';
|
import JournalOptions from '@/components/JournalView/JournalOptions.vue';
|
||||||
|
|
||||||
import { URLs } from '@/scripts/utils/apiURLs';
|
import { URLs } from '@/scripts/utils/apiURLs';
|
||||||
import { journalFilters } from '@/data/journalFilters';
|
|
||||||
|
|
||||||
const DEV_MODE = true;
|
const DEV_MODE = true;
|
||||||
const PROD_MODE = !DEV_MODE || process.env.NODE_ENV === 'production';
|
const PROD_MODE = !DEV_MODE || process.env.NODE_ENV === 'production';
|
||||||
@@ -146,18 +152,16 @@ export default defineComponent({
|
|||||||
error: null,
|
error: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const sorterActive = ref({ id: 'timetableId', dir: -1 });
|
const sorterActive = ref({ id: 'timestampFrom', dir: -1 });
|
||||||
const journalFilterActive = ref(journalFilters[0]);
|
const journalFilterActive = ref({});
|
||||||
|
const searchersValues = reactive([{ id: 'search-dispatcher', value: '' }, { id: 'search-station', value: '' }])
|
||||||
|
|
||||||
const searchedDriver = ref('');
|
|
||||||
const searchedTrain = ref('');
|
|
||||||
const countFromIndex = ref(0);
|
const countFromIndex = ref(0);
|
||||||
const countLimit = 15;
|
const countLimit = 15;
|
||||||
|
|
||||||
provide('searchedTrain', searchedTrain);
|
|
||||||
provide('searchedDriver', searchedDriver);
|
|
||||||
provide('sorterActive', sorterActive);
|
provide('sorterActive', sorterActive);
|
||||||
provide('journalFilterActive', journalFilterActive);
|
provide('journalFilterActive', journalFilterActive);
|
||||||
|
provide('searchersValues', searchersValues);
|
||||||
|
|
||||||
const scrollElement: Ref<HTMLElement | null> = ref(null);
|
const scrollElement: Ref<HTMLElement | null> = ref(null);
|
||||||
|
|
||||||
@@ -169,10 +173,8 @@ export default defineComponent({
|
|||||||
isDataError: computed(() => historyDataStatus.value.status === DataStatus.Error),
|
isDataError: computed(() => historyDataStatus.value.status === DataStatus.Error),
|
||||||
isDataInit: computed(() => historyDataStatus.value.status === DataStatus.Initialized),
|
isDataInit: computed(() => historyDataStatus.value.status === DataStatus.Initialized),
|
||||||
|
|
||||||
searchedDriver,
|
|
||||||
searchedTrain,
|
|
||||||
sorterActive,
|
sorterActive,
|
||||||
journalFilterActive,
|
searchersValues,
|
||||||
|
|
||||||
countFromIndex,
|
countFromIndex,
|
||||||
countLimit,
|
countLimit,
|
||||||
@@ -215,8 +217,8 @@ export default defineComponent({
|
|||||||
const minsInHour = minsTotal % 60;
|
const minsInHour = minsTotal % 60;
|
||||||
|
|
||||||
return minsTotal > 60
|
return minsTotal > 60
|
||||||
? this.$t('history.hours', { hours: hoursTotal, minutes: minsInHour })
|
? this.$t('journal.hours', { hours: hoursTotal, minutes: minsInHour })
|
||||||
: this.$t('history.minutes', { minutes: minsTotal });
|
: this.$t('journal.minutes', { minutes: minsTotal });
|
||||||
},
|
},
|
||||||
|
|
||||||
isAnotherDay(prevIndex: number, currIndex: number) {
|
isAnotherDay(prevIndex: number, currIndex: number) {
|
||||||
@@ -246,7 +248,9 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
this.fetchHistoryData();
|
this.fetchHistoryData({
|
||||||
|
searchers: this.searchersValues
|
||||||
|
});
|
||||||
|
|
||||||
this.scrollNoMoreData = false;
|
this.scrollNoMoreData = false;
|
||||||
this.scrollDataLoaded = true;
|
this.scrollDataLoaded = true;
|
||||||
@@ -272,21 +276,33 @@ export default defineComponent({
|
|||||||
this.scrollDataLoaded = true;
|
this.scrollDataLoaded = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
async fetchHistoryData() {
|
async fetchHistoryData(
|
||||||
|
props: {
|
||||||
|
searchers?: JournalSearcher[];
|
||||||
|
filter?: JournalFilter;
|
||||||
|
} = {}
|
||||||
|
) {
|
||||||
this.historyDataStatus.status = DataStatus.Loading;
|
this.historyDataStatus.status = DataStatus.Loading;
|
||||||
|
|
||||||
const queries: string[] = [];
|
const queries: string[] = [];
|
||||||
|
|
||||||
|
const dispatcher = props.searchers?.find((s) => s.id == 'search-dispatcher')?.value.trim();
|
||||||
|
const station = props.searchers?.find((s) => s.id == 'search-station')?.value.trim();
|
||||||
|
|
||||||
|
if (dispatcher) queries.push(`dispatcherName=${dispatcher}`);
|
||||||
|
if (station) queries.push(`stationName=${station}`);
|
||||||
|
|
||||||
|
// Z API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
|
||||||
|
if (this.sorterActive.id == 'timestampFrom') queries.push('sortBy=timestampFrom');
|
||||||
|
else if (this.sorterActive.id == 'duration') queries.push('sortBy=duration');
|
||||||
|
else queries.push('sortBy=timestampFrom');
|
||||||
|
|
||||||
queries.push('countLimit=15');
|
queries.push('countLimit=15');
|
||||||
|
|
||||||
this.currentQuery = queries.join('&');
|
this.currentQuery = queries.join('&');
|
||||||
|
|
||||||
// sorters; sortBy: duration, timestampFrom (default)
|
|
||||||
// filters; dispatcherName, stationName
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const responseData: APIResponse | null = await (
|
const responseData: APIResponse | null = await (await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`)).data;
|
||||||
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`)
|
|
||||||
).data;
|
|
||||||
|
|
||||||
if (!responseData) {
|
if (!responseData) {
|
||||||
this.historyDataStatus.status = DataStatus.Error;
|
this.historyDataStatus.status = DataStatus.Error;
|
||||||
@@ -330,8 +346,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.journal-wrapper {
|
.list-wrapper {
|
||||||
max-width: 1100px;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.journal_item {
|
.journal_item {
|
||||||
@@ -353,15 +369,6 @@ export default defineComponent({
|
|||||||
color: salmon;
|
color: salmon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.journal-current-day {
|
|
||||||
position: sticky;
|
|
||||||
top: -1px;
|
|
||||||
|
|
||||||
padding: 0.5em 0;
|
|
||||||
background-color: salmon;
|
|
||||||
}
|
|
||||||
|
|
||||||
.journal_day {
|
.journal_day {
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -6,13 +6,23 @@
|
|||||||
<select-box
|
<select-box
|
||||||
:itemList="translatedSorterOptions"
|
:itemList="translatedSorterOptions"
|
||||||
:defaultItemIndex="0"
|
:defaultItemIndex="0"
|
||||||
@selected="changeSorter"
|
@selected="onSorterChange"
|
||||||
:prefix="$t('journal.sort-prefix')"
|
:prefix="$t('journal.sort-prefix')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content_search">
|
<div class="content_search">
|
||||||
<div class="search-box">
|
<div class="search-box" v-for="search in searchersValues" :key="search.id">
|
||||||
|
<input
|
||||||
|
class="search-input"
|
||||||
|
:placeholder="$t(`journal.${search.id}`)"
|
||||||
|
v-model="search.value"
|
||||||
|
@keydown.enter="onInputSearch"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<img class="search-exit" :src="exitIcon" alt="exit-icon" @click="onInputClear(search.id)" />
|
||||||
|
</div>
|
||||||
|
<!-- <div class="search-box">
|
||||||
<input
|
<input
|
||||||
class="search-input"
|
class="search-input"
|
||||||
v-model="searchedTrain"
|
v-model="searchedTrain"
|
||||||
@@ -32,21 +42,21 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<img class="search-exit" :src="exitIcon" alt="exit-icon" @click="clearDriver" />
|
<img class="search-exit" :src="exitIcon" alt="exit-icon" @click="clearDriver" />
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<action-button class="search-button" @click="search">
|
<action-button class="search-button" @click="onInputSearch">
|
||||||
{{ $t('history.search') }}
|
{{ $t('journal.search') }}
|
||||||
</action-button>
|
</action-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="options_filters">
|
<div class="options_filters">
|
||||||
<button
|
<button
|
||||||
v-for="filter in journalFilters"
|
v-for="filter in filters"
|
||||||
class="journal-filter-option btn--option"
|
class="journal-filter-option btn--option"
|
||||||
:class="{ checked: journalFilterActive.id === filter.id }"
|
:class="{ checked: journalFilterActive.id === filter.id }"
|
||||||
:id="filter.id"
|
:id="filter.id"
|
||||||
@click="changeJournalFilter(filter)"
|
@click="onFilterChange(filter)"
|
||||||
>
|
>
|
||||||
{{ $t(`journal.filter-${filter.id}`) }}
|
{{ $t(`journal.filter-${filter.id}`) }}
|
||||||
</button>
|
</button>
|
||||||
@@ -56,68 +66,66 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { journalFilters } from '@/data/journalFilters';
|
import { defineComponent, inject, JournalFilter, PropType } from 'vue';
|
||||||
import { computed, defineComponent, inject, JournalFilter } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import ActionButton from '../Global/ActionButton.vue';
|
import ActionButton from '../Global/ActionButton.vue';
|
||||||
import SelectBox from '../Global/SelectBox.vue';
|
import SelectBox from '../Global/SelectBox.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { SelectBox, ActionButton },
|
components: { SelectBox, ActionButton },
|
||||||
emits: ['changedOptions', 'changedFilter'],
|
emits: ['onSorterChange', 'onInputChange', 'onFilterChange'],
|
||||||
|
props: {
|
||||||
|
sorterOptionIds: {
|
||||||
|
type: Array as PropType<Array<string>>,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
filters: {
|
||||||
|
type: Array as PropType<JournalFilter[]>,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
exitIcon: require('@/assets/icon-exit.svg'),
|
exitIcon: require('@/assets/icon-exit.svg'),
|
||||||
journalFilters,
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const sorterOptions = ['timetableId', 'beginDate', 'distance', 'total-stops'];
|
|
||||||
|
|
||||||
const translatedSorterOptions = computed(() =>
|
|
||||||
sorterOptions.map((id) => ({
|
|
||||||
id,
|
|
||||||
value: t(`journal.option-${id}`),
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
translatedSorterOptions,
|
searchersValues: inject('searchersValues') as {id: string; value: string}[],
|
||||||
|
|
||||||
searchedTrain: inject('searchedTrain') as string,
|
|
||||||
searchedDriver: inject('searchedDriver') as string,
|
|
||||||
sorterActive: inject('sorterActive') as { id: string | number; dir: number },
|
sorterActive: inject('sorterActive') as { id: string | number; dir: number },
|
||||||
journalFilterActive: inject('journalFilterActive') as JournalFilter
|
journalFilterActive: inject('journalFilterActive') as JournalFilter,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
translatedSorterOptions() {
|
||||||
|
return this.$props.sorterOptionIds.map((id) => ({
|
||||||
|
id,
|
||||||
|
value: this.$t(`journal.option-${id}`),
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
changeSorter(item: { id: string | number; value: string }) {
|
onSorterChange(item: { id: string | number; value: string }) {
|
||||||
this.sorterActive.id = item.id;
|
this.sorterActive.id = item.id;
|
||||||
this.sorterActive.dir = -1;
|
this.sorterActive.dir = -1;
|
||||||
|
|
||||||
this.$emit('changedOptions');
|
this.$emit('onSorterChange');
|
||||||
},
|
},
|
||||||
|
|
||||||
changeJournalFilter(filter: JournalFilter) {
|
onFilterChange(filter: JournalFilter) {
|
||||||
this.journalFilterActive = filter;
|
this.journalFilterActive = filter;
|
||||||
this.$emit('changedFilter');
|
this.$emit('onFilterChange');
|
||||||
},
|
},
|
||||||
|
|
||||||
search() {
|
onInputSearch() {
|
||||||
this.$emit('changedOptions');
|
this.$emit('onInputChange');
|
||||||
},
|
},
|
||||||
|
|
||||||
clearDriver() {
|
onInputClear(id: string) {
|
||||||
this.searchedDriver = '';
|
this.searchersValues.find(s => s.id == id)!.value = "";
|
||||||
this.search();
|
this.onInputSearch();
|
||||||
},
|
|
||||||
|
|
||||||
clearTrain() {
|
|
||||||
this.searchedTrain = '';
|
|
||||||
this.search();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="journal-timetables">
|
<section class="journal-timetables">
|
||||||
<div class="journal-wrapper">
|
<div class="journal-wrapper">
|
||||||
<JournalOptions @changedOptions="search" @changedFilter="search" />
|
<JournalOptions
|
||||||
|
@on-input-change="search"
|
||||||
|
@on-filter-change="search"
|
||||||
|
@on-sorter-change="search"
|
||||||
|
:sorter-option-ids="['timetableId', 'beginDate', 'distance', 'total-stops']"
|
||||||
|
:filters="journalTimetableFilters"
|
||||||
|
/>
|
||||||
|
|
||||||
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
||||||
<img :src="icons.arrow" alt="return arrow" />
|
<img :src="icons.arrow" alt="return arrow" />
|
||||||
@@ -69,7 +75,7 @@
|
|||||||
<b v-if="(item.fulfilled && item.terminated) || !item.terminated">
|
<b v-if="(item.fulfilled && item.terminated) || !item.terminated">
|
||||||
{{ item.route.split('|').slice(-1)[0] }}:
|
{{ item.route.split('|').slice(-1)[0] }}:
|
||||||
</b>
|
</b>
|
||||||
<i v-else>{{ $t('history.timetable-abandoned') }} </i>
|
<i v-else>{{ $t('journal.timetable-abandoned') }} </i>
|
||||||
|
|
||||||
<s v-if="item.endDate != item.scheduledEndDate && item.terminated" class="text--grayed">
|
<s v-if="item.endDate != item.scheduledEndDate && item.terminated" class="text--grayed">
|
||||||
{{ localeTime(item.fulfilled ? item.endDate : item.scheduledEndDate, $i18n.locale) }}
|
{{ localeTime(item.fulfilled ? item.endDate : item.scheduledEndDate, $i18n.locale) }}
|
||||||
@@ -90,35 +96,35 @@
|
|||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
!item.terminated
|
!item.terminated
|
||||||
? $t('history.timetable-active')
|
? $t('journal.timetable-active')
|
||||||
: item.fulfilled || item.currentDistance >= item.routeDistance * 0.9
|
: item.fulfilled || item.currentDistance >= item.routeDistance * 0.9
|
||||||
? $t('history.timetable-fulfilled')
|
? $t('journal.timetable-fulfilled')
|
||||||
: $t('history.timetable-abandoned')
|
: $t('journal.timetable-abandoned')
|
||||||
}}
|
}}
|
||||||
</b>
|
</b>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top: 1em;">
|
<div style="margin-top: 1em">
|
||||||
<div>
|
<div>
|
||||||
{{ $t('history.timetable-day') }} <b>{{ localeDay(item.beginDate, $i18n.locale) }}</b>
|
{{ $t('journal.timetable-day') }} <b>{{ localeDay(item.beginDate, $i18n.locale) }}</b>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Nick dyżurnego -->
|
<!-- Nick dyżurnego -->
|
||||||
<div v-if="item.authorName">
|
<div v-if="item.authorName">
|
||||||
<b class="text--grayed">{{ $t('history.dispatcher-name') }} </b>
|
<b class="text--grayed">{{ $t('journal.dispatcher-name') }} </b>
|
||||||
<b>{{ item.authorName }}</b>
|
<b>{{ item.authorName }}</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top: 1em;">
|
<div style="margin-top: 1em">
|
||||||
<div>
|
<div>
|
||||||
<b>{{ $t('history.route-length') }}</b>
|
<b>{{ $t('journal.route-length') }}</b>
|
||||||
{{ !item.fulfilled ? item.currentDistance + ' /' : '' }}
|
{{ !item.fulfilled ? item.currentDistance + ' /' : '' }}
|
||||||
{{ item.routeDistance }} km
|
{{ item.routeDistance }} km
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<b>{{ $t('history.station-count') }}</b>
|
<b>{{ $t('journal.station-count') }}</b>
|
||||||
{{ item.confirmedStopsCount }} /
|
{{ item.confirmedStopsCount }} /
|
||||||
{{ item.allStopsCount }}
|
{{ item.allStopsCount }}
|
||||||
</div>
|
</div>
|
||||||
@@ -138,7 +144,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, JournalFilter, provide, Ref, ref } from 'vue';
|
import { computed, defineComponent, JournalFilter, JournalSearcher, provide, reactive, Ref, ref } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import SearchBox from '@/components/Global/SearchBox.vue';
|
import SearchBox from '@/components/Global/SearchBox.vue';
|
||||||
@@ -149,7 +155,7 @@ import ActionButton from '@/components/Global/ActionButton.vue';
|
|||||||
import JournalOptions from '@/components/JournalView/JournalOptions.vue';
|
import JournalOptions from '@/components/JournalView/JournalOptions.vue';
|
||||||
|
|
||||||
import { URLs } from '@/scripts/utils/apiURLs';
|
import { URLs } from '@/scripts/utils/apiURLs';
|
||||||
import { journalFilters } from '@/data/journalFilters';
|
import { journalTimetableFilters } from '@/data/journalFilters';
|
||||||
import { JournalFilterType } from '@/scripts/enums/JournalFilterType';
|
import { JournalFilterType } from '@/scripts/enums/JournalFilterType';
|
||||||
|
|
||||||
const PROD_MODE = true;
|
const PROD_MODE = true;
|
||||||
@@ -206,6 +212,8 @@ export default defineComponent({
|
|||||||
scrollNoMoreData: false,
|
scrollNoMoreData: false,
|
||||||
|
|
||||||
showReturnButton: false,
|
showReturnButton: false,
|
||||||
|
|
||||||
|
journalTimetableFilters
|
||||||
}),
|
}),
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
@@ -215,15 +223,13 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const sorterActive = ref({ id: 'timetableId', dir: -1 });
|
const sorterActive = ref({ id: 'timetableId', dir: -1 });
|
||||||
const journalFilterActive = ref(journalFilters[0]);
|
const journalFilterActive = ref(journalTimetableFilters[0]);
|
||||||
|
|
||||||
const searchedDriver = ref('');
|
const searchersValues = reactive([{ id: 'search-train', value: '' }, { id: 'search-driver', value: '' }])
|
||||||
const searchedTrain = ref('');
|
|
||||||
const countFromIndex = ref(0);
|
const countFromIndex = ref(0);
|
||||||
const countLimit = 15;
|
const countLimit = 15;
|
||||||
|
|
||||||
provide('searchedTrain', searchedTrain);
|
provide('searchersValues', searchersValues);
|
||||||
provide('searchedDriver', searchedDriver);
|
|
||||||
provide('sorterActive', sorterActive);
|
provide('sorterActive', sorterActive);
|
||||||
provide('journalFilterActive', journalFilterActive);
|
provide('journalFilterActive', journalFilterActive);
|
||||||
|
|
||||||
@@ -237,10 +243,9 @@ export default defineComponent({
|
|||||||
isDataError: computed(() => historyDataStatus.value.status === DataStatus.Error),
|
isDataError: computed(() => historyDataStatus.value.status === DataStatus.Error),
|
||||||
isDataInit: computed(() => historyDataStatus.value.status === DataStatus.Initialized),
|
isDataInit: computed(() => historyDataStatus.value.status === DataStatus.Initialized),
|
||||||
|
|
||||||
searchedDriver,
|
|
||||||
searchedTrain,
|
|
||||||
sorterActive,
|
sorterActive,
|
||||||
journalFilterActive,
|
journalFilterActive,
|
||||||
|
searchersValues,
|
||||||
|
|
||||||
countFromIndex,
|
countFromIndex,
|
||||||
countLimit,
|
countLimit,
|
||||||
@@ -297,8 +302,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
search() {
|
search() {
|
||||||
this.fetchHistoryData({
|
this.fetchHistoryData({
|
||||||
searchedDriver: this.searchedDriver,
|
searchers: this.searchersValues,
|
||||||
searchedTrain: this.searchedTrain,
|
|
||||||
filter: this.journalFilterActive,
|
filter: this.journalFilterActive,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -330,8 +334,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
async fetchHistoryData(
|
async fetchHistoryData(
|
||||||
props: {
|
props: {
|
||||||
searchedDriver?: string;
|
searchers?: JournalSearcher[],
|
||||||
searchedTrain?: string;
|
|
||||||
filter?: JournalFilter;
|
filter?: JournalFilter;
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
@@ -339,8 +342,11 @@ export default defineComponent({
|
|||||||
|
|
||||||
const queries: string[] = [];
|
const queries: string[] = [];
|
||||||
|
|
||||||
if (props.searchedDriver) queries.push(`driver=${props.searchedDriver}`);
|
const driver = props.searchers?.find(s => s.id == "search-driver")?.value.trim();
|
||||||
if (props.searchedTrain) queries.push(`train=${props.searchedTrain}`);
|
const train = props.searchers?.find(s => s.id == "search-train")?.value.trim();
|
||||||
|
|
||||||
|
if (driver) queries.push(`driver=${driver}`);
|
||||||
|
if (train) queries.push(`train=${train}`);
|
||||||
|
|
||||||
// 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');
|
||||||
@@ -435,6 +441,4 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { JournalFilterType } from "@/scripts/enums/JournalFilterType";
|
import { JournalFilterType } from "@/scripts/enums/JournalFilterType";
|
||||||
import { JournalFilter } from "vue";
|
import { JournalFilter } from "vue";
|
||||||
|
|
||||||
export const journalFilters: JournalFilter[] = [
|
export const journalTimetableFilters: JournalFilter[] = [
|
||||||
{
|
{
|
||||||
id: JournalFilterType.all,
|
id: JournalFilterType.all,
|
||||||
filterSection: "timetable-status",
|
filterSection: "timetable-status",
|
||||||
@@ -25,5 +25,6 @@ export const journalFilters: JournalFilter[] = [
|
|||||||
filterSection: "timetable-status",
|
filterSection: "timetable-status",
|
||||||
isActive: false
|
isActive: false
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const journalDispatcherFilters: JournalFilter[] = []
|
||||||
+23
-15
@@ -185,8 +185,14 @@
|
|||||||
"loading": "Loading dispatcher history data...",
|
"loading": "Loading dispatcher history data...",
|
||||||
"no-history": "No dispatcher history found!",
|
"no-history": "No dispatcher history found!",
|
||||||
|
|
||||||
|
"section-timetables": "TIMETABLES",
|
||||||
|
"section-dispatchers": "DISPATCHERS",
|
||||||
|
|
||||||
|
"search": "Search",
|
||||||
"search-train": "Train no.",
|
"search-train": "Train no.",
|
||||||
"search-driver": "Driver name",
|
"search-driver": "Driver name",
|
||||||
|
"search-dispatcher": "Dispatcher name",
|
||||||
|
"search-station": "Scenery name",
|
||||||
|
|
||||||
"sort-prefix": "Sort: ",
|
"sort-prefix": "Sort: ",
|
||||||
|
|
||||||
@@ -194,6 +200,8 @@
|
|||||||
"option-total-stops": "total stops",
|
"option-total-stops": "total stops",
|
||||||
"option-beginDate": "date",
|
"option-beginDate": "date",
|
||||||
"option-timetableId": "timetable ID",
|
"option-timetableId": "timetable ID",
|
||||||
|
"option-timestampFrom": "date",
|
||||||
|
"option-duration": "duration",
|
||||||
|
|
||||||
"filter-all": "ALL ENTRIES",
|
"filter-all": "ALL ENTRIES",
|
||||||
"filter-abandoned": "ABANDONED",
|
"filter-abandoned": "ABANDONED",
|
||||||
@@ -201,7 +209,20 @@
|
|||||||
"filter-active": "ACTIVE",
|
"filter-active": "ACTIVE",
|
||||||
|
|
||||||
"no-further-data": "No further data for current parameters",
|
"no-further-data": "No further data for current parameters",
|
||||||
"loading-further-data": "Loading..."
|
"loading-further-data": "Loading...",
|
||||||
|
|
||||||
|
"route-length": "Route length:",
|
||||||
|
"station-count": "Stations:",
|
||||||
|
"dispatcher-name": "Created by",
|
||||||
|
"timetable-day": "Timetable created at",
|
||||||
|
"timetable-active": "ACTIVE",
|
||||||
|
"timetable-fulfilled": "FULFILLED",
|
||||||
|
"timetable-abandoned": "ABANDONED",
|
||||||
|
|
||||||
|
"online-since": "ONLINE SINCE",
|
||||||
|
"duty-lasted": "The duty lasted",
|
||||||
|
"minutes": "{minutes} mins",
|
||||||
|
"hours": "{hours}h {minutes} mins"
|
||||||
},
|
},
|
||||||
"scenery": {
|
"scenery": {
|
||||||
"users": "PLAYERS ONLINE",
|
"users": "PLAYERS ONLINE",
|
||||||
@@ -228,20 +249,7 @@
|
|||||||
},
|
},
|
||||||
"history": {
|
"history": {
|
||||||
"title": "TIMETABLE JOURNAL",
|
"title": "TIMETABLE JOURNAL",
|
||||||
"search": "Search",
|
|
||||||
"search-train": "Train no.",
|
"search-train": "Train no.",
|
||||||
"search-driver": "Driver name",
|
"search-driver": "Driver name"
|
||||||
"route-length": "Route length:",
|
|
||||||
"station-count": "Stations:",
|
|
||||||
"dispatcher-name": "Created by",
|
|
||||||
"timetable-day": "Timetable created at",
|
|
||||||
"timetable-active": "ACTIVE",
|
|
||||||
"timetable-fulfilled": "FULFILLED",
|
|
||||||
"timetable-abandoned": "ABANDONED",
|
|
||||||
|
|
||||||
"online-since": "ONLINE SINCE",
|
|
||||||
"duty-lasted": "The duty lasted",
|
|
||||||
"minutes": "{minutes} mins",
|
|
||||||
"hours": "{hours}h {minutes} mins"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-17
@@ -187,8 +187,14 @@
|
|||||||
"loading": "Ładowanie historii dyżurów...",
|
"loading": "Ładowanie historii dyżurów...",
|
||||||
"no-history": "Brak historii dyżurów dla tej scenerii!",
|
"no-history": "Brak historii dyżurów dla tej scenerii!",
|
||||||
|
|
||||||
|
"section-timetables": "ROZKŁADY JAZDY",
|
||||||
|
"section-dispatchers": "DYŻURNI",
|
||||||
|
|
||||||
|
"search": "Szukaj",
|
||||||
"search-train": "Numer pociągu",
|
"search-train": "Numer pociągu",
|
||||||
"search-driver": "Nick maszynisty",
|
"search-driver": "Nick maszynisty",
|
||||||
|
"search-dispatcher": "Nick dyżurnego",
|
||||||
|
"search-station": "Nazwa scenerii",
|
||||||
|
|
||||||
"sort-prefix": "Sortuj: ",
|
"sort-prefix": "Sortuj: ",
|
||||||
|
|
||||||
@@ -196,6 +202,8 @@
|
|||||||
"option-total-stops": "stacje",
|
"option-total-stops": "stacje",
|
||||||
"option-beginDate": "data",
|
"option-beginDate": "data",
|
||||||
"option-timetableId": "ID rozkładu",
|
"option-timetableId": "ID rozkładu",
|
||||||
|
"option-timestampFrom": "data",
|
||||||
|
"option-duration": "czas dyżuru",
|
||||||
|
|
||||||
"filter-all": "WSZYSTKIE",
|
"filter-all": "WSZYSTKIE",
|
||||||
"filter-abandoned": "PORZUCONE",
|
"filter-abandoned": "PORZUCONE",
|
||||||
@@ -203,7 +211,20 @@
|
|||||||
"filter-active": "AKTYWNE",
|
"filter-active": "AKTYWNE",
|
||||||
|
|
||||||
"no-further-data": "Brak dalszych wyników dla podanych parametrów",
|
"no-further-data": "Brak dalszych wyników dla podanych parametrów",
|
||||||
"loading-further-data": "Ładowanie..."
|
"loading-further-data": "Ładowanie...",
|
||||||
|
|
||||||
|
"online-since": "ONLINE OD",
|
||||||
|
"duty-lasted": "Dyżur trwał",
|
||||||
|
"minutes": "{minutes} min.",
|
||||||
|
"hours": "{hours} godz. {minutes} min.",
|
||||||
|
|
||||||
|
"route-length": "Kilometraż:",
|
||||||
|
"station-count": "Stacje:",
|
||||||
|
"dispatcher-name": "Wystawiony przez dyżurnego",
|
||||||
|
"timetable-day": "Rozkład z dnia",
|
||||||
|
"timetable-active": "AKTYWNY",
|
||||||
|
"timetable-fulfilled": "WYPEŁNIONY",
|
||||||
|
"timetable-abandoned": "PORZUCONY"
|
||||||
},
|
},
|
||||||
"scenery": {
|
"scenery": {
|
||||||
"users": "GRACZE ONLINE",
|
"users": "GRACZE ONLINE",
|
||||||
@@ -229,21 +250,6 @@
|
|||||||
"terminates": "KOŃCZY BIEG"
|
"terminates": "KOŃCZY BIEG"
|
||||||
},
|
},
|
||||||
"history": {
|
"history": {
|
||||||
"title": "DZIENNIK ROZKŁADÓW JAZDY",
|
"title": "DZIENNIK ROZKŁADÓW JAZDY"
|
||||||
"search": "Szukaj",
|
|
||||||
"search-train": "Numer pociągu",
|
|
||||||
"search-driver": "Nick maszynisty",
|
|
||||||
"route-length": "Kilometraż:",
|
|
||||||
"station-count": "Stacje:",
|
|
||||||
"dispatcher-name": "Wystawiony przez dyżurnego",
|
|
||||||
"timetable-day": "Rozkład z dnia",
|
|
||||||
"timetable-active": "AKTYWNY",
|
|
||||||
"timetable-fulfilled": "WYPEŁNIONY",
|
|
||||||
"timetable-abandoned": "PORZUCONY",
|
|
||||||
|
|
||||||
"online-since": "ONLINE OD",
|
|
||||||
"duty-lasted": "Dyżur trwał",
|
|
||||||
"minutes": "{minutes} min.",
|
|
||||||
"hours": "{hours} godz. {minutes} min."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
:class="{ checked: journalTypeChosen == 'timetables' }"
|
:class="{ checked: journalTypeChosen == 'timetables' }"
|
||||||
@click="changeJournalType('timetables')"
|
@click="changeJournalType('timetables')"
|
||||||
>
|
>
|
||||||
ROZKŁADY JAZDY
|
{{ $t('journal.section-timetables') }}
|
||||||
</button>
|
</button>
|
||||||
•
|
•
|
||||||
<button
|
<button
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
:class="{ checked: journalTypeChosen == 'dispatchers' }"
|
:class="{ checked: journalTypeChosen == 'dispatchers' }"
|
||||||
@click="changeJournalType('dispatchers')"
|
@click="changeJournalType('dispatchers')"
|
||||||
>
|
>
|
||||||
DYŻURNI
|
{{ $t('journal.section-dispatchers') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Vendored
+5
@@ -25,4 +25,9 @@ declare module '@vue/runtime-core' {
|
|||||||
filterSection: string;
|
filterSection: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface JournalSearcher {
|
||||||
|
id: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
|
"src/**/**/*.vue",
|
||||||
"tests/**/*.ts",
|
"tests/**/*.ts",
|
||||||
"tests/**/*.tsx"
|
"tests/**/*.tsx"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user