CommonOrganizationsList.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import type { AvatarOrganization } from '@shared/components/CommonOrganizationAvatar'
  4. import CommonOrganizationAvatar from '@shared/components/CommonOrganizationAvatar/CommonOrganizationAvatar.vue'
  5. import CommonSectionMenu from '../CommonSectionMenu/CommonSectionMenu.vue'
  6. import CommonShowMoreButton from '../CommonShowMoreButton/CommonShowMoreButton.vue'
  7. interface Props {
  8. organizations: (AvatarOrganization & { id: string; internalId: number })[]
  9. totalCount: number
  10. disableShowMore?: boolean
  11. label?: string
  12. }
  13. withDefaults(defineProps<Props>(), {
  14. disableShowMore: false,
  15. })
  16. const emit = defineEmits<{
  17. (e: 'showMore'): void
  18. }>()
  19. </script>
  20. <template>
  21. <CommonSectionMenu v-if="organizations.length" :header-label="label">
  22. <CommonLink
  23. v-for="organization of organizations"
  24. :key="organization.id"
  25. :link="`/organizations/${organization.internalId}`"
  26. class="flex min-h-[66px] items-center"
  27. >
  28. <CommonOrganizationAvatar
  29. :entity="organization"
  30. class="ltr:mr-3 rtl:ml-3"
  31. />
  32. <span class="overflow-hidden text-ellipsis whitespace-nowrap">
  33. {{ organization.name }}
  34. </span>
  35. </CommonLink>
  36. <CommonShowMoreButton
  37. :entities="organizations"
  38. :disabled="disableShowMore"
  39. :total-count="totalCount"
  40. @click="emit('showMore')"
  41. />
  42. </CommonSectionMenu>
  43. </template>