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
@@ -86,8 +86,8 @@
<h5>Documentos Anexados</h5>
<ion-list class="width-100">
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
<ion-label class="width-100 d-flex " >
<p class="flex-grow-1" (click)="viewDocument(attach.SourceId)">
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
<p class="flex-grow-1" >
<span class="attach-title-item d-block">{{attach.SourceName}}</span>
<span class="span-left d-block">{{attach.Stakeholders}}</span>
</p>
@@ -96,7 +96,7 @@
<span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span>
</div>
<div (click)="docIndex(i);openTaskOptions()" class="cursor-pointer" style="width: 35px; height: 41px;" autoHide="false">
<div (click)="docIndex(i);LoadDocumentDetails()" class="cursor-pointer" style="width: 35px; height: 41px;" autoHide="false">
<ion-icon src="assets/images/icons-menu.svg" ></ion-icon>
</div>
@@ -12,6 +12,13 @@ import { ActivatedRoute, Router } from '@angular/router';
import { ToastService } from 'src/app/services/toast.service';
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
import { Location } from '@angular/common'
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';
@Component({
selector: 'app-view-event',
@@ -42,6 +49,8 @@ export class ViewEventPage implements OnInit {
dicIndex = 0;
isModal = false
header = true
task: ExpedientTaskModalPageNavParamsTask;
LoadedDocument:any = null;
constructor(
private modalController: ModalController,
@@ -257,47 +266,124 @@ 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 openTaskOptions() {
const doc = this.loadedAttachments[this.dicIndex];
let customTask = {
serialNumber: doc.SourceId,
taskStartDate: doc.CreateDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationId,
FolderID: null,
DocId: doc.SourceId,
Subject: doc.SourceName
},
}
const popover = await this.popoverController.create({
component: OptsExpedientePage,
cssClass: 'exp-options',
componentProps: {
fulltask: customTask,
task: customTask
},
translucent: true
});
return await popover.present();
}
docIndex(index: number){
this.dicIndex = index
}
async LoadDocumentDetails() {
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: document.ApplicationID || document.ApplicationId,
docId: document.ApplicationID || document.ApplicationId,
folderId: folder['FolderId'] || folder['FolderID'] || folder.folderId
},
cssClass: 'modal modal-desktop'
});
await modal.present();
});
}
async openBookMeetingModal() {
let classs;
if( window.innerWidth < 701) {
classs = 'book-meeting-modal modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: DocumentSetUpMeetingPage,
componentProps: {
subject: this.task.workflowInstanceDataFields.Subject,
document: this.loadedEvent.Attachments[ this.dicIndex],
},
cssClass: classs,
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(res=>{
//this.location.back();
});
}
// efetuar despacho
async openExpedientActionsModal( taskAction: any) {
let classs;
if( window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: ExpedientTaskModalPage,
componentProps: {
taskAction: taskAction,
task: this.task,
seachDocuments: this.loadedEvent.Attachments[ this.dicIndex],
aplicationId: this.loadedEvent.Attachments[ this.dicIndex].ApplicationId || this.loadedEvent.Attachments[ this.dicIndex]['ApplicationID']
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then( async(res)=>{});
}
}