mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 13:58:12 +00:00
fix: other driver's trains broken listing
This commit is contained in:
@@ -1,34 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="driver-not-found">
|
<div class="driver-not-found">
|
||||||
<h2>⦻ {{ $t('trains.driver-not-found-header') }}</h2>
|
<h2>⦻ {{ $t('trains.driver-not-found-header') }}</h2>
|
||||||
|
|
||||||
<p class="text--grayed">
|
<p class="text--grayed">
|
||||||
{{ $t('trains.driver-not-found-desc-1') }} <br />
|
{{ $t('trains.driver-not-found-desc-1') }} <br />
|
||||||
{{ $t('trains.driver-not-found-desc-2') }}
|
{{ $t('trains.driver-not-found-desc-2') }}
|
||||||
<router-link to="/journal/timetables">{{ $t('trains.driver-not-found-journal') }} </router-link>!
|
<router-link to="/journal/timetables"
|
||||||
</p>
|
>{{ $t('trains.driver-not-found-journal') }} </router-link
|
||||||
|
>!
|
||||||
|
</p>
|
||||||
|
|
||||||
<p v-if="props.trainId && otherDriverTrains.length > 0">
|
<p v-if="props.trainId && otherDriverTrains.length > 0">
|
||||||
<i18n-t keypath="trains.driver-not-found-others">
|
<i18n-t keypath="trains.driver-not-found-others">
|
||||||
<template v-slot:driver>
|
<template v-slot:driver>
|
||||||
<b>{{ otherDriverTrains[0].driverName }}</b>
|
<b>{{ otherDriverTrains[0].driverName }}</b>
|
||||||
</template>
|
</template>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="other-driver-trains">
|
<div class="other-driver-trains">
|
||||||
<template v-for="(train, i) in otherDriverTrains">
|
<template v-for="(train, i) in otherDriverTrains">
|
||||||
<router-link :to="`/driver?trainId=${train.id}`">
|
<router-link :to="`/driver?trainId=${train.id}`">
|
||||||
{{ train.trainNo }}
|
{{ train.trainNo }}
|
||||||
| {{ regions.find((r) => r.id == train.region)?.name ?? 'PL1' }}
|
| {{ regions.find((r) => r.id == train.region)?.name ?? 'PL1' }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="margin-top: 1em">
|
|
||||||
<router-link to="/"><< {{ $t('trains.driver-not-found-return') }}</router-link>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 1em">
|
||||||
|
<router-link to="/"><< {{ $t('trains.driver-not-found-return') }}</router-link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -39,42 +41,41 @@ import { regions } from '../../data/options.json';
|
|||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
trainId: {
|
trainId: {
|
||||||
type: String
|
type: String
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const otherDriverTrains = computed(() => {
|
const otherDriverTrains = computed(() => {
|
||||||
return mainStore.trainList.filter(
|
return mainStore.trainList.filter(
|
||||||
(train) =>
|
(train) =>
|
||||||
train.driverId == Number(props.trainId?.split('|')[0]) &&
|
train.driverId == Number(props.trainId?.split('|')[0]) &&
|
||||||
(train.timetableData || train.online || train.lastSeen >= Date.now() - 60000)
|
(train.timetableData || train.online || train.lastSeen >= Date.now() - 60000)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.driver-not-found {
|
.driver-not-found {
|
||||||
background-color: var(--clr-view-bg);
|
background-color: var(--clr-view-bg);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border-radius: 0.5em 0.5em;
|
border-radius: 0.5em 0.5em;
|
||||||
|
|
||||||
p {
|
p {
|
||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.other-driver-trains {
|
.other-driver-trains {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<Loading v-else-if="apiStore.dataStatuses.connection == Status.Data.Loading" />
|
<Loading v-else-if="apiStore.dataStatuses.connection == Status.Data.Loading" />
|
||||||
|
|
||||||
<DriverNotFound v-else />
|
<DriverNotFound v-else :trainId="props.trainId" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user