mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Poprawiono kartę ze statystykami dyżurnego
This commit is contained in:
+4
-6
@@ -31,9 +31,8 @@
|
|||||||
background: $bgCol;
|
background: $bgCol;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
overflow-y: scroll;
|
||||||
|
|
||||||
@include smallScreen() {
|
@include smallScreen() {
|
||||||
font-size: calc(0.4rem + 1.4vw);
|
font-size: calc(0.4rem + 1.4vw);
|
||||||
@@ -44,9 +43,8 @@
|
|||||||
.app_container {
|
.app_container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
|
height: 100vh;
|
||||||
min-width: 0;
|
min-height: 800px;
|
||||||
min-height: 100vh;
|
|
||||||
|
|
||||||
header {
|
header {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
@@ -97,7 +95,7 @@
|
|||||||
&_body {
|
&_body {
|
||||||
max-width: 21em;
|
max-width: 21em;
|
||||||
}
|
}
|
||||||
|
|
||||||
&_container {
|
&_container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@@ -1,46 +1,45 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="card-dimmer" @click="closeCard"></div>
|
<div class="stats_container" v-click-outside="() => (cardVisible = false)">
|
||||||
|
<button class="stats_button btn btn--option" @click="toggleCard">
|
||||||
|
Statystyki dyżurnego {{ store.dispatcherStatsName }}
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="stats-card card">
|
<div class="stats_card" v-if="store.dispatcherStatsName && cardVisible">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="card-title">
|
<Loading v-if="!store.dispatcherStatsData" />
|
||||||
STATYSTYKI DYŻURNEGO <span class="text--primary">{{ store.dispatcherStatsName.toUpperCase() }}</span>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div class="loading" v-if="!store.dispatcherStatsData">Ładowanie...</div>
|
<div class="loading" v-else-if="!store.dispatcherStatsData._count._all">
|
||||||
<div class="loading" v-else-if="!store.dispatcherStatsData._count._all">Ten dyżurny nie ma jeszcze szczegółowych statystyk!</div>
|
Ten dyżurny nie ma jeszcze szczegółowych statystyk!
|
||||||
<div v-else>
|
|
||||||
<h3>STATYSTYKI WYSTAWIONYCH ROZKŁADÓW</h3>
|
|
||||||
<div class="info-stats" v-if="store.dispatcherStatsData._count._all">
|
|
||||||
<span class="stat-badge">
|
|
||||||
<span>LICZBA</span>
|
|
||||||
<span>{{ store.dispatcherStatsData._count._all }}</span>
|
|
||||||
</span>
|
|
||||||
<span class="stat-badge">
|
|
||||||
<span>SUMA (KM)</span>
|
|
||||||
<span>{{ store.dispatcherStatsData._sum.routeDistance.toFixed(2) }}km</span>
|
|
||||||
</span>
|
|
||||||
<span class="stat-badge">
|
|
||||||
<span>NAJDŁUŻSZY</span>
|
|
||||||
<span>{{ store.dispatcherStatsData._max.routeDistance.toFixed(2) }}km</span>
|
|
||||||
</span>
|
|
||||||
<span class="stat-badge">
|
|
||||||
<span>ŚREDNIO</span>
|
|
||||||
<span>{{ store.dispatcherStatsData._avg.routeDistance.toFixed(2) }}km</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3>OSTATNIE WYSTAWIONE ROZKŁADY</h3>
|
<div v-else>
|
||||||
|
<h3>STATYSTYKI WYSTAWIONYCH ROZKŁADÓW</h3>
|
||||||
<div class="last-timetables">
|
<div class="info-stats" v-if="store.dispatcherStatsData._count._all">
|
||||||
<div class="timetable-row" v-for="timetable in timetables">
|
<span class="stat-badge">
|
||||||
<span>#{{ timetable.timetableId }}</span>
|
<span>LICZBA</span>
|
||||||
<span>{{ timetable.routeDistance }}km</span>
|
<span>{{ store.dispatcherStatsData._count._all }}</span>
|
||||||
<span>
|
|
||||||
<b>{{ timetable.trainNo }}</b
|
|
||||||
> {{ timetable.driverName }}
|
|
||||||
</span>
|
</span>
|
||||||
<span>{{ timetable.route.replace('|', ' > ') }}</span>
|
<span class="stat-badge">
|
||||||
|
<span>SUMA (KM)</span>
|
||||||
|
<span>{{ store.dispatcherStatsData._sum.routeDistance.toFixed(2) }}km</span>
|
||||||
|
</span>
|
||||||
|
<span class="stat-badge">
|
||||||
|
<span>NAJDŁUŻSZY</span>
|
||||||
|
<span>{{ store.dispatcherStatsData._max.routeDistance.toFixed(2) }}km</span>
|
||||||
|
</span>
|
||||||
|
<span class="stat-badge">
|
||||||
|
<span>ŚREDNIO</span>
|
||||||
|
<span>{{ store.dispatcherStatsData._avg.routeDistance.toFixed(2) }}km</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>OSTATNIE WYSTAWIONE ROZKŁADY</h3>
|
||||||
|
<div class="last-timetables">
|
||||||
|
<div class="timetable-row" v-for="timetable in timetables">
|
||||||
|
#{{ timetable.timetableId }} | <b>{{ timetable.trainCategoryCode }} {{ timetable.trainNo }}</b> |
|
||||||
|
{{ timetable.driverName }} ({{ timetable.routeDistance }}km)
|
||||||
|
<div>{{ timetable.route.replace('|', ' > ') }}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,9 +54,10 @@ import { URLs } from '@/scripts/utils/apiURLs';
|
|||||||
import { useStore } from '@/store/store';
|
import { useStore } from '@/store/store';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
import Loading from '../Global/Loading.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
emits: ['closeCard'],
|
components: { Loading },
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
@@ -65,21 +65,25 @@ export default defineComponent({
|
|||||||
store,
|
store,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
cardVisible: false,
|
||||||
lastDispatcherName: '',
|
lastDispatcherName: '',
|
||||||
timetables: [] as TimetableHistory[],
|
timetables: [] as TimetableHistory[],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
activated() {
|
|
||||||
this.fetchDispatcherStats();
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
toggleCard() {
|
||||||
|
if (!this.store.dispatcherStatsName) return;
|
||||||
|
|
||||||
|
this.cardVisible = !this.cardVisible;
|
||||||
|
if (this.cardVisible) this.fetchDispatcherStats();
|
||||||
|
},
|
||||||
|
|
||||||
async fetchDispatcherStats() {
|
async fetchDispatcherStats() {
|
||||||
this.store.dispatcherStatsData = undefined;
|
if (this.lastDispatcherName != this.store.dispatcherStatsName) {
|
||||||
|
this.store.dispatcherStatsData = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const statsData: DispatcherStatsAPIData = await (
|
const statsData: DispatcherStatsAPIData = await (
|
||||||
await axios.get(`${URLs.stacjownikAPI}/api/getDispatcherInfo?name=${this.store.dispatcherStatsName}`)
|
await axios.get(`${URLs.stacjownikAPI}/api/getDispatcherInfo?name=${this.store.dispatcherStatsName}`)
|
||||||
@@ -91,10 +95,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.timetables = timetables;
|
this.timetables = timetables;
|
||||||
this.store.dispatcherStatsData = statsData;
|
this.store.dispatcherStatsData = statsData;
|
||||||
},
|
this.lastDispatcherName = this.store.dispatcherStatsName;
|
||||||
|
|
||||||
closeCard() {
|
|
||||||
this.$emit('closeCard');
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -102,26 +103,90 @@ export default defineComponent({
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import '../../styles/responsive.scss';
|
@import '../../styles/responsive.scss';
|
||||||
|
@import '../../styles/variables.scss';
|
||||||
|
|
||||||
|
.stats_container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats_card {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 999;
|
||||||
|
top: 120%;
|
||||||
|
right: 0;
|
||||||
|
width: 500px;
|
||||||
|
max-width: 97vw;
|
||||||
|
min-height: 100px;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
border-radius: 1em 0 1em 1em;
|
||||||
|
background-color: #222222f1;
|
||||||
|
box-shadow: 0 3px 10px 5px #131313;
|
||||||
|
padding: 1em 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.last-timetables {
|
||||||
|
max-height: 400px;
|
||||||
|
margin: 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
.timetable-row {
|
.timetable-row {
|
||||||
display: grid;
|
width: 95%;
|
||||||
grid-template-columns: 1fr 1fr 3fr 4fr;
|
margin: 0.5em auto;
|
||||||
gap: 0.2em;
|
padding: 0.5em;
|
||||||
margin: 0.5em 0;
|
|
||||||
|
background-color: #4d4d4d;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2.card-title {
|
||||||
|
font-size: 1.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2,
|
||||||
|
h3 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-stats {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.last-timetables {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-badge {
|
||||||
|
margin-right: 0.5em;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
min-width: 100px;
|
padding: 0.25em 0.3em;
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
|
|
||||||
background-color: #4d4d4d;
|
|
||||||
padding: 0.5em 0.2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@include smallScreen() {
|
span:first-child {
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
background-color: #4d4d4d;
|
background-color: #4d4d4d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span:last-child {
|
||||||
|
background-color: $accentCol;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include smallScreen() {
|
||||||
|
.stats_card {
|
||||||
|
text-align: center;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
border-radius: 0 0 1em 1em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="journal-timetables">
|
<section class="journal-timetables">
|
||||||
<keep-alive>
|
|
||||||
<DispatcherStats v-if="statsCardOpen" @close-card="closeDispatcherStatsCard" />
|
|
||||||
</keep-alive>
|
|
||||||
|
|
||||||
<div class="journal-wrapper">
|
<div class="journal-wrapper">
|
||||||
<div class="journal_top-bar">
|
<div class="journal_top-bar">
|
||||||
<journal-options
|
<JournalOptions
|
||||||
@on-filter-change="search"
|
@on-filter-change="search"
|
||||||
@on-input-change="search"
|
@on-input-change="search"
|
||||||
@on-sorter-change="search"
|
@on-sorter-change="search"
|
||||||
:sorter-option-ids="['timestampFrom', 'duration']"
|
:sorter-option-ids="['timestampFrom', 'duration']"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<button
|
<DispatcherStats />
|
||||||
|
|
||||||
|
<!-- <button
|
||||||
class="btn btn--option"
|
class="btn btn--option"
|
||||||
:disabled="store.dispatcherStatsName == ''"
|
:disabled="store.dispatcherStatsName == ''"
|
||||||
@click="() => (statsCardOpen = !statsCardOpen)"
|
@click="() => (statsCardOpen = !statsCardOpen)"
|
||||||
@@ -22,7 +20,7 @@
|
|||||||
Statystyki dyżurnego <b>{{ store.dispatcherStatsName }}</b>
|
Statystyki dyżurnego <b>{{ store.dispatcherStatsName }}</b>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>Statystyki dyżurnego niedostępne</span>
|
<span v-else>Statystyki dyżurnego niedostępne</span>
|
||||||
</button>
|
</button> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
<!-- <button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
||||||
@@ -221,7 +219,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
activated() {
|
activated() {
|
||||||
if (this.sceneryName || this.dispatcherName) {
|
if (this.sceneryName || this.dispatcherName) {
|
||||||
this.searchersValues[1].value = this.sceneryName?.toString() || '';
|
this.searchersValues[1].value = this.sceneryName?.toString() || '';
|
||||||
this.searchersValues[0].value = this.dispatcherName?.toString() || '';
|
this.searchersValues[0].value = this.dispatcherName?.toString() || '';
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button.btn {
|
button.btn {
|
||||||
@@ -61,5 +60,6 @@ button.btn {
|
|||||||
|
|
||||||
.journal_top-bar {
|
.journal_top-bar {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,12 @@
|
|||||||
|
|
||||||
html {
|
html {
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
width: 100vw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
// font-family: "Open Sans", sans-serif;
|
padding: 0;
|
||||||
font-family: 'Quicksand', sans-serif;
|
font-family: 'Quicksand', sans-serif;
|
||||||
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*:focus-visible {
|
*:focus-visible {
|
||||||
|
|||||||
@@ -50,11 +50,7 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
@import '../styles/card.scss';
|
|
||||||
@import '../styles/variables.scss';
|
|
||||||
@import '../styles/responsive.scss';
|
|
||||||
|
|
||||||
.journal-type-options {
|
.journal-type-options {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -79,72 +75,4 @@ export default defineComponent({
|
|||||||
.router-link.active {
|
.router-link.active {
|
||||||
color: gold;
|
color: gold;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stats cards
|
|
||||||
.stats-card {
|
|
||||||
padding: 1em;
|
|
||||||
max-width: 850px;
|
|
||||||
width: 100vw;
|
|
||||||
max-height: 750px;
|
|
||||||
min-height: 600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading {
|
|
||||||
font-size: 1.4em;
|
|
||||||
padding: 0.6em;
|
|
||||||
text-align: center;
|
|
||||||
margin: 1em 0 400px 0;
|
|
||||||
|
|
||||||
background-color: #4d4d4d;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2.card-title {
|
|
||||||
font-size: 1.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2,
|
|
||||||
h3 {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-stats {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.last-timetables {
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-badge {
|
|
||||||
margin-right: 0.5em;
|
|
||||||
padding-bottom: 1em;
|
|
||||||
|
|
||||||
span {
|
|
||||||
padding: 0.25em 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
span:first-child {
|
|
||||||
background-color: #4d4d4d;
|
|
||||||
}
|
|
||||||
|
|
||||||
span:last-child {
|
|
||||||
background-color: $accentCol;
|
|
||||||
color: black;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include smallScreen() {
|
|
||||||
.stats-card {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user