This commit is contained in:
Peter Maquiran
2021-06-09 16:34:14 +01:00
parent 4674baa0bd
commit 762b6b9f83
37 changed files with 282 additions and 87 deletions
@@ -102,9 +102,12 @@ export class ApproveEventModalPage implements OnInit {
console.log(body);
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.successMessage('Evento aprovado')
this.successMessage('Evento aprovado', ()=>{
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
})
} catch (error) {
this.badRequest('Evento não aprovado')
}
@@ -125,9 +128,12 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.successMessage('Evento rejeitado', () =>{
this.router.navigate(['/home/gabinete-digital/event-list']);
})
this.successMessage('Evento rejeitado')
} catch (error) {
this.badRequest('Evento não rejeitado')
}
@@ -214,7 +220,7 @@ export class ApproveEventModalPage implements OnInit {
}
async successMessage(message?: string) {
async successMessage(message?: string, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
@@ -253,12 +259,15 @@ export class ApproveEventModalPage implements OnInit {
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
async badRequest(message?: string) {
async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
@@ -296,6 +305,9 @@ export class ApproveEventModalPage implements OnInit {
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
@@ -74,7 +74,7 @@ export class ApproveEventPage implements OnInit {
}
async getTask(){
async getTask() {
this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise();
console.log(this.loadedEvent);
@@ -86,15 +86,17 @@ export class ApproveEventPage implements OnInit {
this.getAttachments(instanceId);
}
async approveTask(serialNumber:string){
async approveTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
try {
await this.processes.PostTaskAction(body).toPromise()
//this.successMessage()
this.toastService.successMessage('Evento aprovado');
this.goBack();
this.toastService.successMessage('Evento aprovado', ()=>{
this.goBack();
});
} catch (error) {
this.badRequest()
}
@@ -122,8 +124,10 @@ export class ApproveEventPage implements OnInit {
try {
this.processes.PostTaskAction(body).toPromise();
//await this.successMessage('Processo rejeitado');
await this.toastService.successMessage('Processo rejeitado');
this.goBack();
await this.toastService.successMessage('Processo rejeitado', ()=>{
this.goBack();
});
} catch (error) {
this.badRequest()
}
@@ -231,7 +235,7 @@ export class ApproveEventPage implements OnInit {
async successMessage(message?: string) {
async successMessage(message?: string, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
@@ -270,12 +274,15 @@ export class ApproveEventPage implements OnInit {
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
async badRequest(message?: string) {
async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
@@ -313,6 +320,9 @@ export class ApproveEventPage implements OnInit {
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}