fix agenda

This commit is contained in:
Peter Maquiran
2023-03-30 15:22:40 +01:00
parent b7d878851e
commit 936878f6cd
6 changed files with 46 additions and 29 deletions
+24 -8
View File
@@ -574,11 +574,11 @@ export class AgendaPage implements OnInit {
let load = 0;
for ( const selectedCalendar of selectedCalendarIds) {
this.eventService.getEventsByCalendarId(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59'), selectedCalendar.calendarId).then((response: any) => {
this.eventService.getEventsByCalendarId(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59'), selectedCalendar.CalendarId).then((response: any) => {
let label;
if(SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.calendarId)) {
if(SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.CalendarId)) {
label = 'md'
} else {
label = "pr"
@@ -588,7 +588,7 @@ export class AgendaPage implements OnInit {
// this.addEventToDB(response, label);
let eventsList = response;
this.CalendarStore.removeRangeForCalendar(startTime, endTime, label, selectedCalendar.calendarId)
this.CalendarStore.removeRangeForCalendar(startTime, endTime, label, selectedCalendar.CalendarId)
this.CalendarStore.pushEvent(eventsList, label);
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
@@ -617,6 +617,18 @@ export class AgendaPage implements OnInit {
selectedAgenda = {}
getSelectedAgendaCalendars () {
if(this.CalendarName == 'PR+MDGPR') {
let result = this.SessionStore.user.OwnerCalendars
const pr = this.SessionStore.user.SharedCalendars.filter(e => e.CalendarRoleId == this.RoleIdService.PRES.toString())
const md = this.SessionStore.user.SharedCalendars.filter(e => e.CalendarRoleId == this.RoleIdService.PV.toString())
const join = pr.concat(md)
return result.concat(join)
} else {
const calendar = this.eventService.calendarNamesType[this.CalendarName];
let Oficial = calendar?.['OficialId']
let Pessoal = calendar?.['PessoalId']
@@ -625,13 +637,13 @@ export class AgendaPage implements OnInit {
return [
{
calendarId : Oficial,
CalendarId : Oficial,
OwnerId: calendar.OwnerId,
CalendarName: calendar.CalendarName
},
{
OwnerId: calendar.OwnerId,
calendarId : Pessoal,
CalendarId : Pessoal,
CalendarName: calendar.CalendarName
}
]
@@ -639,18 +651,23 @@ export class AgendaPage implements OnInit {
} else if (Oficial) {
return [{
OwnerId: calendar.OwnerId,
calendarId : Oficial,
CalendarId : Oficial,
CalendarName: calendar.CalendarName
}]
} else {
return [{
OwnerId: calendar.OwnerId,
calendarId : Pessoal,
CalendarId : Pessoal,
CalendarName: calendar.CalendarName
}]
}
}
}
// trasnformData(response, profile) {
@@ -1196,7 +1213,6 @@ export class AgendaPage implements OnInit {
}
this.showTimelineFilterState = false;
// THIS LINE
this.updateEventListBox();