mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Improve
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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,6 +9,15 @@ export class SearchDocument {
|
||||
appName?: string;
|
||||
}
|
||||
|
||||
|
||||
export class Attachments {
|
||||
Id?: number
|
||||
Source: number
|
||||
SourceId: any
|
||||
SourceName: any
|
||||
ApplicationId: number | string
|
||||
}
|
||||
|
||||
export class FromSearchDocument {
|
||||
ApplicationId: number
|
||||
ApplicationID: number
|
||||
|
||||
+4
-5
@@ -53,11 +53,10 @@
|
||||
<div class="bottom-content width-100">
|
||||
<ion-list>
|
||||
<h5>Documentos Anexados</h5>
|
||||
<ion-item class="ion-no-margin ion-no-padding cursor-pointer">
|
||||
<ion-label
|
||||
(click)="viewDocument()">
|
||||
<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">{{task.Remetente}}</span><span class="span-right">{{ task.CreateDate | date: 'dd/MM/yy' }}</span></p>
|
||||
<ion-item class="ion-no-margin ion-no-padding cursor-pointer" *ngFor="let Document of fulltask.Documents">
|
||||
<ion-label class="d-block" (click)="viewDocument(Document.DocId)">
|
||||
<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><span class="span-left">{{ Document.Sender}}</span><span class="span-right">{{ Document.DocDate | date: 'dd/MM/yyyy HH:mm' }}</span></p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
+37
-30
@@ -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()
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { ExpedientTaskModalPageNavParamsTask } from '../models/ExpedientTaskModalPage';
|
||||
import { FromSearchDocument, SearchFolder } from '../models/search-document';
|
||||
import { Attachments, FromSearchDocument, SearchFolder } from '../models/search-document';
|
||||
|
||||
@Pipe({
|
||||
name: 'searchDocument'
|
||||
@@ -12,7 +12,7 @@ export class SearchDocumentPipe implements PipeTransform {
|
||||
}
|
||||
|
||||
|
||||
transformToAttachment(document): unknown {
|
||||
transformToAttachment(document): Attachments[] {
|
||||
|
||||
let task: ExpedientTaskModalPageNavParamsTask
|
||||
//let _document: = this.LoadedDocument
|
||||
@@ -26,7 +26,7 @@ export class SearchDocumentPipe implements PipeTransform {
|
||||
attachments.push({
|
||||
ApplicationId: 361,
|
||||
Source: 1,
|
||||
SourceId: ele.docID || ele.docId || ele.DocId,
|
||||
SourceId: ele.docID || ele.docId || ele.DocId || ele.Id,
|
||||
SourceName: ele.Assunto
|
||||
})
|
||||
});
|
||||
@@ -34,7 +34,7 @@ export class SearchDocumentPipe implements PipeTransform {
|
||||
attachments.push({
|
||||
ApplicationId: 8,
|
||||
Source: 1,
|
||||
SourceId: document.docID || document.docId || document.DocId,
|
||||
SourceId: document.docID || document.docId || document.DocId || document.Id,
|
||||
SourceName: document.Assunto
|
||||
})
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
// "target": "es5",
|
||||
//"target": "es5",
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
|
||||
Reference in New Issue
Block a user