ticketCreate.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { useConfirmation } from '#shared/composables/useConfirmation.ts'
  3. import { EnumTaskbarEntity } from '#shared/graphql/types.ts'
  4. import type { ObjectWithUid } from '#shared/types/utils.ts'
  5. import type { UserTaskbarTabPlugin } from '#desktop/components/UserTaskbarTabs/types.ts'
  6. import TicketCreate from '../Ticket/TicketCreate.vue'
  7. export default <UserTaskbarTabPlugin>{
  8. type: EnumTaskbarEntity.TicketCreate,
  9. component: TicketCreate,
  10. buildEntityTabKey: (entityInternalId: string) =>
  11. `TicketCreateScreen-${entityInternalId}`,
  12. buildTaskbarTabParams: (entityInternalId: string) => {
  13. return {
  14. id: entityInternalId,
  15. }
  16. },
  17. buildTaskbarTabLink: (entity?: ObjectWithUid) => {
  18. if (!entity?.uid) return
  19. return `/tickets/create/${entity.uid}`
  20. },
  21. confirmTabRemove: async (dirty?: boolean) => {
  22. if (!dirty) return true
  23. const { waitForVariantConfirmation } = useConfirmation()
  24. return waitForVariantConfirmation('unsaved')
  25. },
  26. }