to many changes

This commit is contained in:
Eudes Inácio
2023-02-27 17:39:10 +01:00
parent fcd1989334
commit 46387d4977
30 changed files with 329 additions and 160 deletions
@@ -11,6 +11,7 @@ import { EventActionsPopoverPage } from '../../../agenda/event-actions-popover/e
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ToastService } from 'src/app/services/toast.service';
import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-approve-event-modal',
@@ -40,7 +41,8 @@ export class ApproveEventModalPage implements OnInit {
private activatedRoute: ActivatedRoute,
private iab: InAppBrowser,
private toastService: ToastService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) {
@@ -101,18 +103,13 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService._successMessage('Evento aprovado', ()=>{
this.httpErrorHandle.httpsSucessMessagge('Aprovar', ()=>{
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
})
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não aprovado')
}
this.httpErrorHandle.httpStatusHandle(error)
}
finally {
loader.remove()
@@ -128,7 +125,7 @@ export class ApproveEventModalPage implements OnInit {
async rejectTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
let body = { "serialNumber": serialNumber, "action": "Descartar" }
const loader = this.toastService.loading()
@@ -299,7 +299,7 @@ export class ApproveEventPage implements OnInit {
}
async rejeitar(serialNumber: string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
let body = { "serialNumber": serialNumber, "action": "Descartar" }
const loader = this.toastService.loading()
try {
@@ -384,16 +384,10 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService._successMessage();
this.goBack();
this.toastService._successMessage('Evento enviado para revisão');
this.httpErrorHandle.httpsSucessMessagge('Rever')
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}