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
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ExpedientesService } from './expedientes.service';
describe('ExpedientesService', () => {
let service: ExpedientesService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ExpedientesService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+19
View File
@@ -0,0 +1,19 @@
import { Injectable } from '@angular/core';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ProcessDocumentService } from './process-document.service';
@Injectable({
providedIn: 'root'
})
export class ExpedientesService {
constructor(
private iab: InAppBrowser,
private processDocumentService: ProcessDocumentService
) { }
viewDocument({DocId, ApplicationId}) {
this.processDocumentService.viewDocument({DocId, ApplicationId})
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ProcessDocumentService } from './process-document.service';
describe('ProcessDocumentService', () => {
let service: ProcessDocumentService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ProcessDocumentService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+23
View File
@@ -0,0 +1,23 @@
import { Injectable } from '@angular/core';
import { ProcessesService } from '../services/processes.service';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@Injectable({
providedIn: 'root'
})
export class ProcessDocumentService {
constructor(
private processes: ProcessesService,
private iab: InAppBrowser,
) { }
viewDocument({DocId, ApplicationId}) {
this.processes.GetDocumentUrl(DocId, ApplicationId).subscribe( (res) => {
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
});
}
}
+9
View File
@@ -9,6 +9,15 @@ export class SearchDocument {
appName?: string; appName?: string;
} }
export class Attachments {
Id?: number
Source: number
SourceId: any
SourceName: any
ApplicationId: number | string
}
export class FromSearchDocument { export class FromSearchDocument {
ApplicationId: number ApplicationId: number
ApplicationID: number ApplicationID: number
@@ -53,13 +53,12 @@
<div class="bottom-content width-100"> <div class="bottom-content width-100">
<ion-list> <ion-list>
<h5>Documentos Anexados</h5> <h5>Documentos Anexados</h5>
<ion-item class="ion-no-margin ion-no-padding cursor-pointer"> <ion-item class="ion-no-margin ion-no-padding cursor-pointer" *ngFor="let Document of fulltask.Documents">
<ion-label <ion-label class="d-block" (click)="viewDocument(Document.DocId)">
(click)="viewDocument()"> <p class="attach-title-item">{{ Document.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p class="attach-title-item">{{ task.Folio }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p> <p><span class="span-left">{{ Document.Sender}}</span><span class="span-right">{{ Document.DocDate | date: 'dd/MM/yyyy HH:mm' }}</span></p>
<p><span class="span-left">{{task.Remetente}}</span><span class="span-right">{{ task.CreateDate | date: 'dd/MM/yy' }}</span></p> </ion-label>
</ion-label> </ion-item>
</ion-item>
</ion-list> </ion-list>
</div> </div>
@@ -18,6 +18,8 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from 'src/app/models/search-document'; import { SearchDocument } from 'src/app/models/search-document';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { PermissionService } from 'src/app/OtherService/permission.service'; 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({ @Component({
selector: 'app-expediente-detail', selector: 'app-expediente-detail',
@@ -34,9 +36,8 @@ export class ExpedienteDetailPage implements OnInit {
task: any; task: any;
fulltask: any; fulltask: any;
eventsList: Event[]; eventsList: Event[];
serialnumber: string;
caller:string;
serialNumber: string; serialNumber: string;
caller:string;
profile: string; profile: string;
intervenientes: any; intervenientes: any;
cc: any = []; cc: any = [];
@@ -44,6 +45,7 @@ export class ExpedienteDetailPage implements OnInit {
attachments:any; attachments:any;
hideSendToPendentes = true hideSendToPendentes = true
searchDocumentPipe = new SearchDocumentPipe()
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
@@ -57,11 +59,12 @@ export class ExpedienteDetailPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
private location: Location, private location: Location,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
public p: PermissionService public p: PermissionService,
private expedientesService: ExpedientesService
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) { if(params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber; this.serialNumber = params["params"].SerialNumber;
} }
if(params["params"].caller) { if(params["params"].caller) {
this.caller = params["params"].caller; this.caller = params["params"].caller;
@@ -70,8 +73,8 @@ export class ExpedienteDetailPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.LoadTaskDetail(this.serialnumber); this.LoadTaskDetail(this.serialNumber);
this.LoadRelatedEvents(this.serialnumber); this.LoadRelatedEvents(this.serialNumber);
} }
close() { close() {
@@ -85,7 +88,7 @@ export class ExpedienteDetailPage implements OnInit {
async approve(note:string, documents:any) { async approve(note:string, documents:any) {
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialNumber,
"action": "Aprovar", "action": "Aprovar",
"ActionTypeId": 100000004 , "ActionTypeId": 100000004 ,
"dataFields": { "dataFields": {
@@ -112,7 +115,7 @@ export class ExpedienteDetailPage implements OnInit {
async sendToReview(note:string, documents:any) { async sendToReview(note:string, documents:any) {
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialNumber,
"action": "Retificar", "action": "Retificar",
"ActionTypeId": 99999877, "ActionTypeId": 99999877,
"dataFields": { "dataFields": {
@@ -221,7 +224,7 @@ export class ExpedienteDetailPage implements OnInit {
} }
sendExpedienteToPending() { sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
console.log(res); console.log(res);
this.toastService.successMessage('Processo enviado para pendentes') this.toastService.successMessage('Processo enviado para pendentes')
this.goBack(); this.goBack();
@@ -251,6 +254,7 @@ export class ExpedienteDetailPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
"DispatchNumber": res.workflowInstanceDataFields.DispatchNumber, "DispatchNumber": res.workflowInstanceDataFields.DispatchNumber,
"AttachmentsProcessLastInstanceID": res.workflowInstanceDataFields.AttachmentsProcessLastInstanceID, "AttachmentsProcessLastInstanceID": res.workflowInstanceDataFields.AttachmentsProcessLastInstanceID,
"InstanceID": res.workflowInstanceDataFields.InstanceID
} }
this.fulltask = res; this.fulltask = res;
@@ -267,9 +271,7 @@ export class ExpedienteDetailPage implements OnInit {
}); });
}) })
console.log('this.task', this.task.InstanceID)
console.log('this.task', this.task)
console.log('this.task.DocumentURL', this.task.DocumentURL) console.log('this.task.DocumentURL', this.task.DocumentURL)
}, (error)=>{ }, (error)=>{
@@ -306,14 +308,9 @@ export class ExpedienteDetailPage implements OnInit {
} }
} }
viewDocument() { viewDocument(DocId:string) {
this.processes.GetDocumentUrl(this.task.DocId, this.task.FsId).subscribe(res=>{
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank"); this.expedientesService.viewDocument({ApplicationId:'361', DocId})
browser.show();
});
} }
getAttachments(serialNumber) { getAttachments(serialNumber) {
@@ -340,25 +337,35 @@ export class ExpedienteDetailPage implements OnInit {
} }
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then((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 =>{ this.documents.forEach((element: any) =>{
/* let body = {
"InstanceID":null, let body = {
"InstanceID": this.task.InstanceID,
"WorkflowDisplayName": this.task.WorkflowName, "WorkflowDisplayName": this.task.WorkflowName,
"FolderID": this.task.FolderId, "FolderID": this.task.FolderId,
"DispatchNumber": this.task.DispatchNumber, "DispatchNumber": this.task.DispatchNumber,
"AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID, "AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID,
"Attachments": [ "Attachments": []
ApplicationId: element.ApplicationType,
SourceId: element.Id,
},
} }
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()
});
}); });
} }
}); });
+4 -4
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 { FromSearchDocument, SearchFolder } from '../models/search-document'; import { Attachments, FromSearchDocument, SearchFolder } from '../models/search-document';
@Pipe({ @Pipe({
name: 'searchDocument' name: 'searchDocument'
@@ -12,7 +12,7 @@ export class SearchDocumentPipe implements PipeTransform {
} }
transformToAttachment(document): unknown { transformToAttachment(document): Attachments[] {
let task: ExpedientTaskModalPageNavParamsTask let task: ExpedientTaskModalPageNavParamsTask
//let _document: = this.LoadedDocument //let _document: = this.LoadedDocument
@@ -26,7 +26,7 @@ export class SearchDocumentPipe implements PipeTransform {
attachments.push({ attachments.push({
ApplicationId: 361, ApplicationId: 361,
Source: 1, Source: 1,
SourceId: ele.docID || ele.docId || ele.DocId, SourceId: ele.docID || ele.docId || ele.DocId || ele.Id,
SourceName: ele.Assunto SourceName: ele.Assunto
}) })
}); });
@@ -34,7 +34,7 @@ export class SearchDocumentPipe implements PipeTransform {
attachments.push({ attachments.push({
ApplicationId: 8, ApplicationId: 8,
Source: 1, Source: 1,
SourceId: document.docID || document.docId || document.DocId, SourceId: document.docID || document.docId || document.DocId || document.Id,
SourceName: document.Assunto SourceName: document.Assunto
}) })
} }
+1 -1
View File
@@ -11,7 +11,7 @@
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": true, "importHelpers": true,
"target": "es2015", "target": "es2015",
// "target": "es5", //"target": "es5",
"lib": [ "lib": [
"es2018", "es2018",
"dom" "dom"