This commit is contained in:
Peter Maquiran
2021-10-07 09:43:16 +01:00
parent f09201237c
commit 5d85796785
4 changed files with 195 additions and 55 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<name>gabinete digital</name> <name>gabinete digital</name>
<description>An awesome Ionic/Cordova app.</description> <description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author> <author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
<content original-src="index.html" src="http://localhost:8101" /> <content src="index.html" />
<access origin="*" /> <access origin="*" />
<allow-navigation href="*" /> <allow-navigation href="*" />
<allow-navigation href="*" /> <allow-navigation href="*" />
@@ -1,14 +1,3 @@
ion-content { ion-content {
background-color: #ececec; background-color: #ececec;
}
.ng2-pdf-viewer-container {
padding-top: 10px;
}
#pdf-container {
canvas {
width: 100%;
height: 100%;
}
} }
@@ -92,7 +92,7 @@
<span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span> <span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span>
</div> </div>
<div (click)="docIndex(i);openTaskOptions()" class="doc-options"> <div (click)="docIndex(i);LoadDocumentDetails()" class="doc-options">
<ion-icon src="assets/images/icons-menu.svg" ></ion-icon> <ion-icon src="assets/images/icons-menu.svg" ></ion-icon>
</div> </div>
@@ -100,7 +100,7 @@
</li> </li>
</ion-list> </ion-list>
</div> </div>
<!-- <div class="line"></div> --> {{ this.loadedEvent.Attachments | json }}
</div> </div>
@@ -6,10 +6,13 @@ import { EventsService } from 'src/app/services/events.service';
import { Event } from 'src/app/models/event.model'; import { Event } from 'src/app/models/event.model';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { OptsExpedientePage } from '../../popover/opts-expediente/opts-expediente.page';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page'; import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
import { AlertService } from 'src/app/services/alert.service'; import { SearchDocumentDetails, SearchFolderDetails } from 'src/app/models/search-document';
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
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';
@Component({ @Component({
selector: 'app-view-event', selector: 'app-view-event',
@@ -18,14 +21,15 @@ import { AlertService } from 'src/app/services/alert.service';
}) })
export class ViewEventPage implements OnInit { export class ViewEventPage implements OnInit {
loadedEvent: Event; loadedEvent: any;
isEventEdited: boolean; isEventEdited: boolean;
eventBody: EventBody; eventBody: EventBody;
loadedAttachments:any; loadedAttachments:any;
pageId: string; pageId: string;
showLoader: boolean; showLoader: boolean;
task: ExpedientTaskModalPageNavParamsTask;
minDate: Date; minDate: Date;
LoadedDocument:any = null;
customDate:any; customDate:any;
today:any; today:any;
@@ -48,10 +52,8 @@ export class ViewEventPage implements OnInit {
private processes: ProcessesService, private processes: ProcessesService,
private modalController: ModalController, private modalController: ModalController,
public popoverController: PopoverController, public popoverController: PopoverController,
private toastService: ToastService, private toastService: ToastService
private alertService: AlertService, ) {
)
{
this.isEventEdited = false; this.isEventEdited = false;
this.loadedEvent = new Event(); this.loadedEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""}; this.eventBody = { BodyType : "1", Text : ""};
@@ -59,19 +61,16 @@ export class ViewEventPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
/* console.log(this.eventId); */
this.loadEvent(); this.loadEvent();
//this.getAttachments();
} }
doRefresh(ev){ doRefresh(ev) {
this.loadEvent(); this.loadEvent();
ev.target.complete(); ev.target.complete();
} }
ngOnChanges(changes: any): void { ngOnChanges(changes: any): void {
this.loadedAttachments = null; this.loadedEvent.Attachments = null;
this.loadEvent(); this.loadEvent();
} }
@@ -160,7 +159,6 @@ export class ViewEventPage implements OnInit {
} }
async editEvent() { async editEvent() {
this.viewEventDetailDismiss.emit({ this.viewEventDetailDismiss.emit({
type: 'edit', type: 'edit',
@@ -178,51 +176,204 @@ export class ViewEventPage implements OnInit {
}); });
} }
async LoadDocumentDetails() {
const docId = this.loadedEvent.Attachments[ this.dicIndex].Id
const applicationId = this.loadedEvent.Attachments[ this.dicIndex].ApplicationId
console.log(this.loadedEvent.Attachments[ this.dicIndex])
this.processes.GetDocumentDetails(docId, applicationId).subscribe( async(res)=> {
alert('loads')
console.log(res);
this.LoadedDocument = res;
this.LoadedDocument.Subject = this.LoadedDocument.Assunto
let thedate = new Date(this.LoadedDocument.DateDispatch || this.LoadedDocument.DocDate);
console.log(res)
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()
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')
}
});
});
}
async openTaskOptions() { async openTaskOptions() {
const doc = this.loadedAttachments[ this.dicIndex]; let task: ExpedientTaskModalPageNavParamsTask
let document: SearchDocumentDetails = this.loadedEvent.Attachments[ this.dicIndex];
let folder: SearchFolderDetails = this.loadedEvent.Attachments[ this.dicIndex];
let customTask; if(this.loadedEvent.Attachments[this.dicIndex].ApplicationID == 361 || this.loadedEvent.Attachments[this.dicIndex].ApplicationId == 361) {
task = {
if(doc.ApplicationID == 361 || doc.ApplicationId == 361) { serialNumber: folder.DispatchNumber,
customTask = { taskStartDate: folder.DateDispatch,
serialNumber: doc.DispatchNumber,
taskStartDate: doc.DateDispatch,
isEvent: true, isEvent: true,
workflowInstanceDataFields: { workflowInstanceDataFields: {
FsId: doc.ApplicationID, FolderID: folder['FolderId'] || folder['FolderID'] || folder.folderId,
FolderID: null, Subject: folder.Assunto,
DocId: doc.DispatchNumber, SourceSecFsID: folder.ApplicationID || folder['ApplicationId'],
Subject: doc.Assunto SourceType: 'FOLDER',
SourceID: folder.folderId,
DispatchNumber: folder.DispatchNumber
}, },
} }
} else if (doc.ApplicationID == 8 || doc.ApplicationId == 8) { } else if (document.ApplicationID == 8 || document.ApplicationId == 8) {
customTask = { task = {
serialNumber: doc.DocId, serialNumber: document.DocId,
taskStartDate: doc.DocDate, taskStartDate: document.DocDate,
isEvent: true, isEvent: true,
workflowInstanceDataFields: { workflowInstanceDataFields: {
FsId: doc.ApplicationID || doc.ApplicationId,
FolderID: null, FolderID: null,
DocId: doc.DocId, Subject: document.Assunto,
Subject: doc.Assunto DispatchNumber: null,
SourceSecFsID: document.ApplicationID || document.ApplicationId,
SourceType: 'DOC',
SourceID: document.DocId,
} }
} }
} }
console.log(doc) this.task = task
customTask.Status = ''
const popover = await this.modalController.create({ const popover = await this.popoverController.create({
component: OptsExpedientePage, component: SearchedDocumentOptionsPage,
cssClass: 'model aside-modal search-submodal', cssClass: 'exp-options',
componentProps: { componentProps: {
fulltask: customTask, task: this.task,
task: customTask LoadedDocument: this.LoadedDocument
}, },
//translucent: true translucent: true
}); });
return await popover.present(); 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')
}
});
}
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,
},
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,
aplicationId: this.loadedEvent.ApplicationId || this.loadedEvent.ApplicationID
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then( async(res)=>{});
} }
} }