CommonTicketPriorityIndicator.vue 984 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import type { TicketPriority } from './types.ts'
  5. export interface Props {
  6. priority?: TicketPriority
  7. }
  8. const props = defineProps<Props>()
  9. const priorityClass = computed(() => {
  10. if (!props.priority || props.priority.defaultCreate) return null
  11. switch (props.priority.uiColor) {
  12. case 'high-priority':
  13. return 'bg-red-dark text-red-bright'
  14. case 'low-priority':
  15. return 'bg-blue-highlight text-blue'
  16. default:
  17. return 'bg-gray-highlight text-gray'
  18. }
  19. })
  20. const priorityText = computed(() => {
  21. if (!props.priority || props.priority.defaultCreate) return null
  22. return props.priority.name
  23. })
  24. </script>
  25. <template>
  26. <div
  27. v-if="priorityText"
  28. :class="priorityClass"
  29. class="leading-2 select-none whitespace-nowrap rounded px-2 py-1 text-xs uppercase"
  30. >
  31. {{ $t(priorityText) }}
  32. </div>
  33. </template>