mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
show already selected members of the group chat
- filter list of available members to group chat
This commit is contained in:
@@ -51,7 +51,7 @@ export class HomePage implements OnInit {
|
|||||||
PushNotifications.addListener(
|
PushNotifications.addListener(
|
||||||
'registration',
|
'registration',
|
||||||
(token: PushNotificationToken) => {
|
(token: PushNotificationToken) => {
|
||||||
alert('Push registration success, token: ' + token.value);
|
/* alert('Push registration success, token: ' + token.value); */
|
||||||
console.log('FIREBASE: ', token.value)
|
console.log('FIREBASE: ', token.value)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,7 +26,19 @@
|
|||||||
</ion-refresher-content>
|
</ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</ion-list>
|
||||||
|
|
||||||
<ion-virtual-scroll [items]="users | filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">
|
<ion-virtual-scroll [items]="users | filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">
|
||||||
|
|
||||||
<div class="item-divider" *virtualHeader="let header">
|
<div class="item-divider" *virtualHeader="let header">
|
||||||
|
|||||||
@@ -85,13 +85,27 @@
|
|||||||
overflow:auto;
|
overflow:auto;
|
||||||
padding: 0 0 0 0;
|
padding: 0 0 0 0;
|
||||||
|
|
||||||
.item-divider{
|
.members-label{
|
||||||
background: #ebebeb;
|
margin: 10px 20px 10px 20px !important;
|
||||||
font-size: 15px;
|
/* font-size: 15px; */
|
||||||
margin: 10px 0 10px 0;
|
font-weight: bold;
|
||||||
padding:5px 0 5px 20px;
|
}
|
||||||
|
|
||||||
}
|
.members-checkbox{
|
||||||
|
display: flex;
|
||||||
|
margin: .5px 20px .5px 20px !important;
|
||||||
|
overflow: auto;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-divider{
|
||||||
|
background: #ebebeb;
|
||||||
|
font-size: 15px;
|
||||||
|
margin: 10px 0 10px 0;
|
||||||
|
padding:5px 0 5px 20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.item-checkbox{
|
.item-checkbox{
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -101,13 +115,13 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-checkbox ion-checkbox{
|
.item-checkbox ion-checkbox, .members-checkbox ion-checkbox{
|
||||||
--border-color: #0d89d1;
|
--border-color: #0d89d1;
|
||||||
--background-checked:#0d89d1;
|
--background-checked:#0d89d1;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-checkbox p{
|
.item-checkbox p, .members-checkbox p{
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
width: 330px;
|
width: 330px;
|
||||||
@@ -116,7 +130,7 @@
|
|||||||
color: #0d89d1;
|
color: #0d89d1;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
.item-checkbox ion-icon{
|
.item-checkbox ion-icon, .members-checkbox ion-icon{
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
float: left;
|
float: left;
|
||||||
color:#99e47b;
|
color:#99e47b;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ModalController, NavParams } from '@ionic/angular';
|
import { ModalController, NavParams } from '@ionic/angular';
|
||||||
|
import * as _ from 'lodash';
|
||||||
import { AuthService } from 'src/app/services/auth.service';
|
import { AuthService } from 'src/app/services/auth.service';
|
||||||
import { ChatService } from 'src/app/services/chat.service';
|
import { ChatService } from 'src/app/services/chat.service';
|
||||||
import { NewGroupPage } from '../../new-group/new-group.page';
|
import { NewGroupPage } from '../../new-group/new-group.page';
|
||||||
@@ -24,6 +25,7 @@ export class GroupContactsPage implements OnInit {
|
|||||||
contacts: any;
|
contacts: any;
|
||||||
textSearch:string;
|
textSearch:string;
|
||||||
room:any;
|
room:any;
|
||||||
|
members:any;
|
||||||
dm:any;
|
dm:any;
|
||||||
isGroupCreated:boolean;
|
isGroupCreated:boolean;
|
||||||
groupName:string;
|
groupName:string;
|
||||||
@@ -46,6 +48,7 @@ export class GroupContactsPage implements OnInit {
|
|||||||
this.isGroupCreated = this.navParams.get('isCreated');
|
this.isGroupCreated = this.navParams.get('isCreated');
|
||||||
this.groupName = this.navParams.get('name');
|
this.groupName = this.navParams.get('name');
|
||||||
this.room = this.navParams.get('room');
|
this.room = this.navParams.get('room');
|
||||||
|
this.members = this.navParams.get('members');
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -59,21 +62,7 @@ export class GroupContactsPage implements OnInit {
|
|||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
};
|
};
|
||||||
this.chatService.getAllUsers().subscribe((res:any)=>{
|
this.chatService.getAllUsers().subscribe((res:any)=>{
|
||||||
console.log(res.users);
|
this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));
|
||||||
res.users.forEach(user =>{
|
|
||||||
let usr = {
|
|
||||||
"_id": user._id,
|
|
||||||
"username": user.username,
|
|
||||||
"name":user.name,
|
|
||||||
"isChecked": false,
|
|
||||||
}
|
|
||||||
if(this.listContacts == null){
|
|
||||||
this.listContacts = new Array();
|
|
||||||
}
|
|
||||||
this.listContacts.push(usr);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.contacts = this.listContacts.filter(data => data.username != this.loggedUser.me.username);
|
|
||||||
this.users = this.contacts.sort((a,b) => {
|
this.users = this.contacts.sort((a,b) => {
|
||||||
if(a.name < b.name){
|
if(a.name < b.name){
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -152,12 +152,16 @@ export class GroupMessagesPage implements OnInit {
|
|||||||
return await popover.present();
|
return await popover.present();
|
||||||
}
|
}
|
||||||
async addContacts(){
|
async addContacts(){
|
||||||
|
console.log(this.members);
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: GroupContactsPage,
|
component: GroupContactsPage,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
isCreated: this.isGroupCreated,
|
isCreated: this.isGroupCreated,
|
||||||
room: this.room,
|
room: this.room,
|
||||||
|
members: this.members,
|
||||||
|
name: this.room.name,
|
||||||
},
|
},
|
||||||
cssClass: 'contacts',
|
cssClass: 'contacts',
|
||||||
backdropDismiss: false
|
backdropDismiss: false
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ export class LoginPage implements OnInit {
|
|||||||
password: string = environment.defaultuserpwd;
|
password: string = environment.defaultuserpwd;
|
||||||
userattempt: User;
|
userattempt: User;
|
||||||
|
|
||||||
public body = {"user": this.username,"password": this.password};
|
|
||||||
public postData = {"user": this.username,"password": this.password};
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
@@ -56,11 +53,18 @@ export class LoginPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loginRocketChat(){
|
loginRocketChat(){
|
||||||
this.authService.loginChat(this.postData).subscribe((res: any) =>{
|
|
||||||
|
let postData = {
|
||||||
|
"user": this.username,
|
||||||
|
"password": this.password
|
||||||
|
}
|
||||||
|
this.authService.loginChat(postData).subscribe((res: any) =>{
|
||||||
this.storageService.store(AuthConnstants.AUTH, res.data);
|
this.storageService.store(AuthConnstants.AUTH, res.data);
|
||||||
|
console.log('Logged user \n'+res.data);
|
||||||
console.log('Login to Rocket chat OK');
|
console.log('Login to Rocket chat OK');
|
||||||
},(error:any) =>{
|
},(error:any) =>{
|
||||||
console.log('Network error');
|
console.log('Network error');
|
||||||
|
this.presentAlert('Network error '+error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +82,8 @@ export class LoginPage implements OnInit {
|
|||||||
BasicAuthKey: ""
|
BasicAuthKey: ""
|
||||||
}
|
}
|
||||||
if (await this.authService.login(this.userattempt)){
|
if (await this.authService.login(this.userattempt)){
|
||||||
|
console.log(this.userattempt);
|
||||||
|
|
||||||
this.loginRocketChat();
|
this.loginRocketChat();
|
||||||
this.router.navigate(['/home/events']);
|
this.router.navigate(['/home/events']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ export class AuthService {
|
|||||||
|
|
||||||
//Login to rocketChat server
|
//Login to rocketChat server
|
||||||
loginChat(postData: any):Observable<any> {
|
loginChat(postData: any):Observable<any> {
|
||||||
|
console.log(postData);
|
||||||
|
|
||||||
return this.httpService.post('login', postData);
|
return this.httpService.post('login', postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export const environment = {
|
|||||||
apiChatUrl: 'https://www.tabularium.pt/api/v1/',
|
apiChatUrl: 'https://www.tabularium.pt/api/v1/',
|
||||||
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
|
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
|
||||||
domain: 'gabinetedigital.local',
|
domain: 'gabinetedigital.local',
|
||||||
defaultuser: 'paulo.pinto',
|
defaultuser: 'tiago.kayaya',
|
||||||
defaultuserpwd: 'tabteste@006'
|
defaultuserpwd: 'tabteste@006'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user