CommonOrganizationsList.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import CommonOrganizationAvatar from '#shared/components/CommonOrganizationAvatar/CommonOrganizationAvatar.vue'
  4. import type { AvatarOrganization } from '#shared/components/CommonOrganizationAvatar/index.ts'
  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. showMore: []
  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="truncate">
  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>