TicketItem.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!-- Copyright (C) 2012-2024 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.ts'
  7. import { type TicketItemData } from './types.ts'
  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. <CommonTicketStateIndicator
  25. :color-code="entity.stateColorCode"
  26. :label="entity.state.name"
  27. />
  28. </div>
  29. <div
  30. 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"
  31. >
  32. <div class="flex-1 truncate">
  33. <span>
  34. #{{ entity.number }}
  35. <template v-if="customer">
  36. ·
  37. {{ customer }}
  38. </template>
  39. </span>
  40. <span
  41. class="mb-1 line-clamp-3 whitespace-normal text-lg font-bold leading-5"
  42. >
  43. <slot>
  44. {{ entity.title }}
  45. </slot>
  46. </span>
  47. <div
  48. v-if="stringUpdated"
  49. data-test-id="stringUpdated"
  50. class="truncate text-gray"
  51. >
  52. {{ stringUpdated }}
  53. </div>
  54. </div>
  55. <CommonTicketPriorityIndicator :priority="entity.priority" />
  56. </div>
  57. </div>
  58. </template>