Improve loader

This commit is contained in:
Peter Maquiran
2021-07-12 11:13:29 +01:00
parent c526426aec
commit 507ebd691a
34 changed files with 400 additions and 32 deletions
@@ -252,7 +252,7 @@ export class BookMeetingModalPage implements OnInit {
console.log(this.postData);
if(this.task.FsId == '8') {
const loader = this.toastService.loading()
try {
switch (this.loggeduser.Profile) {
case 'MDGPR':
@@ -271,10 +271,14 @@ export class BookMeetingModalPage implements OnInit {
} catch (error) {
this.toastService.badRequest('Reunião não criada')
}
finally {
loader.remove()
}
}
else if(this.task.FsId == '361') {
const loader = this.toastService.loading()
try {
switch (this.loggeduser.Profile) {
case 'MDGPR':
@@ -290,7 +294,10 @@ export class BookMeetingModalPage implements OnInit {
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
}
@@ -271,6 +271,8 @@ export class ExpedientTaskModalPage implements OnInit {
DispatchFolder: this.dispatchFolder,
AttachmentList: docs,
}
const loader = this.toastService.loading()
try {
let action_despacho = {
"serialNumber": this.task.serialNumber,
@@ -291,6 +293,8 @@ export class ExpedientTaskModalPage implements OnInit {
} catch (error) {
loader.remove()
await this.toastService.badRequest('Processo não efetuado')
} finally {
loader.remove()
}
console.log('this.taskResult', this.taskResult);
break;
@@ -336,6 +340,8 @@ export class ExpedientTaskModalPage implements OnInit {
AttachmentList: docs
}
//console.log(this.postData);
const loader1 = this.toastService.loading()
try {
let action_deferimento = {
"serialNumber": this.task.serialNumber,
@@ -346,14 +352,15 @@ export class ExpedientTaskModalPage implements OnInit {
}
}
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
loader.remove()
await this.toastService.successMessage('Processo efetuado');
this.modalController.dismiss(action_deferimento);
} catch (error) {
loader.remove()
await this.toastService.badRequest('Processo não efetuado')
} finally {
loader1.remove()
}
console.log('this.taskResult', this.taskResult);
break;
}
@@ -375,6 +382,8 @@ export class ExpedientTaskModalPage implements OnInit {
AttachmentList: docs,
}
console.log(this.postData);
const loader = this.toastService.loading()
try {
let action_despacho_pr = {
"serialNumber": this.task.serialNumber,
@@ -394,7 +403,10 @@ export class ExpedientTaskModalPage implements OnInit {
} catch (error) {
loader.remove()
await this.toastService.badRequest('Processo não efetuado')
} finally {
loader.remove()
}
console.log('this.taskResult', this.taskResult);
break;
@@ -408,7 +420,9 @@ export class ExpedientTaskModalPage implements OnInit {
DispatchFolder: this.dispatchFolder,
AttachmentList: docs
}
const loader2 = this.toastService.loading()
try {
let action_parecer_pr = {
"serialNumber": this.task.serialNumber,
@@ -418,15 +432,17 @@ export class ExpedientTaskModalPage implements OnInit {
"Note": "",
}
}
loader.remove()
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService.badRequest('Processo não efetuado');
this.modalController.dismiss(action_parecer_pr);
} catch (error) {
loader.remove()
await this.toastService.badRequest('Processo não efetuado')
} finally {
loader2.remove()
}
break;
}
@@ -246,12 +246,16 @@ export class ExpedienteDetailPage implements OnInit {
}
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
}
}
@@ -261,23 +265,30 @@ export class ExpedienteDetailPage implements OnInit {
}
else{
if(res['data']== 'Yes'){
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
}
this.goBack();
}
else if(res['data'] == 'No'){
console.log('Update');
const loader = this.toastService.loading()
try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
}