2021-04-08 01:56:11 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2021-08-10 13:22:33 +01:00
|
|
|
import { MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular';
|
2021-04-09 04:34:21 +01:00
|
|
|
import { AlertService } from 'src/app/services/alert.service';
|
|
|
|
|
import { ProcessesService } from 'src/app/services/processes.service';
|
|
|
|
|
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
2021-07-23 15:57:01 +01:00
|
|
|
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
|
2021-07-29 10:13:39 +01:00
|
|
|
import { DocumentSetUpMeetingPage } from '../document-set-up-meeting/document-set-up-meeting.page';
|
2021-07-30 22:03:48 +01:00
|
|
|
import { FromSearchDocument, SearchFolder } from 'src/app/models/search-document';
|
|
|
|
|
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
|
2021-08-05 11:47:09 +01:00
|
|
|
import { PermissionService } from 'src/app/OtherService/permission.service';
|
2021-08-10 13:22:33 +01:00
|
|
|
import { SearchedDocumentOptionsPage } from 'src/app/shared/popover/searched-document-options/searched-document-options.page';
|
2021-04-08 01:56:11 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-document-detail',
|
|
|
|
|
templateUrl: './document-detail.page.html',
|
|
|
|
|
styleUrls: ['./document-detail.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class DocumentDetailPage implements OnInit {
|
|
|
|
|
|
2021-04-09 05:46:01 +01:00
|
|
|
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
|
|
|
|
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
|
|
|
|
|
|
|
|
|
customDate:any;
|
|
|
|
|
|
2021-04-09 04:34:21 +01:00
|
|
|
docId: string;
|
|
|
|
|
applicationId:string;
|
2021-04-09 05:46:01 +01:00
|
|
|
LoadedDocument:any = null;
|
2021-04-09 04:34:21 +01:00
|
|
|
|
2021-07-30 22:03:48 +01:00
|
|
|
folder: SearchFolder
|
|
|
|
|
document: FromSearchDocument
|
|
|
|
|
|
2021-08-10 13:22:33 +01:00
|
|
|
task: any = {}
|
|
|
|
|
|
2021-04-09 04:34:21 +01:00
|
|
|
constructor(
|
|
|
|
|
private navParams: NavParams,
|
|
|
|
|
private modalController: ModalController,
|
|
|
|
|
private alertService: AlertService,
|
|
|
|
|
private processes: ProcessesService,
|
|
|
|
|
private menu: MenuController,
|
|
|
|
|
private iab: InAppBrowser,
|
2021-08-05 11:47:09 +01:00
|
|
|
public p: PermissionService,
|
2021-08-10 13:22:33 +01:00
|
|
|
private popoverController: PopoverController,
|
2021-08-09 15:47:36 +01:00
|
|
|
) {
|
2021-04-09 04:34:21 +01:00
|
|
|
this.docId = this.navParams.get('docId');
|
|
|
|
|
this.applicationId = this.navParams.get('applicationId');
|
|
|
|
|
}
|
2021-04-08 01:56:11 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
2021-04-09 04:34:21 +01:00
|
|
|
this.LoadDocumentDetails();
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-30 14:12:45 +01:00
|
|
|
async LoadDocumentDetails() {
|
|
|
|
|
this.processes.GetDocumentDetails(this.docId, this.applicationId).subscribe(res=>{
|
|
|
|
|
this.LoadedDocument = res;
|
|
|
|
|
|
|
|
|
|
this.LoadedDocument.Subject = this.LoadedDocument.Assunto
|
2021-04-09 05:46:01 +01:00
|
|
|
|
2021-08-09 13:56:17 +01:00
|
|
|
let thedate = new Date(this.LoadedDocument.DateDispatch || this.LoadedDocument.DocDate);
|
|
|
|
|
|
|
|
|
|
console.log(res)
|
2021-04-09 05:46:01 +01:00
|
|
|
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
|
2021-04-09 04:34:21 +01:00
|
|
|
});
|
|
|
|
|
|
2021-07-23 15:57:01 +01:00
|
|
|
|
2021-07-30 22:03:48 +01:00
|
|
|
let task: ExpedientTaskModalPageNavParamsTask
|
|
|
|
|
|
|
|
|
|
let document: FromSearchDocument = this.LoadedDocument
|
|
|
|
|
let folder: SearchFolder = this.LoadedDocument
|
2021-07-23 15:57:01 +01:00
|
|
|
|
|
|
|
|
if(this.LoadedDocument.ApplicationID == 361) {
|
|
|
|
|
task = {
|
2021-07-30 22:03:48 +01:00
|
|
|
serialNumber: folder.DispatchNumber,
|
|
|
|
|
taskStartDate: folder.DateDispatch,
|
2021-07-23 15:57:01 +01:00
|
|
|
isEvent: true,
|
|
|
|
|
workflowInstanceDataFields: {
|
2021-07-30 22:03:48 +01:00
|
|
|
FsId: folder.ApplicationID || folder.ApplicationId,
|
2021-07-23 15:57:01 +01:00
|
|
|
FolderID: null,
|
2021-07-30 22:03:48 +01:00
|
|
|
DocId: folder.DispatchNumber,
|
|
|
|
|
Subject: folder.Assunto
|
2021-07-23 15:57:01 +01:00
|
|
|
},
|
|
|
|
|
}
|
2021-07-30 22:03:48 +01:00
|
|
|
} else if (document.ApplicationID == 8 || document.ApplicationId == 8) {
|
2021-07-23 15:57:01 +01:00
|
|
|
task = {
|
2021-07-30 22:03:48 +01:00
|
|
|
serialNumber: document.DocId,
|
|
|
|
|
taskStartDate: document.DocDate,
|
2021-07-23 15:57:01 +01:00
|
|
|
isEvent: true,
|
|
|
|
|
workflowInstanceDataFields: {
|
2021-07-30 22:03:48 +01:00
|
|
|
FsId: document.ApplicationID || document.ApplicationId,
|
2021-07-23 15:57:01 +01:00
|
|
|
FolderID: null,
|
2021-07-30 22:03:48 +01:00
|
|
|
DocId: document.DocId || document.DocID,
|
|
|
|
|
Subject: document.Assunto
|
2021-07-23 15:57:01 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-10 13:22:33 +01:00
|
|
|
this.task = task
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
viewDocument() {
|
|
|
|
|
this.processes.GetDocumentUrl(this.docId, '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();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openMenu() {
|
|
|
|
|
this.menu.open();
|
|
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close() {
|
|
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
notImplemented() {
|
|
|
|
|
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// efetuar despacho
|
|
|
|
|
async openExpedientActionsModal( taskAction: any) {
|
|
|
|
|
|
2021-07-23 15:57:01 +01:00
|
|
|
let classs;
|
|
|
|
|
if( window.innerWidth <= 800) {
|
|
|
|
|
classs = 'modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: ExpedientTaskModalPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
taskAction: taskAction,
|
2021-08-10 13:22:33 +01:00
|
|
|
task: this.task,
|
2021-07-23 15:57:01 +01:00
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss().then( async(res)=>{});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openBookMeetingModal() {
|
|
|
|
|
|
|
|
|
|
let classs;
|
|
|
|
|
if( window.innerWidth <= 800) {
|
|
|
|
|
classs = 'book-meeting-modal modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
2021-07-29 10:13:39 +01:00
|
|
|
component: DocumentSetUpMeetingPage,
|
2021-07-23 15:57:01 +01:00
|
|
|
componentProps: {
|
2021-08-10 13:22:33 +01:00
|
|
|
task: this.task,
|
2021-07-29 15:40:24 +01:00
|
|
|
document: this.LoadedDocument
|
2021-07-23 15:57:01 +01:00
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-10 13:22:33 +01:00
|
|
|
async openOptions() {
|
|
|
|
|
const popover = await this.popoverController.create({
|
|
|
|
|
component: SearchedDocumentOptionsPage,
|
|
|
|
|
cssClass: 'exp-options',
|
|
|
|
|
componentProps: {
|
|
|
|
|
},
|
|
|
|
|
translucent: true
|
|
|
|
|
});
|
|
|
|
|
return await popover.present();
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-23 15:57:01 +01:00
|
|
|
}
|