This commit is contained in:
Peter Maquiran
2021-08-13 16:07:17 +01:00
parent ce25fc8e4a
commit d15e0d1f2a
4 changed files with 80 additions and 35 deletions
@@ -311,7 +311,7 @@ export class ExpedienteDetailPage implements OnInit {
}); });
} }
attachDocument(){ attachDocument() {
this.getDoc(); this.getDoc();
} }
@@ -326,11 +326,11 @@ export class ExpedienteDetailPage implements OnInit {
} }
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then( async (res)=> {
if(res){ if(res){
const data = res.data; const data = res.data;
this.documents.push(data.selected); this.documents.push(data.selected);
this.documents.forEach((element: any) =>{ this.documents.forEach((element: any) => {
let body = { let body = {
"InstanceID": this.task.InstanceID, "InstanceID": this.task.InstanceID,
@@ -348,10 +348,9 @@ export class ExpedienteDetailPage implements OnInit {
this.attachmentsService.AddAttachment(body).subscribe((res)=> { this.attachmentsService.AddAttachment(body).subscribe((res)=> {
this.toastService.successMessage() this.toastService.successMessage()
}, ()=> {
},()=> {
this.toastService.badRequest() this.toastService.badRequest()
},()=> { }, ()=> {
loader.remove() loader.remove()
}); });
+2 -7
View File
@@ -7,13 +7,11 @@ import { formatDate } from '@angular/common';
import { SenderPage } from 'src/app/pages/search/sender/sender.page'; import { SenderPage } from 'src/app/pages/search/sender/sender.page';
import { OrganicEntityPage } from 'src/app/pages/search/organic-entity/organic-entity.page'; import { OrganicEntityPage } from 'src/app/pages/search/organic-entity/organic-entity.page';
import WordCloud from 'src/plugin/wordcloud2.js'; import WordCloud from 'src/plugin/wordcloud2.js';
import { slugify } from 'src/plugin/javascript-remove-accents.js';
import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page'; import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page';
import { PublicationDetailPage } from '../publications/view-publications/publication-detail/publication-detail.page'; import { PublicationDetailPage } from '../publications/view-publications/publication-detail/publication-detail.page';
import { DocumentDetailPage } from 'src/app/modals/document-detail/document-detail.page'; import { DocumentDetailPage } from 'src/app/modals/document-detail/document-detail.page';
import { ExpedientTaskModalPage } from '../gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page'; import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
@Component({ @Component({
@@ -75,7 +73,6 @@ export class SearchPage implements OnInit {
this.showSearchInput = this.navParams.get('showSearchInput'); this.showSearchInput = this.navParams.get('showSearchInput');
if(this.type == null || this.type == undefined) { if(this.type == null || this.type == undefined) {
if(this.currentPath == '/home/agenda') { if(this.currentPath == '/home/agenda') {
@@ -89,10 +86,8 @@ export class SearchPage implements OnInit {
console.log('search bug!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') console.log('search bug!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
} }
} }
} }
selectItem(item: SearchDocument) { selectItem(item: SearchDocument) {
if(this.select){ if(this.select){
this.modalController.dismiss({ this.modalController.dismiss({
@@ -187,7 +182,7 @@ export class SearchPage implements OnInit {
}, },
); );
},100); }, 100);
} }
+8 -15
View File
@@ -1,6 +1,6 @@
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import { ExpedientTaskModalPageNavParamsTask } from '../models/ExpedientTaskModalPage'; import { ExpedientTaskModalPageNavParamsTask } from '../models/ExpedientTaskModalPage';
import { Attachments, FromSearchDocument, SearchFolder } from '../models/search-document'; import { Attachments, FromSearchDocument, SearchDocument, SearchFolder } from '../models/search-document';
@Pipe({ @Pipe({
name: 'searchDocument' name: 'searchDocument'
@@ -12,29 +12,22 @@ export class SearchDocumentPipe implements PipeTransform {
} }
transformToAttachment(document): Attachments[] { transformToAttachment(document: SearchDocument): Attachments[] {
let task: ExpedientTaskModalPageNavParamsTask
//let _document: = this.LoadedDocument
// let folder: SearchFolder = this.LoadedDocument
const attachments = [] const attachments = []
if(document.Documents) { console.log('document', document)
document.Documents.forEach( (ele) => { if(document.ApplicationType == 361) {
console.log(ele)
attachments.push({ attachments.push({
ApplicationId: 361, ApplicationId: 361,
Source: 1, Source: 1,
SourceId: ele.docID || ele.docId || ele.DocId || ele.Id, SourceId: document['docID'] || document['docId'] || document['DocId'] || document.Id,
SourceName: ele.Assunto SourceName: document.Assunto
}) })
}); } else if (document.ApplicationType == 8) {
} else {
attachments.push({ attachments.push({
ApplicationId: 8, ApplicationId: 8,
Source: 1, Source: 1,
SourceId: document.docID || document.docId || document.DocId || document.Id, SourceId: document['docID'] || document['docId'] || document['DocId'] || document.Id,
SourceName: document.Assunto SourceName: document.Assunto
}) })
} }
@@ -2,10 +2,14 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { ModalController, NavParams, PopoverController } from '@ionic/angular'; import { ModalController, NavParams, PopoverController } from '@ionic/angular';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; 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 { PermissionService } from 'src/app/OtherService/permission.service';
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; 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 { 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 { 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 { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
@@ -21,6 +25,8 @@ export class OptsExpedientePage implements OnInit {
caller:string; caller:string;
showEnviarPendentes = false showEnviarPendentes = false
searchDocumentPipe = new SearchDocumentPipe()
documents:SearchDocument[] = [];
constructor( constructor(
private popoverController: PopoverController, private popoverController: PopoverController,
@@ -30,7 +36,8 @@ export class OptsExpedientePage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
private router: Router, private router: Router,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
public p: PermissionService public p: PermissionService,
private attachmentsService: AttachmentsService,
) { ) {
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
this.fulltask = this.navParams.get('fulltask'); this.fulltask = this.navParams.get('fulltask');
@@ -53,7 +60,7 @@ export class OptsExpedientePage implements OnInit {
this.popoverController.dismiss(); this.popoverController.dismiss();
} }
else{ 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) { async openAddNoteModal(actionName:string) {
let classs; let classs;
@@ -355,4 +412,5 @@ export class OptsExpedientePage implements OnInit {
}); });
} }
} }