TicketEscalationTimeMenuItem.vue 1018 B

1234567891011121314151617181920212223242526272829303132333435
  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. import CommonSectionMenuItem from '#mobile/components/CommonSectionMenu/CommonSectionMenuItem.vue'
  10. const props = defineProps<{
  11. label: string
  12. escalationAt?: Maybe<Scalars['ISO8601DateTime']['output']>
  13. }>()
  14. const escalationState = useEscalationState(toRef(() => props.escalationAt))
  15. </script>
  16. <template>
  17. <CommonSectionMenuItem
  18. v-if="escalationAt && escalationState !== EscalationState.None"
  19. :class="{
  20. 'text-red-bright bg-red-highlight':
  21. escalationState === EscalationState.Escalated,
  22. 'text-yellow bg-yellow-highlight':
  23. escalationState === EscalationState.Warning,
  24. }"
  25. :label="label"
  26. >
  27. {{ i18n.relativeDateTime(escalationAt) }}
  28. </CommonSectionMenuItem>
  29. </template>