Subheader.vue 3.0 KB

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