mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Fix loader in create process
This commit is contained in:
@@ -166,7 +166,6 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
runValidation() {
|
||||
this.validateFrom = true
|
||||
}
|
||||
@@ -254,11 +253,9 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.postDespatcho(this.postData).toPromise();
|
||||
this.FinalizarDespacho('Despacho criado');
|
||||
loader.remove()
|
||||
this.FinalizarDespacho(loader, 'Despacho criado');
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -275,12 +272,10 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.postParecer(this.postData).toPromise();
|
||||
this.FinalizarParecer('Pedido de Parecer enviado');
|
||||
loader.remove()
|
||||
}
|
||||
this.FinalizarParecer(loader, 'Pedido de Parecer enviado');
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -297,12 +292,10 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.postDeferimento(this.postData).toPromise();
|
||||
this.FinalizarDeferimento('Pedido de deferimento enviado');
|
||||
loader.remove()
|
||||
this.FinalizarDeferimento(loader, 'Pedido de deferimento enviado');
|
||||
}
|
||||
catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
loader.remove()
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -325,10 +318,8 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.postDespatcho(this.postData).toPromise();
|
||||
loader.remove()
|
||||
this.executado('Despacho criado');
|
||||
this.executado(loader, 'Despacho criado');
|
||||
} catch (error) {
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
@@ -346,12 +337,10 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.postParecer(this.postData).toPromise();
|
||||
this.executado();
|
||||
loader.remove()
|
||||
this.executado(loader);
|
||||
this.toastService.successMessage('Pedido de Parecer criado');
|
||||
}
|
||||
catch (error) {
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
@@ -369,12 +358,10 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.processes.postDeferimento(this.postData).toPromise();
|
||||
this.executado();
|
||||
loader.remove()
|
||||
this.executado(loader);
|
||||
this.toastService.successMessage('Pedido de Deferimento criado');
|
||||
}
|
||||
catch (error) {
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
}
|
||||
|
||||
@@ -386,7 +373,7 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async executado(message?) {
|
||||
async executado(loader:HTMLDivElement, message?) {
|
||||
|
||||
let body;
|
||||
|
||||
@@ -423,7 +410,7 @@ export class CreateProcessPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async FinalizarDespacho(message?) {
|
||||
async FinalizarDespacho(loader: HTMLDivElement, message?) {
|
||||
|
||||
let body;
|
||||
|
||||
@@ -463,11 +450,13 @@ export class CreateProcessPage implements OnInit {
|
||||
this.toastService.successMessage(message);
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async FinalizarParecer(message?) {
|
||||
async FinalizarParecer(loader: HTMLDivElement, message?) {
|
||||
let body;
|
||||
|
||||
if(this.task.activityInstanceName =='Concluir Deferimento' ||
|
||||
@@ -511,12 +500,14 @@ export class CreateProcessPage implements OnInit {
|
||||
this.toastService.successMessage(message)
|
||||
} catch (e) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async FinalizarDeferimento(message?){
|
||||
if(this.task.activityInstanceName =='Reapreciar Deferimento'){
|
||||
async FinalizarDeferimento(loader: HTMLDivElement, message?) {
|
||||
if(this.task.activityInstanceName =='Reapreciar Deferimento') {
|
||||
let body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Parecer",
|
||||
@@ -529,8 +520,11 @@ export class CreateProcessPage implements OnInit {
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.toastService.successMessage(message)
|
||||
|
||||
} catch (e) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user