Integração dos eventos de agenda no Expediente

This commit is contained in:
Paulo Pinto
2020-09-08 09:01:41 +01:00
parent e61efd19a1
commit 4689b71b3a
4 changed files with 73 additions and 6 deletions
@@ -1,11 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { ProcessesService } from 'src/app/services/processes.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { DailyWorkTask } from '../../../../models/dailyworktask.model';
import { ActivatedRoute } from '@angular/router';
import { formatDate } from '@angular/common';
import { LoadingService } from 'src/app/services/loading.service';
import { Event } from '../../../../models/event.model';
@Component({
selector: 'app-expediente-detail',
@@ -16,10 +17,12 @@ export class ExpedienteDetailPage implements OnInit {
constructor(private activateRoute: ActivatedRoute,
private processes:ProcessesService,
private iab: InAppBrowser) { }
private iab: InAppBrowser,
private attachments: AttachmentsService,
private events: EventsService) { }
task: DailyWorkTask;
eventsList: Event[];
serialnumber:string;
ngOnInit() {
@@ -29,10 +32,11 @@ export class ExpedienteDetailPage implements OnInit {
}
this.serialnumber = paramMap.get('SerialNumber');
this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber);
});
}
LoadTaskDetail(serial:string)
async LoadTaskDetail(serial:string)
{
this.processes.GetTask(serial).subscribe(result => {
this.task = {
@@ -45,6 +49,22 @@ export class ExpedienteDetailPage implements OnInit {
});
}
async LoadRelatedEvents(serial:string)
{
this.eventsList = null;
this.attachments.getAttachments(2, serial).subscribe(result => {
result.forEach(att =>{
if (this.eventsList == null)
{
this.eventsList = new Array();
}
this.events.getEvent(att.ParentId).subscribe(event => {
this.eventsList.push(event);
});
});
});
}
viewDocument()
{
const url: string = this.task.DocumentURL.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");