TicketDetailTopBar.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import { useTouchDevice } from '#shared/composables/useTouchDevice.ts'
  5. import { useTicketChannel } from '#shared/entities/ticket/composables/useTicketChannel.ts'
  6. import { useTicketView } from '#shared/entities/ticket/composables/useTicketView.ts'
  7. import TopBarHeader from '#desktop/pages/ticket/components/TicketDetailView/TicketDetailTopBar/TopBarHeader.vue'
  8. import { useTicketInformation } from '#desktop/pages/ticket/composables/useTicketInformation.ts'
  9. interface Props {
  10. hideDetails: boolean
  11. }
  12. const { hideDetails } = defineProps<Props>()
  13. const isHovering = defineModel<boolean>('hover', {
  14. required: false,
  15. })
  16. const { ticket } = useTicketInformation()
  17. const { isTicketAgent, isTicketEditable } = useTicketView(ticket)
  18. const { hasChannelAlert, channelAlert } = useTicketChannel(ticket)
  19. const { isTouchDevice } = useTouchDevice()
  20. const events = computed(() => {
  21. if (isTouchDevice.value)
  22. return {
  23. touchstart() {
  24. isHovering.value = true
  25. },
  26. touchend() {
  27. isHovering.value = false
  28. },
  29. }
  30. return {
  31. mouseenter() {
  32. isHovering.value = true
  33. },
  34. mouseleave() {
  35. isHovering.value = false
  36. },
  37. }
  38. })
  39. </script>
  40. <template>
  41. <div
  42. v-if="isTicketAgent && isTicketEditable && hasChannelAlert"
  43. class="z-10"
  44. :tabindex="hideDetails ? 0 : -1"
  45. v-on="events"
  46. >
  47. <TopBarHeader :hide-details="hideDetails" />
  48. <CommonAlert
  49. class="rounded-none px-14 md:grid-cols-none md:justify-center"
  50. :variant="channelAlert?.variant"
  51. >
  52. {{ $t(channelAlert?.text, channelAlert?.textPlaceholder) }}
  53. </CommonAlert>
  54. </div>
  55. <TopBarHeader v-else :hide-details="hideDetails" v-on="events" />
  56. </template>