pull made

This commit is contained in:
Eudes Inácio
2023-08-15 18:10:45 +01:00
21 changed files with 196 additions and 234 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(){
@@ -22,7 +22,6 @@
</ion-header>
<ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<!-- <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> -->
<ion-refresher-content>
@@ -30,7 +29,7 @@
</ion-refresher>
<div class="main-content">
<ion-progress-bar class="position-absolute" type="indeterminate" *ngIf="loading"></ion-progress-bar>
<ion-virtual-scroll [items]="userList" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
@@ -21,6 +21,7 @@ export class ContactsPage implements OnInit {
room:any;
dm:any;
sessionStore = SessionStore
loading = false
@Input() roomId: string;
@Output() openMessage:EventEmitter<any> = new EventEmitter<any>();
@@ -67,10 +68,19 @@ export class ContactsPage implements OnInit {
let body = {
username: username,
}
this.loading = true
this.chatService.createRoom(body).subscribe(res => {
this.ChatSystemService.getAllRooms();
this.room = res['room'];
this.openMessage.emit(this.room._id);
this.ChatSystemService.getAllRooms(() => {
this.openMessage.emit(this.room._id);
this.loading = false
}, this.room._id);
}, ()=> {
this.loading = false
});
}
}