Subheader.vue 3.0 KB

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