diff --git a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts
index 682e002a8..69e8717be 100644
--- a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts
+++ b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts
@@ -53,6 +53,7 @@ export class GroupContactsPage implements OnInit {
ngOnInit() {
this.loadUsers();
+ this.getMembers();
console.log(this.groupName);
console.log(this.isGroupCreated);
}
@@ -62,23 +63,35 @@ export class GroupContactsPage implements OnInit {
"roomId": this.room._id,
"userId": data._id,
}
- console.log(this.room);
-
console.log(body);
if(this.room.t == "p"){
this.chatService.removeGroupMember(body).subscribe(res=>{
console.log(res);
- this.loadUsers();
+ this.getMembers();
});
}
else if(this.room.t == "c"){
this.chatService.removeChannelMember(body).subscribe(res=>{
console.log(res);
- this.loadUsers();
+ this.getMembers();
});
}
}
+ getMembers(){
+ if(this.room.t == "p"){
+ this.chatService.getGroupMembers(this.room._id).subscribe(res=>{
+ this.members = res['members'];
+ });
+ }
+ else if(this.room.t == "c"){
+ this.chatService.getChannelMembers(this.room._id).subscribe(res=>{
+ this.members = res['members'];
+ });
+ }
+ }
+
+
loadUsers(){
this.options = {
headers: this.headers,
@@ -90,7 +103,6 @@ export class GroupContactsPage implements OnInit {
else{
this.contacts = res.users.filter(data => data.username != this.loggedUser.me.username);
}
-
this.users = this.contacts.sort((a,b) => {
if(a.name < b.name){
return -1;
@@ -121,7 +133,8 @@ export class GroupContactsPage implements OnInit {
}
doRefresh(event){
-
+ this.loadUsers();
+ this.getMembers();
}
async close(){
diff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html
index c0f241913..02ae52460 100644
--- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html
+++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html
@@ -3,7 +3,9 @@
-
+
Contactos
@@ -34,6 +36,9 @@
{{user.name}}
+
diff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.scss b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.scss
index b681605ce..a2f88e2f3 100644
--- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.scss
+++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.scss
@@ -102,6 +102,22 @@
overflow: auto;
align-items: center;
+ .detele-item-icon{
+ display: none;
+ width: 30px;
+ margin-left: 15px;
+ }
+
+ .detele-item-icon ion-icon{
+ font-size: 20px !important;
+ }
+ }
+
+ .members-checkbox:hover{
+ .detele-item-icon{
+ display: flex;
+ justify-content: flex-end;
+ }
}
.item-divider{
diff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts
index 3b6091d09..b186a88a0 100644
--- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts
+++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts
@@ -70,6 +70,49 @@ export class GroupContactsPage implements OnInit {
this.getGroupContacts(room['room']);
});
}
+ deleteMember(data:any){
+ console.log(data);
+
+ let body = {
+ "roomId": this.roomId,
+ "userId": data._id,
+ }
+ console.log(body);
+ this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
+ if(room['room'].t == "p"){
+ this.chatService.removeGroupMember(body).subscribe(res=>{
+ console.log(res);
+ this.getMembers();
+ this.getChatInfo();
+ });
+ }
+ else if(room['room'].t == "c"){
+ this.chatService.removeChannelMember(body).subscribe(res=>{
+ console.log(res);
+ this.getMembers();
+ this.getChatInfo();
+ });
+ }
+ });
+ }
+
+ getMembers(){
+ this.chatService.getRoomInfo(this.roomId).subscribe(res=>{
+ console.log(res);
+ let room = res['room'];
+
+ if(room.t == "p"){
+ this.chatService.getGroupMembers(this.roomId).subscribe(res=>{
+ this.members = res['members'];
+ });
+ }
+ else if(room.t == "c"){
+ this.chatService.getChannelMembers(this.roomId).subscribe(res=>{
+ this.members = res['members'];
+ });
+ }
+ });
+ }
getGroupContacts(room:any){
this.showLoader = true;