Subheader.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!--
  2. Second header de l'application
  3. Contient entre autres le breadcrumb, les commandes de changement d'année et les listes personnalisées
  4. -->
  5. <template>
  6. <main>
  7. <v-card
  8. id="subheader"
  9. class="d-flex theme-neutral text-body-2 px-2"
  10. :flat="true"
  11. rounded="0"
  12. >
  13. <LayoutSubHeaderBreadcrumbs v-if="lgAndUp" class="mr-auto d-flex" />
  14. <span class="flex-fill" />
  15. <v-card
  16. class="d-flex flex-row align-center mr-6"
  17. :flat="true"
  18. tile
  19. >
  20. <LayoutSubHeaderActivityYear v-if="smAndUp && !showDateTimeRange" class="activity-year" />
  21. <div v-if="hasMenuOrIsTeacher" class="d-flex flex-row align-center h-100">
  22. <LayoutSubHeaderDataTiming
  23. v-if="smAndUp && !showDateTimeRange"
  24. class="data-timing ml-2"
  25. />
  26. <LayoutSubHeaderDataTimingRange
  27. v-if="smAndUp && showDateTimeRange"
  28. class="data-timing-range ml-n1"
  29. />
  30. <v-btn
  31. v-if="smAndUp"
  32. ref="btn"
  33. class="switch-btn ml-1 theme-neutral-soft"
  34. height="22" min-height="22" max-height="22"
  35. width="25" min-width="25" max-width="25"
  36. elevation="0"
  37. @click="showDateTimeRange = !showDateTimeRange"
  38. >
  39. <v-icon icon="fas fa-history" class="font-weight-normal" style="font-size: 14px;" />
  40. </v-btn>
  41. <v-tooltip location="bottom" :activator="btn">
  42. <span>{{ $t('history_help') }}</span>
  43. </v-tooltip>
  44. <LayoutSubHeaderPersonnalizedList class="personalized-list ml-2 d-flex align-center" />
  45. </div>
  46. </v-card>
  47. </v-card>
  48. </main>
  49. </template>
  50. <script setup lang="ts">
  51. import {useAccessProfileStore} from "~/stores/accessProfile";
  52. import {computed, ref} from "@vue/reactivity";
  53. import type {ComputedRef, Ref} from "@vue/reactivity";
  54. import {useMenu} from "~/composables/layout/useMenu";
  55. import {useDisplay} from "vuetify";
  56. const { smAndUp, lgAndUp } = useDisplay()
  57. const accessProfile = useAccessProfileStore()
  58. const { hasMenu } = useMenu()
  59. const btn: Ref = ref(null)
  60. const hasMenuOrIsTeacher: ComputedRef<boolean> = computed(
  61. () => hasMenu('Main') || (accessProfile.isTeacher ?? false)
  62. )
  63. const showDateTimeRange: Ref<boolean> = ref(
  64. Object.hasOwn(accessProfile.historical, 'dateStart') && accessProfile.historical.dateStart !== null &&
  65. Object.hasOwn(accessProfile.historical, 'dateEnd') && accessProfile.historical.dateEnd !== null
  66. )
  67. </script>
  68. <style scoped lang="scss">
  69. main {
  70. font-size: 12px;
  71. }
  72. #subheader {
  73. max-height: 36px;
  74. }
  75. :deep(#subheader .v-card) {
  76. max-height: 36px;
  77. background-color: transparent !important;
  78. }
  79. .switch-btn {
  80. border-width: 1px;
  81. border-style: solid;
  82. }
  83. </style>