useTicketNumber.ts 706 B

1234567891011121314151617181920212223
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { storeToRefs } from 'pinia'
  3. import { computed, type Ref } from 'vue'
  4. import type { TicketById } from '#shared/entities/ticket/types.ts'
  5. import { useApplicationStore } from '#shared/stores/application.ts'
  6. export const useTicketNumber = (ticket: Ref<TicketById | undefined>) => {
  7. const ticketNumber = computed(() => ticket?.value?.number?.toString())
  8. const { config } = storeToRefs(useApplicationStore())
  9. const ticketNumberWithTicketHook = computed(
  10. () =>
  11. ticketNumber.value && `${config.value.ticket_hook}${ticketNumber.value}`,
  12. )
  13. return {
  14. ticketNumber,
  15. ticketNumberWithTicketHook,
  16. }
  17. }