recei and clear the code

This commit is contained in:
Peter Maquiran
2024-08-21 20:14:48 +01:00
parent 82c67b8976
commit 24aac56824
36 changed files with 319 additions and 246 deletions
@@ -121,7 +121,33 @@ export class ContactsPage implements OnInit {
}
onChange(event) {
const textSearch = event.detail.value;
const filteredUserList: (UserContacts & {isChecked: boolean})[] = this.FilterUserListedByTextSearch(textSearch) as any
const userContainer = {}
for(const user of filteredUserList) {
const firstLetter = user.wxFullName.charAt(0)
if(!userContainer[firstLetter]) {
userContainer[firstLetter] = [user]
} else {
userContainer[firstLetter].push(user)
}
}
this.userContainer = userContainer
}
FilterUserListedByTextSearch(textSearch: string) {
return this.allChatUsers.filter( e => e.wxFullName.toLowerCase().includes(textSearch.toLowerCase())).sort((a,b) => {
if(a.wxFullName < b.wxFullName) {
return -1;
}
if(a.wxFullName > b.wxFullName) {
return 1;
}
return 0;
});
}
clicked() {}