TicketSidebarOrganizationContent.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script lang="ts" setup>
  3. import type { AvatarOrganization } from '#shared/components/CommonOrganizationAvatar'
  4. import CommonOrganizationAvatar from '#shared/components/CommonOrganizationAvatar/CommonOrganizationAvatar.vue'
  5. import ObjectAttributes from '#shared/components/ObjectAttributes/ObjectAttributes.vue'
  6. import type {
  7. ObjectManagerFrontendAttribute,
  8. OrganizationQuery,
  9. User,
  10. } from '#shared/graphql/types.ts'
  11. import { normalizeEdges } from '#shared/utils/helpers.ts'
  12. import type { MenuItem } from '#desktop/components/CommonPopoverMenu/types.ts'
  13. import CommonSimpleEntityList from '#desktop/components/CommonSimpleEntityList/CommonSimpleEntityList.vue'
  14. import { EntityType } from '#desktop/components/CommonSimpleEntityList/types.ts'
  15. import type { TicketSidebarContentProps } from '#desktop/pages/ticket/types/sidebar.ts'
  16. import TicketSidebarContent from '../TicketSidebarContent.vue'
  17. interface Props extends TicketSidebarContentProps {
  18. organization: OrganizationQuery['organization']
  19. organizationMembers: ReturnType<typeof normalizeEdges<Partial<User>>>
  20. objectAttributes: ObjectManagerFrontendAttribute[]
  21. }
  22. defineProps<Props>()
  23. defineEmits<{
  24. 'load-more-members': []
  25. }>()
  26. const actions: MenuItem[] = [
  27. {
  28. key: 'edit-organization',
  29. label: __('Edit Organization'),
  30. icon: 'organization-edit',
  31. show: (entity) => entity?.policy.update,
  32. onClick: (id) => {
  33. console.log(id, 'Edit organization')
  34. },
  35. },
  36. ]
  37. </script>
  38. <template>
  39. <TicketSidebarContent
  40. :title="sidebarPlugin.title"
  41. :icon="sidebarPlugin.icon"
  42. :entity="organization"
  43. :actions="actions"
  44. >
  45. <CommonLink
  46. :link="`/organizations/${organization.internalId}`"
  47. class="flex gap-2"
  48. >
  49. <CommonOrganizationAvatar
  50. class="p-3.5"
  51. :entity="organization as AvatarOrganization"
  52. size="normal"
  53. />
  54. <CommonLabel size="large" class="dark:text-white"
  55. >{{ organization.name }}
  56. </CommonLabel>
  57. </CommonLink>
  58. <ObjectAttributes
  59. :object="organization"
  60. :attributes="objectAttributes"
  61. :skip-attributes="['name', 'vip', 'active']"
  62. />
  63. <CommonSimpleEntityList
  64. id="organization-members"
  65. :type="EntityType.User"
  66. :label="__('Members')"
  67. :entity="organizationMembers"
  68. @load-more="$emit('load-more-members')"
  69. />
  70. </TicketSidebarContent>
  71. </template>