useTicketView.ts 677 B

1234567891011121314151617
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { computed, type Ref } from 'vue'
  3. import type { TicketById } from '#shared/entities/ticket/types.ts'
  4. import { getTicketView } from '../utils/getTicketView.ts'
  5. export const useTicketView = (ticket: Ref<TicketById | undefined>) => {
  6. const view = computed(() => ticket.value && getTicketView(ticket.value))
  7. const isTicketEditable = computed(() => !!view.value?.isTicketEditable)
  8. const isTicketCustomer = computed(() => !!view.value?.isTicketCustomer)
  9. const isTicketAgent = computed(() => !!view.value?.isTicketAgent)
  10. return { isTicketAgent, isTicketCustomer, isTicketEditable }
  11. }