CommonTicketStateIndicator.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import { EnumTicketStateColorCode } from '#shared/graphql/types.ts'
  5. import CommonTicketStateIndicatorIcon from '../CommonTicketStateIndicatorIcon/CommonTicketStateIndicatorIcon.vue'
  6. export interface Props {
  7. colorCode: EnumTicketStateColorCode
  8. label: string
  9. }
  10. const props = defineProps<Props>()
  11. const badgeVariant = computed(() => {
  12. switch (props.colorCode) {
  13. case EnumTicketStateColorCode.Closed:
  14. return 'success'
  15. case EnumTicketStateColorCode.Pending:
  16. return 'tertiary'
  17. case EnumTicketStateColorCode.Escalating:
  18. return 'danger'
  19. case EnumTicketStateColorCode.Open:
  20. default:
  21. return 'warning'
  22. }
  23. })
  24. </script>
  25. <template>
  26. <CommonBadge :variant="badgeVariant" role="group" class="uppercase">
  27. <CommonTicketStateIndicatorIcon
  28. class="ltr:mr-1.5 rtl:ml-1.5"
  29. :color-code="props.colorCode"
  30. :label="label"
  31. />
  32. {{ $t(label) }}
  33. </CommonBadge>
  34. </template>