mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Informacja o statystykach
This commit is contained in:
@@ -1,56 +1,67 @@
|
||||
<template>
|
||||
<section class="daily-stats">
|
||||
<i18n-t keypath="journal.timetable-stats-total" tag="p">
|
||||
<template #count>
|
||||
<b class="text--primary">
|
||||
{{ data.stats.totalTimetables }}
|
||||
{{ $t('journal.timetable-count', data.stats.dispatcherTimetablesCount) }}
|
||||
</b>
|
||||
</template>
|
||||
<span :data-active="data.statsStatus">
|
||||
<b v-if="data.stats.distanceSum == null">
|
||||
{{ $t('journal.daily-stats-info') }}
|
||||
</b>
|
||||
|
||||
<template #distance>
|
||||
<b class="text--primary"> {{ data.stats.distanceSum }} km </b>
|
||||
</template>
|
||||
</i18n-t>
|
||||
<span v-else>
|
||||
<i18n-t keypath="journal.timetable-stats-total" tag="p">
|
||||
<template #count>
|
||||
<b class="text--primary">
|
||||
{{ data.stats.totalTimetables }}
|
||||
{{ $t('journal.timetable-count', data.stats.dispatcherTimetablesCount) }}
|
||||
</b>
|
||||
</template>
|
||||
|
||||
<i18n-t keypath="journal.timetable-stats-longest" tag="p">
|
||||
<template #id>
|
||||
<b>{{ data.stats.timetableId }}</b>
|
||||
</template>
|
||||
<template #author>
|
||||
<b>{{ data.stats.timetableAuthor }}</b>
|
||||
</template>
|
||||
<template #driver>
|
||||
<b>{{ data.stats.timetableDriver }}</b>
|
||||
</template>
|
||||
<template #distance>
|
||||
<b class="text--primary">{{ data.stats.timetableRouteDistance }} km</b>
|
||||
</template>
|
||||
</i18n-t>
|
||||
<template #distance>
|
||||
<b class="text--primary"> {{ data.stats.distanceSum }} km </b>
|
||||
</template>
|
||||
</i18n-t>
|
||||
|
||||
<i18n-t keypath="journal.timetable-stats-most-active" tag="p">
|
||||
<template #dispatcher>
|
||||
<b>{{ data.stats.dispatcherName }}</b>
|
||||
</template>
|
||||
<template #count>
|
||||
<b class="text--primary">
|
||||
{{ data.stats.dispatcherTimetablesCount }}
|
||||
{{ $t('journal.timetable-count', data.stats.dispatcherTimetablesCount) }}
|
||||
</b>
|
||||
</template>
|
||||
</i18n-t>
|
||||
<i18n-t keypath="journal.timetable-stats-longest" tag="p">
|
||||
<template #id>
|
||||
<b>{{ data.stats.timetableId }}</b>
|
||||
</template>
|
||||
<template #author>
|
||||
<b>{{ data.stats.timetableAuthor }}</b>
|
||||
</template>
|
||||
<template #driver>
|
||||
<b>{{ data.stats.timetableDriver }}</b>
|
||||
</template>
|
||||
<template #distance>
|
||||
<b class="text--primary">{{ data.stats.timetableRouteDistance }} km</b>
|
||||
</template>
|
||||
</i18n-t>
|
||||
|
||||
<i18n-t keypath="journal.timetable-stats-most-active" tag="p">
|
||||
<template #dispatcher>
|
||||
<b>{{ data.stats.dispatcherName }}</b>
|
||||
</template>
|
||||
<template #count>
|
||||
<b class="text--primary">
|
||||
{{ data.stats.dispatcherTimetablesCount }}
|
||||
{{ $t('journal.timetable-count', data.stats.dispatcherTimetablesCount) }}
|
||||
</b>
|
||||
</template>
|
||||
</i18n-t>
|
||||
</span>
|
||||
</span>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import axios from 'axios';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import { ITimetablesDailyStats, ITimetablesDailyStatsResponse } from '../../scripts/interfaces/api/StatsAPIData';
|
||||
import { URLs } from '../../scripts/utils/apiURLs';
|
||||
|
||||
const intervalId = ref(-1);
|
||||
|
||||
const data = reactive({
|
||||
statsStatus: DataStatus.Loading,
|
||||
|
||||
stats: {
|
||||
totalTimetables: 0,
|
||||
distanceSum: 0,
|
||||
@@ -87,8 +98,11 @@ async function fetchDailyTimetableStats() {
|
||||
dispatcherName: mostActiveDispatcher?.name || '',
|
||||
dispatcherTimetablesCount: mostActiveDispatcher?.count || 0,
|
||||
};
|
||||
|
||||
data.statsStatus = DataStatus.Loaded;
|
||||
} catch (error) {
|
||||
console.error('Ups! Wystąpił błąd podczas pobierania statystyk rozkładów jazdy...');
|
||||
data.statsStatus = DataStatus.Error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,5 +121,9 @@ defineExpose({
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
.daily-stats > span[data-active='0'] {
|
||||
opacity: 0.75;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user