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
@@ -27,7 +27,8 @@ export class DiplomaOptionsPage implements OnInit {
task: any
fulltask: any
DraftIds = ""
DraftNames= ""
DraftNames = ""
asDrat: boolean;
constructor(
@@ -41,42 +42,43 @@ export class DiplomaOptionsPage implements OnInit {
private despachoService: DespachoService,
private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService) {
this.serialNumber = this.navParams.get('serialNumber');
this.task = this.navParams.get('task');
this.fulltask = this.navParams.get('fulltask');
this.serialNumber = this.navParams.get('serialNumber');
this.task = this.navParams.get('task');
this.fulltask = this.navParams.get('fulltask');
this.DraftIds = this.navParams.get("DraftIds");
this.DraftNames = this.navParams.get("DraftNames");
this.DraftIds = this.navParams.get("DraftIds");
this.DraftNames = this.navParams.get("DraftNames");
this.asDrat = this.navParams.get('asDrat');
console.log('this.task', this.task)
console.log('this.task', this.task)
}
}
ngOnInit() {
console.log(this.task.activityInstanceName)
}
async openAddNoteModal(actionName:string) {
async openAddNoteModal(actionName: string) {
// this.popoverController.dismiss();
let classs;
if( window.innerWidth <= 800) {
if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
} else {
} else {
classs = 'modal modal-desktop'
}
const modal = await this.modalController.create({
component: AddNotePage,
componentProps:{
actionName:actionName
componentProps: {
actionName: actionName
},
cssClass: classs,
backdropDismiss: true
});
modal.onDidDismiss().then(async (res) => {
if(res.data) {
if (res.data) {
const DocumentToSave = res.data.documents.map((e) => {
@@ -91,22 +93,22 @@ export class DiplomaOptionsPage implements OnInit {
Attachments: DocumentToSave,
}
if(actionName == 'Solicitar assinatura') {
if (actionName == 'Solicitar assinatura') {
await this.askSignature(res.data.note, docs);
this.goBack();
} else if(actionName == 'Solicitar alteração') {
} else if (actionName == 'Solicitar alteração') {
await this.askToChange(res.data.note, docs);
this.goBack();
} else if (actionName == 'Assinar Diploma') {
await this.sign(res.data.note, docs);
this.goBack();
} else if(actionName == 'Concluir diploma'){
} else if (actionName == 'Concluir diploma') {
await this.finish(res.data.note, docs);
this.goBack();
} else if (actionName == 'Arquivo') {
await this.arquivar(res.data.note, docs);
this.goBack();
} else if (actionName =='AssinarNew') {
} else if (actionName == 'AssinarNew') {
await this.AssinarNew(res.data.note, docs)
}
}
@@ -117,7 +119,7 @@ export class DiplomaOptionsPage implements OnInit {
await modal.present();
}
async askToChange(note:string, documents:any){
async askToChange(note: string, documents: any) {
let body = {
"serialNumber": this.serialNumber,
"action": "Retificar",
@@ -125,7 +127,7 @@ export class DiplomaOptionsPage implements OnInit {
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
"AttachmentList": documents,
}
const loader = this.toastService.loading()
@@ -135,13 +137,13 @@ export class DiplomaOptionsPage implements OnInit {
this.close();
this.toastService._successMessage()
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally {
} finally {
loader.remove()
}
@@ -151,23 +153,23 @@ export class DiplomaOptionsPage implements OnInit {
async openBookMeetingModal(task: any) {
this.popoverController.dismiss();
let classs;
if( window.innerWidth <= 800){
if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop'
} else {
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: BookMeetingModalPage,
componentProps: {
task: this.task,
fulltask:this.fulltask
fulltask: this.fulltask
},
cssClass: classs,
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(
()=> {},
() => { },
(error) => {
console.log(error)
}
@@ -175,7 +177,7 @@ export class DiplomaOptionsPage implements OnInit {
}
async askSignature(note:string, documents:any) {
async askSignature(note: string, documents: any) {
let body = {
"serialNumber": this.serialNumber,
"action": "Aprovar",
@@ -183,7 +185,7 @@ export class DiplomaOptionsPage implements OnInit {
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
"AttachmentList": documents,
}
const loader = this.toastService.loading()
@@ -193,20 +195,20 @@ export class DiplomaOptionsPage implements OnInit {
this.close();
this.toastService._successMessage()
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally {
} finally {
loader.remove()
}
}
async sign(note?:string, documents?:any) {
async sign(note?: string, documents?: any) {
let body = {
"serialNumber": this.serialNumber,
"action": "Assinado",
@@ -217,7 +219,7 @@ export class DiplomaOptionsPage implements OnInit {
"InstanceIDNew": this.task.InstanceID,
"DraftIds": "",
},
"AttachmentList" : {
"AttachmentList": {
"ProcessInstanceID": this.task.InstanceID,
"DraftIds": null,
"Attachments": []
@@ -229,61 +231,65 @@ export class DiplomaOptionsPage implements OnInit {
await this.processes.CompleteTask(body).toPromise()
this.httpErroHandle.httpsSucessMessagge('Assinado')
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally {}
} finally { }
}
async AssinarNew(note?, doc?) {
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' */
if (this.asDrat) {
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
});
},
cssClass: "popup-question discart-expedient-modal",
backdropDismiss: true
});
modal.onDidDismiss().then(async (res) => {
const data = res.data
if(data == "Yes") {
let body = {
"InstanceId": this.task.InstanceID,
"FolderId": this.task.FolderID,
"DraftIds": this.DraftIds,
"OriginalFileName": this.DraftNames
modal.onDidDismiss().then(async (res) => {
const data = res.data
if (data == "Yes") {
let body = {
"InstanceId": this.task.InstanceID,
"FolderId": this.task.FolderID,
"DraftIds": this.DraftIds,
"OriginalFileName": this.DraftNames
}
const loader = this.toastService.loading()
try {
await this.processes.presidentialActionsSignature(body).toPromise()
await this.sign()
this.TaskService.loadDiplomas()
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
const loader = this.toastService.loading()
try {
await this.processes.presidentialActionsSignature(body).toPromise()
await this.sign()
this.TaskService.loadDiplomas()
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
}, (error) => {
console.log(error)
});
}, (error) => {
console.log(error)
});
await modal.present();
await modal.present();
} else {
this.httpErroHandle.validationMessagge("diplomaAsDraft");
}
}
async finish(note:string, documents:any){
async finish(note: string, documents: any) {
let body = {
"serialNumber": this.serialNumber,
@@ -292,7 +298,7 @@ export class DiplomaOptionsPage implements OnInit {
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
"AttachmentList": documents,
}
const loader = this.toastService.loading()
@@ -301,11 +307,11 @@ export class DiplomaOptionsPage implements OnInit {
await this.processes.CompleteTask(body).toPromise();
this.toastService._successMessage('Processo concluído')
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
this.toastService._badRequest()
}
}
finally {
@@ -9,7 +9,7 @@
</div>
<div *ngIf="content != ''" class="buttons header-fix">
<!-- <button (click)="save(Document, content)" class="btn-cancel" shape="round" >Salvar</button> -->
<button (click)="saveDraft(Document, content)" class="btn-cancel" shape="round" >Salvar Rascunho</button>
<button (click)="AssinarDraft()" class="btn-cancel" shape="round" >Assinar</button>
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
</div>
</ion-content>
@@ -3,6 +3,10 @@ import { ModalController, NavParams } from '@ionic/angular';
import { PermissionService } from 'src/app/services/permission.service';
import { ProcessesService} from 'src/app/services/processes.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { ToastService } from 'src/app/services/toast.service';
import { TaskService } from 'src/app/services/task.service';
import { RouteService } from 'src/app/services/route.service';
import { PopupQuestionPage } from 'src/app/modals/popup-question/popup-question.page';
@Component({
selector: 'app-event-details-documents-options',
@@ -13,20 +17,35 @@ export class EventDetailsDocumentsOptionsPage implements OnInit {
Document: any
content: any = "";
InstanceID:any
FolderID:any
DraftIds:any
DraftNames:any
serialnumber: any
constructor(
public p: PermissionService,
private modalController: ModalController,
private navParams: NavParams,
private processService: ProcessesService,
private erroHandler: HttpErrorHandle
private erroHandler: HttpErrorHandle,
private processes: ProcessesService,
private toastService: ToastService,
public TaskService: TaskService,
private RouteService: RouteService,
) {
this.Document = this.navParams.get('Document')
this.content = this.navParams.get('content')
this.InstanceID = this.navParams.get('InstanceId')
this.FolderID = this.navParams.get('FolderId')
this.DraftIds = this.navParams.get('DraftIds')
this.DraftNames = this.navParams.get('OriginalFileName')
this.serialnumber = this.navParams.get('Serialnumber');
}
ngOnInit() {
console.log(this.content)
console.log(this.serialnumber)
}
close() {
@@ -86,4 +105,83 @@ export class EventDetailsDocumentsOptionsPage implements OnInit {
}
async Assinar() {
let body = {
"serialNumber": this.serialnumber,
"action": "Assinado",
"ActionTypeId": 99999842,
"FolderId": this.FolderID,
"dataFields": {
"ReviewUserComment": '',
"InstanceIDNew": this.InstanceID,
"DraftIds": "",
},
"AttachmentList": {
"ProcessInstanceID": this.InstanceID,
"DraftIds": null,
"Attachments": []
},
}
try {
await this.processes.CompleteTask(body).toPromise()
this.erroHandler.httpsSucessMessagge('Assinado')
} catch (error) {
this.erroHandler.httpStatusHandle(error)
}
finally { }
}
async AssinarDraft() {
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") {
let body = {
"InstanceId": this.InstanceID,
"FolderId": this.FolderID,
"DraftIds": this.DraftIds,
"OriginalFileName": this.DraftNames
}
const loader = this.toastService.loading()
try {
await this.processes.presidentialActionsSignature(body).toPromise()
await this.Assinar();
this.TaskService.loadDiplomas();
this.goBackRoute();
} catch (error) {
this.erroHandler.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
}, (error) => {
console.log(error)
});
await modal.present();
}
goBackRoute() {
this.RouteService.goBack();
}
}