Fix get files

This commit is contained in:
Peter Maquiran
2021-08-13 14:59:17 +01:00
parent 6f6b05b359
commit ce25fc8e4a
9 changed files with 73 additions and 86 deletions
@@ -77,10 +77,10 @@ export class DespachoPrPage implements OnInit {
} }
/* this.serialnumber = paramMap.get('SerialNumber'); */ /* this.serialnumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialnumber); this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber); // this.LoadRelatedEvents(this.serialnumber);
}); });
this.LoadTaskDetail(this.serialnumber); this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber); // this.LoadRelatedEvents(this.serialnumber);
} }
close(){ close(){
@@ -156,22 +156,22 @@ export class DespachoPrPage implements OnInit {
}) })
} }
async LoadRelatedEvents(serial: string) { // async LoadRelatedEvents(serial: string) {
if (this.eventsList == null) { // if (this.eventsList == null) {
this.attachmentsService.getAttachmentsBySerial(serial).subscribe(res => { // this.attachmentsService.getAttachmentsBySerial(serial).subscribe(res => {
console.log(res); // console.log(res);
res.forEach(att => { // res.forEach(att => {
if (this.eventsList == null) { // if (this.eventsList == null) {
this.eventsList = new Array(); // this.eventsList = new Array();
} // }
this.events.getEvent(att.ParentId).subscribe(event => { // this.events.getEvent(att.ParentId).subscribe(event => {
this.eventsList.push(event); // this.eventsList.push(event);
console.log(this.eventsList); // console.log(this.eventsList);
}); // });
}); // });
}); // });
} // }
} // }
viewDocument(docId:string){ viewDocument(docId:string){
this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{ this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{
@@ -56,13 +56,10 @@
<div class="bottom-content width-100"> <div class="bottom-content width-100">
<ion-list> <ion-list>
<h5>Documentos Anexados</h5> <h5>Documentos Anexados</h5>
<ion-item *ngFor="let attachment of attachments" <ion-item class="ion-no-margin ion-no-padding cursor-pointer" *ngFor="let Document of fulltask.Documents">
class="ion-no-margin ion-no-padding cursor-pointer"> <ion-label class="d-block" (click)="viewDocument(Document.DocId)">
<ion-label <p class="attach-title-item">{{ Document.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
(click)="viewDocument(attachment.DocId)"> <p><span class="span-left">{{ Document.Sender}}</span><span class="span-right">{{ Document.DocDate | date: 'dd/MM/yyyy HH:mm' }}</span></p>
<p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p *ngIf="!attachment.Assunto" class="attach-title-item">{{ attachment.DocNumber }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd/MM/yy' }}</span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
@@ -71,10 +71,10 @@ export class DespachoPage implements OnInit {
} }
/* this.serialnumber = paramMap.get('SerialNumber'); */ /* this.serialnumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialnumber); this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber); // this.LoadRelatedEvents(this.serialnumber);
}); });
this.LoadTaskDetail(this.serialnumber); this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber); // this.LoadRelatedEvents(this.serialnumber);
} }
close() { close() {
@@ -167,20 +167,20 @@ export class DespachoPage implements OnInit {
}) })
} }
async LoadRelatedEvents(serial: string) { // async LoadRelatedEvents(serial: string) {
if (this.eventsList == null) { // if (this.eventsList == null) {
this.attachmentsService.getAttachmentsBySerial(serial).subscribe(res => { // this.attachmentsService.getAttachmentsBySerial(serial).subscribe(res => {
res.forEach(att => { // res.forEach(att => {
if (this.eventsList == null) { // if (this.eventsList == null) {
this.eventsList = new Array(); // this.eventsList = new Array();
} // }
this.events.getEvent(att.ParentId).subscribe(event => { // this.events.getEvent(att.ParentId).subscribe(event => {
this.eventsList.push(event); // this.eventsList.push(event);
}); // });
}); // });
}); // });
} // }
} // }
viewDocument(docId:string){ viewDocument(docId:string){
this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{ this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{
@@ -60,9 +60,11 @@
<ion-list> <ion-list>
<h5>Documentos Anexados</h5> <h5>Documentos Anexados</h5>
<ion-item *ngFor="let attachment of attachments" <ion-item *ngFor="let attachment of attachments"
class="ion-no-margin ion-no-padding cursor-pointer"> class="ion-no-margin ion-no-padding cursor-pointer"
>
<ion-label <ion-label
(click)="viewDocument(attachment.DocId)"> (click)="viewDocument(attachment.DocId)"
>
<p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p> <p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p *ngIf="!attachment.Assunto" class="attach-title-item">{{ attachment.DocNumber }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p> <p *ngIf="!attachment.Assunto" class="attach-title-item">{{ attachment.DocNumber }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd/MM/yy' }}</span></p> <p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd/MM/yy' }}</span></p>
@@ -60,7 +60,8 @@
<ion-list> <ion-list>
<h5>Documentos Anexados</h5> <h5>Documentos Anexados</h5>
<ion-item *ngFor="let attachment of attachments" <ion-item *ngFor="let attachment of attachments"
class="ion-no-margin ion-no-padding cursor-pointer"> class="ion-no-margin ion-no-padding cursor-pointer"
>
<ion-label <ion-label
(click)="viewDocument(attachment.DocId)"> (click)="viewDocument(attachment.DocId)">
<p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p> <p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
@@ -74,7 +74,7 @@ export class ExpedienteDetailPage implements OnInit {
ngOnInit() { ngOnInit() {
this.LoadTaskDetail(this.serialNumber); this.LoadTaskDetail(this.serialNumber);
this.LoadRelatedEvents(this.serialNumber);
} }
close() { close() {
@@ -294,18 +294,7 @@ export class ExpedienteDetailPage implements OnInit {
} }
async LoadRelatedEvents(serial: string) { async LoadRelatedEvents(serial: string) {
if (this.eventsList == null) {
this.attachments.getAttachmentsBySerial(serial).subscribe(res => {
res.forEach(att => {
if (this.eventsList == null) {
this.eventsList = new Array();
}
this.events.getEvent(att.ParentId).subscribe(event => {
this.eventsList.push(event);
});
});
});
}
} }
viewDocument(DocId:string) { viewDocument(DocId:string) {
@@ -56,15 +56,9 @@ export class ExpedientePage implements OnInit {
this.skeletonLoader = true this.skeletonLoader = true
try { try {
const expedientePr: object[] = await this.processes.GetTasksList("Expediente", false).toPromise() const expediente: object[] = await this.processes.GetTasksList("Expediente", false).toPromise()
const expedienteMD: object[] = await this.processes.GetTasksList("Expediente", false).toPromise()
const result = expedientePr.concat(expedienteMD)
console.log('result', result);
console.log('expedientePr', expedientePr)
console.log('expedienteMD', expedienteMD)
const result = expediente
this.taskslist = new Array(); this.taskslist = new Array();
let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active"); let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
@@ -87,9 +81,11 @@ export class ExpedientePage implements OnInit {
} }
this.taskslist.push(task); this.taskslist.push(task);
}); });
console.log(this.taskslist); console.log(this.taskslist);
this.expedienteStorage.reset(this.taskslist); this.expedienteStorage.reset(this.taskslist);
this.skeletonLoader = false; this.skeletonLoader = false;
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
this.goBack() this.goBack()
@@ -60,9 +60,11 @@
<ion-list> <ion-list>
<h5>Documentos Anexados</h5> <h5>Documentos Anexados</h5>
<ion-item *ngFor="let attachment of attachments" <ion-item *ngFor="let attachment of attachments"
class="ion-no-margin ion-no-padding cursor-pointer"> class="ion-no-margin ion-no-padding cursor-pointer"
>
<ion-label <ion-label
(click)="viewDocument(attachment.DocId)"> (click)="viewDocument(attachment.DocId)"
>
<p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p> <p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p *ngIf="!attachment.Assunto" class="attach-title-item">{{ attachment.DocNumber }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p> <p *ngIf="!attachment.Assunto" class="attach-title-item">{{ attachment.DocNumber }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd/MM/yy' }}</span></p> <p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd/MM/yy' }}</span></p>
@@ -184,7 +184,7 @@ export class PedidoPage implements OnInit {
}) })
} }
viewDocument(docId:string){ viewDocument(docId:string) {
this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{ this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank"); const browser = this.iab.create(url,"_blank");