TicketOverviewEditItem.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!-- Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import { TicketOverview } from '../stores/ticketOverviews'
  5. const props = defineProps<{
  6. action: 'add' | 'delete'
  7. draggable?: boolean
  8. overview: TicketOverview
  9. }>()
  10. const emit = defineEmits<{
  11. (e: 'action'): void
  12. }>()
  13. const icon = computed(() => {
  14. if (props.action === 'add') {
  15. return {
  16. name: 'plus-small',
  17. class: 'bg-green',
  18. }
  19. }
  20. return {
  21. name: 'minus-small',
  22. class: 'bg-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="flex h-5 w-5 cursor-pointer items-center justify-center rounded-full text-gray-500 ltr:mr-2 rtl:ml-2"
  33. :class="icon.class"
  34. @click="emit('action')"
  35. >
  36. <CommonIcon :name="icon.name" size="tiny" />
  37. </div>
  38. <div class="flex-1">
  39. {{ $t(overview.name) }}
  40. </div>
  41. <CommonIcon
  42. v-if="draggable"
  43. name="draggable"
  44. size="small"
  45. class="handler cursor-move text-white/30 ltr:mr-4 rtl:ml-4"
  46. />
  47. </div>
  48. </template>