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:
@@ -1,6 +1,6 @@
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import {
|
||||
Component,
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
ViewChild,
|
||||
ViewContainerRef,
|
||||
@@ -36,7 +36,7 @@ export class ChatPage implements OnInit {
|
||||
options:any;
|
||||
X_User_Id:any;
|
||||
X_Auth_Token:any;
|
||||
|
||||
|
||||
loggedUser: any;
|
||||
/* Set segment variable */
|
||||
segment:string;
|
||||
@@ -76,7 +76,7 @@ export class ChatPage implements OnInit {
|
||||
/*
|
||||
|
||||
Websockets variables
|
||||
|
||||
|
||||
*/
|
||||
|
||||
subject: any;
|
||||
@@ -100,7 +100,7 @@ export class ChatPage implements OnInit {
|
||||
private authService: AuthService,
|
||||
private storage:Storage,
|
||||
private resolver: ComponentFactoryResolver,
|
||||
){
|
||||
){
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.headers = new HttpHeaders();
|
||||
this.loadMessage();
|
||||
@@ -108,7 +108,7 @@ export class ChatPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.loggedUserChat);
|
||||
|
||||
|
||||
this.segment = "Contactos";
|
||||
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
@@ -116,12 +116,12 @@ export class ChatPage implements OnInit {
|
||||
console.log(this.loggedUser);
|
||||
this.load();
|
||||
});
|
||||
|
||||
|
||||
/* websocket functions */
|
||||
//this.sendMsg();
|
||||
|
||||
/* Fim websocket functions */
|
||||
this.hideRefreshButton();
|
||||
this.hideRefreshButton();
|
||||
}
|
||||
|
||||
hideRefreshButton(){
|
||||
@@ -193,7 +193,7 @@ sendMsg() {
|
||||
openContactsPage() {
|
||||
console.log('OK');
|
||||
this.closeAllDesktopComponents();
|
||||
|
||||
|
||||
if( window.innerWidth <= 1024){
|
||||
this.selectContact();
|
||||
}
|
||||
@@ -222,16 +222,17 @@ sendMsg() {
|
||||
}
|
||||
}
|
||||
|
||||
openGroupMessagesPage(data) {
|
||||
console.log('HERE');
|
||||
|
||||
openGroupMessagesPage(rid) {
|
||||
console.log(rid);
|
||||
|
||||
if( window.innerWidth <= 1024){
|
||||
this.openGroupMessagesModal(data);
|
||||
this.openGroupMessagesModal(rid);
|
||||
}
|
||||
else{
|
||||
this.closeAllDesktopComponents();
|
||||
this.showEmptyComponent = false;
|
||||
this.roomId = data;
|
||||
this.roomId = rid;
|
||||
console.log(this.roomId);
|
||||
this.showGroupMessages=true;
|
||||
}
|
||||
}
|
||||
@@ -261,13 +262,13 @@ sendMsg() {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
getDirectMessages(){
|
||||
this.showLoader = true;
|
||||
|
||||
|
||||
this.chatService.getAllDirectMessages().subscribe((res:any)=>{
|
||||
console.log(res.ims);
|
||||
|
||||
|
||||
this.userDirectMessages = res.ims.sort((a,b)=>{
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
@@ -288,7 +289,7 @@ sendMsg() {
|
||||
this.privateGroups = res.groups;
|
||||
this.result = this.chatService.getAllUserChannels().subscribe((res:any)=>{
|
||||
this.publicGroups = res.channels;
|
||||
let all = this.privateGroups.concat(this.publicGroups);
|
||||
let all = this.privateGroups.concat(this.publicGroups);
|
||||
this.allGroups = all.sort((a,b)=>{
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
@@ -297,7 +298,7 @@ sendMsg() {
|
||||
console.log(this.allGroups);
|
||||
this.showLoader = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async selectContact(){
|
||||
@@ -337,7 +338,7 @@ sendMsg() {
|
||||
this.closeAllDesktopComponents();
|
||||
|
||||
console.log(roomId);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: MessagesPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
@@ -352,7 +353,7 @@ sendMsg() {
|
||||
async openGroupMessagesModal(roomId:any){
|
||||
|
||||
console.log(roomId);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: GroupMessagesPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
|
||||
@@ -37,11 +37,10 @@ export class GroupContactsPage implements OnInit {
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
private navParams: NavParams,
|
||||
)
|
||||
)
|
||||
{
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
});
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
this.textSearch="";
|
||||
this.dm=null;
|
||||
this.room=null;
|
||||
@@ -95,7 +94,7 @@ export class GroupContactsPage implements OnInit {
|
||||
|
||||
|
||||
loadUsers(){
|
||||
this.options = {
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
this.chatService.getAllUsers().subscribe((res:any)=>{
|
||||
@@ -115,7 +114,7 @@ export class GroupContactsPage implements OnInit {
|
||||
return 0;
|
||||
});
|
||||
console.log(this.users);
|
||||
|
||||
|
||||
this.showLoader = false;
|
||||
});
|
||||
}
|
||||
@@ -143,7 +142,7 @@ export class GroupContactsPage implements OnInit {
|
||||
async close(){
|
||||
this.modalController.dismiss();
|
||||
if(this.isGroupCreated){
|
||||
console.log('go to conversa');
|
||||
console.log('go to conversa');
|
||||
}
|
||||
else{
|
||||
this.modalController.dismiss();
|
||||
@@ -167,12 +166,12 @@ export class GroupContactsPage implements OnInit {
|
||||
}
|
||||
clicked(){
|
||||
console.log('clicked');
|
||||
|
||||
|
||||
}
|
||||
selectedContact(user:any){
|
||||
/* this.groupName = this.room.name; */
|
||||
user.isChecked = !user.isChecked;
|
||||
|
||||
|
||||
|
||||
}
|
||||
addContacts(room:any){
|
||||
@@ -185,11 +184,11 @@ export class GroupContactsPage implements OnInit {
|
||||
let body ={
|
||||
"roomId":room._id,
|
||||
"userId":user._id,
|
||||
|
||||
|
||||
}
|
||||
this.chatService.addUserToGroup(body).subscribe(res=>{
|
||||
console.log(res['success']);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -202,9 +201,9 @@ export class GroupContactsPage implements OnInit {
|
||||
console.log(res['group']);
|
||||
this.addContacts(res['group']);
|
||||
this.openGroupMessages(res['group']);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
this.addContacts(this.room);
|
||||
@@ -212,12 +211,12 @@ export class GroupContactsPage implements OnInit {
|
||||
/* this.openGroupMessages(this.room); */
|
||||
/* this.chatService.getGroupInfo(this.room._id).subscribe(res=>{
|
||||
console.log(res);
|
||||
|
||||
|
||||
this.addContacts(res['group']);
|
||||
this.openGroupMessages(res['group']);
|
||||
}) */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async newGroup(){
|
||||
@@ -237,7 +236,7 @@ export class GroupContactsPage implements OnInit {
|
||||
component: GroupMessagesPage,
|
||||
componentProps: {
|
||||
room: room,
|
||||
},
|
||||
},
|
||||
cssClass: 'group-messages',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<button class="btn-no-color" (click)="openOptions()">
|
||||
<ion-icon src="assets/images/icons-menu.svg"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div (click)="addContacts()" class="header-bottom">
|
||||
<div class="header-bottom-icon">
|
||||
@@ -56,7 +56,7 @@
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
<!--
|
||||
<!--
|
||||
<ion-footer>
|
||||
<ion-toolbar>
|
||||
<ion-row align-items-center class="row">
|
||||
|
||||
@@ -28,6 +28,7 @@ export class GroupMessagesPage implements OnInit {
|
||||
contacts: string[] = [" Ana M.", "Andre F.", "Bruno G.", "Catarina T", "Tiago"];
|
||||
|
||||
roomId: string;
|
||||
loggedUserChat:any;
|
||||
|
||||
constructor(
|
||||
private menu: MenuController,
|
||||
@@ -39,15 +40,14 @@ export class GroupMessagesPage implements OnInit {
|
||||
private authService: AuthService,
|
||||
private alertService: AlertService,
|
||||
) {
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.isGroupCreated = true;
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
console.log(this.loggedUser);
|
||||
});
|
||||
console.log(this.roomId);
|
||||
this.loggedUser=this.loggedUserChat;
|
||||
this.getRoomInfo();
|
||||
}
|
||||
|
||||
@@ -121,17 +121,17 @@ export class GroupMessagesPage implements OnInit {
|
||||
sendMessage(){
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
this.getRoomInfo();
|
||||
|
||||
|
||||
},(error) => {
|
||||
|
||||
|
||||
});
|
||||
this.message = "";
|
||||
}
|
||||
@@ -154,7 +154,7 @@ export class GroupMessagesPage implements OnInit {
|
||||
console.log('cancel');
|
||||
}
|
||||
console.log('OK2');
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ export class GroupMessagesPage implements OnInit {
|
||||
}
|
||||
async addContacts(){
|
||||
console.log(this.members);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: GroupContactsPage,
|
||||
componentProps: {
|
||||
@@ -180,7 +180,7 @@ export class GroupMessagesPage implements OnInit {
|
||||
room: this.room,
|
||||
members: this.members,
|
||||
name: this.room.name,
|
||||
},
|
||||
},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
@@ -211,7 +211,7 @@ export class GroupMessagesPage implements OnInit {
|
||||
handler: () => {
|
||||
console.log('Play clicked');
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
});
|
||||
await actionSheet.present();
|
||||
|
||||
@@ -28,11 +28,10 @@ export class ContactsPage implements OnInit {
|
||||
private http: HttpClient,
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
)
|
||||
{
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
});
|
||||
)
|
||||
{
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
this.textSearch="";
|
||||
this.dm=null;
|
||||
this.room=null;
|
||||
@@ -47,7 +46,7 @@ export class ContactsPage implements OnInit {
|
||||
}
|
||||
|
||||
loadUsers(){
|
||||
this.options = {
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
this.chatService.getAllUsers().subscribe((res:any)=>{
|
||||
@@ -86,7 +85,7 @@ export class ContactsPage implements OnInit {
|
||||
close(){
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
|
||||
clicked(){
|
||||
console.log('clicked');
|
||||
}
|
||||
@@ -99,17 +98,17 @@ export class ContactsPage implements OnInit {
|
||||
console.log(res);
|
||||
this.room = res['room'];
|
||||
console.log(this.room._id);
|
||||
|
||||
|
||||
this.getDirectMessage(this.room._id);
|
||||
});
|
||||
}
|
||||
getDirectMessage(roomId:any){
|
||||
console.log(roomId);
|
||||
|
||||
|
||||
this.chatService.getAllDirectMessages().subscribe(res=>{
|
||||
let result = res['ims'].filter(data => data._id == roomId);
|
||||
console.log(result[0]);
|
||||
|
||||
|
||||
this.dm = result[0];
|
||||
console.log(this.dm);
|
||||
this.openModal(this.dm._id);
|
||||
@@ -118,7 +117,7 @@ export class ContactsPage implements OnInit {
|
||||
async openModal(roomId:any){
|
||||
this.close();
|
||||
console.log(roomId);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: MessagesPage,
|
||||
cssClass: 'group-messages',
|
||||
@@ -139,8 +138,8 @@ export class ContactsPage implements OnInit {
|
||||
//Get direct messages (dm)
|
||||
/* this.getDirectMessage(this.room._id); */
|
||||
console.log(this.dm);
|
||||
|
||||
|
||||
|
||||
|
||||
/* const modal = await this.modalController.create({
|
||||
component: MessagesPage,
|
||||
cssClass: 'group-messages',
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<button class="btn-no-color" (click)="openMessagesOptions()">
|
||||
<ion-icon src="assets/images/icons-menu.svg"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div hidden class="header-bottom" (click)="addContacts()">
|
||||
<div class="header-bottom-icon">
|
||||
@@ -35,7 +35,7 @@
|
||||
<ion-refresher-content>
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<div class="messages" #scrollMe>
|
||||
<div id="scrollToBottom" class="messages" #scrollMe>
|
||||
<div *ngFor="let msg of messages" class='incoming-{{msg.u.username!=loggedUser.me.username}}'>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
@@ -83,7 +83,7 @@
|
||||
<ion-item class="ion-no-padding ion-no-margin type-message" lines="none">
|
||||
<ion-textarea clearOnEdit="true" placeholder="Escrever uma mensagem" auto-grow class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
|
||||
<button class="btn-no-color" (click)="notImplemented()">
|
||||
<ion-icon slot="end" src="assets/icon/icons-chat-mic.svg"></ion-icon>
|
||||
<!-- <ion-icon slot="end" src="assets/icon/icons-chat-mic.svg"></ion-icon> -->
|
||||
</button>
|
||||
</ion-item>
|
||||
</div>
|
||||
@@ -96,4 +96,4 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ion-footer>
|
||||
</ion-footer>
|
||||
|
||||
@@ -26,8 +26,9 @@ export class MessagesPage implements OnInit, AfterViewChecked {
|
||||
userPresence='';
|
||||
dmUsers:any;
|
||||
roomId:string;
|
||||
el:any;
|
||||
|
||||
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
private modalController: ModalController,
|
||||
@@ -36,7 +37,8 @@ export class MessagesPage implements OnInit, AfterViewChecked {
|
||||
private authService: AuthService,
|
||||
private alertService: AlertService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
}
|
||||
|
||||
@@ -44,15 +46,12 @@ export class MessagesPage implements OnInit, AfterViewChecked {
|
||||
|
||||
this.scrollToBottom();
|
||||
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
console.log(this.loggedUser);
|
||||
});
|
||||
|
||||
/* setInterval(()=>{ */
|
||||
this.load();
|
||||
/* }, 9000); */
|
||||
|
||||
this.el = document.getElementById("scrollToBottom");
|
||||
this.el.scrollTop = this.el.scrollHeight - this.el.scrollTop;
|
||||
|
||||
}
|
||||
|
||||
notImplemented(){
|
||||
@@ -70,34 +69,31 @@ export class MessagesPage implements OnInit, AfterViewChecked {
|
||||
this.load();
|
||||
ev.target.complete();
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
this.scrollToBottom();
|
||||
}
|
||||
scrollToBottom(): void {
|
||||
|
||||
ngAfterViewChecked() {
|
||||
this.scrollToBottom();
|
||||
}
|
||||
|
||||
scrollToBottom(): void {
|
||||
try {
|
||||
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
||||
} catch(err) { }
|
||||
|
||||
}
|
||||
loadMoreMessages(ev:any){
|
||||
} catch(err) { }
|
||||
|
||||
}
|
||||
|
||||
sendMessage(){
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
}
|
||||
}
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
this.loadMessages();
|
||||
this.loadMessages();
|
||||
});
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
|
||||
loadMessages(){
|
||||
this.showLoader = true;
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
|
||||
@@ -133,7 +129,7 @@ export class MessagesPage implements OnInit, AfterViewChecked {
|
||||
async addContacts(){
|
||||
const modal = await this.modalController.create({
|
||||
component: ContactsPage,
|
||||
componentProps: {},
|
||||
componentProps: {},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
@@ -153,4 +149,4 @@ async openChatOptions(ev?: any) {
|
||||
return await popover.present();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class PublicationDetailPage implements OnInit {
|
||||
private publications:PublicationsService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
) {
|
||||
this.publicationId = this.navParams.get('publicationId');
|
||||
/* this.folderId = this.navParams.get('folderIdId'); */
|
||||
this.publication = {
|
||||
@@ -98,8 +98,7 @@ export class PublicationDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
async editPost(publicationType:any) {
|
||||
console.log('HERE');
|
||||
|
||||
|
||||
console.log(this.publication);
|
||||
const modal = await this.modalController.create({
|
||||
component: NewPublicationPage,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { ModalController, PickerController } from '@ionic/angular';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
|
||||
@Component({
|
||||
@@ -14,6 +15,7 @@ export class EditGroupPage implements OnInit {
|
||||
selectedDuration = ['','',''];
|
||||
groupName:string;
|
||||
room:any;
|
||||
loggedUser: any;
|
||||
@Input() roomId:string;
|
||||
@Output() openGroupContacts:EventEmitter<any> = new EventEmitter<any>();
|
||||
@Output() openGroupMessage:EventEmitter<any> = new EventEmitter<any>();
|
||||
@@ -23,7 +25,9 @@ export class EditGroupPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private pickerController: PickerController,
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -58,7 +62,7 @@ export class EditGroupPage implements OnInit {
|
||||
else{
|
||||
console.log("Invalid name!");
|
||||
}
|
||||
this.close();
|
||||
this.close();
|
||||
}
|
||||
|
||||
_ionChange(event){
|
||||
@@ -68,11 +72,11 @@ export class EditGroupPage implements OnInit {
|
||||
const picker = await this.pickerController.create({
|
||||
cssClass: '',
|
||||
buttons: [
|
||||
{
|
||||
{
|
||||
text: 'Cancelar', role: 'cancel', cssClass: 'btn-cancel'
|
||||
},
|
||||
{
|
||||
text: 'Ok',
|
||||
{
|
||||
text: 'Ok',
|
||||
cssClass: 'btn-cancel',
|
||||
handler:(value:any)=>{
|
||||
console.log('button done pressed');
|
||||
@@ -86,24 +90,24 @@ export class EditGroupPage implements OnInit {
|
||||
if(value.days.value > 0){
|
||||
if(value.days.value == 1){
|
||||
if(value.hours.value == 1){
|
||||
this.displayDuration = value.days.value + " day " +
|
||||
this.displayDuration = value.days.value + " day " +
|
||||
value.hours.value + " hora " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
else{
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " horas " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(value.hours.value == 1){
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " hora " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
else{
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " horas " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
@@ -119,7 +123,7 @@ export class EditGroupPage implements OnInit {
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -173,7 +177,7 @@ export class EditGroupPage implements OnInit {
|
||||
await picker.present();
|
||||
picker.onDidDismiss().then(async data =>{
|
||||
let day = await picker.getColumn('days');
|
||||
let hour = await picker.getColumn('hours');
|
||||
let hour = await picker.getColumn('hours');
|
||||
let minutes = await picker.getColumn('minutes');
|
||||
});
|
||||
|
||||
|
||||
@@ -40,11 +40,9 @@ export class GroupContactsPage implements OnInit {
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
//private navParams: NavParams,
|
||||
)
|
||||
)
|
||||
{
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
});
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
this.textSearch="";
|
||||
this.dm=null;
|
||||
this.room=null;
|
||||
@@ -56,9 +54,9 @@ export class GroupContactsPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
//this.getRoomInfo();
|
||||
//this.loadUsers();
|
||||
this.loadUsers();
|
||||
console.log(this.roomId);
|
||||
this.getChatInfo();
|
||||
this.getChatInfo();
|
||||
//console.log(this.isGroupCreated);
|
||||
}
|
||||
|
||||
@@ -72,7 +70,7 @@ export class GroupContactsPage implements OnInit {
|
||||
}
|
||||
deleteMember(data:any){
|
||||
console.log(data);
|
||||
|
||||
|
||||
let body = {
|
||||
"roomId": this.roomId,
|
||||
"userId": data._id,
|
||||
@@ -100,7 +98,7 @@ export class GroupContactsPage implements OnInit {
|
||||
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'];
|
||||
@@ -148,7 +146,7 @@ export class GroupContactsPage implements OnInit {
|
||||
}
|
||||
|
||||
loadUsers1(members:any){
|
||||
this.options = {
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
this.chatService.getAllUsers().subscribe((res:any)=>{
|
||||
@@ -161,7 +159,7 @@ 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;
|
||||
@@ -172,13 +170,13 @@ export class GroupContactsPage implements OnInit {
|
||||
return 0;
|
||||
});
|
||||
console.log(this.users);
|
||||
|
||||
|
||||
this.showLoader = false;
|
||||
});
|
||||
}
|
||||
|
||||
loadUsers(){
|
||||
this.options = {
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
this.chatService.getAllUsers().subscribe((res:any)=>{
|
||||
@@ -191,7 +189,7 @@ 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;
|
||||
@@ -202,7 +200,7 @@ export class GroupContactsPage implements OnInit {
|
||||
return 0;
|
||||
});
|
||||
console.log(this.users);
|
||||
|
||||
|
||||
this.showLoader = false;
|
||||
});
|
||||
}
|
||||
@@ -228,7 +226,7 @@ export class GroupContactsPage implements OnInit {
|
||||
async close(){
|
||||
this.modalController.dismiss();
|
||||
if(this.isGroupCreated){
|
||||
console.log('go to conversa');
|
||||
console.log('go to conversa');
|
||||
}
|
||||
else{
|
||||
this.modalController.dismiss();
|
||||
@@ -272,7 +270,7 @@ export class GroupContactsPage implements OnInit {
|
||||
}
|
||||
this.chatService.addUserToGroup(body).subscribe(res=>{
|
||||
console.log(res['success']);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -285,14 +283,14 @@ export class GroupContactsPage implements OnInit {
|
||||
console.log(res['group']);
|
||||
this.addContacts(res['group']);
|
||||
this.openGroupMessages(res['group']);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
this.addContacts(this.room);
|
||||
this.close();
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
} */
|
||||
|
||||
async newGroup(){
|
||||
@@ -312,7 +310,7 @@ export class GroupContactsPage implements OnInit {
|
||||
component: GroupMessagesPage,
|
||||
componentProps: {
|
||||
room: room,
|
||||
},
|
||||
},
|
||||
cssClass: 'group-messages',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<button class="btn-no-color" (click)="openGroupMessagesOptions()">
|
||||
<ion-icon src="assets/images/icons-menu.svg"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div (click)="openGroupContactsPage()" class="header-bottom">
|
||||
<div class="header-bottom-icon">
|
||||
|
||||
@@ -21,12 +21,13 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
message:any;
|
||||
leaveStatus:any;
|
||||
messages:any;
|
||||
|
||||
|
||||
|
||||
room:any;
|
||||
roomName:any;
|
||||
members:any;
|
||||
|
||||
loggedUserChat:any;
|
||||
@Input() roomId:string;
|
||||
@Output() closeAllDesktopComponents:EventEmitter<any> = new EventEmitter<any>();
|
||||
@Output() showEmptyContainer:EventEmitter<any> = new EventEmitter<any>();
|
||||
@@ -43,6 +44,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
private animationController: AnimationController,
|
||||
private alertService: AlertService,
|
||||
) {
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.isGroupCreated = true;
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
@@ -50,10 +52,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
console.log(this.loggedUser);
|
||||
});
|
||||
this.loggedUser=this.loggedUserChat;
|
||||
this.getRoomInfo();
|
||||
console.log(this.roomId);
|
||||
}
|
||||
@@ -77,7 +76,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
get watch(){
|
||||
this.getRoomInfo();
|
||||
console.log('here watching');
|
||||
|
||||
|
||||
return this.roomId;
|
||||
}
|
||||
getRoomInfo(){
|
||||
@@ -112,18 +111,18 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
}
|
||||
loadGroupMessages(room:any){
|
||||
console.log('here'+room.t);
|
||||
|
||||
|
||||
this.showLoader = true;
|
||||
//If group is private call getGroupMembers
|
||||
if(room.t === 'p'){
|
||||
console.log('private');
|
||||
|
||||
|
||||
this.chatService.getPrivateGroupMessages(this.roomId).subscribe(res=>{
|
||||
console.log(res);
|
||||
let msgOnly = res['messages'].filter(data => data.t != 'au');
|
||||
this.messages = msgOnly.reverse();
|
||||
console.log(res);
|
||||
|
||||
|
||||
this.showLoader = false;
|
||||
});
|
||||
}
|
||||
@@ -138,14 +137,14 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
sendMessage(){
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
/* this.loadGroupMessages(); */
|
||||
/* this.loadGroupMessages(); */
|
||||
this.getRoomInfo();
|
||||
});
|
||||
this.message = "";
|
||||
@@ -174,7 +173,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
@@ -217,11 +216,11 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
else{
|
||||
this.roomName = res.data.name.split('-').join(' ');
|
||||
console.log(this.roomName);
|
||||
|
||||
|
||||
this.getRoomInfo();
|
||||
//this.modalController.dismiss();
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -252,9 +251,9 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
console.log(res);
|
||||
if(res.data){
|
||||
this.getRoomInfo();
|
||||
//this.modalController.dismiss();
|
||||
//this.modalController.dismiss();
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
async openChatOptions(ev: any) {
|
||||
@@ -271,7 +270,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
}
|
||||
async addContacts(){
|
||||
console.log(this.members);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: GroupContactsPage,
|
||||
componentProps: {
|
||||
@@ -279,7 +278,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
room: this.room,
|
||||
members: this.members,
|
||||
name: this.room.name,
|
||||
},
|
||||
},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
@@ -310,7 +309,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
handler: () => {
|
||||
console.log('Play clicked');
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
});
|
||||
await actionSheet.present();
|
||||
|
||||
@@ -30,11 +30,9 @@ export class ContactsPage implements OnInit {
|
||||
private http: HttpClient,
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
)
|
||||
{
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
});
|
||||
)
|
||||
{
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
this.textSearch="";
|
||||
this.dm=null;
|
||||
this.room=null;
|
||||
@@ -65,7 +63,7 @@ export class ContactsPage implements OnInit {
|
||||
}
|
||||
|
||||
loadUsers(){
|
||||
this.options = {
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
this.chatService.getAllUsers().subscribe((res:any)=>{
|
||||
@@ -105,7 +103,7 @@ export class ContactsPage implements OnInit {
|
||||
close(){
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
|
||||
clicked(){
|
||||
console.log('clicked');
|
||||
}
|
||||
@@ -122,7 +120,7 @@ export class ContactsPage implements OnInit {
|
||||
}
|
||||
getDirectMessage(roomId:any){
|
||||
console.log(roomId);
|
||||
|
||||
|
||||
this.chatService.getAllDirectMessages().subscribe(res=>{
|
||||
let result = res['ims'].filter(data => data._id == roomId);
|
||||
this.dm = result[0];
|
||||
@@ -133,7 +131,7 @@ export class ContactsPage implements OnInit {
|
||||
async openModal(dm:any){
|
||||
this.close();
|
||||
console.log(dm);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: MessagesPage,
|
||||
cssClass: 'group-messages',
|
||||
@@ -155,8 +153,8 @@ export class ContactsPage implements OnInit {
|
||||
//Get direct messages (dm)
|
||||
/* this.getDirectMessage(this.room._id); */
|
||||
console.log(this.dm);
|
||||
|
||||
|
||||
|
||||
|
||||
/* const modal = await this.modalController.create({
|
||||
component: MessagesPage,
|
||||
cssClass: 'group-messages',
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<button class="btn-no-color" (click)="_openMessagesOptions()">
|
||||
<ion-icon src="assets/images/icons-menu.svg"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div hidden class="header-bottom" (click)="addContacts()">
|
||||
<div class="header-bottom-icon">
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
|
||||
<ion-footer>
|
||||
FOOter
|
||||
<div class="container width-100 d-flex">
|
||||
<div>
|
||||
<button class="btn-no-color" (click)="openSendMessageOptions()">
|
||||
|
||||
@@ -29,7 +29,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
dmUsers:any;
|
||||
|
||||
@Input() roomId:string;
|
||||
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
private modalController: ModalController,
|
||||
@@ -39,33 +39,30 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
private animationController: AnimationController,
|
||||
private alertService: AlertService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
/* this.dm = this.navParams.get('dm'); */
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
console.log(this.roomId);
|
||||
this.load();
|
||||
|
||||
|
||||
//throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.scrollToBottom();
|
||||
//this.scrollToBottom();
|
||||
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
console.log(this.loggedUser);
|
||||
});
|
||||
|
||||
/* setInterval(()=>{ */
|
||||
this.load();
|
||||
/* }, 9000); */
|
||||
console.log(this.roomId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
notImplemented(){
|
||||
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
|
||||
}
|
||||
@@ -80,22 +77,22 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
this.load();
|
||||
ev.target.complete();
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
this.scrollToBottom();
|
||||
|
||||
ngAfterViewChecked() {
|
||||
//this.scrollToBottom();
|
||||
console.log(this.roomId);
|
||||
}
|
||||
scrollToBottom(): void {
|
||||
}
|
||||
/* scrollToBottom(): void {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
||||
} catch(err) { }
|
||||
} catch(err) { }
|
||||
finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} */
|
||||
loadMoreMessages(ev:any){
|
||||
|
||||
}
|
||||
@@ -103,18 +100,18 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
sendMessage(){
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
this.loadMessages();
|
||||
this.loadMessages();
|
||||
});
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
|
||||
loadMessages(){
|
||||
this.showLoader = true;
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
|
||||
@@ -126,7 +123,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
}
|
||||
getChatMembers(){
|
||||
console.log(this.roomId);
|
||||
|
||||
|
||||
this.showLoader = true;
|
||||
this.chatService.getMembers(this.roomId).subscribe(res=> {
|
||||
this.dmUsers = res['members'].filter(data => data.username != this.loggedUser.me.username)
|
||||
@@ -152,7 +149,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
async addContacts(){
|
||||
const modal = await this.modalController.create({
|
||||
component: ContactsPage,
|
||||
componentProps: {},
|
||||
componentProps: {},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
@@ -209,7 +206,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
@@ -234,7 +231,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
return await modal.present();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async _openChatOptions() {
|
||||
|
||||
@@ -260,7 +257,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
|
||||
@@ -52,12 +52,12 @@ export class PedidosPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
this.LoadList();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if(event instanceof NavigationStart && '/home/gabinete-digital?parecer=true'.startsWith(event.url) ||
|
||||
event instanceof NavigationStart && '/home/gabinete-digital?deferimento=true'.startsWith(event.url) ||
|
||||
if(event instanceof NavigationStart && '/home/gabinete-digital?parecer=true'.startsWith(event.url) ||
|
||||
event instanceof NavigationStart && '/home/gabinete-digital?deferimento=true'.startsWith(event.url) ||
|
||||
event instanceof NavigationStart && '/home/gabinete-digital?pedidos=true'.startsWith(event.url)
|
||||
) {
|
||||
|
||||
@@ -70,7 +70,7 @@ export class PedidosPage implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
segmentChanged(ev: any) {
|
||||
@@ -88,7 +88,7 @@ export class PedidosPage implements OnInit {
|
||||
|
||||
async LoadList() {
|
||||
|
||||
this.skeletonLoader = true
|
||||
this.skeletonLoader = true;
|
||||
|
||||
if(this.segment == 'parecer') {
|
||||
this.taskType = "Pedido de Parecer";
|
||||
@@ -132,7 +132,7 @@ export class PedidosPage implements OnInit {
|
||||
this.processes.GetTasksList("Pedido de Deferimento", false).subscribe(result => {
|
||||
|
||||
this.taskslist = result.filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
|
||||
|
||||
this.skeletonLoader = false
|
||||
|
||||
this.deferimentoList = new Array();
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiURL: 'https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/',
|
||||
/* apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V4/api/', */
|
||||
/* apiURL: 'https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/', */
|
||||
apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V4/api/',
|
||||
apiChatUrl: 'https://www.tabularium.pt/api/v1/',
|
||||
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
|
||||
domain: 'gabinetedigital.local', //gabinetedigital.local
|
||||
|
||||
Reference in New Issue
Block a user