Improve rules

This commit is contained in:
Peter Maquiran
2021-08-13 11:57:12 +01:00
parent 11bcf89932
commit 7fdb3610df
2 changed files with 68 additions and 12 deletions
+31 -3
View File
@@ -6,12 +6,26 @@ import { ProcessesService } from '../services/processes.service';
}) })
export class DeplomaService { export class DeplomaService {
activityInstanceName = {
'Revisar Diploma': [
'Solicitar assinatura do Presidente',
'Solicitar alteração',
'Marcar Reunião'
],
'Diploma Assinado': [
'Concluir'
],
'Assinar Diploma': [
'Assinado'
]
}
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
) { } ) { }
async askSignature({note, documents, serialNumber}) { async askSignature({note, documents, serialNumber, activityInstanceName}) {
let body = { let body = {
"serialNumber": serialNumber, "serialNumber": serialNumber,
"action": "Aprovar", "action": "Aprovar",
@@ -25,7 +39,7 @@ export class DeplomaService {
return this.processes.CompleteTask(body) return this.processes.CompleteTask(body)
} }
async askToChange({note, documents, serialNumber}) { async askToChange({note, documents, serialNumber, activityInstanceName}) {
let body = { let body = {
"serialNumber": serialNumber, "serialNumber": serialNumber,
"action": "Retificar", "action": "Retificar",
@@ -40,7 +54,7 @@ export class DeplomaService {
} }
async finish({note, documents, serialNumber}) { async finish({note, documents, serialNumber, activityInstanceName}) {
let body = { let body = {
"serialNumber": serialNumber, "serialNumber": serialNumber,
@@ -55,4 +69,18 @@ export class DeplomaService {
return this.processes.CompleteTask(body); return this.processes.CompleteTask(body);
} }
async sign({note, documents, serialNumber, activityInstanceName}) {
let body = {
"serialNumber": serialNumber,
"action": "Assinado",
"ActionTypeId": 99999842,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
} }
@@ -17,7 +17,7 @@ import { SuccessMessagePage } from '../success-message/success-message.page';
export class DeplomaOptionsPage implements OnInit { export class DeplomaOptionsPage implements OnInit {
serialnumber: string; serialNumber: string;
profile: string; profile: string;
task: any task: any
fulltask: any fulltask: any
@@ -31,20 +31,19 @@ export class DeplomaOptionsPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
private router: Router, private router: Router,
private deplomaService: DeplomaService) { private deplomaService: DeplomaService) {
this.serialnumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
this.fulltask = this.navParams.get('fulltask'); this.fulltask = this.navParams.get('fulltask');
} }
ngOnInit() { ngOnInit() {
console.log(this.serialnumber); console.log(this.serialNumber);
} }
async openAddNoteModal(actionName:string) { async openAddNoteModal(actionName:string) {
this.popoverController.dismiss(); this.popoverController.dismiss();
let classs; let classs;
if( window.innerWidth <= 800){ if( window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
@@ -84,6 +83,9 @@ export class DeplomaOptionsPage implements OnInit {
} else if (actionName == 'Assinar Diploma') { } else if (actionName == 'Assinar Diploma') {
await this.sign(res.data.note, docs); await this.sign(res.data.note, docs);
this.goBack(); this.goBack();
} else if(actionName == 'Concluir diploma'){
await this.finish(res.data.note, docs);
this.goBack();
} }
} }
}); });
@@ -91,7 +93,7 @@ export class DeplomaOptionsPage implements OnInit {
async askToChange(note:string, documents:any){ async askToChange(note:string, documents:any){
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialNumber,
"action": "Retificar", "action": "Retificar",
"ActionTypeId": 99999841, "ActionTypeId": 99999841,
"dataFields": { "dataFields": {
@@ -138,7 +140,7 @@ export class DeplomaOptionsPage implements OnInit {
async askSignature(note:string, documents:any) { async askSignature(note:string, documents:any) {
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialNumber,
"action": "Aprovar", "action": "Aprovar",
"ActionTypeId": 99999840, "ActionTypeId": 99999840,
"dataFields": { "dataFields": {
@@ -164,7 +166,7 @@ export class DeplomaOptionsPage implements OnInit {
async sign(note:string, documents:any) { async sign(note:string, documents:any) {
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialNumber,
"action": "Assinado", "action": "Assinado",
"ActionTypeId": 99999842, "ActionTypeId": 99999842,
"dataFields": { "dataFields": {
@@ -187,6 +189,32 @@ export class DeplomaOptionsPage implements OnInit {
} }
async finish(note:string, documents:any){
let body = {
"serialNumber": this.serialNumber,
"action": "Concluir",
"ActionTypeId": 95,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo concluído')
} catch (error) {
this.toastService.badRequest()
}
finally {
loader.remove()
}
}
goBack() { goBack() {
this.router.navigate(['/home/gabinete-digital/diplomas-assinar']); this.router.navigate(['/home/gabinete-digital/diplomas-assinar']);
} }