diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index c60d3a6de..8af165c68 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -14,6 +14,8 @@ import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page'; import { ToastService } from 'src/app/services/toast.service'; import { Location } from '@angular/common'; +import { SearchPage } from 'src/app/pages/search/search.page'; +import { SearchDocument } from 'src/app/models/search-document'; @Component({ selector: 'app-expediente-detail', @@ -36,13 +38,15 @@ export class ExpedienteDetailPage implements OnInit { profile: string; intervenientes: any; cc: any = []; + documents:SearchDocument[] = []; + attachments:any; hideSendToPendentes = true constructor( private processes: ProcessesService, private iab: InAppBrowser, - private attachments: AttachmentsService, + //private attachments: AttachmentsService, private events: EventsService, private router: Router, private modalController: ModalController, @@ -50,6 +54,7 @@ export class ExpedienteDetailPage implements OnInit { private activatedRoute: ActivatedRoute, private toastService: ToastService, private location: Location, + private attachmentsService: AttachmentsService, ) { this.activatedRoute.paramMap.subscribe(params => { if(params["params"].SerialNumber) { @@ -207,6 +212,53 @@ export class ExpedienteDetailPage implements OnInit { }); } + getAttachments(serialNumber){ + console.log(serialNumber); + + this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res=>{ + this.attachments = res; + console.log('res', res); + }); + } + + attachDocument(){ + this.getDoc(); + } + + async getDoc() { + const modal = await this.modalController.create({ + component: SearchPage, + cssClass: 'modal-width-100-width-background modal', + componentProps: { + type: 'AccoesPresidenciais & ArquivoDespachoElect', + showSearchInput: true, + select: true + } + }); + await modal.present(); + modal.onDidDismiss().then((res)=>{ + if(res){ + const data = res.data; + this.documents.push(data.selected); + console.log( this.documents); + this.documents.forEach(element =>{ + let body = { + "Source": "1", + "SourceId": element.Id, + "SourceTitle": element.Assunto, + "SerialNumber": this.task.SerialNumber, + "ApplicationId": element.ApplicationType + } + this.attachmentsService.setEventAttachmentById(body).subscribe((res)=>{ + this.getAttachments(this.task.SerialNumber); + }); + }) + + } + }); + + } + async openExpedientActionsModal(taskAction: any, task: any) { let classs; if( window.innerWidth <= 800){