mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
ITOTEAM-523 A app não redireciona as notificações
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
@@ -13,7 +12,9 @@ import { environment } from 'src/environments/environment';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
||||
import { TracingType, XTracer } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-profile',
|
||||
@@ -58,7 +59,9 @@ export class ProfilePage implements OnInit {
|
||||
private eventsService: EventsService,
|
||||
private storageService: StorageService,
|
||||
public NotificationHolderService: NotificationHolderService,
|
||||
private authservice: AuthService
|
||||
private authservice: AuthService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
|
||||
window['e'] = () => {
|
||||
@@ -212,41 +215,68 @@ export class ProfilePage implements OnInit {
|
||||
return time;
|
||||
}
|
||||
|
||||
@XTracer({name:'profile/notificationClick', bugPrint: true, module:'notification'})
|
||||
notificatinsRoutes (index, Service, Object, IdObject, FolderId, i, tracing?: TracingType) {
|
||||
@XTracerAsync({name:'profile/notificationClick', bugPrint: true, module:'notification'})
|
||||
async notificatinsRoutes (index, Service, Object, IdObject, FolderId, i, tracing?: TracingType) {
|
||||
|
||||
console.log(index, i)
|
||||
|
||||
try {
|
||||
if (Service === "agenda") {
|
||||
this.isloading = true
|
||||
if (Service === "agenda" && IdObject.length > 10) {
|
||||
this.eventsService.getEvent(IdObject).subscribe((task) => {
|
||||
if (Service === "agenda") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
||||
this.deleteNotification(index);
|
||||
this.isloading = false
|
||||
let res = await this.agendaDataRepository.getEventById(IdObject, tracing)
|
||||
|
||||
}, (error) => {
|
||||
this.NotificationHolderService.notificationList[i].read = true;
|
||||
this.isloading = false
|
||||
})
|
||||
}
|
||||
if(IdObject) {
|
||||
|
||||
if (Service === "agenda" && Object === "event-list") {
|
||||
if(res.isOk()) {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
||||
this.deleteNotification(index);
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
} else {
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
tracing.setAttribute('data.exist', 'false')
|
||||
this.NotificationHolderService.notificationList[i].read = true;
|
||||
console.log('error', res.error)
|
||||
}
|
||||
} else {
|
||||
tracing.setAttribute('data.IdObject', 'false')
|
||||
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #01')
|
||||
}
|
||||
|
||||
this.isloading = false
|
||||
|
||||
} else if (Service === "agenda" && Object === "event-list") {
|
||||
this.isloading = true
|
||||
this.processesService.GetTask(IdObject).subscribe((task) => {
|
||||
console.log('evento exist')
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
|
||||
this.deleteNotification(index);
|
||||
this.isloading = false
|
||||
|
||||
}, (error) => {
|
||||
console.log('evento não existe')
|
||||
this.NotificationHolderService.notificationList[i].read = true;
|
||||
this.isloading = false
|
||||
})
|
||||
if(IdObject) {
|
||||
|
||||
let res = await this.agendaDataRepository.getEventById(IdObject, tracing)
|
||||
if(res.isOk()) {
|
||||
console.log('evento exist')
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
|
||||
this.deleteNotification(index);
|
||||
this.isloading = false
|
||||
} else {
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
console.log('evento não existe')
|
||||
tracing.setAttribute('data.exist', 'false')
|
||||
this.NotificationHolderService.notificationList[i].read = true;
|
||||
this.isloading = false
|
||||
}
|
||||
} else {
|
||||
tracing.setAttribute('data.IdObject', 'false')
|
||||
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #01')
|
||||
}
|
||||
|
||||
this.isloading = false
|
||||
|
||||
} else {
|
||||
tracing.setAttribute('notification.route', 'false')
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing.setAttribute('parameters', JSON.stringify({Service, Object, IdObject, FolderId}))
|
||||
}
|
||||
|
||||
} else if (Service === "gabinete-digital") {
|
||||
|
||||
@@ -92,6 +92,55 @@ export class ViewDocumentPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @XTracerAsync({name:'view-document/LoadViewer', bugPrint: true, daley: 4000})
|
||||
// async LoadViewer(tracing?: TracingType) {
|
||||
// this.processes.GetViewer(this.docId, this.applicationId).subscribe(async(res)=> {
|
||||
|
||||
// const link: string = res.replace('//pdfjs/web/', '/pdfjs/web/')
|
||||
// this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(link);
|
||||
|
||||
// // const iframe = document.getElementById("iframe")
|
||||
// // const handleLoad = () => {
|
||||
// // this.loader = false
|
||||
// // };
|
||||
|
||||
// // iframe.addEventListener('load', handleLoad, true)
|
||||
|
||||
// if(res == "") {
|
||||
// const alert = await this.alertController.create({
|
||||
// cssClass: 'my-custom-class',
|
||||
// //header: 'Apagar evento!',
|
||||
// message: 'Sem imagem',
|
||||
// buttons: [
|
||||
// {
|
||||
// text: 'Sim',
|
||||
// handler: () => {
|
||||
// this.close();
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// });
|
||||
// }
|
||||
|
||||
// tracing.setAttribute('outcome', 'success')
|
||||
|
||||
// }, (error)=>{
|
||||
// if(isHttpError(error)) {
|
||||
// tracing?.setAttribute('status.code', error.status.toString())
|
||||
// if (error.status == 400) {
|
||||
// tracing?.bugFlag()
|
||||
// tracing?.setAttribute('outcome', 'failed')
|
||||
// }
|
||||
// }
|
||||
// tracing.setAttribute('outcome', 'failed')
|
||||
// this.close();
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
close() {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user