TicketItem.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed, toRef } from 'vue'
  4. import CommonTicketStateIndicator from '@shared/components/CommonTicketStateIndicator/CommonTicketStateIndicator.vue'
  5. import CommonTicketPriorityIndicator from '@shared/components/CommonTicketPriorityIndicator/CommonTicketPriorityIndicator.vue'
  6. import { useEditedBy } from '@mobile/composables/useEditedBy'
  7. import { type TicketItemData } from './types'
  8. export interface Props {
  9. entity: TicketItemData
  10. }
  11. const props = defineProps<Props>()
  12. const { stringUpdated } = useEditedBy(toRef(props, 'entity'))
  13. const customer = computed(() => {
  14. const { customer } = props.entity
  15. if (!customer) return ''
  16. const { fullname } = customer
  17. if (fullname === '-') return ''
  18. return fullname
  19. })
  20. </script>
  21. <template>
  22. <div class="flex cursor-pointer ltr:pr-3 rtl:pl-3">
  23. <div class="flex w-14 items-center justify-center">
  24. <!-- TODO label? -->
  25. <CommonTicketStateIndicator :status="entity.state.name" label="" />
  26. </div>
  27. <div
  28. class="flex flex-1 items-center gap-1 overflow-hidden border-b border-white/10 py-3 text-gray-100 ltr:pr-2 rtl:pl-2"
  29. >
  30. <div class="flex-1 overflow-hidden text-ellipsis whitespace-nowrap">
  31. <span>
  32. #{{ entity.number }}
  33. <template v-if="customer">
  34. ·
  35. {{ customer }}
  36. </template>
  37. </span>
  38. <span
  39. class="mb-1 whitespace-normal text-lg font-bold leading-5 line-clamp-3"
  40. >
  41. <slot>
  42. {{ entity.title }}
  43. </slot>
  44. </span>
  45. <div
  46. v-if="stringUpdated"
  47. data-test-id="stringUpdated"
  48. class="overflow-hidden text-ellipsis text-gray"
  49. >
  50. {{ stringUpdated }}
  51. </div>
  52. </div>
  53. <CommonTicketPriorityIndicator :priority="entity.priority" />
  54. </div>
  55. </div>
  56. </template>