diff --git a/src/components/ContactDetails.vue b/src/components/ContactDetails.vue index fb4e6373d..a1181383c 100644 --- a/src/components/ContactDetails.vue +++ b/src/components/ContactDetails.vue @@ -252,6 +252,20 @@ <!-- properties iteration --> <!-- using contact.key in the key and index as key to avoid conflicts between similar data and exact key --> + <!-- Special handling for lifeEvents --> + <div v-if="name === 'lifeEvents'" class="life-events-group"> + <ContactDetailsProperty v-for="(property, index) in properties" + :key="`${index}-${contact.key}-${property.name}`" + :is-first-property="index===0" + :is-last-property="index === properties.length - 1" + :property="property" + :contact="contact" + :local-contact="localContact" + :contacts="contacts" + :bus="bus" + :is-read-only="isReadOnly" /> + </div> + <div v-for="(properties, name) in groupedProperties" :key="name"> <ContactDetailsProperty v-for="(property, index) in properties" @@ -356,18 +370,18 @@ import ICAL from 'ical.js' import { getSVG } from '@shortcm/qr-image/lib/svg' import mitt from 'mitt' import { - NcActions as Actions, + isMobile, NcActionButton as ActionButton, NcActionLink as ActionLink, + NcActions as Actions, NcAppContentDetails as AppContentDetails, + NcButton, NcEmptyContent as EmptyContent, - NcModal as Modal, - NcSelect, + NcEmptyContent, NcLoadingIcon as IconLoading, - NcButton, + NcModal as Modal, NcRelatedResourcesPanel, - isMobile, - NcEmptyContent, + NcSelect, } from '@nextcloud/vue' import IconContact from 'vue-material-design-icons/AccountMultiple.vue' import IconDownload from 'vue-material-design-icons/Download.vue' @@ -575,6 +589,15 @@ export default { return list } + // Group bday and deathdate together under 'lifeEvents' + if (property.name === 'bday' || property.name === 'deathdate' || property.name === 'anniversary') { + if (!list.lifeEvents) { + list.lifeEvents = [] + } + list.lifeEvents.push(property) + return list + } + // Init if needed if (!list[property.name]) { list[property.name] = [] diff --git a/src/components/Properties/PropertyTitle.vue b/src/components/Properties/PropertyTitle.vue index 519e58e13..6eca6b211 100644 --- a/src/components/Properties/PropertyTitle.vue +++ b/src/components/Properties/PropertyTitle.vue @@ -10,7 +10,7 @@ </div> <h3 class="property__value"> - {{ readableName }} + {{ displayName }} </h3> <div class="property__actions"> @@ -71,6 +71,15 @@ export default { required: false, }, }, + computed: { + displayName() { + if (this.property.name === 'bday' || this.property.name === 'deathdate' || this.property.name === 'anniversary') { + return this.t('contacts', 'Personal dates') + } + + return this.readableName + }, + }, methods: { /** * Add prop of type id