This commit is contained in:
Eudes Inácio
2021-10-14 08:46:42 +01:00
8 changed files with 55 additions and 129 deletions
@@ -73,15 +73,16 @@
</div>
</div>
<div *ngIf="loadedAttachments" class="bottom-content width-100">
<div *ngIf="loadedEvent.Documents" class="bottom-content width-100">
<ion-list>
<h5>Documentos Anexados</h5>
<ion-item class="ion-no-margin ion-no-padding cursor-pointer"
*ngFor="let attach of loadedAttachments"
(click)="viewDocument(attach.SourceId)">
*ngFor="let attachment of loadedEvent.Documents"
(click)="viewDocument(attachment.DocId, attachment)">
<ion-label>
<p class="attach-title-item d-block">{{attach.SourceName}}</p>
<p><span class="span-left">{{attach.Stakeholders}}</span><span class="span-right">{{ attach.CreateDate | 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-item>
</ion-list>
@@ -11,6 +11,7 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page';
import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { SqliteService } from '../../../../services/sqlite.service';
import { synchro } from '../../../../services/socket/synchro.service';
@@ -32,9 +33,11 @@ export class ApproveEventPage implements OnInit {
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"];
serialNumber: string;
caller: string;
@Input() InstanceId: string;
serialNumber:string;
caller:string;
attachments:any;
@Input() InstanceId:string;
@Output() approveEventDismiss = new EventEmitter<any>();
@Output() closeEventToApprove = new EventEmitter<any>();
@@ -79,7 +82,7 @@ export class ApproveEventPage implements OnInit {
console.log(this.serialNumber);
console.log(this.caller);
this.getProcessFromDB();
}
goBack() {
@@ -164,13 +167,13 @@ export class ApproveEventPage implements OnInit {
console.log('offline event',this.loadedEvent);
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.loadedAttachments = this.loadedEvent.Documents;
console.log('Attatara', this.loadedAttachments)
})
})
console.log('Offlineee')
@@ -183,12 +186,7 @@ export class ApproveEventPage implements OnInit {
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.getAttachments(instanceId);
this.addProcessToDB(this.loadedEvent)
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}
async approveTask(serialNumber: string) {
@@ -286,27 +284,27 @@ export class ApproveEventPage implements OnInit {
}
}
async getAttachments(instanceId: string) {
try {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise();
this.sqliteservice.updateUser(JSON.stringify(this.serialNumber),JSON.stringify(this.loadedAttachments))
console.log('Attatara', this.loadedAttachments)
} catch (error) {
}
}
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) {
@@ -208,7 +208,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
"SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender,
"CreateDate": taskDate,
//"CreateDate": taskDate,
"CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
@@ -280,7 +280,7 @@ export class PedidoPage implements OnInit {
getDocumentDetails(forlderId: string, applicationId: string) {
this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => {
this.attachments = res.Documents;
console.log('Attachment',this.attachments);
console.log(res['Documents']);
})
}