View documents of event to aprove

This commit is contained in:
Peter Maquiran
2021-05-03 13:08:57 +01:00
parent 15299a5d6f
commit f87a44471c
19 changed files with 100 additions and 56 deletions
@@ -7,6 +7,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { EmendMessageModalPage } from 'src/app/pages/agenda/emend-message-modal/emend-message-modal.page';
import { EventActionsPopoverPage } from 'src/app/pages/agenda/event-actions-popover/event-actions-popover.page';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@Component({
@@ -27,6 +28,7 @@ export class ApproveEventComponent implements OnInit {
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@Input() serialNumber:string;
@Input() InstanceId:string;
@Input() showAside:boolean;
@Output() approveEventDismiss = new EventEmitter<any>();
@@ -40,8 +42,11 @@ export class ApproveEventComponent implements OnInit {
private attachmentsService: AttachmentsService,
private popoverController: PopoverController,
private menu: MenuController,
private alertService: AlertService
) { }
private alertService: AlertService,
private iab: InAppBrowser
) {
// $$$
}
ngOnInit() {
this.getTask();
@@ -102,10 +107,20 @@ export class ApproveEventComponent implements OnInit {
this.modalController.dismiss(null);
}
getAttachments(){
this.attachmentsService.getAttachmentsBySerial(this.serialNumber).subscribe(res=>{
this.loadedAttachments = res;
console.log(res);
async getAttachments(){
console.log('load attachment')
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
console.log('this.loadedAttachments', this.loadedAttachments)
}
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();
});
}
@@ -139,9 +154,9 @@ export class ApproveEventComponent implements OnInit {
if(res.data !== ''){
let body = { "serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewerComments": res.data,
}
"dataFields": {
"ReviewerComments": res.data,
}
}
console.log(body);
this.processes.PostTaskAction(body);