You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.5 KiB

  1. <template>
  2. <v-row v-if="stats">
  3. <v-col
  4. cols="12"
  5. lg="4"
  6. >
  7. <v-card>
  8. <doughnut-chart
  9. :chart-data="progressLocale()"
  10. />
  11. </v-card>
  12. </v-col>
  13. <v-col
  14. cols="12"
  15. lg="4"
  16. >
  17. <v-card>
  18. <bar-chart
  19. :chart-data="labelStatsLocale()"
  20. />
  21. </v-card>
  22. </v-col>
  23. <v-col
  24. cols="12"
  25. lg="4"
  26. >
  27. <v-card>
  28. <bar-chart
  29. :chart-data="userStatsLocale()"
  30. />
  31. </v-card>
  32. </v-col>
  33. </v-row>
  34. </template>
  35. <script>
  36. import { mapActions, mapGetters, mapState } from 'vuex'
  37. import DoughnutChart from '@/components/molecules/DoughnutChart'
  38. import BarChart from '@/components/molecules/BarChart'
  39. export default {
  40. layout: 'project',
  41. components: {
  42. DoughnutChart,
  43. BarChart
  44. },
  45. computed: {
  46. ...mapGetters('statistics', ['userStats', 'labelStats', 'progress']),
  47. ...mapState('statistics', ['stats'])
  48. },
  49. async created() {
  50. await this.fetchStatistics({
  51. projectId: this.$route.params.id
  52. })
  53. },
  54. methods: {
  55. ...mapActions('statistics', ['fetchStatistics']),
  56. progressLocale() {
  57. return this.progress(this.$t('statistics.progress'))
  58. },
  59. labelStatsLocale() {
  60. return this.labelStats(this.$t('statistics.labelStats'))
  61. },
  62. userStatsLocale() {
  63. return this.userStats(this.$t('statistics.userStats'))
  64. }
  65. },
  66. validate({ params }) {
  67. return /^\d+$/.test(params.id)
  68. }
  69. }
  70. </script>