TicketSidebarOrganizationContent.vue 2.4 KB

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