fix view event in some component

This commit is contained in:
Peter Maquiran
2024-05-31 13:59:51 +01:00
parent 2159692018
commit a89b9dd4b6
5 changed files with 60 additions and 71 deletions
+26 -4
View File
@@ -16,7 +16,7 @@ import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expedient
import { RouteService } from 'src/app/services/route.service';
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@Component({
selector: 'app-view-event',
@@ -64,7 +64,8 @@ export class ViewEventPage implements OnInit {
private backgroundservice: BackgroundService,
private storage: StorageService,
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
private httpErrorHandle: HttpErrorHandle,
private agendaDataRepository: AgendaDataRepositoryService
) {
this.eventId = this.navParams.get('eventId');
this.CalendarId = this.navParams.get('CalendarId');
@@ -106,7 +107,6 @@ export class ViewEventPage implements OnInit {
}
close() {
this.modalController.dismiss(this.isEventEdited);
}
@@ -119,7 +119,7 @@ export class ViewEventPage implements OnInit {
ev.target.complete();
}
loadEvent() {
async loadEvent() {
const loader = this.toastService.loading();
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
@@ -168,6 +168,28 @@ export class ViewEventPage implements OnInit {
}
let res = await this.agendaDataRepository.getEventById(this.eventId)
if(res.isOk()) {
this.loadedEvent = res.value as any;
// this.addEventToDb(res);
loader.remove()
} else {
if (res.error.status === 0) {
// this.getFromDb();
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
loader.remove()
this.modalController.dismiss('Eevent not Foud');
this.RouteService.goBack();
}
loader.remove()
}
}
deleteEvent() {