This commit is contained in:
tiago.kayaya
2021-07-13 14:34:05 +01:00
parent 03c9b56ea4
commit bc3306366b
16 changed files with 184 additions and 177 deletions
@@ -23,7 +23,7 @@ export class ApproveEventPage implements OnInit {
customDate:any;
today:any;
show: boolean = false;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@@ -47,10 +47,10 @@ export class ApproveEventPage implements OnInit {
private iab: InAppBrowser,
private animationController: AnimationController,
private toastService: ToastService,
) {
) {
this.activatedRoute.paramMap.subscribe(params => {
console.log(params["params"]);
if(params["params"].serialNumber) {
this.serialNumber = params["params"].serialNumber;
}
@@ -63,7 +63,7 @@ export class ApproveEventPage implements OnInit {
ngOnInit() {
console.log(this.serialNumber);
console.log(this.caller);
this.getTask();
}
@@ -88,7 +88,7 @@ export class ApproveEventPage implements OnInit {
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.getAttachments(instanceId);
}
@@ -96,14 +96,14 @@ export class ApproveEventPage implements OnInit {
async approveTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
const loader = this.toastService.loading()
try {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
}
@@ -112,9 +112,9 @@ export class ApproveEventPage implements OnInit {
}
/* this.approveEventDismiss.emit({
/* this.approveEventDismiss.emit({
"serialNumber": serialNumber,
"action": "Aprovar",
"action": "Aprovar",
"saveData": {
loadedEvent: this.loadedEvent,
today: this.today,
@@ -139,9 +139,9 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss()
.then( async (res) => {
console.log(res.data);
if(res.data !== ''){
let body = { "serialNumber": serialNumber,
let body = { "serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
@@ -150,8 +150,8 @@ export class ApproveEventPage implements OnInit {
console.log(body);
const loader = this.toastService.loading()
try {
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
this.goBack();
@@ -166,7 +166,7 @@ export class ApproveEventPage implements OnInit {
//this.alertService.presentAlert('Operação cancelada!');
}
});
//this.openEmendMessageModal(serialNumber);
//this.goBack();
}
@@ -175,7 +175,7 @@ export class ApproveEventPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
const loader = this.toastService.loading()
try {
try {
this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado');
this.goBack();
@@ -186,17 +186,17 @@ export class ApproveEventPage implements OnInit {
loader.remove()
}
}
async getAttachments(instanceId:string){
const loader = this.toastService.loading()
try {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise();
} catch (error) {
}
}
viewDocument(sourceId){
@@ -205,7 +205,7 @@ export class ApproveEventPage implements OnInit {
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
});
}
@@ -222,7 +222,7 @@ export class ApproveEventPage implements OnInit {
});
return await popover.present();
}
openMenu() {
this.menu.open();
}
@@ -239,9 +239,9 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss().then( async (res) => {
console.log(res.data);
if(res.data !== ''){
let body = { "serialNumber": serialNumber,
let body = { "serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
@@ -250,7 +250,7 @@ export class ApproveEventPage implements OnInit {
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage();
@@ -295,6 +295,6 @@ export class ApproveEventPage implements OnInit {
this.getTask();
});
}
}
}