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
@@ -95,13 +95,18 @@ export class DeplomaOptionsPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -135,13 +140,19 @@ export class DeplomaOptionsPage implements OnInit {
},
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -146,12 +146,16 @@ export class DespachosOptionsPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -220,13 +224,19 @@ export class DespachosOptionsPage implements OnInit {
},
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest('Processo não arquivado')
} finally {
loader.remove()
}
}
@@ -242,13 +252,18 @@ export class DespachosOptionsPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
} catch(error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -263,12 +278,17 @@ export class DespachosOptionsPage implements OnInit {
},
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -179,12 +179,16 @@ export class DespachosPrOptionsPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -255,12 +259,17 @@ export class DespachosPrOptionsPage implements OnInit {
},
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest('Processo não arquivado')
} finally {
loader.remove()
}
}
@@ -277,13 +286,18 @@ export class DespachosPrOptionsPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
} catch(error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -297,12 +311,17 @@ export class DespachosPrOptionsPage implements OnInit {
},
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -128,12 +128,16 @@ export class OptsExpedientePrPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
} catch(error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
@@ -162,12 +166,16 @@ export class OptsExpedientePrPage 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()
}
}
@@ -177,23 +185,31 @@ export class OptsExpedientePrPage 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()
}
}
}
@@ -212,13 +228,18 @@ export class OptsExpedientePrPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise();
this.close();
this.toastService.successMessage()
} catch(error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
sendExpedienteToPending(){
@@ -187,13 +187,18 @@ export class OptsExpedientePage 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()
}
}
else if(res['data'] == 'No'){
@@ -202,23 +207,31 @@ export class OptsExpedientePage 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()
}
}
}
@@ -166,12 +166,17 @@ export class RequestOptionsPage implements OnInit {
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
} catch (error) {
this.toastService.badRequest()
}
finally {
loader.remove()
}
}