+
+
{{file.title}}
diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts
index bab89164b..15f53070d 100644
--- a/src/app/pages/chat/messages/messages.page.ts
+++ b/src/app/pages/chat/messages/messages.page.ts
@@ -2,6 +2,7 @@ import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnIn
import {ActivatedRoute, Router} from '@angular/router'
import { GestureController, Gesture, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { map } from 'rxjs/operators';
+import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { EventPerson } from 'src/app/models/eventperson.model';
import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page';
import { AlertService } from 'src/app/services/alert.service';
@@ -273,8 +274,28 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
}
- viewDocument(url:string){
- this.fileService.viewDocumentByUrl(url);
+ viewDocument(file:any){
+ if(file.type == "file"){
+ let fullUrl = "https://www.tabularium.pt" + file.title_link;
+ this.fileService.viewDocumentByUrl(fullUrl);
+ }
+ else{
+ this.fileService.viewDocumentByUrl(file.title_link);
+ //this.openViewDocumentModal(file);
+ }
+ }
+
+ async openViewDocumentModal(file:any){
+ const modal = await this.modalController.create({
+ component: ViewDocumentPage,
+ componentProps: {
+ file: file,
+ },
+ cssClass: 'modal modal-desktop',
+ backdropDismiss: false
+ });
+ await modal.present();
+ modal.onDidDismiss();
}
getChatMembers() {
diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts
index d8094ed39..ca61b3319 100644
--- a/src/app/services/auth.service.ts
+++ b/src/app/services/auth.service.ts
@@ -65,7 +65,7 @@ export class AuthService {
}
SetSession(response: LoginUserRespose, user:UserForm) {
- const session: UserSession = Object.assign(SessionStore.user, response)
+ const session: UserSession = Object.assign(SessionStore.user, response)
if (response) {
if( session.RoleID == 100000014) {
@@ -102,6 +102,8 @@ export class AuthService {
console.log('Login to Rocket chat OK');
this.ValidatedUserChat = responseChat;
localStorage.setItem('userChat', JSON.stringify(responseChat));
+ localStorage.setItem('Meteor.loginToken', JSON.stringify(responseChat['data'].userId));
+ localStorage.setItem('Meteor.userId', JSON.stringify(responseChat['data'].authToken));
this.storageService.store(AuthConnstants.AUTH, responseChat);
return true;
}
diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts
index 910ffa9e1..612975aaf 100644
--- a/src/app/services/chat.service.ts
+++ b/src/app/services/chat.service.ts
@@ -49,6 +49,22 @@ export class ChatService {
}); */
}
+ getDocumentDetails(url:string){
+ let headersc = new HttpHeaders();
+ headersc = headersc.set('X-User-Id', this.loggedUserChat['data'].userId);
+ headersc = headersc.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
+ // headersc = headersc.set("Host", "www.tabularium.pt");
+ // headersc = headersc.set("Origin", "http://localhost:8100");
+ // headersc = headersc.set("Referer", "http://localhost:8100/");
+ let optionsc = {
+ headers: headersc,
+ };
+ let fullUrl = "https://www.tabularium.pt/" + url;
+ return this.http.get(fullUrl, optionsc).subscribe(()=>{
+ //this.fileService.viewDocumentByUrl(url)
+ });
+ }
+
getAllChannels(){
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
}
@@ -113,6 +129,14 @@ export class ChatService {
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
}
+ uploadFile(formData:any, rid:string){
+ let url = environment.apiChatUrl+'rooms.upload/'+rid;
+ let opts = {
+ headers: this.headers,
+ }
+ return this.http.post(url, formData, opts);
+ }
+
deleteMessage(body:any){
let opts = {
headers: this.headers,
diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts
index 037f7031a..95f02e6b5 100644
--- a/src/app/services/functions/file.service.ts
+++ b/src/app/services/functions/file.service.ts
@@ -21,6 +21,8 @@ export class FileService {
documents:SearchList[] = [];
showLoader: boolean;
+ files: Set
;
+
constructor(
private camera: Camera,
private fileLoaderService: FileLoaderService,
@@ -160,33 +162,12 @@ export class FileService {
console.log(file);
- const imageData = await this.fileToBase64Service.convert(file)
- this.capturedImage = imageData;
- this.capturedImageTitle = file.name;
+ const formData = new FormData();
+ formData.append('file', file, file.name);
- let body = {
- "message":
- {
- "rid": roomId,
- "msg": "",
- "attachments": [{
- "title": this.capturedImageTitle,
- "text": "",
- "title_link": this.capturedImage,
- "title_link_download": true,
- "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
- "message_link": this.capturedImage,
- }],
- "file":{
- "name": this.capturedImageTitle,
- "type": "application/pdf",
- }
- }
- }
-
- this.chatService.sendMessage(body).subscribe(res=> {
+ this.chatService.uploadFile(formData, roomId).subscribe(res=> {
+ console.log(res);
loader.remove();
- //console.log(res);
},(error) => {
loader.remove();
});
@@ -233,6 +214,7 @@ export class FileService {
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
"message_link": url_no_options,
+ "type": "webtrix"
}],
"file":{
"name": res.data.selected.Assunto,
diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html
index e8a8bc4ab..051d6a75d 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.html
+++ b/src/app/shared/chat/group-messages/group-messages.page.html
@@ -59,10 +59,11 @@
-
-
+
+
+
{{file.title}}
@@ -126,9 +127,31 @@
-
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts
index 3e4a60242..0935d57f9 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.ts
+++ b/src/app/shared/chat/group-messages/group-messages.page.ts
@@ -17,6 +17,7 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchList } from 'src/app/models/search-document';
import { ProcessesService } from 'src/app/services/processes.service';
import { FileService } from 'src/app/services/functions/file.service';
+import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
/*
@@ -89,7 +90,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
ngOnChanges(changes: SimpleChanges): void {
- //this.getRoomInfo();
+ this.getRoomInfo();
//this.scrollToBottom();
}
@@ -607,8 +608,48 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
});
}
- viewDocument(url:string){
- this.fileService.viewDocumentByUrl(url);
+ viewDocument(file:any){
+ if(file.type == "file"){
+ let fullUrl = "https://www.tabularium.pt" + file.title_link;
+ this.fileService.viewDocumentByUrl(fullUrl);
+ }
+ else{
+ this.fileService.viewDocumentByUrl(file.title_link);
+ //this.openViewDocumentModal(file);
+ }
+ }
+
+ async openViewDocumentModal(file:any){
+ const modal = await this.modalController.create({
+ component: ViewDocumentPage,
+ componentProps: {
+ file: file,
+ },
+ cssClass: 'modal modal-desktop',
+ backdropDismiss: false
+ });
+ await modal.present();
+ modal.onDidDismiss();
+ }
+
+ takePicture(){
+ this.fileService.addCameraPictureToChat(this.roomId);
+ }
+ addImage(){
+ this.fileService.addPictureToChat(this.roomId);
+ }
+ addFile(){
+ this.fileService.addDocumentToChat(this.roomId);
+ }
+ addFileWebtrix(){
+ this.fileService.addDocGestaoDocumentalToChat(this.roomId);
+ }
+ bookMeeting(){
+ let data = {
+ roomId: this.roomId,
+ members: this.members
+ }
+ this.openNewEventPage.emit(data);
}
async _openChatOptions() {
diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html
index d722ff16d..a26012f2e 100644
--- a/src/app/shared/chat/messages/messages.page.html
+++ b/src/app/shared/chat/messages/messages.page.html
@@ -51,8 +51,8 @@
-
-
+
+
@@ -99,9 +99,33 @@
-
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts
index 3bffc01df..cab59831e 100644
--- a/src/app/shared/chat/messages/messages.page.ts
+++ b/src/app/shared/chat/messages/messages.page.ts
@@ -14,6 +14,8 @@ import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
import { TimeService } from 'src/app/services/functions/time.service';
import { FileService } from 'src/app/services/functions/file.service';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@Component({
selector: 'app-messages',
@@ -68,6 +70,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private timeService: TimeService,
private fileService: FileService,
private gestureController: GestureController,
+ private http:HttpClient,
) {
this.loggedUser = authService.ValidatedUserChat['data'];
@@ -239,8 +242,28 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
})
}
- viewDocument(url:string){
- this.fileService.viewDocumentByUrl(url);
+ viewDocument(file:any){
+ if(file.type == "file"){
+ let fullUrl = "https://www.tabularium.pt" + file.title_link;
+ this.fileService.viewDocumentByUrl(fullUrl);
+ }
+ else{
+ this.fileService.viewDocumentByUrl(file.title_link);
+ //this.openViewDocumentModal(file);
+ }
+ }
+
+ async openViewDocumentModal(file:any){
+ const modal = await this.modalController.create({
+ component: ViewDocumentPage,
+ componentProps: {
+ file: file,
+ },
+ cssClass: 'modal modal-desktop',
+ backdropDismiss: false
+ });
+ await modal.present();
+ modal.onDidDismiss();
}
getChatMembers() {
@@ -356,6 +379,28 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
+ takePicture(){
+ this.fileService.addCameraPictureToChat(this.roomId);
+ }
+ addImage(){
+ this.fileService.addPictureToChat(this.roomId);
+ }
+ addFile(){
+ this.fileService.addDocumentToChat(this.roomId);
+ }
+ addFileWebtrix(){
+ this.fileService.addDocGestaoDocumentalToChat(this.roomId);
+ }
+ bookMeeting(){
+ let data = {
+ roomId: this.roomId,
+ members: this.members
+ }
+ this.openNewEventPage.emit(data);
+ }
+
+
+
async _openChatOptions() {
const enterAnimation = (baseEl: any) => {
diff --git a/src/global.scss b/src/global.scss
index a837a721a..60b71dcf2 100644
--- a/src/global.scss
+++ b/src/global.scss
@@ -1175,6 +1175,23 @@ ngx-mat-datetime-content{
.powerpoint-icon{
color: #d24726;
}
+.menu-icon{
+ color: #42b9fe;
+ padding: 0 5px 0 5px;
+}
+
+.fab-list{
+ overflow: auto;
+
+ .fab-list-btn{
+ position: relative;
+ float: left;
+ border: 1px solid blue;
+ }
+ .fab-list-text{
+ border-radius: 15px;
+ }
+}
@media only screen and (min-width: 665px) {
.loading-blocker {
diff --git a/src/index.html b/src/index.html
index fb77a3f7a..2cc52887a 100644
--- a/src/index.html
+++ b/src/index.html
@@ -7,13 +7,13 @@
-
-
+
-
-
- -->
+
+