diff --git a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts index 0fb21d728..74beab957 100644 --- a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts +++ b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts @@ -183,6 +183,8 @@ export class DocumentSetUpMeetingPage implements OnInit { }) } else{ + console.log(this.document); +alert('PARA') this.docs.push({ ApplicationId: this.document.ApplicationId || this.document.ApplicationType, Source: 1, diff --git a/src/app/modals/view-document/view-document.page.html b/src/app/modals/view-document/view-document.page.html index a16d98c43..7de84b677 100644 --- a/src/app/modals/view-document/view-document.page.html +++ b/src/app/modals/view-document/view-document.page.html @@ -22,8 +22,8 @@ -
- +
+ Estamos a preparar a visualização do documento. Por favor aguarde.
diff --git a/src/app/pages/agenda/view-event/view-event.page.ts b/src/app/pages/agenda/view-event/view-event.page.ts index 6a39d96ab..25775dc21 100644 --- a/src/app/pages/agenda/view-event/view-event.page.ts +++ b/src/app/pages/agenda/view-event/view-event.page.ts @@ -15,9 +15,6 @@ import { Location } from '@angular/common' import { SqliteService } from 'src/app/services/sqlite.service'; import { synchro } from '../../../services/socket/synchro.service'; import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage'; -import { SearchDocumentDetails, SearchFolderDetails } from 'src/app/models/search-document'; -import { EventDetailsDocumentsOptionsPage } from 'src/app/shared/popover/event-details-documents-options/event-details-documents-options.page'; -import { SearchedDocumentOptionsPage } from 'src/app/shared/popover/searched-document-options/searched-document-options.page'; import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page'; import { ExpedientTaskModalPage } from '../../gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; @@ -297,70 +294,43 @@ export class ViewEventPage implements OnInit { const docId = this.loadedEvent.Attachments[ this.dicIndex].SourceId const applicationId: any = this.loadedEvent.Attachments[ this.dicIndex].ApplicationId + const selectedDoc = this.loadedEvent.Attachments[ this.dicIndex] - this.processes.GetDocumentDetails(docId, applicationId).subscribe( async(res)=> { - - this.LoadedDocument = res; - this.LoadedDocument.Subject = this.LoadedDocument.Assunto + console.log('selectedDoc', selectedDoc) - 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') + this.task = { + serialNumber: '', + taskStartDate: '', + isEvent: true, + workflowInstanceDataFields: { + FolderID: '', + Subject: selectedDoc.SourceName, + SourceSecFsID: selectedDoc.ApplicationId || selectedDoc['ApplicationID'], + SourceType: 'DOC', + SourceID: selectedDoc.SourceId, + DispatchNumber: '' } + } - 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: this.task.workflowInstanceDataFields.Subject, + url: '', + title_link: '', }, - cssClass: 'modal modal-desktop' - }); - await modal.present(); + Document: this.loadedEvent.Attachments[ this.dicIndex], + applicationId: this.task.workflowInstanceDataFields.SourceSecFsID, + docId: selectedDoc.SourceId, + folderId: '', + task: this.task + }, + cssClass: 'modal modal-desktop' }); + await modal.present(); } async openBookMeetingModal() { diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html index 13523de85..cdf628d87 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -66,7 +66,7 @@
-
+
diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index e77fd6af9..55922891b 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -365,28 +365,66 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { }; } - viewDocument(file:any){ - if(file.type == "file"){ - let fullUrl = "https://www.tabularium.pt" + file.title_link; - this.fileService.viewDocumentByUrl(fullUrl); + viewDocument(file:any, url?:string){ + + if(file.type == "application/webtrix") { + this.openViewDocumentModal(file); } else{ - this.fileService.viewDocumentByUrl(file.title_link); - //this.openViewDocumentModal(file); + let fullUrl = "https://www.tabularium.pt" + url; + this.fileService.viewDocumentByUrl(fullUrl); } } 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() { diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index db6c33508..c29f6e2a5 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -64,7 +64,7 @@
-
+
diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index ed7fd015f..2b4c147e7 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -282,16 +282,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { }) } - viewDocument(file:any){ + viewDocument(file:any, url?:string){ console.log(file); - if(file.type == "file"){ - let fullUrl = "https://www.tabularium.pt" + file.title_link; - this.fileService.viewDocumentByUrl(fullUrl); + if(file.type == "application/webtrix") { + this.openViewDocumentModal(file); } else{ - this.fileService.viewDocumentByUrl(file.title_link); - //this.openViewDocumentModal(file); + let fullUrl = "https://www.tabularium.pt" + url; + this.fileService.viewDocumentByUrl(fullUrl); } } @@ -300,75 +299,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() { diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts index 4dbdcd120..d5f3af27b 100644 --- a/src/app/services/functions/file.service.ts +++ b/src/app/services/functions/file.service.ts @@ -267,8 +267,6 @@ export class FileService { modal.onDidDismiss().then(async res=>{ const data = res.data; - alert('HERE') - if(data.selected){ const loader = this.toastService.loading(); @@ -277,14 +275,9 @@ export class FileService { console.log(res.data.selected.Id); console.log(res.data.selected.ApplicationType); - console.log('AQUIIIII'); - - alert('HERE 2') - let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise(); let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); console.log(url_no_options); - console.log('Oie'); let body = { "message": @@ -305,6 +298,7 @@ export class FileService { "type": "application/webtrix", "ApplicationId": res.data.selected.ApplicationType, "DocId": res.data.selected.Id, + "Assunto": res.data.selected.Assunto, } } } diff --git a/src/app/services/processes.service.ts b/src/app/services/processes.service.ts index cfd6dc9c3..24404944e 100644 --- a/src/app/services/processes.service.ts +++ b/src/app/services/processes.service.ts @@ -27,7 +27,7 @@ export class ProcessesService { ) { this.loggeduser = this.user.ValidatedUser; - + this.setHeader() this.changeProfileService.registerCallback(()=>{ this.loggeduser = this.user.ValidatedUser; @@ -89,7 +89,7 @@ export class ProcessesService { }; return this.http.get(`${geturl}`, options); } - + SetTaskToPending(serialNumber:string): Observable{ const geturl = environment.apiURL + 'Tasks/SetTaskPending'; @@ -325,6 +325,23 @@ export class ProcessesService { return this.http.post(`${url}`,body, options); } + DocumentDetail(DocId:string, FsId:string){ + + const geturl = environment.apiURL + 'ecm/GetDocument'; + let params = new HttpParams(); + + params = params.set("docId", DocId); + params = params.set("applicationId", FsId); + params = params.set("externalAppId ", 101); + params = params.set("SourceLocation ", 17); + + let options = { + headers: this.headers, + params: params + }; + return this.http.get(`${geturl}`, options); + } + getFileBase64(DocId: string | number) { let url = environment.apiURL + 'ecm/document/file'; diff --git a/src/app/shared/agenda/view-event/view-event.page.ts b/src/app/shared/agenda/view-event/view-event.page.ts index 042625331..8277b7ecf 100644 --- a/src/app/shared/agenda/view-event/view-event.page.ts +++ b/src/app/shared/agenda/view-event/view-event.page.ts @@ -172,70 +172,6 @@ export class ViewEventPage implements OnInit { const docId = this.loadedEvent.Attachments[ this.dicIndex].SourceId const applicationId: any = this.loadedEvent.Attachments[ this.dicIndex].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') - // } - - // const modal = await this.modalController.create({ - // component: ViewDocumentPage, - // componentProps: { - // trustedUrl: '', - // file: { - // title: task.workflowInstanceDataFields.Subject, - // url: '', - // title_link: '', - // }, - // Document: this.LoadedDocument, - // applicationId: task.workflowInstanceDataFields.SourceSecFsID, - // docId: this.LoadedDocument.DocId || this.LoadedDocument.DocID, - // folderId: folder['FolderId'] || folder['FolderID'] || folder.folderId - // }, - // cssClass: 'modal modal-desktop' - // }); - // await modal.present(); - // }); - const selectedDoc = this.loadedEvent.Attachments[ this.dicIndex] console.log('selectedDoc', selectedDoc) @@ -254,7 +190,6 @@ export class ViewEventPage implements OnInit { } } - const modal = await this.modalController.create({ component: ViewDocumentPage, componentProps: { 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 5afddf0db..643a633f1 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -59,7 +59,7 @@
-
+
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 0935d57f9..8b10e1990 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -608,28 +608,63 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe }); } - 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); - } + viewDocument(file:any, url?:string){ + if(file.type == "application/webtrix") { + this.openViewDocumentModal(file); + } + else{ + let fullUrl = "https://www.tabularium.pt" + url; + this.fileService.viewDocumentByUrl(fullUrl); + } } 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(); } takePicture(){ diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index c582ee122..dc7c45171 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -51,7 +51,7 @@
-
+
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 3b20a5099..90519e085 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -242,28 +242,64 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy }) } - 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); - } + viewDocument(file:any, url?:string){ + if(file.type == "application/webtrix") { + this.openViewDocumentModal(file); + } + else{ + let fullUrl = "https://www.tabularium.pt" + url; + this.fileService.viewDocumentByUrl(fullUrl); + } } + 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(); } getChatMembers() {