This commit is contained in:
tiago.kayaya
2021-08-06 12:36:56 +01:00
parent c90b278d53
commit b79f595a0f
@@ -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){