ArticleBubbleFooter.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import CommonFilePreview from '#shared/components/CommonFilePreview/CommonFilePreview.vue'
  4. import { type AttachmentWithUrls } from '#shared/composables/useAttachments.ts'
  5. import type { TicketArticle } from '#shared/entities/ticket/types.ts'
  6. import type { FilePreview } from '#shared/utils/files.ts'
  7. interface Props {
  8. article: TicketArticle
  9. articleAttachments: AttachmentWithUrls[]
  10. }
  11. defineProps<Props>()
  12. defineEmits<{
  13. preview: [type: FilePreview, image: AttachmentWithUrls]
  14. }>()
  15. </script>
  16. <template>
  17. <footer
  18. v-if="articleAttachments.length > 0"
  19. class="flex flex-col gap-1 bg-blue-300 p-3 dark:bg-stone-700"
  20. >
  21. <div class="flex flex-row">
  22. <CommonLabel prefix-icon="paperclip" size="small">
  23. {{
  24. articleAttachments.length === 1
  25. ? $t('1 attached file')
  26. : $t('%s attached files', articleAttachments.length)
  27. }}
  28. </CommonLabel>
  29. </div>
  30. <CommonFilePreview
  31. v-for="attachment of articleAttachments"
  32. :key="attachment.internalId"
  33. :download-url="attachment.downloadUrl"
  34. :preview-url="attachment.preview"
  35. :file="attachment"
  36. :no-preview="!$c.ui_ticket_zoom_attachments_preview"
  37. no-remove
  38. @preview="($event, type) => $emit('preview', type, attachment)"
  39. />
  40. </footer>
  41. </template>