ticket.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { useConfirmation } from '#shared/composables/useConfirmation.ts'
  3. import { TicketTaskbarTabAttributesFragmentDoc } from '#shared/entities/ticket/graphql/fragments/ticketTaskbarTabAttributes.api.ts'
  4. import {
  5. EnumTaskbarEntity,
  6. type Ticket as TicketType,
  7. } from '#shared/graphql/types.ts'
  8. import type { UserTaskbarTabPlugin } from '#desktop/components/UserTaskbarTabs/types.ts'
  9. import Ticket from '../Ticket/Ticket.vue'
  10. const entityType = 'Ticket'
  11. export default <UserTaskbarTabPlugin>{
  12. type: EnumTaskbarEntity.TicketZoom,
  13. component: Ticket,
  14. entityType,
  15. entityDocument: TicketTaskbarTabAttributesFragmentDoc,
  16. buildEntityTabKey: (entityInternalId: string) =>
  17. `${entityType}-${entityInternalId}`,
  18. buildTaskbarTabParams: (entityInternalId: string) => {
  19. return {
  20. ticket_id: entityInternalId,
  21. }
  22. },
  23. buildTaskbarTabLink: (entity?: TicketType) => {
  24. if (!entity?.internalId) return
  25. return `/tickets/${entity.internalId}`
  26. },
  27. confirmTabRemove: async (dirty?: boolean) => {
  28. if (!dirty) return true
  29. const { waitForVariantConfirmation } = useConfirmation()
  30. return waitForVariantConfirmation('unsaved')
  31. },
  32. }