Subheader.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 class="d-flex flex-row align-center mr-6" :flat="true" tile>
  16. <LayoutSubHeaderActivityYear
  17. v-if="smAndUp && !showDateTimeRange"
  18. class="activity-year"
  19. />
  20. <div
  21. v-if="hasMenuOrIsTeacher"
  22. class="d-flex flex-row align-center h-100"
  23. >
  24. <LayoutSubHeaderDataTiming
  25. v-if="smAndUp && !showDateTimeRange"
  26. class="data-timing ml-2"
  27. />
  28. <LayoutSubHeaderDataTimingRange
  29. v-if="smAndUp && showDateTimeRange"
  30. class="data-timing-range ml-n1"
  31. />
  32. <v-btn
  33. v-if="smAndUp"
  34. ref="btn"
  35. class="switch-btn ml-1 theme-neutral-soft"
  36. height="22"
  37. min-height="22"
  38. max-height="22"
  39. width="25"
  40. min-width="25"
  41. max-width="25"
  42. elevation="0"
  43. @click="showDateTimeRange = !showDateTimeRange"
  44. >
  45. <v-icon
  46. icon="fas fa-history"
  47. class="font-weight-normal"
  48. style="font-size: 14px"
  49. />
  50. </v-btn>
  51. <v-tooltip location="bottom" :activator="btn">
  52. <span>{{ $t('history_help') }}</span>
  53. </v-tooltip>
  54. <LayoutSubHeaderPersonnalizedList
  55. class="personalized-list ml-2 d-flex align-center"
  56. />
  57. </div>
  58. </v-card>
  59. </v-card>
  60. </main>
  61. </template>
  62. <script setup lang="ts">
  63. import { useAccessProfileStore } from '~/stores/accessProfile'
  64. import { computed, ref } from '@vue/reactivity'
  65. import type { ComputedRef, Ref } from '@vue/reactivity'
  66. import { useMenu } from '~/composables/layout/useMenu'
  67. import { useDisplay } from 'vuetify'
  68. const { smAndUp, lgAndUp } = useDisplay()
  69. const accessProfile = useAccessProfileStore()
  70. const { hasMenu } = useMenu()
  71. const btn: Ref = ref(null)
  72. const hasMenuOrIsTeacher: ComputedRef<boolean> = computed(
  73. () => hasMenu('Main') || (accessProfile.isTeacher ?? false),
  74. )
  75. const showDateTimeRange: Ref<boolean> = ref(
  76. Object.hasOwn(accessProfile.historical, 'dateStart') &&
  77. accessProfile.historical.dateStart !== null &&
  78. Object.hasOwn(accessProfile.historical, 'dateEnd') &&
  79. accessProfile.historical.dateEnd !== null,
  80. )
  81. </script>
  82. <style scoped lang="scss">
  83. main {
  84. font-size: 13px;
  85. }
  86. #subheader {
  87. max-height: 36px;
  88. }
  89. :deep(#subheader .v-card) {
  90. max-height: 36px;
  91. background-color: transparent !important;
  92. }
  93. .switch-btn {
  94. border-width: 1px;
  95. border-style: solid;
  96. }
  97. </style>