viewer hot-fix

This commit is contained in:
Peter Maquiran
2021-10-08 19:29:21 +01:00
parent 405c989b87
commit 9ceb915fef
37 changed files with 708 additions and 360 deletions
@@ -13,6 +13,8 @@ import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTas
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
import { SearchedDocumentOptionsPage } from '../../popover/searched-document-options/searched-document-options.page';
import { EventDetailsDocumentsOptionsPage } from '../../popover/event-details-documents-options/event-details-documents-options.page';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@Component({
selector: 'app-view-event',
@@ -85,8 +87,7 @@ export class ViewEventPage implements OnInit {
this.dicIndex = index;
}
close(){
console.log(this.isEventEdited);
close() {
this.viewEventDetailDismiss.emit({
type: 'close'
@@ -101,8 +102,6 @@ export class ViewEventPage implements OnInit {
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
// console.log('errer', )
this.viewEventDetailDismiss.emit({
type: 'close'
})
@@ -139,7 +138,6 @@ export class ViewEventPage implements OnInit {
()=>{
loader.remove();
});
}
}
@@ -156,7 +154,6 @@ export class ViewEventPage implements OnInit {
modal.onDidDismiss().then((res) => {
});
}
async editEvent() {
@@ -168,155 +165,115 @@ export class ViewEventPage implements OnInit {
viewDocument(sourceId) {
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
console.log(res);
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
});
}
async LoadDocumentDetails() {
const docId = this.loadedEvent.Attachments[ this.dicIndex].SourceId
const applicationId = this.loadedEvent.Attachments[ this.dicIndex].ApplicationId
const applicationId: any = this.loadedEvent.Attachments[ this.dicIndex].ApplicationId
console.log(this.loadedEvent.Attachments[ this.dicIndex])
// this.processes.GetDocumentDetails(docId, applicationId).subscribe( async(res)=> {
// this.LoadedDocument = res;
// this.LoadedDocument.Subject = this.LoadedDocument.Assunto
this.processes.GetDocumentDetails(docId, applicationId).subscribe( async(res)=> {
// let thedate = new Date(this.LoadedDocument.DateDispatch || this.LoadedDocument.DocDate);
// this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
this.LoadedDocument = res;
this.LoadedDocument.Subject = this.LoadedDocument.Assunto
// let task: ExpedientTaskModalPageNavParamsTask
// let document: SearchDocumentDetails = this.LoadedDocument
// let folder: SearchFolderDetails = this.LoadedDocument
let thedate = new Date(this.LoadedDocument.DateDispatch || this.LoadedDocument.DocDate);
// 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.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 = task
console.log('this.task = task', this.task)
this.task = task
const popover = await this.popoverController.create({
component: SearchedDocumentOptionsPage,
cssClass: 'exp-options',
componentProps: {
task: this.task,
LoadedDocument: this.LoadedDocument
},
translucent: true
});
await popover.present()
// 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();
// });
popover.onDidDismiss().then((res:any) => {
if(res.data.component == 'openBookMeetingModal') {
this.openBookMeetingModal()
} else if(res.data.component == 'openExpedientActionsModal') {
this.openExpedientActionsModal(res.data.taskAction)
} else {
console.log(res.data)
}
});
const selectedDoc = this.loadedEvent.Attachments[ this.dicIndex]
});
console.log('selectedDoc', selectedDoc)
}
async openTaskOptions() {
let task: ExpedientTaskModalPageNavParamsTask
let document: SearchDocumentDetails = this.loadedEvent.Attachments[ this.dicIndex];
let folder: SearchFolderDetails = this.loadedEvent.Attachments[ this.dicIndex];
if(this.loadedEvent.Attachments[this.dicIndex].ApplicationID == 361 || this.loadedEvent.Attachments[this.dicIndex].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,
}
this.task = {
serialNumber: '',
taskStartDate: '',
isEvent: true,
workflowInstanceDataFields: {
FolderID: '',
Subject: selectedDoc.SourceName,
SourceSecFsID: selectedDoc.ApplicationId,
SourceType: 'DOC',
SourceID: selectedDoc.SourceId,
DispatchNumber: ''
}
}
this.task = task
const popover = await this.popoverController.create({
component: SearchedDocumentOptionsPage,
cssClass: 'exp-options',
componentProps: {
task: this.task,
LoadedDocument: this.LoadedDocument
},
translucent: true
});
await popover.present()
popover.onDidDismiss().then((res:any) => {
if(res.data.component == 'openBookMeetingModal') {
this.openBookMeetingModal()
} else if(res.data.component == 'openExpedientActionsModal') {
this.openExpedientActionsModal(res.data.taskAction)
} else {
console.log(res.data)
console.log('component not found')
}
});
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: this.task.workflowInstanceDataFields.Subject,
url: '',
title_link: '',
},
applicationId: this.task.workflowInstanceDataFields.SourceSecFsID,
docId: selectedDoc.SourceId,
folderId: ''
},
cssClass: 'modal modal-desktop'
});
await modal.present();
}
@@ -332,7 +289,7 @@ export class ViewEventPage implements OnInit {
component: DocumentSetUpMeetingPage,
componentProps: {
subject: this.task.workflowInstanceDataFields.Subject,
document: this.loadedEvent,
document: this.loadedEvent.Attachments[ this.dicIndex],
},
cssClass: classs,
backdropDismiss: false
@@ -357,8 +314,8 @@ export class ViewEventPage implements OnInit {
componentProps: {
taskAction: taskAction,
task: this.task,
seachDocuments: this.loadedEvent,
aplicationId: this.loadedEvent.ApplicationId || this.loadedEvent.ApplicationID
seachDocuments: this.loadedEvent.Attachments[ this.dicIndex],
aplicationId: this.loadedEvent.Attachments[ this.dicIndex].ApplicationId || this.loadedEvent.Attachments[ this.dicIndex].ApplicationID
},
cssClass: classs,
});