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:
@@ -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() !== '';
|
||||
|
||||
Reference in New Issue
Block a user