CommonTicketEscalationIndicator.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { toRef } from 'vue'
  4. import {
  5. useEscalationState,
  6. EscalationState,
  7. } from '#shared/composables/useEscalationState.ts'
  8. import type { Scalars } from '#shared/graphql/types.ts'
  9. export interface Props {
  10. escalationAt?: Maybe<Scalars['ISO8601DateTime']['output']>
  11. }
  12. const props = defineProps<Props>()
  13. const escalationState = useEscalationState(toRef(() => props.escalationAt))
  14. </script>
  15. <template>
  16. <div
  17. v-if="escalationState !== EscalationState.None"
  18. :class="{
  19. 'bg-red-dark text-red-bright':
  20. escalationState === EscalationState.Escalated,
  21. 'bg-yellow-highlight text-yellow':
  22. escalationState === EscalationState.Warning,
  23. }"
  24. class="flex select-none items-center rounded bg-gray-100 py-1 text-black ltr:pl-1 ltr:pr-1.5 rtl:pl-1.5 rtl:pr-1"
  25. role="alert"
  26. >
  27. <CommonIcon name="ticket-escalating" size="tiny" decorative />
  28. <div
  29. v-if="escalationAt"
  30. class="text-xs uppercase leading-[14px] ltr:ml-[2px] rtl:mr-[2px]"
  31. >
  32. {{ $t('escalation %s', i18n.relativeDateTime(escalationAt)) }}
  33. </div>
  34. </div>
  35. </template>