This commit is contained in:
Peter Maquiran
2021-08-13 14:36:45 +01:00
parent 7fdb3610df
commit 6f6b05b359
9 changed files with 131 additions and 42 deletions
@@ -18,6 +18,8 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from 'src/app/models/search-document';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { PermissionService } from 'src/app/OtherService/permission.service';
import { SearchDocumentPipe } from 'src/app/pipes/search-document.pipe';
import { ExpedientesService } from 'src/app/Rules/expedientes.service';
@Component({
selector: 'app-expediente-detail',
@@ -34,9 +36,8 @@ export class ExpedienteDetailPage implements OnInit {
task: any;
fulltask: any;
eventsList: Event[];
serialnumber: string;
caller:string;
serialNumber: string;
caller:string;
profile: string;
intervenientes: any;
cc: any = [];
@@ -44,6 +45,7 @@ export class ExpedienteDetailPage implements OnInit {
attachments:any;
hideSendToPendentes = true
searchDocumentPipe = new SearchDocumentPipe()
constructor(
private processes: ProcessesService,
@@ -57,11 +59,12 @@ export class ExpedienteDetailPage implements OnInit {
private toastService: ToastService,
private location: Location,
private attachmentsService: AttachmentsService,
public p: PermissionService
public p: PermissionService,
private expedientesService: ExpedientesService
) {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber;
this.serialNumber = params["params"].SerialNumber;
}
if(params["params"].caller) {
this.caller = params["params"].caller;
@@ -70,8 +73,8 @@ export class ExpedienteDetailPage implements OnInit {
}
ngOnInit() {
this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber);
this.LoadTaskDetail(this.serialNumber);
this.LoadRelatedEvents(this.serialNumber);
}
close() {
@@ -85,7 +88,7 @@ export class ExpedienteDetailPage implements OnInit {
async approve(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"serialNumber": this.serialNumber,
"action": "Aprovar",
"ActionTypeId": 100000004 ,
"dataFields": {
@@ -112,7 +115,7 @@ export class ExpedienteDetailPage implements OnInit {
async sendToReview(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"serialNumber": this.serialNumber,
"action": "Retificar",
"ActionTypeId": 99999877,
"dataFields": {
@@ -221,7 +224,7 @@ export class ExpedienteDetailPage implements OnInit {
}
sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
console.log(res);
this.toastService.successMessage('Processo enviado para pendentes')
this.goBack();
@@ -251,6 +254,7 @@ export class ExpedienteDetailPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status,
"DispatchNumber": res.workflowInstanceDataFields.DispatchNumber,
"AttachmentsProcessLastInstanceID": res.workflowInstanceDataFields.AttachmentsProcessLastInstanceID,
"InstanceID": res.workflowInstanceDataFields.InstanceID
}
this.fulltask = res;
@@ -267,9 +271,7 @@ export class ExpedienteDetailPage implements OnInit {
});
})
console.log('this.task', this.task)
console.log('this.task', this.task.InstanceID)
console.log('this.task.DocumentURL', this.task.DocumentURL)
}, (error)=>{
@@ -306,14 +308,9 @@ export class ExpedienteDetailPage implements OnInit {
}
}
viewDocument() {
this.processes.GetDocumentUrl(this.task.DocId, this.task.FsId).subscribe(res=>{
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
viewDocument(DocId:string) {
const browser = this.iab.create(url,"_blank");
browser.show();
});
this.expedientesService.viewDocument({ApplicationId:'361', DocId})
}
getAttachments(serialNumber) {
@@ -340,25 +337,35 @@ export class ExpedienteDetailPage implements OnInit {
}
});
await modal.present();
modal.onDidDismiss().then((res)=>{
modal.onDidDismiss().then( async (res)=>{
if(res){
const data = res.data;
this.documents.push(data.selected);
this.documents.forEach(element =>{
/* let body = {
"InstanceID":null,
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": [
ApplicationId: element.ApplicationType,
SourceId: element.Id,
},
"Attachments": []
}
this.attachmentsService.AddAttachment(body).subscribe((res)=>{
this.getAttachments(this.task.SerialNumber);
}); */
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()
});
});
}
});