feat(accidentForm): sort filtered participants by last and first name

- Enhanced the availableMembers computed property to sort filtered members alphabetically by last name and then by first name, improving the organization of participant lists.
This commit is contained in:
Torsten Schulz (local)
2026-01-14 13:42:54 +01:00
parent c4e237cfca
commit 30e3f4f321

View File

@@ -93,7 +93,18 @@ export default {
: this.participants)
: [];
const participantSet = new Set(participantIds);
return this.members.filter(m => participantSet.has(m.id));
const filtered = this.members.filter(m => participantSet.has(m.id));
// Alphabetisch sortieren nach Nachname, dann Vorname
return filtered.sort((a, b) => {
const lastNameA = (a.lastName || '').toLowerCase();
const lastNameB = (b.lastName || '').toLowerCase();
if (lastNameA !== lastNameB) {
return lastNameA.localeCompare(lastNameB, 'de');
}
const firstNameA = (a.firstName || '').toLowerCase();
const firstNameB = (b.firstName || '').toLowerCase();
return firstNameA.localeCompare(firstNameB, 'de');
});
},
isValid() {
return this.localAccident.memberId && this.localAccident.accident && this.localAccident.accident.trim() !== '';