getAutoCompleteOption.ts 487 B

12345678910111213141516
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { Organization } from '#shared/graphql/types.ts'
  3. import { ensureGraphqlId } from '#shared/graphql/utils.ts'
  4. export const getAutoCompleteOption = (organization: Partial<Organization>) => {
  5. return {
  6. label: organization.name,
  7. value:
  8. organization.internalId ||
  9. (organization.id
  10. ? ensureGraphqlId('Organization', organization.id)
  11. : null),
  12. organization,
  13. }
  14. }