Füge Sichtbarkeits-Flags für Mitglieder hinzu, um die Anzeige von E-Mail, Telefon, Adresse und Geburtstag zu steuern
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 52s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 52s
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user