improvements

This commit is contained in:
tiago.kayaya
2021-03-29 16:01:58 +01:00
parent 9ae7570fd5
commit 05e89fbf13
12 changed files with 242 additions and 88 deletions
@@ -19,21 +19,21 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-content class="width-100">
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<div *ngIf="members">
<div class="main-content width-100">
<div class="members" *ngIf="members">
<ion-label class="members-label">Contactos selecção:</ion-label>
<ion-list class="members-list" *ngFor="let user of members">
<div class="members-checkbox">
<ion-checkbox checked color="primary"></ion-checkbox>
<p>{{user.name}}</p>
<ion-icon name="ellipse"></ion-icon>
<ion-icon class="{{user.status}}" name="ellipse"></ion-icon>
</div>
</ion-list>
</div>
@@ -47,7 +47,7 @@
<div *virtualItem="let user" class="item-checkbox">
<ion-checkbox (ionChange)="selectedContact(user)" color="primary"></ion-checkbox>
<ion-label>{{user.name}}</ion-label>
<div class="icon"><ion-icon name="ellipse"></ion-icon></div>
<div class="icon"><ion-icon class="{{user.status}}" name="ellipse"></ion-icon></div>
</div>
</ion-virtual-scroll>
@@ -73,7 +73,7 @@
}
.main-content{
width: 100%;
//width: 100%;
height: 100%;
font-family: Roboto;
margin: 0 auto;
@@ -81,15 +81,24 @@
padding: 0 0 0 0;
overflow:auto;
.members{
padding: 15px 20px 0 20px !important;
.members-list{
margin: 0 !important;
padding: 0 !important;
}
}
.members-label{
margin: 10px 20px 10px 20px !important;
//margin: 10px 20px 10px 20px !important;
/* font-size: 15px; */
font-weight: bold;
}
.members-checkbox{
display: flex;
margin: .5px 20px .5px 20px !important;
//margin: 0px 20px 0px 20px !important;
overflow: auto;
align-items: center;
@@ -124,8 +133,22 @@
}
.icon, .members-checkbox ion-icon{
font-size: 10px;
color:#99e47b;
}
.online{
color:#99e47b !important;
}
.offline{
color:#cbced1 !important;
}
.away{
color:#ffd21f !important;
}
.invisible{
color:#cbced1 !important;
}
.busy{
color:#f5455c !important;
}
}
@@ -56,18 +56,46 @@ export class GroupContactsPage implements OnInit {
ngOnInit() {
//this.getRoomInfo();
this.loadUsers();
//this.loadUsers();
console.log(this.roomId);
this.getChatInfo();
//console.log(this.isGroupCreated);
}
getChatInfo(){
console.log('HERE');
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
console.log('HERE 2');
console.log(room['room']);
this.getGroupContacts(room['room']);
});
}
getGroupContacts(room:any){
this.showLoader = true;
if(room.t === 'p'){
this.chatService.getGroupMembers(this.roomId).subscribe(res=>{
this.members = res['members'];
this.loadUsers1(this.members);
this.showLoader = false;
});
}
else{
this.chatService.getChannelMembers(this.roomId).subscribe(res=>{
this.members = res['members'];
this.loadUsers1(this.members);
this.showLoader = false;
});
}
}
updateGroup(){
this.showLoader = true;
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
this.room = room['room'];
this.addContacts(this.room);
this.showLoader = false;
this.openGroupMessage.emit(this.room._id)
this.openGroupMessage.emit(this.room._id);
});
}
openGroupMessagesPage(){
@@ -76,11 +104,44 @@ export class GroupContactsPage implements OnInit {
this.showLoader = false;
}
loadUsers1(members:any){
this.options = {
headers: this.headers,
};
this.chatService.getAllUsers().subscribe((res:any)=>{
if(members){
this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));
}
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;
}
if(a.name > b.name){
return 1;
}
return 0;
});
console.log(this.users);
this.showLoader = false;
});
}
loadUsers(){
this.options = {
headers: this.headers,
};
this.chatService.getAllUsers().subscribe((res:any)=>{
if(this.members){
this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));
}
@@ -146,16 +207,16 @@ export class GroupContactsPage implements OnInit {
onChange(event){
this.textSearch = event.detail.value;
}
clicked(){
console.log('clicked');
}
selectedContact(user:any){
/* this.groupName = this.room.name; */
user.isChecked = !user.isChecked;
}
addContacts(room:any){
console.log(room);
this.selectedUserList = this.users.filter(function(contact) {