1010 <AccountMultipleIcon :size =" 20" />
1111 <span class =" invitees-list__header__title__text" >{{ t('calendar', 'Attendees') }}</span >
1212 <NcCounterBubble :count =" invitees.length + 1" />
13+ <NcButton
14+ :disabled =" invitees.length === 0"
15+ :aria-label =" t('calendar', 'Export attendees')"
16+ :title =" t('calendar', 'Export attendees')"
17+ @click =" exportInvitteesList()" >
18+ <template #icon >
19+ <Download :size =" 20" />
20+ </template >
21+ </NcButton >
1322 </div >
1423
1524 <div v-if =" !hideButtons" class =" invitees-list-button-group" >
@@ -81,6 +90,7 @@ import {
8190import { NcButton , NcCounterBubble } from ' @nextcloud/vue'
8291import { mapState , mapStores } from ' pinia'
8392import AccountMultipleIcon from ' vue-material-design-icons/AccountMultipleOutline.vue'
93+ import Download from ' vue-material-design-icons/TrayArrowDown.vue'
8494import FreeBusy from ' ../FreeBusy/FreeBusy.vue'
8595import OrganizerNoEmailError from ' ../OrganizerNoEmailError.vue'
8696import InviteesListItem from ' ./InviteesListItem.vue'
@@ -104,6 +114,7 @@ export default {
104114 OrganizerListItem,
105115 AccountMultipleIcon,
106116 NcCounterBubble,
117+ Download,
107118 },
108119
109120 props: {
@@ -446,6 +457,28 @@ export default {
446457 this .$emit (' update-dates' , dates)
447458 this .showFreeBusyModel = false
448459 },
460+
461+ exportInvitteesList () {
462+ const BOM = ' \uFEFF '
463+ const headers = ` ${ t (' calendar' , ' Name' )} ,${ t (' calendar' , ' Email' )} ,${ t (' calendar' , ' Status' )} ,${ t (' calendar' , ' Role' )} \n `
464+ const rows = this .inviteesWithoutOrganizer .map ((attendee ) => {
465+ const name = attendee .commonName || ' '
466+ const email = removeMailtoPrefix (attendee .uri ) || ' '
467+ const status = attendee .participationStatus || ' '
468+ const role = attendee .role || ' '
469+ return ` ${ name} ,${ email} ,${ status} ,${ role} \n `
470+ })
471+ const csvContent = BOM + headers + rows .join (' ' )
472+ const blob = new Blob ([csvContent], { type: ' text/csv;charset=utf-8;' })
473+ const link = document .createElement (' a' )
474+ link .href = URL .createObjectURL (blob)
475+ const eventTitle = this .calendarObjectInstance .title || t (' calendar' , ' Untitled event' )
476+ const timestamp = new Date ().toISOString ().slice (0 , 10 )
477+ link .setAttribute (' download' , ` ${ eventTitle} -${ timestamp} .csv` )
478+ document .body .appendChild (link)
479+ link .click ()
480+ document .body .removeChild (link)
481+ },
449482 },
450483}
451484< / script>
0 commit comments