lot of changes

This commit is contained in:
Eudes Inácio
2023-10-19 16:51:12 +01:00
parent ff52c56cde
commit 57f51903bc
51 changed files with 43514 additions and 1079 deletions
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, PopoverController, ToastController } from '@ionic/angular';
import { ProcessesService } from 'src/app/services/processes.service';
import { momentG } from 'src/plugin/momentG';
import { momentG } from 'src/plugin/momentG';
import { ActivatedRoute } from '@angular/router';
import { DiplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page';
@@ -9,7 +9,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import {HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { DespachoService } from 'src/app/Rules/despacho.service'
import { AttachmentList } from 'src/app/models/Excludetask';
@@ -35,12 +35,13 @@ export class DiplomaAssinarPage implements OnInit {
fulltask: any
intervenientes: any = []
cc: any = [];
attachments:any;
attachments: any;
customDate: any;
caller:string;
caller: string;
mergedArray: any = [];
DraftIds = ""
DraftNames = ""
asDraft = true;
constructor(
private processes: ProcessesService,
@@ -57,10 +58,10 @@ export class DiplomaAssinarPage implements OnInit {
public p: PermissionService,
) {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
if (params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber;
}
if(params["params"].caller) {
if (params["params"].caller) {
this.caller = params["params"].caller;
}
});
@@ -91,7 +92,8 @@ export class DiplomaAssinarPage implements OnInit {
showEnviarPendentes: false,
fulltask: this.fulltask,
DraftNames: this.DraftNames,
DraftIds: this.DraftIds
DraftIds: this.DraftIds,
asDraft: this.asDraft
},
translucent: true
@@ -112,7 +114,7 @@ export class DiplomaAssinarPage implements OnInit {
"SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject,
"Senders": res.originator.email,
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'),
"CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
"Remetente": res.workflowInstanceDataFields.Sender,
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
@@ -144,13 +146,13 @@ export class DiplomaAssinarPage implements OnInit {
this.getDocumentPdf(this.fulltask.Documents)
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users=>{
this.intervenientes = users.filter(user=>{
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
this.intervenientes = users.filter(user => {
return user.Type == 'I';
});
this.cc = users.filter(user=>{
this.cc = users.filter(user => {
return user.Type == 'CC';
});
@@ -158,20 +160,20 @@ export class DiplomaAssinarPage implements OnInit {
});
this.getDocumentDetails(this.task.FolderId, '361');
}, (error)=>{
}, (error) => {
try {
this.httpErroHandle.httpStatusHandle(error)
this.goBack()
} catch (e) {
window.history.back();
} finally {
} finally {
this.httpErroHandle.httpStatusHandle(error)
}
});
}
async viewDocument({Document, content}) {
async viewDocument({ Document, content }) {
if (Document.content == "") {
const modal = await this.modalController.create({
@@ -197,7 +199,12 @@ export class DiplomaAssinarPage implements OnInit {
component: TinyMCEPage,
componentProps: {
Document,
content
content,
InstanceID: this.task.InstanceID,
FolderId: this.task.FolderID,
DraftIds: this.DraftIds,
OriginalFileName: this.DraftNames,
Serialnumber:this.serialnumber
},
cssClass: 'modal modal-desktop'
});
@@ -208,8 +215,8 @@ export class DiplomaAssinarPage implements OnInit {
}
getDocumentDetails(forlderId:string, applicationId:string) {
this.processes.GetDocumentDetails(forlderId,applicationId).subscribe(res=>{
getDocumentDetails(forlderId: string, applicationId: string) {
this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => {
this.attachments = res.Documents;
@@ -239,28 +246,28 @@ export class DiplomaAssinarPage implements OnInit {
await this.processes.CompleteTask(body).toPromise()
this.httpErroHandle.httpsSucessMessagge('Assinado')
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
this.httpErroHandle.httpStatusHandle(error)
}
finally {}
finally { }
}
async AssinarDraft() {
if (this.asDraft) {
const modal = await this.modalController.create({
component: PopupQuestionPage,
componentProps: {
title: 'Deseja assinar este Diploma?',
/* message: 'Nota: Ao Efetuar esta operação, o tratamento deste diploma não poderá ser realizado a partir da caixa de correspondência' */
},
cssClass: "popup-question discart-expedient-modal",
backdropDismiss: true
});
const modal = await this.modalController.create({
component: PopupQuestionPage,
componentProps: {
title: 'Deseja assinar este Diploma?',
/* message: 'Nota: Ao Efetuar esta operação, o tratamento deste diploma não poderá ser realizado a partir da caixa de correspondência' */
},
cssClass: "popup-question discart-expedient-modal",
backdropDismiss: true
});
modal.onDidDismiss().then(async (res) => {
const data = res.data
if(data == "Yes") {
modal.onDidDismiss().then(async (res) => {
const data = res.data
if (data == "Yes") {
let body = {
"InstanceId": this.task.InstanceID,
"FolderId": this.task.FolderID,
@@ -278,18 +285,22 @@ export class DiplomaAssinarPage implements OnInit {
this.TaskService.loadDiplomas();
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
}
}, (error) => {
console.log(error)
});
}, (error) => {
console.log(error)
});
await modal.present();
} else {
this.httpErroHandle.validationMessagge("diplomaAsDraft");
}
await modal.present();
}
async openAddNoteModal(actionName: string) {
@@ -338,7 +349,7 @@ export class DiplomaAssinarPage implements OnInit {
else if (actionName == 'Reexecução') {
/* await this.reexecute(res.data.note, docs);
this.goBack(); */
} else if(actionName == 'Gerar Diploma') {
} else if (actionName == 'Gerar Diploma') {
/* await this.generateDiploma(res.data.note, docs);
this.goBack(); */
}
@@ -382,7 +393,8 @@ export class DiplomaAssinarPage implements OnInit {
taskAction: taskAction,
task: task,
profile: this.profile,
fulltask: this.fulltask
fulltask: this.fulltask,
asDrat: this.asDraft
},
cssClass: classs,
});
@@ -458,34 +470,47 @@ export class DiplomaAssinarPage implements OnInit {
async getDraft(split_stringDraft: string[]) {
this.DraftNames = ""
this.DraftNames = "";
this.DraftIds = "";
for(const strg of split_stringDraft) {
console.log('List of ids', strg)
const resd = await this.processes.GetDraftByID(strg).toPromise()
const draftPromises = split_stringDraft.map(async (strg) => {
console.log('List of ids', strg);
try {
const resd = await this.processes.GetDraftByID(strg).toPromise();
let object = {
"ApplicationId": "",
"Assunto": resd.data.description,
"DocDate": "",
"DocId": resd.data.id,
"DocNumber": "",
"FolderId": "",
"Sender": "",
"SourceDocId": "",
"content": resd.data.content,
"path": resd.data.path,
"ownerId": resd.data.ownerId,
"status": resd.data.status,
let object = {
"ApplicationId": "",
"Assunto": resd.data.description,
"DocDate": "",
"DocId": resd.data.id,
"DocNumber": "",
"FolderId": "",
"Sender": "",
"SourceDocId": "",
"content": resd.data.content,
"path": resd.data.path,
"ownerId": resd.data.ownerId,
"status": resd.data.status,
};
this.mergedArray.push(object);
this.DraftNames += resd.data.description + ";";
this.DraftIds += resd.data.id + ";";
console.log('List of draft', resd);
} catch (error) {
console.log('Error getting draft', error);
}
this.mergedArray.push(object)
this.DraftNames = this.DraftNames + resd.data.description+";"
console.log('List of draff', resd)
});
await Promise.all(draftPromises);
if (this.DraftNames) {
this.DraftNames = this.DraftNames.slice(0, -1);
this.DraftIds = this.DraftIds.slice(0, -1);
} else {
console.log('No draft found.');
this.asDraft = false
}
this.DraftNames = this.DraftNames.slice(0, -1);
this.DraftIds = this.DraftIds.slice(0, -1);
}
}
@@ -314,8 +314,8 @@
</ion-content>
<ion-footer>
<div class="buttons">
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
<button class="btn-ok" shape="round" (click)="saveTask()">Gravar</button>
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
</div>
</ion-footer>
@@ -221,6 +221,7 @@
class="d-flex flex-column height-100 hide-footer"
[adding]="adding"
[footer]="false"
[taskType]="taskType"
[taskParticipants]="taskParticipants"
[taskParticipantsCc]="taskParticipantsCc"
(closeComponent)="closeComponent()"
@@ -235,7 +236,7 @@
</ion-content>
<ion-footer>
<div class="buttons">
<button class="btn-cancel" shape="round" (click)="cancelTask()">Cancelar</button>
<button class="btn-ok" shape="round" (click)="saveTask()">Concluir</button>
<button class="btn-cancel" shape="round" (click)="cancelTask()">Cancelar</button>
</div>
</ion-footer>
@@ -533,7 +533,8 @@ export class ExpedientTaskModalPage implements OnInit {
componentProps: {
adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
taskParticipantsCc: this.taskParticipantsCc,
taskType: this.taskType
},
cssClass: 'attendee modal modal-desktop',
backdropDismiss: false