mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
save
This commit is contained in:
@@ -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(){
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
<div class="main-header width-100">
|
||||
<div class="title-content width-100">
|
||||
<div class="back-icon">
|
||||
<ion-icon (click)="openGroupMessagesPage()" slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
|
||||
<button class="btn-no-color" (click)="openGroupMessagesPage()">
|
||||
<ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="div-title">
|
||||
<ion-label class="title">Contactos</ion-label>
|
||||
@@ -34,6 +36,9 @@
|
||||
<ion-checkbox checked color="primary"></ion-checkbox>
|
||||
<p>{{user.name}}</p>
|
||||
<ion-icon class="{{user.status}}" name="ellipse"></ion-icon>
|
||||
<button (click)="deleteMember(user)" class="btn-no-color detele-item-icon">
|
||||
<ion-icon color="danger" name="close"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
</ion-list>
|
||||
</div>
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user