TicketOverviewEditItem.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import type { TicketOverview } from '#mobile/entities/ticket/stores/ticketOverviews.ts'
  5. const props = defineProps<{
  6. action: 'add' | 'delete'
  7. draggable?: boolean
  8. overview: TicketOverview
  9. }>()
  10. const emit = defineEmits<{
  11. action: []
  12. }>()
  13. const icon = computed(() => {
  14. if (props.action === 'add') {
  15. return {
  16. name: 'plus',
  17. class: 'text-green',
  18. }
  19. }
  20. return {
  21. name: 'minus',
  22. class: 'text-red',
  23. }
  24. })
  25. </script>
  26. <template>
  27. <div
  28. class="flex min-h-[54px] items-center border-b border-gray-300 last:border-0"
  29. data-test-id="overviewItem"
  30. >
  31. <div
  32. class="shrink-0 cursor-pointer items-center justify-center ltr:mr-2 rtl:ml-2"
  33. :class="icon.class"
  34. role="button"
  35. tabindex="0"
  36. @keydown.enter="emit('action')"
  37. @click="emit('action')"
  38. >
  39. <CommonIcon :name="icon.name" size="base" />
  40. </div>
  41. <div class="flex-1">
  42. {{ $t(overview.name) }}
  43. </div>
  44. <CommonIcon
  45. v-if="draggable"
  46. name="change-order"
  47. size="small"
  48. class="handler text-gray shrink-0 cursor-move ltr:mr-4 rtl:ml-4"
  49. />
  50. </div>
  51. </template>