From ecf3a00cabdb55ddab9fa2355c1a98c443392f09 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 1 Oct 2022 15:55:10 +0200 Subject: [PATCH] =?UTF-8?q?Statystyki=20maszynist=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JournalView/DispatcherStats.vue | 32 +---- src/components/JournalView/DriverStats.vue | 126 +++++------------- .../JournalView/JournalTimetables.vue | 27 ++-- src/styles/JournalStats.scss | 42 ++++++ 4 files changed, 90 insertions(+), 137 deletions(-) create mode 100644 src/styles/JournalStats.scss diff --git a/src/components/JournalView/DispatcherStats.vue b/src/components/JournalView/DispatcherStats.vue index 2d30359..bd683fb 100644 --- a/src/components/JournalView/DispatcherStats.vue +++ b/src/components/JournalView/DispatcherStats.vue @@ -14,6 +14,7 @@

STATYSTYKI WYSTAWIONYCH ROZKŁADÓW

+
LICZBA @@ -162,42 +163,11 @@ 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; - left: 50%; - transform: translateX(-50%); - border-radius: 0 0 1em 1em; - } -} diff --git a/src/components/JournalView/DriverStats.vue b/src/components/JournalView/DriverStats.vue index 3802d1e..12d5fef 100644 --- a/src/components/JournalView/DriverStats.vue +++ b/src/components/JournalView/DriverStats.vue @@ -1,51 +1,40 @@ @@ -78,13 +67,9 @@ export default defineComponent({ }; }, - activated() { - this.fetchDispatcherStats(); - }, - watch: { - driverStatsName(value: any) { - console.log(value); + driverStatsName(value: string) { + this.fetchDispatcherStats(); }, }, @@ -92,57 +77,18 @@ export default defineComponent({ async fetchDispatcherStats() { this.store.driverStatsData = undefined; + if (!this.store.driverStatsName) return; + const statsData: DriverStatsAPIData = await ( await axios.get(`${URLs.stacjownikAPI}/api/getDriverInfo?name=${this.store.driverStatsName}`) ).data; - const recentTimetablesData: TimetableHistory[] = await ( - await axios.get(`${URLs.stacjownikAPI}/api/getTimetables?driverName=${this.store.driverStatsName}`) - ).data; - this.store.driverStatsData = statsData; - this.lastTimetables = recentTimetablesData || []; - }, - - closeCard() { - this.$emit('closeCard'); }, }, }); diff --git a/src/components/JournalView/JournalTimetables.vue b/src/components/JournalView/JournalTimetables.vue index c5f28c8..b332ed0 100644 --- a/src/components/JournalView/JournalTimetables.vue +++ b/src/components/JournalView/JournalTimetables.vue @@ -1,28 +1,22 @@