list events

This commit is contained in:
Peter Maquiran
2024-05-29 15:45:34 +01:00
parent caa11d6be7
commit 38d36a6e49
22 changed files with 629 additions and 198 deletions
@@ -19,6 +19,8 @@ import { NavigationExtras, Router } from '@angular/router';
import { EventController } from 'src/app/controller/event'
import { DateService } from 'src/app/services/date.service';
import { EventList } from 'src/app/models/agenda/AgendaEventList';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@Component({
selector: 'app-view-event',
templateUrl: './view-event.page.html',
@@ -65,7 +67,8 @@ export class ViewEventPage implements OnInit {
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle,
private router: Router,
private dateService: DateService
private dateService: DateService,
public AgendaDataRepositoryService: AgendaDataRepositoryService
) {
this.isEventEdited = false;
this.loadedEvent = new Event();
@@ -123,52 +126,24 @@ export class ViewEventPage implements OnInit {
setTimeZone() {
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
}
loadEvent() {
async loadEvent() {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
try {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
let res = await this.AgendaDataRepositoryService.getEventById(this.eventId).toPromise()
console.log('Loaded Event', res)
res = this.dateService.fixDate(res as any)
this.loadedEvent = res as any;
this.setTimeZone()
// this.addEventToDb(res);
this.setTimeZone()
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
} catch (error) {
this.viewEventDetailDismiss.emit({
type: 'close'
})
this.viewEventDetailDismiss.emit({
type: 'close'
})
this.httpErrorHandle.httpStatusHandle(error)
});
} else {
if(this.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
res = this.dateService.fixDate(res as any)
/* const div = document.createElement("div")
div.innerHTML = res.Body.Text
res.Body.Text = div.innerText */
this.loadedEvent = res;
// console.log('Event details',res)
this.setTimeZone()
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
this.viewEventDetailDismiss.emit({
type: 'close'
})
this.httpErrorHandle.httpStatusHandle(error)
});
}
// this.httpErrorHandle.httpStatusHandle(error)
}
}