add viewer at agenda in events to approve

This commit is contained in:
tiago.kayaya
2021-10-18 15:44:22 +01:00
parent d0a15a256e
commit cf1eb1aa03
4 changed files with 43 additions and 29 deletions
@@ -9,6 +9,7 @@ import { EmendMessageModalPage } from 'src/app/pages/agenda/emend-message-modal/
import { EventActionsPopoverPage } from 'src/app/pages/agenda/event-actions-popover/event-actions-popover.page';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ToastService } from 'src/app/services/toast.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@Component({
selector: 'app-approve-event',
@@ -23,7 +24,7 @@ export class ApproveEventPage implements OnInit {
customDate:any;
today:any;
show: boolean = false;
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"];
@@ -62,7 +63,7 @@ export class ApproveEventPage implements OnInit {
this.getAttachments();
}
ngOnChanges() {
/* ngOnChanges() {
this.getTask();
this.getAttachments();
@@ -76,7 +77,7 @@ export class ApproveEventPage implements OnInit {
this.getAttachments();
}, 10000)
}
} */
notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
@@ -90,12 +91,12 @@ export class ApproveEventPage implements OnInit {
getTask() {
this.processes.GetTask(this.serialNumber).subscribe(res => {
// console.log(res);
console.log(res);
this.loadedEvent = res;
this.today = new Date(res.workflowInstanceDataFields.StartDate);
// console.log(new Date(this.today));
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
})
}
@@ -115,9 +116,9 @@ export class ApproveEventPage implements OnInit {
loader.remove()
}
/* this.approveEventDismiss.emit({
/* this.approveEventDismiss.emit({
"serialNumber": serialNumber,
"action": "Aprovar",
"action": "Aprovar",
"saveData": {
loadedEvent: this.loadedEvent,
today: this.today,
@@ -127,7 +128,7 @@ export class ApproveEventPage implements OnInit {
}
async rejectTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
@@ -144,20 +145,33 @@ export class ApproveEventPage implements OnInit {
}
}
async getAttachments() {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
}
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 viewDocument(DocId:string, Document) {
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: Document.Assunto,
url: '',
title_link: '',
},
Document,
applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId,
folderId: this.loadedEvent.FolderId,
task: this.loadedEvent
},
cssClass: 'modal modal-desktop'
});
await modal.present();
}
async openOptions(ev:any) {
@@ -186,9 +200,9 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss()
.then( async (res) => {
console.log(res.data);
if(res.data !== ''){
let body = { "serialNumber": serialNumber,
let body = { "serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
@@ -197,7 +211,7 @@ export class ApproveEventPage implements OnInit {
console.log(body);
const loader = this.toastService.loading()
try {
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
this.close();
@@ -211,7 +225,7 @@ export class ApproveEventPage implements OnInit {
//this.alertService.presentAlert('Operação cancelada!');
}
});
//this.openEmendMessageModal(serialNumber);
//this.goBack();
}