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
+6 -1
View File
@@ -24,6 +24,7 @@ import { NewEventPage } from './new-event/new-event.page';
import { AuthService } from 'src/app/services/auth.service';
import { User } from 'src/app/models/user.model';
import { DateAdapter } from '@angular/material/core';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-agenda',
@@ -158,7 +159,8 @@ export class AgendaPage implements OnInit {
private alertController: AlertService,
private sanitizer: DomSanitizer,
authService: AuthService,
private dateAdapter: DateAdapter<any>
private dateAdapter: DateAdapter<any>,
private toastService: ToastService
) {
this.dateAdapter.setLocale('es');
@@ -181,6 +183,9 @@ export class AgendaPage implements OnInit {
}
ngOnInit() {
const loader = this.toastService.loading()
this.profile = "mdgpr";
const pathname = window.location.pathname
@@ -60,13 +60,20 @@ export class EventActionsPopoverPage implements OnInit {
let body = { "serialNumber": this.serialNumber, "action": "Aprovar" }
console.log(body);
const loader = this.toastService.loading()
try {
this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
}
finally {
loader.remove()
}
}
async emendarTask() {
@@ -95,6 +102,8 @@ export class EventActionsPopoverPage implements OnInit {
}
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
@@ -102,6 +111,9 @@ export class EventActionsPopoverPage implements OnInit {
} catch (error) {
this.toastService.badRequest();
}
finally {
loader.remove()
}
}
else{
//this.alertService.presentAlert('Operação cancelada!');
@@ -112,13 +124,21 @@ export class EventActionsPopoverPage implements OnInit {
async rejeitar(){
let body = { "serialNumber": this.serialNumber, "action": "Rejeitar" }
console.log(body);
const loader = this.toastService.loading()
try {
this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado');
this
this.goBack();
} catch (error) {
this.toastService.badRequest()
}
finally {
loader.remove()
}
}
async editTask() {
@@ -270,7 +270,7 @@ export class NewEventPage implements OnInit {
try {
await this.attachmentsService.setEventAttachmentById(attachments).toPromise();
} catch(error) {
alert('document error')
console.log('document not save')
}
});
@@ -139,7 +139,9 @@ export class ViewEventPage implements OnInit {
});
}
getAttachments(){
getAttachments() {
const loader = this.toastService.loading()
try {
this.attachmentsService.getAttachmentsById(this.eventId).subscribe(res=>{
this.loadedAttachments = res;
@@ -148,6 +150,10 @@ export class ViewEventPage implements OnInit {
} catch (error) {
}
finally {
loader.remove()
}
}
async editEventDetail() {