ArticleMetadataAddress.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import type { TicketArticle } from '#shared/entities/ticket/types.ts'
  5. import CommonSectionMenuItem from '#mobile/components/CommonSectionMenu/CommonSectionMenuItem.vue'
  6. interface Props {
  7. address?: TicketArticle['from']
  8. label: string
  9. }
  10. const props = defineProps<Props>()
  11. const show = computed(() => {
  12. const { address } = props
  13. if (!address) return false
  14. return (address.raw && address.raw !== '- <>') || address.parsed?.length
  15. })
  16. </script>
  17. <template>
  18. <CommonSectionMenuItem v-if="address && show" :label="label">
  19. <div v-if="!address.parsed">{{ address.raw }}</div>
  20. <div
  21. v-for="(contact, idx) of address.parsed || []"
  22. :key="idx"
  23. data-test-id="metadataAddress"
  24. >
  25. <div>{{ contact.name }}</div>
  26. <div class="text-sm text-white/75">
  27. &lt;{{ contact.emailAddress }}&gt;
  28. </div>
  29. </div>
  30. </CommonSectionMenuItem>
  31. </template>