ArticleMetadataAddress.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import CommonSectionMenuItem from '@mobile/components/CommonSectionMenu/CommonSectionMenuItem.vue'
  4. import { computed } from 'vue'
  5. import type { TicketArticle } from '@shared/entities/ticket/types'
  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. <!-- TODO no design for how it looks, if there are more than 1 address -->
  21. <div
  22. v-for="(contact, idx) of address.parsed || []"
  23. :key="idx"
  24. data-test-id="metadataAddress"
  25. >
  26. <div>{{ contact.name }}</div>
  27. <div class="text-sm text-white/75">
  28. &lt;{{ contact.emailAddress }}&gt;
  29. </div>
  30. </div>
  31. </CommonSectionMenuItem>
  32. </template>