This commit is contained in:
tiago.kayaya
2021-03-17 09:06:42 +01:00
parent b667fad2a3
commit 41d9c2b5b6
6 changed files with 28 additions and 22 deletions
+2 -2
View File
@@ -93,8 +93,8 @@
<app-empty-chat class="d-flex height-100" *ngIf="showEmptyComponent"></app-empty-chat>
<app-messages class="d-flex height-100 flex-column" [roomId]="roomId" *ngIf="showMessages" #messagecontainer></app-messages>
<app-contacts *ngIf="showContacts" class="d-flex height-100"></app-contacts>
<app-new-group (closeAllDesktopComponent)="openGroupContactsPage()" *ngIf="showNewGroup" class="d-flex height-100 flex-column"></app-new-group>
<app-group-contacts [roomId]="roomId" class="d-flex height-100 flex-column" *ngIf="showGroupContacts"></app-group-contacts>
<app-new-group (addGroupMessage)="openGroupContactsPage($event)" *ngIf="showNewGroup" class="d-flex height-100 flex-column"></app-new-group>
<app-group-contacts (openGroupMessage)="openGroupMessagesPage($event)" [roomId]="groupRoomId" class="d-flex height-100 flex-column" *ngIf="showGroupContacts"></app-group-contacts>
<app-group-messages *ngIf="showGroupMessages" class="d-flex height-100 flex-column" [roomId]="roomId" #messagecontainer></app-group-messages>
</div>
</div>
+1
View File
@@ -44,6 +44,7 @@ ion-content{
overflow: auto;
.aside-wrapper{
border: 1px solid red;
padding: 0 !important;
margin: 0 !important;
}
+11 -4
View File
@@ -57,6 +57,7 @@ export class ChatPage implements OnInit {
componentRef: any;
roomId:any;
groupRoomId:any;
showEmptyComponent=true;
showMessages=false;
showContacts=false;
@@ -107,9 +108,13 @@ export class ChatPage implements OnInit {
this.showNewGroup=false;
this.showGroupMessages=false;
this.showEmptyComponent=false;
this.showGroupContacts=false;
console.log('All components closed!');
}
openGroupContactsPage(){
openGroupContactsPage(data){
console.log(data);
this.groupRoomId = data;
console.log(this.groupRoomId);
this.closeAllDesktopComponents();
if(window.innerWidth <= 1024){
@@ -150,14 +155,16 @@ export class ChatPage implements OnInit {
this.showNewGroup=true;
}
}
openGroupMessagesPage(rid) {
openGroupMessagesPage(data) {
console.log('HERE');
if( window.innerWidth <= 1024){
this.openGroupMessagesModal(rid);
this.openGroupMessagesModal(data);
}
else{
this.closeAllDesktopComponents();
this.showEmptyComponent = false;
this.roomId = rid;
this.roomId = data;
this.showGroupMessages=true;
}
}
@@ -8,7 +8,7 @@
<div class="div-title">
<ion-label class="title">Contactos</ion-label>
</div>
<app-btn-seguinte (click)="createGroup()"></app-btn-seguinte>
<app-btn-seguinte (click)="updateGroup()"></app-btn-seguinte>
</div>
</div>
</ion-toolbar>
@@ -1,5 +1,5 @@
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Component, Input, OnInit } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import * as _ from 'lodash';
import { AuthService } from 'src/app/services/auth.service';
@@ -32,6 +32,7 @@ export class GroupContactsPage implements OnInit {
selectedUserList:any;
@Input() roomId:string;
@Output() openGroupMessage:EventEmitter<any> = new EventEmitter<any>();
constructor(
private modalController: ModalController,
@@ -54,21 +55,19 @@ export class GroupContactsPage implements OnInit {
}
ngOnInit() {
this.getRoomInfo();
//this.getRoomInfo();
this.loadUsers();
console.log(this.groupName);
console.log(this.isGroupCreated);
console.log(this.roomId);
//console.log(this.isGroupCreated);
}
getRoomInfo(){
updateGroup(){
this.showLoader = true;
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
this.room = room['room'];
this.groupName = this.room.name.split('-').join(' ');
/* this.roomName = this.room.name.split('-').join(' ');
this.getGroupContacts(this.room);
this.loadGroupMessages(this.room); */
this.addContacts(this.room);
this.showLoader = false;
this.openGroupMessage.emit(this.room._id)
});
}
@@ -162,7 +161,6 @@ export class GroupContactsPage implements OnInit {
let body ={
"roomId":room._id,
"userId":user._id,
}
this.chatService.addUserToGroup(body).subscribe(res=>{
console.log(res['success']);
@@ -170,7 +168,7 @@ export class GroupContactsPage implements OnInit {
});
}
createGroup(){
/* createGroup(){
console.log(this.groupName);
if(!this.isGroupCreated){
let body = { "name":this.groupName, }
@@ -187,7 +185,7 @@ export class GroupContactsPage implements OnInit {
this.addContacts(this.room);
this.close();
}
}
} */
async newGroup(){
this.close();
@@ -19,7 +19,7 @@ export class NewGroupPage implements OnInit {
//groupName:string;
@Input() groupName:string;
@Output() closeAllDesktopComponent = new EventEmitter<any>();
@Output() addGroupMessage:EventEmitter<any> = new EventEmitter<any>();
constructor(
private pickerController: PickerController,
@@ -42,7 +42,7 @@ export class NewGroupPage implements OnInit {
close(){
//this.modalController.dismiss();
console.log('close');
this.closeAllDesktopComponent.emit();
this.addGroupMessage.emit();
}
createGroup(){
@@ -51,7 +51,7 @@ export class NewGroupPage implements OnInit {
this.chatService.addGroup(body).subscribe(res=>{
console.log('group created');
console.log(res['group']);
this.closeAllDesktopComponent.emit(res['group']._id);
this.addGroupMessage.emit(res['group']._id);
});
}