mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Improve
This commit is contained in:
@@ -2,10 +2,14 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
||||
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
|
||||
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
|
||||
import { SearchDocument } from 'src/app/models/search-document';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
|
||||
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
|
||||
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { SearchDocumentPipe } from 'src/app/pipes/search-document.pipe';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@@ -21,6 +25,8 @@ export class OptsExpedientePage implements OnInit {
|
||||
caller:string;
|
||||
|
||||
showEnviarPendentes = false
|
||||
searchDocumentPipe = new SearchDocumentPipe()
|
||||
documents:SearchDocument[] = [];
|
||||
|
||||
constructor(
|
||||
private popoverController: PopoverController,
|
||||
@@ -30,7 +36,8 @@ export class OptsExpedientePage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
public p: PermissionService
|
||||
public p: PermissionService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
) {
|
||||
this.task = this.navParams.get('task');
|
||||
this.fulltask = this.navParams.get('fulltask');
|
||||
@@ -53,7 +60,7 @@ export class OptsExpedientePage implements OnInit {
|
||||
this.popoverController.dismiss();
|
||||
}
|
||||
else{
|
||||
this.modalController.dismiss();
|
||||
this.popoverController.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +114,57 @@ export class OptsExpedientePage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
attachDocument(){}
|
||||
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( async (res)=>{
|
||||
if(res){
|
||||
const data = res.data;
|
||||
this.documents.push(data.selected);
|
||||
this.documents.forEach((element: any) =>{
|
||||
|
||||
let body = {
|
||||
"InstanceID": this.task.InstanceID,
|
||||
"WorkflowDisplayName": this.task.WorkflowName,
|
||||
"FolderID": this.task.FolderId,
|
||||
"DispatchNumber": this.task.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID,
|
||||
"Attachments": []
|
||||
}
|
||||
|
||||
const Attachments = this.searchDocumentPipe.transformToAttachment(element)
|
||||
body.Attachments = Attachments;
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
this.attachmentsService.AddAttachment(body).subscribe((res)=> {
|
||||
this.toastService.successMessage()
|
||||
},()=> {
|
||||
this.toastService.badRequest()
|
||||
},()=> {
|
||||
loader.remove()
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
this.popoverController.dismiss()
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async openAddNoteModal(actionName:string) {
|
||||
let classs;
|
||||
@@ -354,5 +411,6 @@ export class OptsExpedientePage implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user