mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
feat: driver train view
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<section class="driver-view">
|
||||
<div class="content">
|
||||
<div v-if="chosenTrain">
|
||||
<TrainInfo :train="chosenTrain" :extended="true" ref="trainInfo" />
|
||||
<TrainSchedule :train="chosenTrain" tabindex="0" />
|
||||
</div>
|
||||
|
||||
<Loading v-else-if="apiStore.dataStatuses.connection == Status.Data.Loading" />
|
||||
|
||||
<div v-else>Ups! Nie ma takiego pociągu</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import TrainInfo from '../components/TrainsView/TrainInfo.vue';
|
||||
import TrainSchedule from '../components/TrainsView/TrainSchedule.vue';
|
||||
import Loading from '../components/Global/Loading.vue';
|
||||
import { useMainStore } from '../store/mainStore';
|
||||
import { useApiStore } from '../store/apiStore';
|
||||
import { Status } from '../typings/common';
|
||||
|
||||
const props = defineProps({
|
||||
trainId: {
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
const mainStore = useMainStore();
|
||||
const apiStore = useApiStore();
|
||||
const chosenTrain = computed(() => mainStore.trainList.find((train) => train.id == props.trainId));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../styles/variables.scss';
|
||||
|
||||
.driver-view {
|
||||
padding: 1em 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
background-color: #1a1a1a;
|
||||
}
|
||||
</style>
|
||||
@@ -40,7 +40,6 @@ import { defineComponent, provide, reactive, Ref, ref } from 'vue';
|
||||
|
||||
import dateMixin from '../mixins/dateMixin';
|
||||
import routerMixin from '../mixins/routerMixin';
|
||||
import modalTrainMixin from '../mixins/modalTrainMixin';
|
||||
|
||||
import JournalOptions from '../components/JournalView/JournalOptions.vue';
|
||||
import JournalStats from '../components/JournalView/JournalStats.vue';
|
||||
@@ -148,7 +147,7 @@ export default defineComponent({
|
||||
JournalHeader,
|
||||
JournalTimetablesList
|
||||
},
|
||||
mixins: [dateMixin, routerMixin, modalTrainMixin],
|
||||
mixins: [dateMixin, routerMixin],
|
||||
|
||||
name: 'JournalTimetables',
|
||||
|
||||
@@ -462,7 +461,7 @@ export default defineComponent({
|
||||
this.timetableHistory = responseData;
|
||||
|
||||
// Stats display
|
||||
this.store.driverStatsName =
|
||||
this.mainStore.driverStatsName =
|
||||
this.timetableHistory.length > 0 && this.searchersValues['search-driver'].trim()
|
||||
? this.timetableHistory[0].driverName
|
||||
: '';
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
import { computed, ComputedRef, defineComponent, provide, reactive, ref, watch } from 'vue';
|
||||
import TrainOptions from '../components/TrainsView/TrainOptions.vue';
|
||||
import TrainTable from '../components/TrainsView/TrainTable.vue';
|
||||
import modalTrainMixin from '../mixins/modalTrainMixin';
|
||||
import { useMainStore } from '../store/mainStore';
|
||||
import { TrainFilter, trainFilters } from '../components/TrainsView/typings';
|
||||
import { filteredTrainList } from '../managers/trainFilterManager';
|
||||
@@ -33,8 +32,6 @@ export default defineComponent({
|
||||
TrainStats
|
||||
},
|
||||
|
||||
mixins: [modalTrainMixin],
|
||||
|
||||
props: {
|
||||
train: {
|
||||
type: String,
|
||||
@@ -106,12 +103,6 @@ export default defineComponent({
|
||||
this.searchedTrain = this.train;
|
||||
this.searchedDriver = this.driver || '';
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (this.trainId) {
|
||||
this.selectModalTrainById(this.trainId);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user