This commit is contained in:
Peter Maquiran
2023-08-15 12:03:37 +01:00
parent 30aba9b182
commit 20c53993bf
8 changed files with 78 additions and 30 deletions
@@ -235,20 +235,39 @@ export class GroupContactsPage implements OnInit {
}
}
onChange(event){
onChange(event) {
this.textSearch = event.detail.value;
this.users = this.contacts.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase())).sort((a,b) => {
if(a.name < b.name){
const users: any[] = this.contacts.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase())).sort((a,b) => {
if(a.name < b.name) {
return -1;
}
if(a.name > b.name){
if(a.name > b.name) {
return 1;
}
return 0;
});
const selectedUsers = this.users.filter( e => e?.isChecked == true)
users.forEach( (user, index) => {
if(user[index]) {
console.log({user, index})
const isCheck = selectedUsers.find( e => e._id == user._id)?.isChecked
if(isCheck) {
user[index].isChecked = isCheck
}
// if(user[index].isChecked) {
// console.log('user[index].isChecked', user[index].isChecked)
// }
}
})
this.users = users
// console.log('this.users', this.users)
}
clicked(){