TicketOverviewEditItem.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. :draggable="draggable ? 'true' : undefined"
  31. >
  32. <div
  33. class="ms-3 shrink-0 cursor-pointer items-center justify-center ltr:mr-2 rtl:ml-2"
  34. :class="icon.class"
  35. role="button"
  36. tabindex="0"
  37. @keydown.enter="emit('action')"
  38. @click="emit('action')"
  39. >
  40. <CommonIcon :name="icon.name" size="base" />
  41. </div>
  42. <div class="flex-1">
  43. {{ $t(overview.name) }}
  44. </div>
  45. <CommonIcon
  46. v-if="draggable"
  47. name="change-order"
  48. size="small"
  49. class="handler text-gray shrink-0 cursor-move ltr:mr-4 rtl:ml-4"
  50. />
  51. </div>
  52. </template>