add document viewer in chat

This commit is contained in:
tiago.kayaya
2021-10-09 20:24:34 +01:00
parent 858fa57ebd
commit c36ef9ef87
10 changed files with 196 additions and 88 deletions
@@ -66,7 +66,7 @@
<div>
<div class="file">
<!-- <canvas id="pdf_canvas"></canvas> -->
<div (click)="viewDocument(file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<div (click)="viewDocument(msg.file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
@@ -371,22 +371,60 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.fileService.viewDocumentByUrl(fullUrl);
}
else{
this.fileService.viewDocumentByUrl(file.title_link);
//this.openViewDocumentModal(file);
//this.fileService.viewDocumentByUrl(file.title_link);
this.openViewDocumentModal(file);
}
}
async openViewDocumentModal(file:any){
let task = {
serialNumber: '',
taskStartDate: '',
isEvent: true,
workflowInstanceDataFields: {
FolderID: '',
Subject: file.Assunto,
SourceSecFsID: file.ApplicationId,
SourceType: 'DOC',
SourceID: file.DocId,
DispatchNumber: ''
}
}
let doc = {
"Id": "",
"ParentId": "",
"Source": 1,
"ApplicationId": file.ApplicationId,
"CreateDate": "",
"Data": null,
"Description":"",
"Link": null,
"SourceId": file.DocId,
"SourceName": file.Assunto,
"Stakeholders": "",
}
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
file: file,
trustedUrl: '',
file: {
title: file.Assunto,
url: '',
title_link: '',
},
Document: doc,
applicationId: file.ApplicationId,
docId: file.DocId,
folderId: '',
task: task
},
cssClass: 'modal modal-desktop',
backdropDismiss: false
cssClass: 'modal modal-desktop'
});
await modal.present();
modal.onDidDismiss();
}
async bookMeeting() {
+43 -65
View File
@@ -290,8 +290,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.fileService.viewDocumentByUrl(fullUrl);
}
else{
this.fileService.viewDocumentByUrl(file.title_link);
//this.openViewDocumentModal(file);
//this.fileService.viewDocumentByUrl(file.title_link);
this.openViewDocumentModal(file);
}
}
@@ -300,75 +300,53 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async openViewDocumentModal(file:any){
console.log(file);
const docId = file.DocId;
const applicationId: any = file.ApplicationId;
this.processes.GetDocumentDetails(docId, applicationId).subscribe( async(res)=> {
this.LoadedDocument = res;
this.LoadedDocument.Subject = this.LoadedDocument.Assunto
let thedate = new Date(this.LoadedDocument.DateDispatch || this.LoadedDocument.DocDate);
//this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
let task: ExpedientTaskModalPageNavParamsTask
let document: SearchDocumentDetails = this.LoadedDocument
let folder: SearchFolderDetails = this.LoadedDocument
if(this.LoadedDocument.ApplicationID == 361 || this.LoadedDocument.ApplicationId == 361) {
task = {
serialNumber: folder.DispatchNumber,
taskStartDate: folder.DateDispatch,
isEvent: true,
workflowInstanceDataFields: {
FolderID: folder['FolderId'] || folder['FolderID'] || folder.folderId,
Subject: folder.Assunto,
SourceSecFsID: folder.ApplicationID || folder['ApplicationId'],
SourceType: 'FOLDER',
SourceID: folder.folderId,
DispatchNumber: folder.DispatchNumber
},
}
}
else if (document.ApplicationID == 8 || document.ApplicationId == 8)
{
task = {
serialNumber: document.DocId,
taskStartDate: document.DocDate,
isEvent: true,
workflowInstanceDataFields: {
FolderID: null,
Subject: document.Assunto,
DispatchNumber: null,
SourceSecFsID: document.ApplicationID || document.ApplicationId,
SourceType: 'DOC',
SourceID: document.DocId,
}
}
} else {
console.log('unexpected ApplicationID')
let task = {
serialNumber: '',
taskStartDate: '',
isEvent: true,
workflowInstanceDataFields: {
FolderID: '',
Subject: file.Assunto,
SourceSecFsID: file.ApplicationId,
SourceType: 'DOC',
SourceID: file.DocId,
DispatchNumber: ''
}
}
let doc = {
"Id": "",
"ParentId": "",
"Source": 1,
"ApplicationId": file.ApplicationId,
"CreateDate": "",
"Data": null,
"Description":"",
"Link": null,
"SourceId": file.DocId,
"SourceName": file.Assunto,
"Stakeholders": "",
}
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: task.workflowInstanceDataFields.Subject,
url: '',
title_link: '',
},
Document: this.LoadedDocument,
applicationId: document.ApplicationID || document.ApplicationId,
docId: document.ApplicationID || document.ApplicationId,
folderId: folder['FolderId'] || folder['FolderID'] || folder.folderId
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: file.Assunto,
url: '',
title_link: '',
},
cssClass: 'modal modal-desktop'
});
await modal.present();
Document: doc,
applicationId: file.ApplicationId,
docId: file.DocId,
folderId: '',
task: task
},
cssClass: 'modal modal-desktop'
});
await modal.present();
}
getChatMembers() {