diff --git a/pages/mitgliederbereich/mitglieder.vue b/pages/mitgliederbereich/mitglieder.vue index a6f5450..633cca4 100644 --- a/pages/mitgliederbereich/mitglieder.vue +++ b/pages/mitgliederbereich/mitglieder.vue @@ -775,23 +775,22 @@ const sortedMembers = computed(() => { const arr = [...members.value] if (sortMode.value === 'name') { arr.sort((a, b) => { - // Sortiere nach Vorname Nachname (firstName lastName), fallback auf name - const af = (a.firstName || (a.name ? a.name.split(' ')[0] : '') || '').toLocaleLowerCase() - const bf = (b.firstName || (b.name ? b.name.split(' ')[0] : '') || '').toLocaleLowerCase() - const al = (a.lastName || (a.name ? a.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase() - const bl = (b.lastName || (b.name ? b.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase() + // Sortiere nach Vorname Nachname (firstName lastName) + const af = (a.firstName || '').toLocaleLowerCase() + const bf = (b.firstName || '').toLocaleLowerCase() + const al = (a.lastName || '').toLocaleLowerCase() + const bl = (b.lastName || '').toLocaleLowerCase() if (af === bf) return al.localeCompare(bl) return af.localeCompare(bf) }) } else if (sortMode.value === 'lastname') { arr.sort((a, b) => { - // Sortiere nach Nachname, fallback auf letzten Teil von name - const al = (a.lastName || (a.name ? a.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase() - const bl = (b.lastName || (b.name ? b.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase() + // Sortiere nach Nachname, dann Vorname + const al = (a.lastName || '').toLocaleLowerCase() + const bl = (b.lastName || '').toLocaleLowerCase() if (al === bl) { - // Bei gleichem Nachnamen nach Vorname sortieren - const af = (a.firstName || (a.name ? a.name.split(' ')[0] : '') || '').toLocaleLowerCase() - const bf = (b.firstName || (b.name ? b.name.split(' ')[0] : '') || '').toLocaleLowerCase() + const af = (a.firstName || '').toLocaleLowerCase() + const bf = (b.firstName || '').toLocaleLowerCase() return af.localeCompare(bf) } return al.localeCompare(bl) diff --git a/server/api/members.get.js b/server/api/members.get.js index 52814e8..e7f98eb 100644 --- a/server/api/members.get.js +++ b/server/api/members.get.js @@ -227,6 +227,11 @@ export default defineEventHandler(async (event) => { lastLogin: member.lastLogin, isMannschaftsspieler: member.isMannschaftsspieler, notes: member.notes || '', + // Sichtbarkeits-Flags explizit mitgeben + showEmail: visibility.showEmail === undefined ? true : Boolean(visibility.showEmail), + showPhone: visibility.showPhone === undefined ? true : Boolean(visibility.showPhone), + showAddress: visibility.showAddress === undefined ? false : Boolean(visibility.showAddress), + showBirthday: visibility.showBirthday === undefined ? true : Boolean(visibility.showBirthday), // Privileged viewers (vorstand) always see contact fields email: emailVisible ? member.email : undefined, phone: phoneVisible ? member.phone : undefined,